Mercurial > projects > dstep
view dstep/foundation/NSCompoundPredicate.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 19885b43130e |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Aug 3, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.foundation.NSCompoundPredicate; import dstep.foundation.NSArray; import dstep.foundation.NSPredicate; import dstep.objc.bridge.Bridge; import dstep.objc.objc : id; alias NSUInteger NSCompoundPredicateType; enum { NSNotPredicateType = 0, NSAndPredicateType, NSOrPredicateType } class NSCompoundPredicate : NSPredicate { mixin ObjcWrap; Object initWithType (uint type, NSArray subpredicates) { return invokeObjcSelf!(Object, "initWithType:subpredicates:", uint, NSArray)(type, subpredicates); } this (uint type, NSArray subpredicates) { objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); id result = Bridge.invokeObjcMethod!(id, "initWithType:subpredicates:", uint, NSArray)(objcObject, type, subpredicates); if (result) objcObject = ret; dObject = this; } uint compoundPredicateType () { return invokeObjcSelf!(uint, "compoundPredicateType"); } NSArray subpredicates () { return invokeObjcSelf!(NSArray, "subpredicates"); } static NSPredicate andPredicateWithSubpredicates (NSArray subpredicates) { return invokeObjcSelfClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates); } static NSPredicate orPredicateWithSubpredicates (NSArray subpredicates) { return invokeObjcSelfClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates); } static NSPredicate notPredicateWithSubpredicate (NSPredicate predicate) { return invokeObjcSelfClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate); } }