Mercurial > projects > dstep
view dstep/foundation/NSRange.d @ 27:57371c29ef73 default tip
ObjcWrap is now automatically mixed in. Added support for building as a dylib with DMD.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Fri, 09 Apr 2010 23:00:22 +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.NSRange; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.foundation.NSValue; import dstep.objc.bridge.Bridge; import dstep.objc.objc; import bindings = dstep.foundation.NSRange_bindings; alias NSRange* NSRangePointer; struct NSRange { NSUInteger location; NSUInteger length; } const TNSValueRangeExtensions = ` static NSValue valueWithRange (NSRange range) { return invokeObjcSuperClass!(NSValue, "valueWithRange:", NSRange)(range); } NSRange rangeValue () { return invokeObjcSelf!(NSRange, "rangeValue"); } `; NSString NSStringFromRange (NSRange range) { return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromRange, NSRange)(range); } NSRange NSRangeFromString (NSString aString) { return Bridge.invokeObjcFunction!(NSRange, bindings.NSRangeFromString, NSString)(aString); } extern (C) { NSRange NSUnionRange (NSRange range1, NSRange range2); NSRange NSIntersectionRange (NSRange range1, NSRange range2); }