Mercurial > projects > dstep
view dstep/foundation/NSLock.d @ 25:b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 06 Apr 2010 11:37:27 +0200 |
parents | 19885b43130e |
children |
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.NSLock; import dstep.foundation.NSDate; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; import dstep.objc.objc; class NSLock : NSObject, INSLocking { mixin ObjcWrap; this (id object) { super(object); } this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } bool tryLock () { return invokeObjcSelf!(bool, "tryLock"); } bool lockBeforeDate (NSDate limit) { return invokeObjcSelf!(bool, "lockBeforeDate:", NSDate)(limit); } void setName (NSString n) { return invokeObjcSelf!(void, "setName:", NSString)(n); } NSString name () { return invokeObjcSelf!(NSString, "name"); } void lock () { return invokeObjcSelf!(void, "lock"); } void unlock () { return invokeObjcSelf!(void, "unlock"); } } class NSCondition : NSObject, INSLocking { mixin ObjcWrap; this (id object) { super(object); } this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } void wait () { return invokeObjcSelf!(void, "wait"); } bool waitUntilDate (NSDate limit) { return invokeObjcSelf!(bool, "waitUntilDate:", NSDate)(limit); } void signal () { return invokeObjcSelf!(void, "signal"); } void broadcast () { return invokeObjcSelf!(void, "broadcast"); } void setName (NSString n) { return invokeObjcSelf!(void, "setName:", NSString)(n); } NSString name () { return invokeObjcSelf!(NSString, "name"); } void lock () { return invokeObjcSelf!(void, "lock"); } void unlock () { return invokeObjcSelf!(void, "unlock"); } } class NSConditionLock : NSObject, INSLocking { mixin ObjcWrap; this (id object) { super(object); } this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } Object initWithCondition (NSInteger condition) { return invokeObjcSelf!(Object, "initWithCondition:", NSInteger)(condition); } this (NSInteger condition) { typeof(this).alloc.initWithCondition(condition); } NSInteger condition () { return invokeObjcSelf!(NSInteger, "condition"); } void lockWhenCondition (NSInteger condition) { return invokeObjcSelf!(void, "lockWhenCondition:", NSInteger)(condition); } bool tryLock () { return invokeObjcSelf!(bool, "tryLock"); } bool tryLockWhenCondition (NSInteger condition) { return invokeObjcSelf!(bool, "tryLockWhenCondition:", NSInteger)(condition); } void unlockWithCondition (NSInteger condition) { return invokeObjcSelf!(void, "unlockWithCondition:", NSInteger)(condition); } bool lockBeforeDate (NSDate limit) { return invokeObjcSelf!(bool, "lockBeforeDate:", NSDate)(limit); } bool lockWhenCondition (NSInteger condition, NSDate limit) { return invokeObjcSelf!(bool, "lockWhenCondition:beforeDate:", NSInteger, NSDate)(condition, limit); } void setName (NSString n) { return invokeObjcSelf!(void, "setName:", NSString)(n); } NSString name () { return invokeObjcSelf!(NSString, "name"); } void lock () { return invokeObjcSelf!(void, "lock"); } void unlock () { return invokeObjcSelf!(void, "unlock"); } } class NSRecursiveLock : NSObject, INSLocking { mixin ObjcWrap; this (id object) { super(object); } this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } bool tryLock () { return invokeObjcSelf!(bool, "tryLock"); } bool lockBeforeDate (NSDate limit) { return invokeObjcSelf!(bool, "lockBeforeDate:", NSDate)(limit); } void setName (NSString n) { return invokeObjcSelf!(void, "setName:", NSString)(n); } NSString name () { return invokeObjcSelf!(NSString, "name"); } void lock () { return invokeObjcSelf!(void, "lock"); } void unlock () { return invokeObjcSelf!(void, "unlock"); } } interface INSLocking { void lock (); void unlock (); }