Mercurial > projects > dstep
diff dstep/foundation/NSIndexPath.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 7ff919f595d5 |
children | b9de51448c6b |
line wrap: on
line diff
--- a/dstep/foundation/NSIndexPath.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSIndexPath.d Sun Jan 03 22:06:11 2010 +0100 @@ -6,22 +6,35 @@ */ module dstep.foundation.NSIndexPath; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSIndexPath : NSObject, INSCopying, INSCoding { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + static Object indexPathWithIndex (NSUInteger index) { - return invokeObjcSelfClass!(Object, "indexPathWithIndex:", NSUInteger)(index); + return invokeObjcSuperClass!(Object, "indexPathWithIndex:", NSUInteger)(index); } static Object indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) { - return invokeObjcSelfClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); + return invokeObjcSuperClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); } Object initWithIndex (NSUInteger index) @@ -31,13 +44,7 @@ this (NSUInteger index) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithIndex:", NSUInteger)(objcObject, index); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithIndex(index); } Object initWithIndexes (NSUInteger* indexes, NSUInteger length) @@ -47,13 +54,7 @@ this (NSUInteger* indexes, NSUInteger length) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithIndexes:length:", NSUInteger*, NSUInteger)(objcObject, indexes, length); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithIndexes(indexes, length); } NSIndexPath indexPathByAddingIndex (NSUInteger index) @@ -105,13 +106,7 @@ this (NSCoder aDecoder) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithCoder(aDecoder); } }