Mercurial > projects > dstep
diff dstep/foundation/NSSortDescriptor.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 | 89f3c3ef1fd2 |
children | b9de51448c6b |
line wrap: on
line diff
--- a/dstep/foundation/NSSortDescriptor.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSSortDescriptor.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,12 +7,26 @@ module dstep.foundation.NSSortDescriptor; import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; class NSSortDescriptor : NSObject, INSCoding, INSCopying { - mixin ObjcWrap; + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } Object initWithKey (NSString key, bool ascending) { @@ -21,13 +35,7 @@ this (NSString key, bool ascending) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKey:ascending:", NSString, bool)(objcObject, key, ascending); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKey(key, ascending); } Object initWithKey (NSString key, bool ascending, SEL selector) @@ -37,13 +45,7 @@ this (NSString key, bool ascending, SEL selector) { - objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); - id result = Bridge.invokeObjcMethod!(id, "initWithKey:ascending:selector:", NSString, bool, SEL)(objcObject, key, ascending, selector); - - if (result) - objcObject = ret; - - dObject = this; + typeof(this).alloc.initWithKey(key, ascending, selector); } NSString key () @@ -83,13 +85,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); } Object copyWithZone (NSZone* zone) @@ -98,11 +94,11 @@ } } -template TNSSortDescriptorSorting () -{ +const TNSSortDescriptorSorting = ` + NSArray sortedArrayUsingDescriptors (NSArray sortDescriptors) { return invokeObjcSelf!(NSArray, "sortedArrayUsingDescriptors:", NSArray)(sortDescriptors); } -} +`;