Mercurial > projects > dstep
view dstep/foundation/NSPointerFunctions.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 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.NSPointerFunctions; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSZone; import dstep.objc.bridge.Bridge; import dstep.objc.objc; alias NSUInteger NSPointerFunctionsOptions; enum { NSPointerFunctionsStrongMemory = (0 << 0), NSPointerFunctionsZeroingWeakMemory = (1 << 0), NSPointerFunctionsOpaqueMemory = (2 << 0), NSPointerFunctionsMallocMemory = (3 << 0), NSPointerFunctionsMachVirtualMemory = (4 << 0), NSPointerFunctionsObjectPersonality = (0 << 8), NSPointerFunctionsOpaquePersonality = (1 << 8), NSPointerFunctionsObjectPointerPersonality = (2 << 8), NSPointerFunctionsCStringPersonality = (3 << 8), NSPointerFunctionsStructPersonality = (4 << 8), NSPointerFunctionsIntegerPersonality = (5 << 8), NSPointerFunctionsCopyIn = (1 << 16) } class NSPointerFunctions : NSObject, INSCopying { mixin (ObjcWrap); this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } Object initWithOptions (uint options) { return invokeObjcSelf!(Object, "initWithOptions:", uint)(options); } this (uint options) { objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); id result = Bridge.invokeObjcMethod!(id, "initWithOptions:", uint)(objcObject, options); if (result) objcObject = result; dObject = this; } static Object pointerFunctionsWithOptions (uint options) { return invokeObjcSuperClass!(Object, "pointerFunctionsWithOptions:", uint)(options); } bool usesStrongWriteBarrier () { return invokeObjcSelf!(bool, "usesStrongWriteBarrier"); } void setUsesStrongWriteBarrier (bool arg) { return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)(arg); } bool usesWeakReadAndWriteBarriers () { return invokeObjcSelf!(bool, "usesWeakReadAndWriteBarriers"); } void setUsesWeakReadAndWriteBarriers (bool arg) { return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)(arg); } Object copyWithZone (NSZone* zone) { return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); } }