# HG changeset patch # User Jacob Carlborg # Date 1249305795 -7200 # Node ID 89f3c3ef1fd2d72a911b20376904ee01bcf13a71 # Parent 4f583f7e242ecaff18f558448833ff7268a2085b Added the Foundation framework diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/Foundation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/Foundation.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,139 @@ +/** + * 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.Foundation; + +public: + +import dstep.AvailabilityMacros; +import dstep.corefoundation.CoreFoundation; +import dstep.foundation.FoundationErrors; +import dstep.foundation.NSAffineTransform; +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSAppleEventManager; +import dstep.foundation.NSAppleScript; +import dstep.foundation.NSArchiver; +import dstep.foundation.NSArray; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSAutoreleasePool; +import dstep.foundation.NSBundle; +import dstep.foundation.NSByteOrder; +import dstep.foundation.NSCalendar; +import dstep.foundation.NSCalendarDate; +import dstep.foundation.NSCharacterSet; +import dstep.foundation.NSClassDescription; +import dstep.foundation.NSCoder; +import dstep.foundation.NSComparisonPredicate; +import dstep.foundation.NSCompoundPredicate; +import dstep.foundation.NSConnection; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDateFormatter; +import dstep.foundation.NSDecimal; +import dstep.foundation.NSDecimalNumber; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSDistantObject; +import dstep.foundation.NSDistributedLock; +import dstep.foundation.NSDistributedNotificationCenter; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSError; +import dstep.foundation.NSException; +import dstep.foundation.NSExpression; +import dstep.foundation.NSFileHandle; +import dstep.foundation.NSFileManager; +import dstep.foundation.NSFormatter; +import dstep.foundation.NSGarbageCollector; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSHFSFileTypes; +import dstep.foundation.NSHTTPCookie; +import dstep.foundation.NSHTTPCookieStorage; +import dstep.foundation.NSHashTable; +import dstep.foundation.NSHost; +import dstep.foundation.NSIndexPath; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSInvocation; +import dstep.foundation.NSJavaSetup; +import dstep.foundation.NSKeyValueCoding; +import dstep.foundation.NSKeyValueObserving; +import dstep.foundation.NSKeyedArchiver; +import dstep.foundation.NSLocale; +import dstep.foundation.NSLock; +import dstep.foundation.NSMapTable; +import dstep.foundation.NSMetadata; +import dstep.foundation.NSMethodSignature; +import dstep.foundation.NSNetServices; +import dstep.foundation.NSNotification; +import dstep.foundation.NSNotificationQueue; +import dstep.foundation.NSNull; +import dstep.foundation.NSNumberFormatter; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSObjectScripting; +import dstep.foundation.NSOperation; +import dstep.foundation.NSPathUtilities; +import dstep.foundation.NSPointerArray; +import dstep.foundation.NSPointerFunctions; +import dstep.foundation.NSPort; +import dstep.foundation.NSPortCoder; +import dstep.foundation.NSPortMessage; +import dstep.foundation.NSPortNameServer; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSProcessInfo; +import dstep.foundation.NSPropertyList; +import dstep.foundation.NSProtocolChecker; +import dstep.foundation.NSProxy; +import dstep.foundation.NSRange; +import dstep.foundation.NSRunLoop; +import dstep.foundation.NSScanner; +import dstep.foundation.NSScriptClassDescription; +import dstep.foundation.NSScriptCoercionHandler; +import dstep.foundation.NSScriptCommand; +import dstep.foundation.NSScriptCommandDescription; +import dstep.foundation.NSScriptExecutionContext; +import dstep.foundation.NSScriptKeyValueCoding; +import dstep.foundation.NSScriptObjectSpecifiers; +import dstep.foundation.NSScriptStandardSuiteCommands; +import dstep.foundation.NSScriptSuiteRegistry; +import dstep.foundation.NSScriptWhoseTests; +import dstep.foundation.NSSet; +import dstep.foundation.NSSortDescriptor; +import dstep.foundation.NSSpellServer; +import dstep.foundation.NSStream; +import dstep.foundation.NSString; +import dstep.foundation.NSTask; +import dstep.foundation.NSThread; +import dstep.foundation.NSTimeZone; +import dstep.foundation.NSTimer; +import dstep.foundation.NSURL; +import dstep.foundation.NSURLAuthenticationChallenge; +import dstep.foundation.NSURLCache; +import dstep.foundation.NSURLConnection; +import dstep.foundation.NSURLCredential; +import dstep.foundation.NSURLCredentialStorage; +import dstep.foundation.NSURLDownload; +import dstep.foundation.NSURLError; +import dstep.foundation.NSURLHandle; +import dstep.foundation.NSURLProtectionSpace; +import dstep.foundation.NSURLProtocol; +import dstep.foundation.NSURLRequest; +import dstep.foundation.NSURLResponse; +import dstep.foundation.NSUndoManager; +import dstep.foundation.NSUserDefaults; +import dstep.foundation.NSValue; +import dstep.foundation.NSValueTransformer; +import dstep.foundation.NSXMLDTD; +import dstep.foundation.NSXMLDTDNode; +import dstep.foundation.NSXMLDocument; +import dstep.foundation.NSXMLElement; +import dstep.foundation.NSXMLNode; +import dstep.foundation.NSXMLNodeOptions; +import dstep.foundation.NSXMLParser; +import dstep.foundation.NSZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.objc.objc-auto; +import dstep.objc.objc; + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/FoundationErrors.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/FoundationErrors.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,49 @@ +/** + * 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.FoundationErrors; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +enum +{ + NSFileNoSuchFileError = 4, + NSFileLockingError = 255, + NSFileReadUnknownError = 256, + NSFileReadNoPermissionError = 257, + NSFileReadInvalidFileNameError = 258, + NSFileReadCorruptFileError = 259, + NSFileReadNoSuchFileError = 260, + NSFileReadInapplicableStringEncodingError = 261, + NSFileReadUnsupportedSchemeError = 262, + NSFileReadTooLargeError = 263, + NSFileReadUnknownStringEncodingError = 264, + NSFileWriteUnknownError = 512, + NSFileWriteNoPermissionError = 513, + NSFileWriteInvalidFileNameError = 514, + NSFileWriteInapplicableStringEncodingError = 517, + NSFileWriteUnsupportedSchemeError = 518, + NSFileWriteOutOfSpaceError = 640, + NSKeyValueValidationError = 1024, + NSFormattingError = 2048, + NSUserCancelledError = 3072, + NSExecutableNotLoadableError = 3584, + NSExecutableArchitectureMismatchError = 3585, + NSExecutableRuntimeMismatchError = 3586, + NSExecutableLoadError = 3587, + NSExecutableLinkError = 3588, + NSFileErrorMinimum = 0, + NSFileErrorMaximum = 1023, + NSValidationErrorMinimum = 1024, + NSValidationErrorMaximum = 2047, + NSExecutableErrorMinimum = 3584, + NSExecutableErrorMaximum = 3839, + NSFormattingErrorMinimum = 2048, + NSFormattingErrorMaximum = 2559 +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAffineTransform.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAffineTransform.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,135 @@ +/** + * 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.NSAffineTransform; + +import dstep.applicationservices.coregraphics.CGAffineTransform; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +struct NSAffineTransformStruct +{ + CGFloat m11; + CGFloat m12; + CGFloat m21; + CGFloat m22; + CGFloat tX; + CGFloat tY; +} + +class NSAffineTransform : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + static NSAffineTransform transform () + { + return invokeObjcSelfClass!(NSAffineTransform, "transform"return result is this.objcObject ? this : (result !is null ? new NSAffineTransform(result) : null); } + + Object initWithTransform (NSAffineTransform transform) + { + return invokeObjcSelf!(Object, "initWithTransform:", NSAffineTransform)(transform); + } + + this (NSAffineTransform transform) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTransform:", NSAffineTransform)(objcObject, transform); + + if (result) + objcObject = ret; + + dObject = this; + } + + void translateXBy (CGFloat deltaX, CGFloat deltaY) + { + return invokeObjcSelf!(void, "translateXBy:yBy:", CGFloat, CGFloat)(deltaX, deltaY); + } + + void rotateByDegrees (CGFloat angle) + { + return invokeObjcSelf!(void, "rotateByDegrees:", CGFloat)(angle); + } + + void rotateByRadians (CGFloat angle) + { + return invokeObjcSelf!(void, "rotateByRadians:", CGFloat)(angle); + } + + void scaleBy (CGFloat scale) + { + return invokeObjcSelf!(void, "scaleBy:", CGFloat)(scale); + } + + void scaleXBy (CGFloat scaleX, CGFloat scaleY) + { + return invokeObjcSelf!(void, "scaleXBy:yBy:", CGFloat, CGFloat)(scaleX, scaleY); + } + + void invert () + { + return invokeObjcSelf!(void, "invert"); + } + + void appendTransform (NSAffineTransform transform) + { + return invokeObjcSelf!(void, "appendTransform:", NSAffineTransform)(transform); + } + + void prependTransform (NSAffineTransform transform) + { + return invokeObjcSelf!(void, "prependTransform:", NSAffineTransform)(transform); + } + + NSPoint transformPoint (NSPoint aPoint) + { + return invokeObjcSelf!(NSPoint, "transformPoint:", NSPoint)(aPoint); + } + + NSSize transformSize (NSSize aSize) + { + return invokeObjcSelf!(NSSize, "transformSize:", NSSize)(aSize); + } + + NSAffineTransformStruct transformStruct () + { + return invokeObjcSelf!(NSAffineTransformStruct, "transformStruct"); + } + + void setTransformStruct (NSAffineTransformStruct transformStruct) + { + return invokeObjcSelf!(void, "setTransformStruct:", NSAffineTransformStruct)(transformStruct); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAppleEventDescriptor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAppleEventDescriptor.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,289 @@ +/** + * 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.NSAppleEventDescriptor; + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSData; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSAppleEventDescriptor : NSObject, INSCopying +{ + mixin ObjcWrap; + + static NSAppleEventDescriptor nullDescriptor () + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "nullDescriptor"return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, void* bytes, NSUInteger byteCount) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(descriptorType, bytes, byteCountreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, NSData data) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:data:", uint, NSData)(descriptorType, datareturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor descriptorWithBoolean (ubyte boolean) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithBoolean:", ubyte)(booleanreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor descriptorWithEnumCode (uint enumerator) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithEnumCode:", uint)(enumeratorreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor descriptorWithInt32 (int signedInt) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithInt32:", int)(signedIntreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor descriptorWithTypeCode (uint typeCode) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithTypeCode:", uint)(typeCodereturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor descriptorWithString (NSString string) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithString:", NSString)(stringreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor appleEventWithEventClass (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(eventClass, eventID, targetDescriptor, returnID, transactionIDreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor listDescriptor () + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "listDescriptor"return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + static NSAppleEventDescriptor recordDescriptor () + { + return invokeObjcSelfClass!(NSAppleEventDescriptor, "recordDescriptor"return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + Object initWithAEDescNoCopy (AEDesc* aeDesc) + { + return invokeObjcSelf!(Object, "initWithAEDescNoCopy:", AEDesc*)(aeDesc); + } + + this (AEDesc* aeDesc) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithAEDescNoCopy:", AEDesc*)(objcObject, aeDesc); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithDescriptorType (uint descriptorType, void* bytes, NSUInteger byteCount) + { + return invokeObjcSelf!(Object, "initWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(descriptorType, bytes, byteCount); + } + + this (uint descriptorType, void* bytes, NSUInteger byteCount) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(objcObject, descriptorType, bytes, byteCount); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithDescriptorType (uint descriptorType, NSData data) + { + return invokeObjcSelf!(Object, "initWithDescriptorType:data:", uint, NSData)(descriptorType, data); + } + + this (uint descriptorType, NSData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDescriptorType:data:", uint, NSData)(objcObject, descriptorType, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithEventClass (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) + { + return invokeObjcSelf!(Object, "initWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(eventClass, eventID, targetDescriptor, returnID, transactionID); + } + + this (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(objcObject, eventClass, eventID, targetDescriptor, returnID, transactionID); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initListDescriptor () + { + return invokeObjcSelf!(Object, "initListDescriptor"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initListDescriptor")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initRecordDescriptor () + { + return invokeObjcSelf!(Object, "initRecordDescriptor"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initRecordDescriptor")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + AEDesc* aeDesc () + { + return invokeObjcSelf!(AEDesc*, "aeDesc"); + } + + uint descriptorType () + { + return invokeObjcSelf!(uint, "descriptorType"); + } + + NSData data () + { + return invokeObjcSelf!(NSData, "data"); + } + + ubyte booleanValue () + { + return invokeObjcSelf!(ubyte, "booleanValue"); + } + + uint enumCodeValue () + { + return invokeObjcSelf!(uint, "enumCodeValue"); + } + + int int32Value () + { + return invokeObjcSelf!(int, "int32Value"); + } + + uint typeCodeValue () + { + return invokeObjcSelf!(uint, "typeCodeValue"); + } + + NSString stringValue () + { + return invokeObjcSelf!(NSString, "stringValue"); + } + + uint eventClass () + { + return invokeObjcSelf!(uint, "eventClass"); + } + + uint eventID () + { + return invokeObjcSelf!(uint, "eventID"); + } + + short returnID () + { + return invokeObjcSelf!(short, "returnID"); + } + + int transactionID () + { + return invokeObjcSelf!(int, "transactionID"); + } + + void setParamDescriptor (NSAppleEventDescriptor descriptor, uint keyword) + { + return invokeObjcSelf!(void, "setParamDescriptor:forKeyword:", NSAppleEventDescriptor, uint)(descriptor, keyword); + } + + NSAppleEventDescriptor paramDescriptorForKeyword (uint keyword) + { + id result = invokeObjcSelf!(id, "paramDescriptorForKeyword:", uint)(keywordreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + void removeParamDescriptorWithKeyword (uint keyword) + { + return invokeObjcSelf!(void, "removeParamDescriptorWithKeyword:", uint)(keyword); + } + + void setAttributeDescriptor (NSAppleEventDescriptor descriptor, uint keyword) + { + return invokeObjcSelf!(void, "setAttributeDescriptor:forKeyword:", NSAppleEventDescriptor, uint)(descriptor, keyword); + } + + NSAppleEventDescriptor attributeDescriptorForKeyword (uint keyword) + { + id result = invokeObjcSelf!(id, "attributeDescriptorForKeyword:", uint)(keywordreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + NSInteger numberOfItems () + { + return invokeObjcSelf!(NSInteger, "numberOfItems"); + } + + void insertDescriptor (NSAppleEventDescriptor descriptor, NSInteger index) + { + return invokeObjcSelf!(void, "insertDescriptor:atIndex:", NSAppleEventDescriptor, NSInteger)(descriptor, index); + } + + NSAppleEventDescriptor descriptorAtIndex (NSInteger index) + { + id result = invokeObjcSelf!(id, "descriptorAtIndex:", NSInteger)(indexreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + void removeDescriptorAtIndex (NSInteger index) + { + return invokeObjcSelf!(void, "removeDescriptorAtIndex:", NSInteger)(index); + } + + void setDescriptor (NSAppleEventDescriptor descriptor, uint keyword) + { + return invokeObjcSelf!(void, "setDescriptor:forKeyword:", NSAppleEventDescriptor, uint)(descriptor, keyword); + } + + NSAppleEventDescriptor descriptorForKeyword (uint keyword) + { + id result = invokeObjcSelf!(id, "descriptorForKeyword:", uint)(keywordreturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + void removeDescriptorWithKeyword (uint keyword) + { + return invokeObjcSelf!(void, "removeDescriptorWithKeyword:", uint)(keyword); + } + + uint keywordForDescriptorAtIndex (NSInteger index) + { + return invokeObjcSelf!(uint, "keywordForDescriptorAtIndex:", NSInteger)(index); + } + + NSAppleEventDescriptor coerceToDescriptorType (uint descriptorType) + { + id result = invokeObjcSelf!(id, "coerceToDescriptorType:", uint)(descriptorTypereturn result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAppleEventManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAppleEventManager.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,93 @@ +/** + * 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.NSAppleEventManager; + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSAppleEventManager_bindings; + +alias __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID; + +extern (C) +{ + extern + { + const double NSAppleEventTimeOutDefault; + const double NSAppleEventTimeOutNone; + } +} + +NSString NSAppleEventManagerWillProcessFirstEventNotification; + +static this () +{ + NSAppleEventManagerWillProcessFirstEventNotification = new NSString(bindings.NSAppleEventManagerWillProcessFirstEventNotification); +} + +class NSAppleEventManager : NSObject +{ + mixin ObjcWrap; + + static NSAppleEventManager sharedAppleEventManager () + { + return invokeObjcSelfClass!(NSAppleEventManager, "sharedAppleEventManager"return result is this.objcObject ? this : (result !is null ? new NSAppleEventManager(result) : null); } + + void setEventHandler (Object handler, SEL handleEventSelector, uint eventClass, uint eventID) + { + return invokeObjcSelf!(void, "setEventHandler:andSelector:forEventClass:andEventID:", Object, SEL, uint, uint)(handler, handleEventSelector, eventClass, eventID); + } + + void removeEventHandlerForEventClass (uint eventClass, uint eventID) + { + return invokeObjcSelf!(void, "removeEventHandlerForEventClass:andEventID:", uint, uint)(eventClass, eventID); + } + + short dispatchRawAppleEvent (AppleEvent* theAppleEvent, AppleEvent* theReply, int handlerRefCon) + { + return invokeObjcSelf!(short, "dispatchRawAppleEvent:withRawReply:handlerRefCon:", AppleEvent*, AppleEvent*, int)(theAppleEvent, theReply, handlerRefCon); + } + + NSAppleEventDescriptor currentAppleEvent () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "currentAppleEvent"); + } + + NSAppleEventDescriptor currentReplyAppleEvent () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "currentReplyAppleEvent"); + } + + NSAppleEventManagerSuspensionID suspendCurrentAppleEvent () + { + return invokeObjcSelf!(NSAppleEventManagerSuspensionID, "suspendCurrentAppleEvent"); + } + + NSAppleEventDescriptor appleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(NSAppleEventDescriptor, "appleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } + + NSAppleEventDescriptor replyAppleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(NSAppleEventDescriptor, "replyAppleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } + + void setCurrentAppleEventAndReplyEventWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(void, "setCurrentAppleEventAndReplyEventWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } + + void resumeWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(void, "resumeWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAppleEventManager_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAppleEventManager_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,17 @@ +module dstep.foundation.NSAppleEventManager_bindings; + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package id NSAppleEventManagerWillProcessFirstEventNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAppleScript.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAppleScript.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,100 @@ +/** + * 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.NSAppleScript; + +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSAppleScript_bindings; + +const NSString NSAppleScriptErrorMessage; +const NSString NSAppleScriptErrorNumber; +const NSString NSAppleScriptErrorAppName; +const NSString NSAppleScriptErrorBriefMessage; +const NSString NSAppleScriptErrorRange; + +static this () +{ + NSAppleScriptErrorMessage = new NSString(bindings.NSAppleScriptErrorMessage); + NSAppleScriptErrorNumber = new NSString(bindings.NSAppleScriptErrorNumber); + NSAppleScriptErrorAppName = new NSString(bindings.NSAppleScriptErrorAppName); + NSAppleScriptErrorBriefMessage = new NSString(bindings.NSAppleScriptErrorBriefMessage); + NSAppleScriptErrorRange = new NSString(bindings.NSAppleScriptErrorRange); +} + +class NSAppleScript : NSObject, INSCopying +{ + mixin ObjcWrap; + + Object initWithContentsOfURL (NSURL url, NSDictionary** errorInfo) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:error:", NSURL, NSDictionary**)(url, errorInfo); + } + + this (NSURL url, NSDictionary** errorInfo) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:error:", NSURL, NSDictionary**)(objcObject, url, errorInfo); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithSource (NSString source) + { + return invokeObjcSelf!(Object, "initWithSource:", NSString)(source); + } + + this (NSString source) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithSource:", NSString)(objcObject, source); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString source () + { + return invokeObjcSelf!(NSString, "source"); + } + + bool isCompiled () + { + return invokeObjcSelf!(bool, "isCompiled"); + } + + bool compileAndReturnError (NSDictionary** errorInfo) + { + return invokeObjcSelf!(bool, "compileAndReturnError:", NSDictionary**)(errorInfo); + } + + NSAppleEventDescriptor executeAndReturnError (NSDictionary** errorInfo) + { + return invokeObjcSelf!(NSAppleEventDescriptor, "executeAndReturnError:", NSDictionary**)(errorInfo); + } + + NSAppleEventDescriptor executeAppleEvent (NSAppleEventDescriptor event, NSDictionary** errorInfo) + { + return invokeObjcSelf!(NSAppleEventDescriptor, "executeAppleEvent:error:", NSAppleEventDescriptor, NSDictionary**)(event, errorInfo); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAppleScript_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAppleScript_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,23 @@ +module dstep.foundation.NSAppleScript_bindings; + +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSAppleScriptErrorMessage; + package const id NSAppleScriptErrorNumber; + package const id NSAppleScriptErrorAppName; + package const id NSAppleScriptErrorBriefMessage; + package const id NSAppleScriptErrorRange; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSArchiver.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSArchiver.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,169 @@ +/** + * 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.NSArchiver; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSMutableData; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSArchiver_bindings; + +const NSString NSInconsistentArchiveException; + +static this () +{ + NSInconsistentArchiveException = new NSString(bindings.NSInconsistentArchiveException); +} + +class NSArchiver : NSCoder +{ + mixin ObjcWrap; + + Object initForWritingWithMutableData (NSMutableData mdata) + { + return invokeObjcSelf!(Object, "initForWritingWithMutableData:", NSMutableData)(mdata); + } + + this (NSMutableData mdata) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initForWritingWithMutableData:", NSMutableData)(objcObject, mdata); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSMutableData archiverData () + { + return invokeObjcSelf!(NSMutableData, "archiverData"); + } + + void encodeRootObject (Object rootObject) + { + return invokeObjcSelf!(void, "encodeRootObject:", Object)(rootObject); + } + + void encodeConditionalObject (Object object) + { + return invokeObjcSelf!(void, "encodeConditionalObject:", Object)(object); + } + + static NSData archivedDataWithRootObject (Object rootObject) + { + return invokeObjcSelfClass!(NSData, "archivedDataWithRootObject:", Object)(rootObject); + } + + static bool archiveRootObject (Object rootObject, NSString path) + { + return invokeObjcSelfClass!(bool, "archiveRootObject:toFile:", Object, NSString)(rootObject, path); + } + + void encodeClassName (NSString trueName, NSString inArchiveName) + { + return invokeObjcSelf!(void, "encodeClassName:intoClassName:", NSString, NSString)(trueName, inArchiveName); + } + + NSString classNameEncodedForTrueClassName (NSString trueName) + { + return invokeObjcSelf!(NSString, "classNameEncodedForTrueClassName:", NSString)(trueName); + } + + void replaceObject (Object object, Object newObject) + { + return invokeObjcSelf!(void, "replaceObject:withObject:", Object, Object)(object, newObject); + } +} + +class NSUnarchiver : NSCoder +{ + mixin ObjcWrap; + + Object initForReadingWithData (NSData data) + { + return invokeObjcSelf!(Object, "initForReadingWithData:", NSData)(data); + } + + this (NSData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initForReadingWithData:", NSData)(objcObject, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + void setObjectZone (NSZone* zone) + { + return invokeObjcSelf!(void, "setObjectZone:", NSZone*)(zone); + } + + NSZone* objectZone () + { + return invokeObjcSelf!(NSZone*, "objectZone"); + } + + bool isAtEnd () + { + return invokeObjcSelf!(bool, "isAtEnd"); + } + + uint systemVersion () + { + return invokeObjcSelf!(uint, "systemVersion"); + } + + static Object unarchiveObjectWithData (NSData data) + { + return invokeObjcSelfClass!(Object, "unarchiveObjectWithData:", NSData)(data); + } + + static Object unarchiveObjectWithFile (NSString path) + { + return invokeObjcSelfClass!(Object, "unarchiveObjectWithFile:", NSString)(path); + } + + static void decodeClassName (NSString inArchiveName, NSString trueName) + { + return invokeObjcSelfClass!(void, "decodeClassName:asClassName:", NSString, NSString)(inArchiveName, trueName); + } + + void decodeClassName (NSString inArchiveName, NSString trueName) + { + return invokeObjcSelf!(void, "decodeClassName:asClassName:", NSString, NSString)(inArchiveName, trueName); + } + + static NSString classNameDecodedForArchiveClassName (NSString inArchiveName) + { + return invokeObjcSelfClass!(NSString, "classNameDecodedForArchiveClassName:", NSString)(inArchiveName); + } + + NSString classNameDecodedForArchiveClassName (NSString inArchiveName) + { + return invokeObjcSelf!(NSString, "classNameDecodedForArchiveClassName:", NSString)(inArchiveName); + } + + void replaceObject (Object object, Object newObject) + { + return invokeObjcSelf!(void, "replaceObject:withObject:", Object, Object)(object, newObject); + } +} + +template TNSArchiverCallback () +{ + Class classForArchiver (); + Object replacementObjectForArchiver (NSArchiver archiver); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSArchiver_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSArchiver_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,20 @@ +module dstep.foundation.NSArchiver_bindings; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSMutableData; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSInconsistentArchiveException; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSArray.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSArray.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,499 @@ +/** + * 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.NSArray; + +import dstep.foundation.NSData; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSMutableArray : NSArray +{ + mixin ObjcWrap; + mixin TNSExtendedMutableArray; + mixin TNSMutableArrayCreation; + + void addObject (Object anObject) + { + return invokeObjcSelf!(void, "addObject:", Object)(anObject); + } + + void insertObject (Object anObject, NSUInteger index) + { + return invokeObjcSelf!(void, "insertObject:atIndex:", Object, NSUInteger)(anObject, index); + } + + void removeLastObject () + { + return invokeObjcSelf!(void, "removeLastObject"); + } + + void removeObjectAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removeObjectAtIndex:", NSUInteger)(index); + } + + void replaceObjectAtIndex (NSUInteger index, Object anObject) + { + return invokeObjcSelf!(void, "replaceObjectAtIndex:withObject:", NSUInteger, Object)(index, anObject); + } +} + +class NSArray : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration +{ + mixin ObjcWrap; + mixin TNSArrayCreation; + mixin TNSExtendedArray; + mixin TNSSortDescriptorSorting; + mixin TNSArrayPathExtensions; + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + Object objectAtIndex (NSUInteger index) + { + return invokeObjcSelf!(Object, "objectAtIndex:", NSUInteger)(index); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } +} + +template TNSArrayCreation () +{ + static Object array () + { + return invokeObjcSelfClass!(Object, "array"); + } + + static Object arrayWithObject (Object anObject) + { + return invokeObjcSelfClass!(Object, "arrayWithObject:", Object)(anObject); + } + + static Object arrayWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSelfClass!(Object, "arrayWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + static Object arrayWithObjects (Object arrayWithObjects, ...) + { + return invokeObjcSelfClass!(Object, "arrayWithObjects:", Object)(arrayWithObjects); + } + + static Object arrayWithArray (NSArray array) + { + return invokeObjcSelfClass!(Object, "arrayWithArray:", NSArray)(array); + } + + Object initWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + this (id* objects, NSUInteger cnt) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjects:count:", id*, NSUInteger)(objcObject, objects, cnt); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithObjects (Object initWithObjects, ...) + { + return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); + } + + this (Object initWithObjects, ...) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjects:", Object)(objcObject, initWithObjects); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithArray (NSArray array) + { + return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); + } + + this (NSArray array) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithArray:", NSArray)(objcObject, array); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithArray (NSArray array, bool flag) + { + return invokeObjcSelf!(Object, "initWithArray:copyItems:", NSArray, bool)(array, flag); + } + + this (NSArray array, bool flag) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithArray:copyItems:", NSArray, bool)(objcObject, array, flag); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object arrayWithContentsOfFile (NSString path) + { + return invokeObjcSelfClass!(Object, "arrayWithContentsOfFile:", NSString)(path); + } + + static Object arrayWithContentsOfURL (NSURL url) + { + return invokeObjcSelfClass!(Object, "arrayWithContentsOfURL:", NSURL)(url); + } + + Object initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedArray () +{ + NSArray arrayByAddingObject (Object anObject) + { + return invokeObjcSelf!(NSArray, "arrayByAddingObject:", Object)(anObject); + } + + NSArray arrayByAddingObjectsFromArray (NSArray otherArray) + { + return invokeObjcSelf!(NSArray, "arrayByAddingObjectsFromArray:", NSArray)(otherArray); + } + + NSString componentsJoinedByString (NSString separator) + { + return invokeObjcSelf!(NSString, "componentsJoinedByString:", NSString)(separator); + } + + bool containsObject (Object anObject) + { + return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithLocale (Object locale, NSUInteger level) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level); + } + + Object firstObjectCommonWithArray (NSArray otherArray) + { + return invokeObjcSelf!(Object, "firstObjectCommonWithArray:", NSArray)(otherArray); + } + + void getObjects (id* objects) + { + return invokeObjcSelf!(void, "getObjects:", id*)(objects); + } + + void getObjects (id* objects, NSRange range) + { + return invokeObjcSelf!(void, "getObjects:range:", id*, NSRange)(objects, range); + } + + NSUInteger indexOfObject (Object anObject) + { + return invokeObjcSelf!(NSUInteger, "indexOfObject:", Object)(anObject); + } + + NSUInteger indexOfObject (Object anObject, NSRange range) + { + return invokeObjcSelf!(NSUInteger, "indexOfObject:inRange:", Object, NSRange)(anObject, range); + } + + NSUInteger indexOfObjectIdenticalTo (Object anObject) + { + return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:", Object)(anObject); + } + + NSUInteger indexOfObjectIdenticalTo (Object anObject, NSRange range) + { + return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); + } + + bool isEqualToArray (NSArray otherArray) + { + return invokeObjcSelf!(bool, "isEqualToArray:", NSArray)(otherArray); + } + + Object lastObject () + { + return invokeObjcSelf!(Object, "lastObject"); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + NSEnumerator reverseObjectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "reverseObjectEnumerator"); + } + + NSData sortedArrayHint () + { + return invokeObjcSelf!(NSData, "sortedArrayHint"); + } + + NSArray sortedArrayUsingFunction (NSInteger *id, id, void* comparator, void* context) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:", NSInteger *id, id, void*, void*)(comparator, context); + } + + NSArray sortedArrayUsingFunction (NSInteger *id, id, void* comparator, void* context, NSData hint) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:hint:", NSInteger *id, id, void*, void*, NSData)(comparator, context, hint); + } + + NSArray sortedArrayUsingSelector (SEL comparator) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingSelector:", SEL)(comparator); + } + + NSArray subarrayWithRange (NSRange range) + { + return invokeObjcSelf!(NSArray, "subarrayWithRange:", NSRange)(range); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + void makeObjectsPerformSelector (SEL aSelector) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:", SEL)(aSelector); + } + + void makeObjectsPerformSelector (SEL aSelector, Object argument) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:withObject:", SEL, Object)(aSelector, argument); + } + + NSArray objectsAtIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(NSArray, "objectsAtIndexes:", NSIndexSet)(indexes); + } +} + +template TNSExtendedMutableArray () +{ + void addObjectsFromArray (NSArray otherArray) + { + return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(otherArray); + } + + void exchangeObjectAtIndex (NSUInteger idx1, NSUInteger idx2) + { + return invokeObjcSelf!(void, "exchangeObjectAtIndex:withObjectAtIndex:", NSUInteger, NSUInteger)(idx1, idx2); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + void removeObject (Object anObject, NSRange range) + { + return invokeObjcSelf!(void, "removeObject:inRange:", Object, NSRange)(anObject, range); + } + + void removeObject (Object anObject) + { + return invokeObjcSelf!(void, "removeObject:", Object)(anObject); + } + + void removeObjectIdenticalTo (Object anObject, NSRange range) + { + return invokeObjcSelf!(void, "removeObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); + } + + void removeObjectIdenticalTo (Object anObject) + { + return invokeObjcSelf!(void, "removeObjectIdenticalTo:", Object)(anObject); + } + + void removeObjectsFromIndices (NSUInteger* indices, NSUInteger cnt) + { + return invokeObjcSelf!(void, "removeObjectsFromIndices:numIndices:", NSUInteger*, NSUInteger)(indices, cnt); + } + + void removeObjectsInArray (NSArray otherArray) + { + return invokeObjcSelf!(void, "removeObjectsInArray:", NSArray)(otherArray); + } + + void removeObjectsInRange (NSRange range) + { + return invokeObjcSelf!(void, "removeObjectsInRange:", NSRange)(range); + } + + void replaceObjectsInRange (NSRange range, NSArray otherArray, NSRange otherRange) + { + return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:range:", NSRange, NSArray, NSRange)(range, otherArray, otherRange); + } + + void replaceObjectsInRange (NSRange range, NSArray otherArray) + { + return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:", NSRange, NSArray)(range, otherArray); + } + + void setArray (NSArray otherArray) + { + return invokeObjcSelf!(void, "setArray:", NSArray)(otherArray); + } + + void sortUsingFunction (NSInteger *id, id, void* compare, void* context) + { + return invokeObjcSelf!(void, "sortUsingFunction:context:", NSInteger *id, id, void*, void*)(compare, context); + } + + void sortUsingSelector (SEL comparator) + { + return invokeObjcSelf!(void, "sortUsingSelector:", SEL)(comparator); + } + + void insertObjects (NSArray objects, NSIndexSet indexes) + { + return invokeObjcSelf!(void, "insertObjects:atIndexes:", NSArray, NSIndexSet)(objects, indexes); + } + + void removeObjectsAtIndexes (NSIndexSet indexes) + { + return invokeObjcSelf!(void, "removeObjectsAtIndexes:", NSIndexSet)(indexes); + } + + void replaceObjectsAtIndexes (NSIndexSet indexes, NSArray objects) + { + return invokeObjcSelf!(void, "replaceObjectsAtIndexes:withObjects:", NSIndexSet, NSArray)(indexes, objects); + } +} + +template TNSMutableArrayCreation () +{ + static Object arrayWithCapacity (NSUInteger numItems) + { + return invokeObjcSelfClass!(Object, "arrayWithCapacity:", NSUInteger)(numItems); + } + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAttributedString.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAttributedString.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,215 @@ +/** + * 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.NSAttributedString; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSMutableAttributedString : NSAttributedString +{ + mixin ObjcWrap; + mixin TNSExtendedMutableAttributedString; + + void replaceCharactersInRange (NSRange range, NSString str) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, str); + } + + void setAttributes (NSDictionary attrs, NSRange range) + { + return invokeObjcSelf!(void, "setAttributes:range:", NSDictionary, NSRange)(attrs, range); + } +} + +class NSAttributedString : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSExtendedAttributedString; + + NSString string () + { + return invokeObjcSelf!(NSString, "string"); + } + + NSDictionary attributesAtIndex (NSUInteger location, NSRangePointer range) + { + return invokeObjcSelf!(NSDictionary, "attributesAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(location, range); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedAttributedString () +{ + NSUInteger length () + { + return invokeObjcSelf!(NSUInteger, "length"); + } + + Object attribute (NSString attrName, NSUInteger location, NSRangePointer range) + { + return invokeObjcSelf!(Object, "attribute:atIndex:effectiveRange:", NSString, NSUInteger, NSRangePointer)(attrName, location, range); + } + + NSAttributedString attributedSubstringFromRange (NSRange range) + { + return invokeObjcSelf!(NSAttributedString, "attributedSubstringFromRange:", NSRange)(range); + } + + NSDictionary attributesAtIndex (NSUInteger location, NSRangePointer range, NSRange rangeLimit) + { + return invokeObjcSelf!(NSDictionary, "attributesAtIndex:longestEffectiveRange:inRange:", NSUInteger, NSRangePointer, NSRange)(location, range, rangeLimit); + } + + Object attribute (NSString attrName, NSUInteger location, NSRangePointer range, NSRange rangeLimit) + { + return invokeObjcSelf!(Object, "attribute:atIndex:longestEffectiveRange:inRange:", NSString, NSUInteger, NSRangePointer, NSRange)(attrName, location, range, rangeLimit); + } + + bool isEqualToAttributedString (NSAttributedString other) + { + return invokeObjcSelf!(bool, "isEqualToAttributedString:", NSAttributedString)(other); + } + + Object initWithString (NSString str) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(str); + } + + this (NSString str) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, str); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString str, NSDictionary attrs) + { + return invokeObjcSelf!(Object, "initWithString:attributes:", NSString, NSDictionary)(str, attrs); + } + + this (NSString str, NSDictionary attrs) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:attributes:", NSString, NSDictionary)(objcObject, str, attrs); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithAttributedString (NSAttributedString attrStr) + { + return invokeObjcSelf!(Object, "initWithAttributedString:", NSAttributedString)(attrStr); + } + + this (NSAttributedString attrStr) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithAttributedString:", NSAttributedString)(objcObject, attrStr); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedMutableAttributedString () +{ + NSMutableString mutableString () + { + return invokeObjcSelf!(NSMutableString, "mutableString"); + } + + void addAttribute (NSString name, Object value, NSRange range) + { + return invokeObjcSelf!(void, "addAttribute:value:range:", NSString, Object, NSRange)(name, value, range); + } + + void addAttributes (NSDictionary attrs, NSRange range) + { + return invokeObjcSelf!(void, "addAttributes:range:", NSDictionary, NSRange)(attrs, range); + } + + void removeAttribute (NSString name, NSRange range) + { + return invokeObjcSelf!(void, "removeAttribute:range:", NSString, NSRange)(name, range); + } + + void replaceCharactersInRange (NSRange range, NSAttributedString attrString) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withAttributedString:", NSRange, NSAttributedString)(range, attrString); + } + + void insertAttributedString (NSAttributedString attrString, NSUInteger loc) + { + return invokeObjcSelf!(void, "insertAttributedString:atIndex:", NSAttributedString, NSUInteger)(attrString, loc); + } + + void appendAttributedString (NSAttributedString attrString) + { + return invokeObjcSelf!(void, "appendAttributedString:", NSAttributedString)(attrString); + } + + void deleteCharactersInRange (NSRange range) + { + return invokeObjcSelf!(void, "deleteCharactersInRange:", NSRange)(range); + } + + void setAttributedString (NSAttributedString attrString) + { + return invokeObjcSelf!(void, "setAttributedString:", NSAttributedString)(attrString); + } + + void beginEditing () + { + return invokeObjcSelf!(void, "beginEditing"); + } + + void endEditing () + { + return invokeObjcSelf!(void, "endEditing"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSAutoreleasePool.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAutoreleasePool.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,33 @@ +/** + * 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.NSAutoreleasePool; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSAutoreleasePool : NSObject +{ + mixin ObjcWrap; + mixin TNSAutoreleasePoolDebugging; + + static void addObject (Object anObject) + { + return invokeObjcSelfClass!(void, "addObject:", Object)(anObject); + } + + void addObject (Object anObject) + { + return invokeObjcSelf!(void, "addObject:", Object)(anObject); + } + + void drain () + { + return invokeObjcSelf!(void, "drain"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSBundle.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSBundle.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,247 @@ +/** + * 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.NSBundle; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSBundle_bindings; + +const NSString NSBundleDidLoadNotification; +const NSString NSLoadedClasses; + +enum +{ + NSBundleExecutableArchitectureI386 = 0x00000007, + NSBundleExecutableArchitecturePPC = 0x00000012, + NSBundleExecutableArchitectureX86_64 = 0x01000007, + NSBundleExecutableArchitecturePPC64 = 0x01000012 +} + +static this () +{ + NSBundleDidLoadNotification = new NSString(bindings.NSBundleDidLoadNotification); + NSLoadedClasses = new NSString(bindings.NSLoadedClasses); +} + +class NSBundle : NSObject +{ + mixin ObjcWrap; + + static NSBundle mainBundle () + { + return invokeObjcSelfClass!(NSBundle, "mainBundle"return result is this.objcObject ? this : (result !is null ? new NSBundle(result) : null); } + + static NSBundle bundleWithPath (NSString path) + { + return invokeObjcSelfClass!(NSBundle, "bundleWithPath:", NSString)(pathreturn result is this.objcObject ? this : (result !is null ? new NSBundle(result) : null); } + + Object initWithPath (NSString path) + { + return invokeObjcSelf!(Object, "initWithPath:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithPath:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + static NSBundle bundleForClass (Class aClass) + { + return invokeObjcSelfClass!(NSBundle, "bundleForClass:", Class)(aClassreturn result is this.objcObject ? this : (result !is null ? new NSBundle(result) : null); } + + static NSBundle bundleWithIdentifier (NSString identifier) + { + return invokeObjcSelfClass!(NSBundle, "bundleWithIdentifier:", NSString)(identifierreturn result is this.objcObject ? this : (result !is null ? new NSBundle(result) : null); } + + static NSArray allBundles () + { + return invokeObjcSelfClass!(NSArray, "allBundles"); + } + + static NSArray allFrameworks () + { + return invokeObjcSelfClass!(NSArray, "allFrameworks"); + } + + bool load () + { + return invokeObjcSelf!(bool, "load"); + } + + bool isLoaded () + { + return invokeObjcSelf!(bool, "isLoaded"); + } + + bool unload () + { + return invokeObjcSelf!(bool, "unload"); + } + + bool preflightAndReturnError (NSError** error) + { + return invokeObjcSelf!(bool, "preflightAndReturnError:", NSError**)(error); + } + + bool loadAndReturnError (NSError** error) + { + return invokeObjcSelf!(bool, "loadAndReturnError:", NSError**)(error); + } + + NSString bundlePath () + { + return invokeObjcSelf!(NSString, "bundlePath"); + } + + NSString resourcePath () + { + return invokeObjcSelf!(NSString, "resourcePath"); + } + + NSString executablePath () + { + return invokeObjcSelf!(NSString, "executablePath"); + } + + NSString pathForAuxiliaryExecutable (NSString executableName) + { + return invokeObjcSelf!(NSString, "pathForAuxiliaryExecutable:", NSString)(executableName); + } + + NSString privateFrameworksPath () + { + return invokeObjcSelf!(NSString, "privateFrameworksPath"); + } + + NSString sharedFrameworksPath () + { + return invokeObjcSelf!(NSString, "sharedFrameworksPath"); + } + + NSString sharedSupportPath () + { + return invokeObjcSelf!(NSString, "sharedSupportPath"); + } + + NSString builtInPlugInsPath () + { + return invokeObjcSelf!(NSString, "builtInPlugInsPath"); + } + + NSString bundleIdentifier () + { + return invokeObjcSelf!(NSString, "bundleIdentifier"); + } + + Class classNamed (NSString className) + { + return invokeObjcSelf!(Class, "classNamed:", NSString)(className); + } + + Class principalClass () + { + return invokeObjcSelf!(Class, "principalClass"); + } + + static NSString pathForResource (NSString name, NSString ext, NSString bundlePath) + { + return invokeObjcSelfClass!(NSString, "pathForResource:ofType:inDirectory:", NSString, NSString, NSString)(name, ext, bundlePath); + } + + NSString pathForResource (NSString name, NSString ext) + { + return invokeObjcSelf!(NSString, "pathForResource:ofType:", NSString, NSString)(name, ext); + } + + NSString pathForResource (NSString name, NSString ext, NSString subpath) + { + return invokeObjcSelf!(NSString, "pathForResource:ofType:inDirectory:", NSString, NSString, NSString)(name, ext, subpath); + } + + NSString pathForResource (NSString name, NSString ext, NSString subpath, NSString localizationName) + { + return invokeObjcSelf!(NSString, "pathForResource:ofType:inDirectory:forLocalization:", NSString, NSString, NSString, NSString)(name, ext, subpath, localizationName); + } + + static NSArray pathsForResourcesOfType (NSString ext, NSString bundlePath) + { + return invokeObjcSelfClass!(NSArray, "pathsForResourcesOfType:inDirectory:", NSString, NSString)(ext, bundlePath); + } + + NSArray pathsForResourcesOfType (NSString ext, NSString subpath) + { + return invokeObjcSelf!(NSArray, "pathsForResourcesOfType:inDirectory:", NSString, NSString)(ext, subpath); + } + + NSArray pathsForResourcesOfType (NSString ext, NSString subpath, NSString localizationName) + { + return invokeObjcSelf!(NSArray, "pathsForResourcesOfType:inDirectory:forLocalization:", NSString, NSString, NSString)(ext, subpath, localizationName); + } + + NSString localizedStringForKey (NSString key, NSString value, NSString tableName) + { + return invokeObjcSelf!(NSString, "localizedStringForKey:value:table:", NSString, NSString, NSString)(key, value, tableName); + } + + NSDictionary infoDictionary () + { + return invokeObjcSelf!(NSDictionary, "infoDictionary"); + } + + NSDictionary localizedInfoDictionary () + { + return invokeObjcSelf!(NSDictionary, "localizedInfoDictionary"); + } + + Object objectForInfoDictionaryKey (NSString key) + { + return invokeObjcSelf!(Object, "objectForInfoDictionaryKey:", NSString)(key); + } + + NSArray localizations () + { + return invokeObjcSelf!(NSArray, "localizations"); + } + + NSArray preferredLocalizations () + { + return invokeObjcSelf!(NSArray, "preferredLocalizations"); + } + + NSString developmentLocalization () + { + return invokeObjcSelf!(NSString, "developmentLocalization"); + } + + static NSArray preferredLocalizationsFromArray (NSArray localizationsArray) + { + return invokeObjcSelfClass!(NSArray, "preferredLocalizationsFromArray:", NSArray)(localizationsArray); + } + + static NSArray preferredLocalizationsFromArray (NSArray localizationsArray, NSArray preferencesArray) + { + return invokeObjcSelfClass!(NSArray, "preferredLocalizationsFromArray:forPreferences:", NSArray, NSArray)(localizationsArray, preferencesArray); + } + + NSArray executableArchitectures () + { + return invokeObjcSelf!(NSArray, "executableArchitectures"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSBundle_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSBundle_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,20 @@ +module dstep.foundation.NSBundle_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSBundleDidLoadNotification; + package const id NSLoadedClasses; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSByteOrder.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSByteOrder.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,28 @@ +/** + * 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.NSByteOrder; + +import dstep.corefoundation.CFByteOrder; +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias {unsigned int v;} NSSwappedFloat; +alias {unsigned long long v;} NSSwappedDouble; + +enum +{ + NS_UnknownByteOrder = CFByteOrderUnknown, + NS_LittleEndian = CFByteOrderLittleEndian, + NS_BigEndian = CFByteOrderBigEndian +} + +struct NSSwappedFloat +{ + uint v; +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSCalendar.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSCalendar.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,323 @@ +/** + * 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.NSCalendar; + +import dstep.corefoundation.CFCalendar; +import dstep.foundation.NSDate; +import dstep.foundation.NSDateComponents; +import dstep.foundation.NSLocale; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.foundation.NSTimeZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSCalendarUnit; + +enum +{ + NSEraCalendarUnit = kCFCalendarUnitEra, + NSYearCalendarUnit = kCFCalendarUnitYear, + NSMonthCalendarUnit = kCFCalendarUnitMonth, + NSDayCalendarUnit = kCFCalendarUnitDay, + NSHourCalendarUnit = kCFCalendarUnitHour, + NSMinuteCalendarUnit = kCFCalendarUnitMinute, + NSSecondCalendarUnit = kCFCalendarUnitSecond, + NSWeekCalendarUnit = kCFCalendarUnitWeek, + NSWeekdayCalendarUnit = kCFCalendarUnitWeekday, + NSWeekdayOrdinalCalendarUnit = kCFCalendarUnitWeekdayOrdinal +} + +enum +{ + NSWrapCalendarComponents = kCFCalendarComponentsWrap +} + +enum +{ + NSUndefinedDateComponent = 2147483647L +} + +class NSDateComponents : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + NSInteger era () + { + return invokeObjcSelf!(NSInteger, "era"); + } + + NSInteger year () + { + return invokeObjcSelf!(NSInteger, "year"); + } + + NSInteger month () + { + return invokeObjcSelf!(NSInteger, "month"); + } + + NSInteger day () + { + return invokeObjcSelf!(NSInteger, "day"); + } + + NSInteger hour () + { + return invokeObjcSelf!(NSInteger, "hour"); + } + + NSInteger minute () + { + return invokeObjcSelf!(NSInteger, "minute"); + } + + NSInteger second () + { + return invokeObjcSelf!(NSInteger, "second"); + } + + NSInteger week () + { + return invokeObjcSelf!(NSInteger, "week"); + } + + NSInteger weekday () + { + return invokeObjcSelf!(NSInteger, "weekday"); + } + + NSInteger weekdayOrdinal () + { + return invokeObjcSelf!(NSInteger, "weekdayOrdinal"); + } + + void setEra (NSInteger v) + { + return invokeObjcSelf!(void, "setEra:", NSInteger)(v); + } + + void setYear (NSInteger v) + { + return invokeObjcSelf!(void, "setYear:", NSInteger)(v); + } + + void setMonth (NSInteger v) + { + return invokeObjcSelf!(void, "setMonth:", NSInteger)(v); + } + + void setDay (NSInteger v) + { + return invokeObjcSelf!(void, "setDay:", NSInteger)(v); + } + + void setHour (NSInteger v) + { + return invokeObjcSelf!(void, "setHour:", NSInteger)(v); + } + + void setMinute (NSInteger v) + { + return invokeObjcSelf!(void, "setMinute:", NSInteger)(v); + } + + void setSecond (NSInteger v) + { + return invokeObjcSelf!(void, "setSecond:", NSInteger)(v); + } + + void setWeek (NSInteger v) + { + return invokeObjcSelf!(void, "setWeek:", NSInteger)(v); + } + + void setWeekday (NSInteger v) + { + return invokeObjcSelf!(void, "setWeekday:", NSInteger)(v); + } + + void setWeekdayOrdinal (NSInteger v) + { + return invokeObjcSelf!(void, "setWeekdayOrdinal:", NSInteger)(v); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSCalendar : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + static Object currentCalendar () + { + return invokeObjcSelfClass!(Object, "currentCalendar"); + } + + static Object autoupdatingCurrentCalendar () + { + return invokeObjcSelfClass!(Object, "autoupdatingCurrentCalendar"); + } + + Object initWithCalendarIdentifier (NSString ident) + { + return invokeObjcSelf!(Object, "initWithCalendarIdentifier:", NSString)(ident); + } + + this (NSString ident) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCalendarIdentifier:", NSString)(objcObject, ident); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString calendarIdentifier () + { + return invokeObjcSelf!(NSString, "calendarIdentifier"); + } + + void setLocale (NSLocale locale) + { + return invokeObjcSelf!(void, "setLocale:", NSLocale)(locale); + } + + NSLocale locale () + { + return invokeObjcSelf!(NSLocale, "locale"); + } + + void setTimeZone (NSTimeZone tz) + { + return invokeObjcSelf!(void, "setTimeZone:", NSTimeZone)(tz); + } + + NSTimeZone timeZone () + { + return invokeObjcSelf!(NSTimeZone, "timeZone"); + } + + void setFirstWeekday (NSUInteger weekday) + { + return invokeObjcSelf!(void, "setFirstWeekday:", NSUInteger)(weekday); + } + + NSUInteger firstWeekday () + { + return invokeObjcSelf!(NSUInteger, "firstWeekday"); + } + + void setMinimumDaysInFirstWeek (NSUInteger mdw) + { + return invokeObjcSelf!(void, "setMinimumDaysInFirstWeek:", NSUInteger)(mdw); + } + + NSUInteger minimumDaysInFirstWeek () + { + return invokeObjcSelf!(NSUInteger, "minimumDaysInFirstWeek"); + } + + NSRange minimumRangeOfUnit (uint unit) + { + return invokeObjcSelf!(NSRange, "minimumRangeOfUnit:", uint)(unit); + } + + NSRange maximumRangeOfUnit (uint unit) + { + return invokeObjcSelf!(NSRange, "maximumRangeOfUnit:", uint)(unit); + } + + NSRange rangeOfUnit (uint smaller, uint larger, NSDate date) + { + return invokeObjcSelf!(NSRange, "rangeOfUnit:inUnit:forDate:", uint, uint, NSDate)(smaller, larger, date); + } + + NSUInteger ordinalityOfUnit (uint smaller, uint larger, NSDate date) + { + return invokeObjcSelf!(NSUInteger, "ordinalityOfUnit:inUnit:forDate:", uint, uint, NSDate)(smaller, larger, date); + } + + bool rangeOfUnit (uint unit, NSDate** datep, NSTimeInterval* tip, NSDate date) + { + return invokeObjcSelf!(bool, "rangeOfUnit:startDate:interval:forDate:", uint, NSDate**, NSTimeInterval*, NSDate)(unit, datep, tip, date); + } + + NSDate dateFromComponents (NSDateComponents comps) + { + return invokeObjcSelf!(NSDate, "dateFromComponents:", NSDateComponents)(comps); + } + + NSDateComponents components (NSUInteger unitFlags, NSDate date) + { + return invokeObjcSelf!(NSDateComponents, "components:fromDate:", NSUInteger, NSDate)(unitFlags, date); + } + + NSDate dateByAddingComponents (NSDateComponents comps, NSDate date, NSUInteger opts) + { + return invokeObjcSelf!(NSDate, "dateByAddingComponents:toDate:options:", NSDateComponents, NSDate, NSUInteger)(comps, date, opts); + } + + NSDateComponents components (NSUInteger unitFlags, NSDate startingDate, NSDate resultDate, NSUInteger opts) + { + return invokeObjcSelf!(NSDateComponents, "components:fromDate:toDate:options:", NSUInteger, NSDate, NSDate, NSUInteger)(unitFlags, startingDate, resultDate, opts); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSCalendarDate.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSCalendarDate.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,250 @@ +/** + * 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.NSCalendarDate; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSString; +import dstep.foundation.NSTimeZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSCalendarDate : NSDate +{ + mixin ObjcWrap; + + static Object dateWithYear (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) + { + return invokeObjcSelfClass!(Object, "dateWithYear:month:day:hour:minute:second:timeZone:", NSInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSTimeZone)(year, month, day, hour, minute, second, aTimeZone); + } + + static Object dateWithString (NSString description, NSString format) + { + return invokeObjcSelfClass!(Object, "dateWithString:calendarFormat:", NSString, NSString)(description, format); + } + + static Object dateWithString (NSString description, NSString format, Object locale) + { + return invokeObjcSelfClass!(Object, "dateWithString:calendarFormat:locale:", NSString, NSString, Object)(description, format, locale); + } + + static Object calendarDate () + { + return invokeObjcSelfClass!(Object, "calendarDate"); + } + + Object initWithYear (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) + { + return invokeObjcSelf!(Object, "initWithYear:month:day:hour:minute:second:timeZone:", NSInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSTimeZone)(year, month, day, hour, minute, second, aTimeZone); + } + + this (NSInteger year, NSUInteger month, NSUInteger day, NSUInteger hour, NSUInteger minute, NSUInteger second, NSTimeZone aTimeZone) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithYear:month:day:hour:minute:second:timeZone:", NSInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSUInteger, NSTimeZone)(objcObject, year, month, day, hour, minute, second, aTimeZone); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString description) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(description); + } + + this (NSString description) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, description); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString description, NSString format) + { + return invokeObjcSelf!(Object, "initWithString:calendarFormat:", NSString, NSString)(description, format); + } + + this (NSString description, NSString format) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:calendarFormat:", NSString, NSString)(objcObject, description, format); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString description, NSString format, Object locale) + { + return invokeObjcSelf!(Object, "initWithString:calendarFormat:locale:", NSString, NSString, Object)(description, format, locale); + } + + this (NSString description, NSString format, Object locale) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:calendarFormat:locale:", NSString, NSString, Object)(objcObject, description, format, locale); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSTimeZone timeZone () + { + return invokeObjcSelf!(NSTimeZone, "timeZone"); + } + + void setTimeZone (NSTimeZone aTimeZone) + { + return invokeObjcSelf!(void, "setTimeZone:", NSTimeZone)(aTimeZone); + } + + NSString calendarFormat () + { + return invokeObjcSelf!(NSString, "calendarFormat"); + } + + void setCalendarFormat (NSString format) + { + return invokeObjcSelf!(void, "setCalendarFormat:", NSString)(format); + } + + NSInteger yearOfCommonEra () + { + return invokeObjcSelf!(NSInteger, "yearOfCommonEra"); + } + + NSInteger monthOfYear () + { + return invokeObjcSelf!(NSInteger, "monthOfYear"); + } + + NSInteger dayOfMonth () + { + return invokeObjcSelf!(NSInteger, "dayOfMonth"); + } + + NSInteger dayOfWeek () + { + return invokeObjcSelf!(NSInteger, "dayOfWeek"); + } + + NSInteger dayOfYear () + { + return invokeObjcSelf!(NSInteger, "dayOfYear"); + } + + NSInteger dayOfCommonEra () + { + return invokeObjcSelf!(NSInteger, "dayOfCommonEra"); + } + + NSInteger hourOfDay () + { + return invokeObjcSelf!(NSInteger, "hourOfDay"); + } + + NSInteger minuteOfHour () + { + return invokeObjcSelf!(NSInteger, "minuteOfHour"); + } + + NSInteger secondOfMinute () + { + return invokeObjcSelf!(NSInteger, "secondOfMinute"); + } + + NSCalendarDate dateByAddingYears (NSInteger year, NSInteger month, NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) + { + id result = invokeObjcSelf!(id, "dateByAddingYears:months:days:hours:minutes:seconds:", NSInteger, NSInteger, NSInteger, NSInteger, NSInteger, NSInteger)(year, month, day, hour, minute, secondreturn result is this.objcObject ? this : (result !is null ? new NSCalendarDate(result) : null); } + + void years (NSInteger* yp, NSInteger* mop, NSInteger* dp, NSInteger* hp, NSInteger* mip, NSInteger* sp, NSCalendarDate date) + { + return invokeObjcSelf!(void, "years:months:days:hours:minutes:seconds:sinceDate:", NSInteger*, NSInteger*, NSInteger*, NSInteger*, NSInteger*, NSInteger*, NSCalendarDate)(yp, mop, dp, hp, mip, sp, date); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithCalendarFormat (NSString format) + { + return invokeObjcSelf!(NSString, "descriptionWithCalendarFormat:", NSString)(format); + } + + NSString descriptionWithCalendarFormat (NSString format, Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithCalendarFormat:locale:", NSString, Object)(format, locale); + } +} + +template TNSNaturalLangage () +{ + static Object dateWithNaturalLanguageString (NSString string) + { + return invokeObjcSelfClass!(Object, "dateWithNaturalLanguageString:", NSString)(string); + } + + static Object dateWithNaturalLanguageString (NSString string, Object locale) + { + return invokeObjcSelfClass!(Object, "dateWithNaturalLanguageString:locale:", NSString, Object)(string, locale); + } +} + +template TNSCalendarDateExtras () +{ + static Object dateWithString (NSString aString) + { + return invokeObjcSelfClass!(Object, "dateWithString:", NSString)(aString); + } + + Object initWithString (NSString description) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(description); + } + + this (NSString description) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, description); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSCalendarDate dateWithCalendarFormat (NSString format, NSTimeZone aTimeZone) + { + return invokeObjcSelf!(NSCalendarDate, "dateWithCalendarFormat:timeZone:", NSString, NSTimeZone)(format, aTimeZone); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithCalendarFormat (NSString format, NSTimeZone aTimeZone, Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithCalendarFormat:timeZone:locale:", NSString, NSTimeZone, Object)(format, aTimeZone, locale); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSCharacterSet.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSCharacterSet.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,231 @@ +/** + * 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.NSCharacterSet; + +import dstep.corefoundation.CFCharacterSet; +import dstep.foundation.NSData; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +enum +{ + NSOpenStepUnicodeReservedBase = 0xF400 +} + +class NSCharacterSet : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin ObjcWrap; + + static Object controlCharacterSet () + { + return invokeObjcSelfClass!(Object, "controlCharacterSet"); + } + + static Object whitespaceCharacterSet () + { + return invokeObjcSelfClass!(Object, "whitespaceCharacterSet"); + } + + static Object whitespaceAndNewlineCharacterSet () + { + return invokeObjcSelfClass!(Object, "whitespaceAndNewlineCharacterSet"); + } + + static Object decimalDigitCharacterSet () + { + return invokeObjcSelfClass!(Object, "decimalDigitCharacterSet"); + } + + static Object letterCharacterSet () + { + return invokeObjcSelfClass!(Object, "letterCharacterSet"); + } + + static Object lowercaseLetterCharacterSet () + { + return invokeObjcSelfClass!(Object, "lowercaseLetterCharacterSet"); + } + + static Object uppercaseLetterCharacterSet () + { + return invokeObjcSelfClass!(Object, "uppercaseLetterCharacterSet"); + } + + static Object nonBaseCharacterSet () + { + return invokeObjcSelfClass!(Object, "nonBaseCharacterSet"); + } + + static Object alphanumericCharacterSet () + { + return invokeObjcSelfClass!(Object, "alphanumericCharacterSet"); + } + + static Object decomposableCharacterSet () + { + return invokeObjcSelfClass!(Object, "decomposableCharacterSet"); + } + + static Object illegalCharacterSet () + { + return invokeObjcSelfClass!(Object, "illegalCharacterSet"); + } + + static Object punctuationCharacterSet () + { + return invokeObjcSelfClass!(Object, "punctuationCharacterSet"); + } + + static Object capitalizedLetterCharacterSet () + { + return invokeObjcSelfClass!(Object, "capitalizedLetterCharacterSet"); + } + + static Object symbolCharacterSet () + { + return invokeObjcSelfClass!(Object, "symbolCharacterSet"); + } + + static Object newlineCharacterSet () + { + return invokeObjcSelfClass!(Object, "newlineCharacterSet"); + } + + static Object characterSetWithRange (NSRange aRange) + { + return invokeObjcSelfClass!(Object, "characterSetWithRange:", NSRange)(aRange); + } + + static Object characterSetWithCharactersInString (NSString aString) + { + return invokeObjcSelfClass!(Object, "characterSetWithCharactersInString:", NSString)(aString); + } + + static Object characterSetWithBitmapRepresentation (NSData data) + { + return invokeObjcSelfClass!(Object, "characterSetWithBitmapRepresentation:", NSData)(data); + } + + static Object characterSetWithContentsOfFile (NSString fName) + { + return invokeObjcSelfClass!(Object, "characterSetWithContentsOfFile:", NSString)(fName); + } + + bool characterIsMember (ushort aCharacter) + { + return invokeObjcSelf!(bool, "characterIsMember:", ushort)(aCharacter); + } + + NSData bitmapRepresentation () + { + return invokeObjcSelf!(NSData, "bitmapRepresentation"); + } + + NSCharacterSet invertedSet () + { + id result = invokeObjcSelf!(id, "invertedSet"return result is this.objcObject ? this : (result !is null ? new NSCharacterSet(result) : null); } + + bool longCharacterIsMember (uint theLongChar) + { + return invokeObjcSelf!(bool, "longCharacterIsMember:", uint)(theLongChar); + } + + bool isSupersetOfSet (NSCharacterSet theOtherSet) + { + return invokeObjcSelf!(bool, "isSupersetOfSet:", NSCharacterSet)(theOtherSet); + } + + bool hasMemberInPlane (ubyte thePlane) + { + return invokeObjcSelf!(bool, "hasMemberInPlane:", ubyte)(thePlane); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSMutableCharacterSet : NSCharacterSet, INSCopying, INSMutableCopying +{ + mixin ObjcWrap; + + void addCharactersInRange (NSRange aRange) + { + return invokeObjcSelf!(void, "addCharactersInRange:", NSRange)(aRange); + } + + void removeCharactersInRange (NSRange aRange) + { + return invokeObjcSelf!(void, "removeCharactersInRange:", NSRange)(aRange); + } + + void addCharactersInString (NSString aString) + { + return invokeObjcSelf!(void, "addCharactersInString:", NSString)(aString); + } + + void removeCharactersInString (NSString aString) + { + return invokeObjcSelf!(void, "removeCharactersInString:", NSString)(aString); + } + + void formUnionWithCharacterSet (NSCharacterSet otherSet) + { + return invokeObjcSelf!(void, "formUnionWithCharacterSet:", NSCharacterSet)(otherSet); + } + + void formIntersectionWithCharacterSet (NSCharacterSet otherSet) + { + return invokeObjcSelf!(void, "formIntersectionWithCharacterSet:", NSCharacterSet)(otherSet); + } + + void invert () + { + return invokeObjcSelf!(void, "invert"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSClassDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSClassDescription.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,73 @@ +/** + * 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.NSClassDescription; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSException; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSClassDescription_bindings; + +NSString NSClassDescriptionNeededForClassNotification; + +static this () +{ + NSClassDescriptionNeededForClassNotification = new NSString(bindings.NSClassDescriptionNeededForClassNotification); +} + +class NSClassDescription : NSObject +{ + mixin ObjcWrap; + + static void registerClassDescription (NSClassDescription description, Class aClass) + { + return invokeObjcSelfClass!(void, "registerClassDescription:forClass:", NSClassDescription, Class)(description, aClass); + } + + static void invalidateClassDescriptionCache () + { + return invokeObjcSelfClass!(void, "invalidateClassDescriptionCache"); + } + + static NSClassDescription classDescriptionForClass (Class aClass) + { + return invokeObjcSelfClass!(NSClassDescription, "classDescriptionForClass:", Class)(aClassreturn result is this.objcObject ? this : (result !is null ? new NSClassDescription(result) : null); } + + NSArray attributeKeys () + { + return invokeObjcSelf!(NSArray, "attributeKeys"); + } + + NSArray toOneRelationshipKeys () + { + return invokeObjcSelf!(NSArray, "toOneRelationshipKeys"); + } + + NSArray toManyRelationshipKeys () + { + return invokeObjcSelf!(NSArray, "toManyRelationshipKeys"); + } + + NSString inverseForRelationshipKey (NSString relationshipKey) + { + return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); + } +} + +template TNSClassDescriptionPrimitives () +{ + NSClassDescription classDescription (); + NSArray attributeKeys (); + NSArray toOneRelationshipKeys (); + NSArray toManyRelationshipKeys (); + NSString inverseForRelationshipKey (NSString relationshipKey); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSClassDescription_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSClassDescription_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,19 @@ +module dstep.foundation.NSClassDescription_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSException; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package id NSClassDescriptionNeededForClassNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSCoder.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSCoder.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,259 @@ +/** + * 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.NSCoder; + +import dstep.foundation.NSData; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSCoder : NSObject +{ + mixin ObjcWrap; + mixin TNSGeometryCoding; + mixin TNSExtendedCoder; + mixin TNSTypedstreamCompatibility; + mixin TNSGeometryKeyedCoding; + + void encodeValueOfObjCType (char* type, void* addr) + { + return invokeObjcSelf!(void, "encodeValueOfObjCType:at:", char*, void*)(type, addr); + } + + void encodeDataObject (NSData data) + { + return invokeObjcSelf!(void, "encodeDataObject:", NSData)(data); + } + + void decodeValueOfObjCType (char* type, void* data) + { + return invokeObjcSelf!(void, "decodeValueOfObjCType:at:", char*, void*)(type, data); + } + + NSData decodeDataObject () + { + return invokeObjcSelf!(NSData, "decodeDataObject"); + } + + NSInteger versionForClassName (NSString className) + { + return invokeObjcSelf!(NSInteger, "versionForClassName:", NSString)(className); + } +} + +template TNSExtendedCoder () +{ + void encodeObject (Object object) + { + return invokeObjcSelf!(void, "encodeObject:", Object)(object); + } + + void encodePropertyList (Object aPropertyList) + { + return invokeObjcSelf!(void, "encodePropertyList:", Object)(aPropertyList); + } + + void encodeRootObject (Object rootObject) + { + return invokeObjcSelf!(void, "encodeRootObject:", Object)(rootObject); + } + + void encodeBycopyObject (Object anObject) + { + return invokeObjcSelf!(void, "encodeBycopyObject:", Object)(anObject); + } + + void encodeByrefObject (Object anObject) + { + return invokeObjcSelf!(void, "encodeByrefObject:", Object)(anObject); + } + + void encodeConditionalObject (Object object) + { + return invokeObjcSelf!(void, "encodeConditionalObject:", Object)(object); + } + + void encodeValuesOfObjCTypes (char* encodeValuesOfObjCTypes, ...) + { + return invokeObjcSelf!(void, "encodeValuesOfObjCTypes:", char*)(encodeValuesOfObjCTypes); + } + + void encodeArrayOfObjCType (char* type, NSUInteger count, void* array) + { + return invokeObjcSelf!(void, "encodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(type, count, array); + } + + void encodeBytes (void* byteaddr, NSUInteger length) + { + return invokeObjcSelf!(void, "encodeBytes:length:", void*, NSUInteger)(byteaddr, length); + } + + Object decodeObject () + { + return invokeObjcSelf!(Object, "decodeObject"); + } + + Object decodePropertyList () + { + return invokeObjcSelf!(Object, "decodePropertyList"); + } + + void decodeValuesOfObjCTypes (char* decodeValuesOfObjCTypes, ...) + { + return invokeObjcSelf!(void, "decodeValuesOfObjCTypes:", char*)(decodeValuesOfObjCTypes); + } + + void decodeArrayOfObjCType (char* itemType, NSUInteger count, void* array) + { + return invokeObjcSelf!(void, "decodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(itemType, count, array); + } + + void* decodeBytesWithReturnedLength (NSUInteger* lengthp) + { + return invokeObjcSelf!(void*, "decodeBytesWithReturnedLength:", NSUInteger*)(lengthp); + } + + void setObjectZone (NSZone* zone) + { + return invokeObjcSelf!(void, "setObjectZone:", NSZone*)(zone); + } + + NSZone* objectZone () + { + return invokeObjcSelf!(NSZone*, "objectZone"); + } + + uint systemVersion () + { + return invokeObjcSelf!(uint, "systemVersion"); + } + + bool allowsKeyedCoding () + { + return invokeObjcSelf!(bool, "allowsKeyedCoding"); + } + + void encodeObject (Object objv, NSString key) + { + return invokeObjcSelf!(void, "encodeObject:forKey:", Object, NSString)(objv, key); + } + + void encodeConditionalObject (Object objv, NSString key) + { + return invokeObjcSelf!(void, "encodeConditionalObject:forKey:", Object, NSString)(objv, key); + } + + void encodeBool (bool boolv, NSString key) + { + return invokeObjcSelf!(void, "encodeBool:forKey:", bool, NSString)(boolv, key); + } + + void encodeInt (int intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt:forKey:", int, NSString)(intv, key); + } + + void encodeInt32 (int intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt32:forKey:", int, NSString)(intv, key); + } + + void encodeInt64 (long intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt64:forKey:", long, NSString)(intv, key); + } + + void encodeFloat (float realv, NSString key) + { + return invokeObjcSelf!(void, "encodeFloat:forKey:", float, NSString)(realv, key); + } + + void encodeDouble (double realv, NSString key) + { + return invokeObjcSelf!(void, "encodeDouble:forKey:", double, NSString)(realv, key); + } + + void encodeBytes (char* bytesp, NSUInteger lenv, NSString key) + { + return invokeObjcSelf!(void, "encodeBytes:length:forKey:", char*, NSUInteger, NSString)(bytesp, lenv, key); + } + + bool containsValueForKey (NSString key) + { + return invokeObjcSelf!(bool, "containsValueForKey:", NSString)(key); + } + + Object decodeObjectForKey (NSString key) + { + return invokeObjcSelf!(Object, "decodeObjectForKey:", NSString)(key); + } + + bool decodeBoolForKey (NSString key) + { + return invokeObjcSelf!(bool, "decodeBoolForKey:", NSString)(key); + } + + int decodeIntForKey (NSString key) + { + return invokeObjcSelf!(int, "decodeIntForKey:", NSString)(key); + } + + int decodeInt32ForKey (NSString key) + { + return invokeObjcSelf!(int, "decodeInt32ForKey:", NSString)(key); + } + + long decodeInt64ForKey (NSString key) + { + return invokeObjcSelf!(long, "decodeInt64ForKey:", NSString)(key); + } + + float decodeFloatForKey (NSString key) + { + return invokeObjcSelf!(float, "decodeFloatForKey:", NSString)(key); + } + + double decodeDoubleForKey (NSString key) + { + return invokeObjcSelf!(double, "decodeDoubleForKey:", NSString)(key); + } + + char* decodeBytesForKey (NSString key, NSUInteger* lengthp) + { + return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); + } + + void encodeInteger (NSInteger intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInteger:forKey:", NSInteger, NSString)(intv, key); + } + + NSInteger decodeIntegerForKey (NSString key) + { + return invokeObjcSelf!(NSInteger, "decodeIntegerForKey:", NSString)(key); + } +} + +template TNSTypedstreamCompatibility () +{ + void encodeNXObject (Object object) + { + return invokeObjcSelf!(void, "encodeNXObject:", Object)(object); + } + + Object decodeNXObject () + { + return invokeObjcSelf!(Object, "decodeNXObject"); + } +} + +NSObject NXReadNSObjectFromCoder (NSCoder decoder) +{ + return Bridge.invokeObjcFunction!(NSObject, bindings.NXReadNSObjectFromCoder, NSCoder)(decoder); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSComparisonPredicate.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSComparisonPredicate.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,125 @@ +/** + * 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.NSComparisonPredicate; + +import dstep.foundation.NSExpression; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSPredicateOperator; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSComparisonPredicateModifier; +alias NSUInteger NSPredicateOperatorType; + +enum +{ + NSCaseInsensitivePredicateOption = 0x01, + NSDiacriticInsensitivePredicateOption = 0x02 +} + +enum +{ + NSDirectPredicateModifier = 0, + NSAllPredicateModifier, + NSAnyPredicateModifier +} + +enum +{ + NSLessThanPredicateOperatorType = 0, + NSLessThanOrEqualToPredicateOperatorType, + NSGreaterThanPredicateOperatorType, + NSGreaterThanOrEqualToPredicateOperatorType, + NSEqualToPredicateOperatorType, + NSNotEqualToPredicateOperatorType, + NSMatchesPredicateOperatorType, + NSLikePredicateOperatorType, + NSBeginsWithPredicateOperatorType, + NSEndsWithPredicateOperatorType, + NSInPredicateOperatorType, + NSCustomSelectorPredicateOperatorType, + NSContainsPredicateOperatorType = 99, + NSBetweenPredicateOperatorType +} + +class NSComparisonPredicate : NSPredicate +{ + mixin ObjcWrap; + + static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) + { + return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); + } + + static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) + { + return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); + } + + Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) + { + return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); + } + + this (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(objcObject, lhs, rhs, modifier, type, options); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) + { + return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); + } + + this (NSExpression lhs, NSExpression rhs, SEL selector) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(objcObject, lhs, rhs, selector); + + if (result) + objcObject = ret; + + dObject = this; + } + + uint predicateOperatorType () + { + return invokeObjcSelf!(uint, "predicateOperatorType"); + } + + uint comparisonPredicateModifier () + { + return invokeObjcSelf!(uint, "comparisonPredicateModifier"); + } + + NSExpression leftExpression () + { + return invokeObjcSelf!(NSExpression, "leftExpression"); + } + + NSExpression rightExpression () + { + return invokeObjcSelf!(NSExpression, "rightExpression"); + } + + SEL customSelector () + { + return invokeObjcSelf!(SEL, "customSelector"); + } + + NSUInteger options () + { + return invokeObjcSelf!(NSUInteger, "options"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSCompoundPredicate.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSCompoundPredicate.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,68 @@ +/** + * 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); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSConnection.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSConnection.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,286 @@ +/** + * 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.NSConnection; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSDistantObject; +import dstep.foundation.NSException; +import dstep.foundation.NSMutableData; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.foundation.NSPortNameServer; +import dstep.foundation.NSRunLoop; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSConnection_bindings; + +const NSString NSConnectionReplyMode; +const NSString NSConnectionDidDieNotification; +const NSString NSFailedAuthenticationException; +const NSString NSConnectionDidInitializeNotification; + +static this () +{ + NSConnectionReplyMode = new NSString(bindings.NSConnectionReplyMode); + NSConnectionDidDieNotification = new NSString(bindings.NSConnectionDidDieNotification); + NSFailedAuthenticationException = new NSString(bindings.NSFailedAuthenticationException); + NSConnectionDidInitializeNotification = new NSString(bindings.NSConnectionDidInitializeNotification); +} + +class NSDistantObjectRequest : NSObject +{ + mixin ObjcWrap; + + NSInvocation invocation () + { + return invokeObjcSelf!(NSInvocation, "invocation"); + } + + NSConnection connection () + { + return invokeObjcSelf!(NSConnection, "connection"); + } + + Object conversation () + { + return invokeObjcSelf!(Object, "conversation"); + } + + void replyWithException (NSException exception) + { + return invokeObjcSelf!(void, "replyWithException:", NSException)(exception); + } +} + +class NSConnection : NSObject +{ + mixin ObjcWrap; + + NSDictionary statistics () + { + return invokeObjcSelf!(NSDictionary, "statistics"); + } + + static NSArray allConnections () + { + return invokeObjcSelfClass!(NSArray, "allConnections"); + } + + static NSConnection defaultConnection () + { + return invokeObjcSelfClass!(NSConnection, "defaultConnection"return result is this.objcObject ? this : (result !is null ? new NSConnection(result) : null); } + + static Object connectionWithRegisteredName (NSString name, NSString hostName) + { + return invokeObjcSelfClass!(Object, "connectionWithRegisteredName:host:", NSString, NSString)(name, hostName); + } + + static Object connectionWithRegisteredName (NSString name, NSString hostName, NSPortNameServer server) + { + return invokeObjcSelfClass!(Object, "connectionWithRegisteredName:host:usingNameServer:", NSString, NSString, NSPortNameServer)(name, hostName, server); + } + + static NSDistantObject rootProxyForConnectionWithRegisteredName (NSString name, NSString hostName) + { + return invokeObjcSelfClass!(NSDistantObject, "rootProxyForConnectionWithRegisteredName:host:", NSString, NSString)(name, hostName); + } + + static NSDistantObject rootProxyForConnectionWithRegisteredName (NSString name, NSString hostName, NSPortNameServer server) + { + return invokeObjcSelfClass!(NSDistantObject, "rootProxyForConnectionWithRegisteredName:host:usingNameServer:", NSString, NSString, NSPortNameServer)(name, hostName, server); + } + + static Object serviceConnectionWithName (NSString name, Object root, NSPortNameServer server) + { + return invokeObjcSelfClass!(Object, "serviceConnectionWithName:rootObject:usingNameServer:", NSString, Object, NSPortNameServer)(name, root, server); + } + + static Object serviceConnectionWithName (NSString name, Object root) + { + return invokeObjcSelfClass!(Object, "serviceConnectionWithName:rootObject:", NSString, Object)(name, root); + } + + void setRequestTimeout (double ti) + { + return invokeObjcSelf!(void, "setRequestTimeout:", double)(ti); + } + + double requestTimeout () + { + return invokeObjcSelf!(double, "requestTimeout"); + } + + void setReplyTimeout (double ti) + { + return invokeObjcSelf!(void, "setReplyTimeout:", double)(ti); + } + + double replyTimeout () + { + return invokeObjcSelf!(double, "replyTimeout"); + } + + void setRootObject (Object anObject) + { + return invokeObjcSelf!(void, "setRootObject:", Object)(anObject); + } + + Object rootObject () + { + return invokeObjcSelf!(Object, "rootObject"); + } + + NSDistantObject rootProxy () + { + return invokeObjcSelf!(NSDistantObject, "rootProxy"); + } + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setIndependentConversationQueueing (bool yorn) + { + return invokeObjcSelf!(void, "setIndependentConversationQueueing:", bool)(yorn); + } + + bool independentConversationQueueing () + { + return invokeObjcSelf!(bool, "independentConversationQueueing"); + } + + bool isValid () + { + return invokeObjcSelf!(bool, "isValid"); + } + + void invalidate () + { + return invokeObjcSelf!(void, "invalidate"); + } + + void addRequestMode (NSString rmode) + { + return invokeObjcSelf!(void, "addRequestMode:", NSString)(rmode); + } + + void removeRequestMode (NSString rmode) + { + return invokeObjcSelf!(void, "removeRequestMode:", NSString)(rmode); + } + + NSArray requestModes () + { + return invokeObjcSelf!(NSArray, "requestModes"); + } + + bool registerName (NSString name) + { + return invokeObjcSelf!(bool, "registerName:", NSString)(name); + } + + bool registerName (NSString name, NSPortNameServer server) + { + return invokeObjcSelf!(bool, "registerName:withNameServer:", NSString, NSPortNameServer)(name, server); + } + + static Object connectionWithReceivePort (NSPort receivePort, NSPort sendPort) + { + return invokeObjcSelfClass!(Object, "connectionWithReceivePort:sendPort:", NSPort, NSPort)(receivePort, sendPort); + } + + static Object currentConversation () + { + return invokeObjcSelfClass!(Object, "currentConversation"); + } + + Object initWithReceivePort (NSPort receivePort, NSPort sendPort) + { + return invokeObjcSelf!(Object, "initWithReceivePort:sendPort:", NSPort, NSPort)(receivePort, sendPort); + } + + this (NSPort receivePort, NSPort sendPort) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithReceivePort:sendPort:", NSPort, NSPort)(objcObject, receivePort, sendPort); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSPort sendPort () + { + return invokeObjcSelf!(NSPort, "sendPort"); + } + + NSPort receivePort () + { + return invokeObjcSelf!(NSPort, "receivePort"); + } + + void enableMultipleThreads () + { + return invokeObjcSelf!(void, "enableMultipleThreads"); + } + + bool multipleThreadsEnabled () + { + return invokeObjcSelf!(bool, "multipleThreadsEnabled"); + } + + void addRunLoop (NSRunLoop runloop) + { + return invokeObjcSelf!(void, "addRunLoop:", NSRunLoop)(runloop); + } + + void removeRunLoop (NSRunLoop runloop) + { + return invokeObjcSelf!(void, "removeRunLoop:", NSRunLoop)(runloop); + } + + void runInNewThread () + { + return invokeObjcSelf!(void, "runInNewThread"); + } + + NSArray remoteObjects () + { + return invokeObjcSelf!(NSArray, "remoteObjects"); + } + + NSArray localObjects () + { + return invokeObjcSelf!(NSArray, "localObjects"); + } +} + +template TNSDistantObjectRequestMethods () +{ + bool connection (NSConnection connection, NSDistantObjectRequest doreq); +} + +template TNSConnectionDelegateMethods () +{ + bool makeNewConnection (NSConnection conn, NSConnection ancestor); + bool connection (NSConnection ancestor, NSConnection conn); + NSData authenticationDataForComponents (NSArray components); + bool authenticateComponents (NSArray components, NSData signature); + Object createConversationForConnection (NSConnection conn); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSConnection_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSConnection_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,28 @@ +module dstep.foundation.NSConnection_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSDistantObject; +import dstep.foundation.NSException; +import dstep.foundation.NSMutableData; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.foundation.NSPortNameServer; +import dstep.foundation.NSRunLoop; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSConnectionReplyMode; + package const id NSConnectionDidDieNotification; + package const id NSFailedAuthenticationException; + package const id NSConnectionDidInitializeNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSData.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSData.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,425 @@ +/** + * 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.NSData; + +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +enum +{ + NSMappedRead = 1, + NSUncachedRead = 2 +} + +enum +{ + NSAtomicWrite = 1 +} + +class NSData : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSDataCreation; + mixin TNSExtendedData; + + NSUInteger length () + { + return invokeObjcSelf!(NSUInteger, "length"); + } + + void* bytes () + { + return invokeObjcSelf!(void*, "bytes"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSMutableData : NSData +{ + mixin ObjcWrap; + mixin TNSMutableDataCreation; + mixin TNSExtendedMutableData; + + void* mutableBytes () + { + return invokeObjcSelf!(void*, "mutableBytes"); + } + + void setLength (NSUInteger length) + { + return invokeObjcSelf!(void, "setLength:", NSUInteger)(length); + } +} + +template TNSDataCreation () +{ + static Object data () + { + return invokeObjcSelfClass!(Object, "data"); + } + + static Object dataWithBytes (void* bytes, NSUInteger length) + { + return invokeObjcSelfClass!(Object, "dataWithBytes:length:", void*, NSUInteger)(bytes, length); + } + + static Object dataWithBytesNoCopy (void* bytes, NSUInteger length) + { + return invokeObjcSelfClass!(Object, "dataWithBytesNoCopy:length:", void*, NSUInteger)(bytes, length); + } + + static Object dataWithBytesNoCopy (void* bytes, NSUInteger length, bool b) + { + return invokeObjcSelfClass!(Object, "dataWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(bytes, length, b); + } + + static Object dataWithContentsOfFile (NSString path, NSUInteger readOptionsMask, NSError** errorPtr) + { + return invokeObjcSelfClass!(Object, "dataWithContentsOfFile:options:error:", NSString, NSUInteger, NSError**)(path, readOptionsMask, errorPtr); + } + + static Object dataWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, NSError** errorPtr) + { + return invokeObjcSelfClass!(Object, "dataWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, readOptionsMask, errorPtr); + } + + static Object dataWithContentsOfFile (NSString path) + { + return invokeObjcSelfClass!(Object, "dataWithContentsOfFile:", NSString)(path); + } + + static Object dataWithContentsOfURL (NSURL url) + { + return invokeObjcSelfClass!(Object, "dataWithContentsOfURL:", NSURL)(url); + } + + static Object dataWithContentsOfMappedFile (NSString path) + { + return invokeObjcSelfClass!(Object, "dataWithContentsOfMappedFile:", NSString)(path); + } + + Object initWithBytes (void* bytes, NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithBytes:length:", void*, NSUInteger)(bytes, length); + } + + this (void* bytes, NSUInteger length) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithBytes:length:", void*, NSUInteger)(objcObject, bytes, length); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithBytesNoCopy (void* bytes, NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithBytesNoCopy:length:", void*, NSUInteger)(bytes, length); + } + + this (void* bytes, NSUInteger length) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithBytesNoCopy:length:", void*, NSUInteger)(objcObject, bytes, length); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithBytesNoCopy (void* bytes, NSUInteger length, bool b) + { + return invokeObjcSelf!(Object, "initWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(bytes, length, b); + } + + this (void* bytes, NSUInteger length, bool b) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithBytesNoCopy:length:freeWhenDone:", void*, NSUInteger, bool)(objcObject, bytes, length, b); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfFile (NSString path, NSUInteger readOptionsMask, NSError** errorPtr) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:options:error:", NSString, NSUInteger, NSError**)(path, readOptionsMask, errorPtr); + } + + this (NSString path, NSUInteger readOptionsMask, NSError** errorPtr) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:options:error:", NSString, NSUInteger, NSError**)(objcObject, path, readOptionsMask, errorPtr); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfURL (NSURL url, NSUInteger readOptionsMask, NSError** errorPtr) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, readOptionsMask, errorPtr); + } + + this (NSURL url, NSUInteger readOptionsMask, NSError** errorPtr) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(objcObject, url, readOptionsMask, errorPtr); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfMappedFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfMappedFile:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfMappedFile:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithData (NSData data) + { + return invokeObjcSelf!(Object, "initWithData:", NSData)(data); + } + + this (NSData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithData:", NSData)(objcObject, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object dataWithData (NSData data) + { + return invokeObjcSelfClass!(Object, "dataWithData:", NSData)(data); + } +} + +template TNSMutableDataCreation () +{ + static Object dataWithCapacity (NSUInteger aNumItems) + { + return invokeObjcSelfClass!(Object, "dataWithCapacity:", NSUInteger)(aNumItems); + } + + static Object dataWithLength (NSUInteger length) + { + return invokeObjcSelfClass!(Object, "dataWithLength:", NSUInteger)(length); + } + + Object initWithCapacity (NSUInteger capacity) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(capacity); + } + + this (NSUInteger capacity) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, capacity); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithLength (NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithLength:", NSUInteger)(length); + } + + this (NSUInteger length) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithLength:", NSUInteger)(objcObject, length); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedMutableData () +{ + void appendBytes (void* bytes, NSUInteger length) + { + return invokeObjcSelf!(void, "appendBytes:length:", void*, NSUInteger)(bytes, length); + } + + void appendData (NSData other) + { + return invokeObjcSelf!(void, "appendData:", NSData)(other); + } + + void increaseLengthBy (NSUInteger extraLength) + { + return invokeObjcSelf!(void, "increaseLengthBy:", NSUInteger)(extraLength); + } + + void replaceBytesInRange (NSRange range, void* bytes) + { + return invokeObjcSelf!(void, "replaceBytesInRange:withBytes:", NSRange, void*)(range, bytes); + } + + void resetBytesInRange (NSRange range) + { + return invokeObjcSelf!(void, "resetBytesInRange:", NSRange)(range); + } + + void setData (NSData data) + { + return invokeObjcSelf!(void, "setData:", NSData)(data); + } + + void replaceBytesInRange (NSRange range, void* replacementBytes, NSUInteger replacementLength) + { + return invokeObjcSelf!(void, "replaceBytesInRange:withBytes:length:", NSRange, void*, NSUInteger)(range, replacementBytes, replacementLength); + } +} + +template TNSExtendedData () +{ + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + void getBytes (void* buffer) + { + return invokeObjcSelf!(void, "getBytes:", void*)(buffer); + } + + void getBytes (void* buffer, NSUInteger length) + { + return invokeObjcSelf!(void, "getBytes:length:", void*, NSUInteger)(buffer, length); + } + + void getBytes (void* buffer, NSRange range) + { + return invokeObjcSelf!(void, "getBytes:range:", void*, NSRange)(buffer, range); + } + + bool isEqualToData (NSData other) + { + return invokeObjcSelf!(bool, "isEqualToData:", NSData)(other); + } + + NSData subdataWithRange (NSRange range) + { + return invokeObjcSelf!(NSData, "subdataWithRange:", NSRange)(range); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + bool writeToFile (NSString path, NSUInteger writeOptionsMask, NSError** errorPtr) + { + return invokeObjcSelf!(bool, "writeToFile:options:error:", NSString, NSUInteger, NSError**)(path, writeOptionsMask, errorPtr); + } + + bool writeToURL (NSURL url, NSUInteger writeOptionsMask, NSError** errorPtr) + { + return invokeObjcSelf!(bool, "writeToURL:options:error:", NSURL, NSUInteger, NSError**)(url, writeOptionsMask, errorPtr); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDate.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDate.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,205 @@ +/** + * 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.NSDate; + +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias double NSTimeInterval; + +class NSDate : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSExtendedDate; + mixin TNSDateCreation; + mixin TNSNaturalLangage; + mixin TNSCalendarDateExtras; + + double timeIntervalSinceReferenceDate () + { + return invokeObjcSelf!(double, "timeIntervalSinceReferenceDate"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedDate () +{ + double timeIntervalSinceDate (NSDate anotherDate) + { + return invokeObjcSelf!(double, "timeIntervalSinceDate:", NSDate)(anotherDate); + } + + double timeIntervalSinceNow () + { + return invokeObjcSelf!(double, "timeIntervalSinceNow"); + } + + double timeIntervalSince1970 () + { + return invokeObjcSelf!(double, "timeIntervalSince1970"); + } + + Object addTimeInterval (double seconds) + { + return invokeObjcSelf!(Object, "addTimeInterval:", double)(seconds); + } + + NSDate earlierDate (NSDate anotherDate) + { + return invokeObjcSelf!(NSDate, "earlierDate:", NSDate)(anotherDate); + } + + NSDate laterDate (NSDate anotherDate) + { + return invokeObjcSelf!(NSDate, "laterDate:", NSDate)(anotherDate); + } + + int compare (NSDate other) + { + return invokeObjcSelf!(int, "compare:", NSDate)(other); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + bool isEqualToDate (NSDate otherDate) + { + return invokeObjcSelf!(bool, "isEqualToDate:", NSDate)(otherDate); + } + + static double timeIntervalSinceReferenceDate () + { + return invokeObjcSelfClass!(double, "timeIntervalSinceReferenceDate"); + } +} + +template TNSDateCreation () +{ + static Object date () + { + return invokeObjcSelfClass!(Object, "date"); + } + + static Object dateWithTimeIntervalSinceNow (double secs) + { + return invokeObjcSelfClass!(Object, "dateWithTimeIntervalSinceNow:", double)(secs); + } + + static Object dateWithTimeIntervalSinceReferenceDate (double secs) + { + return invokeObjcSelfClass!(Object, "dateWithTimeIntervalSinceReferenceDate:", double)(secs); + } + + static Object dateWithTimeIntervalSince1970 (double secs) + { + return invokeObjcSelfClass!(Object, "dateWithTimeIntervalSince1970:", double)(secs); + } + + static Object distantFuture () + { + return invokeObjcSelfClass!(Object, "distantFuture"); + } + + static Object distantPast () + { + return invokeObjcSelfClass!(Object, "distantPast"); + } + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithTimeIntervalSinceReferenceDate (double secsToBeAdded) + { + return invokeObjcSelf!(Object, "initWithTimeIntervalSinceReferenceDate:", double)(secsToBeAdded); + } + + this (double secsToBeAdded) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTimeIntervalSinceReferenceDate:", double)(objcObject, secsToBeAdded); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithTimeInterval (double secsToBeAdded, NSDate anotherDate) + { + return invokeObjcSelf!(Object, "initWithTimeInterval:sinceDate:", double, NSDate)(secsToBeAdded, anotherDate); + } + + this (double secsToBeAdded, NSDate anotherDate) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTimeInterval:sinceDate:", double, NSDate)(objcObject, secsToBeAdded, anotherDate); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithTimeIntervalSinceNow (double secsToBeAddedToNow) + { + return invokeObjcSelf!(Object, "initWithTimeIntervalSinceNow:", double)(secsToBeAddedToNow); + } + + this (double secsToBeAddedToNow) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTimeIntervalSinceNow:", double)(objcObject, secsToBeAddedToNow); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDateFormatter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDateFormatter.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,430 @@ +/** + * 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.NSDateFormatter; + +import dstep.corefoundation.CFDateFormatter; +import dstep.foundation.NSArray; +import dstep.foundation.NSCalendar; +import dstep.foundation.NSDate; +import dstep.foundation.NSError; +import dstep.foundation.NSFormatter; +import dstep.foundation.NSLocale; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSTimeZone; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSDateFormatterStyle; +alias NSUInteger NSDateFormatterBehavior; + +enum +{ + NSDateFormatterNoStyle = kCFDateFormatterNoStyle, + NSDateFormatterShortStyle = kCFDateFormatterShortStyle, + NSDateFormatterMediumStyle = kCFDateFormatterMediumStyle, + NSDateFormatterLongStyle = kCFDateFormatterLongStyle, + NSDateFormatterFullStyle = kCFDateFormatterFullStyle +} + +enum +{ + NSDateFormatterBehaviorDefault = 0, + NSDateFormatterBehavior10_0 = 1000, + NSDateFormatterBehavior10_4 = 1040 +} + +class NSDateFormatter : NSFormatter +{ + mixin ObjcWrap; + mixin TNSDateFormatterCompatibility; + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + bool getObjectValue (id* obj, NSString string, NSRange* rangep, NSError** error) + { + return invokeObjcSelf!(bool, "getObjectValue:forString:range:error:", id*, NSString, NSRange*, NSError**)(obj, string, rangep, error); + } + + NSString stringFromDate (NSDate date) + { + return invokeObjcSelf!(NSString, "stringFromDate:", NSDate)(date); + } + + NSDate dateFromString (NSString string) + { + return invokeObjcSelf!(NSDate, "dateFromString:", NSString)(string); + } + + NSString dateFormat () + { + return invokeObjcSelf!(NSString, "dateFormat"); + } + + uint dateStyle () + { + return invokeObjcSelf!(uint, "dateStyle"); + } + + void setDateStyle (uint style) + { + return invokeObjcSelf!(void, "setDateStyle:", uint)(style); + } + + uint timeStyle () + { + return invokeObjcSelf!(uint, "timeStyle"); + } + + void setTimeStyle (uint style) + { + return invokeObjcSelf!(void, "setTimeStyle:", uint)(style); + } + + NSLocale locale () + { + return invokeObjcSelf!(NSLocale, "locale"); + } + + void setLocale (NSLocale locale) + { + return invokeObjcSelf!(void, "setLocale:", NSLocale)(locale); + } + + bool generatesCalendarDates () + { + return invokeObjcSelf!(bool, "generatesCalendarDates"); + } + + void setGeneratesCalendarDates (bool b) + { + return invokeObjcSelf!(void, "setGeneratesCalendarDates:", bool)(b); + } + + uint formatterBehavior () + { + return invokeObjcSelf!(uint, "formatterBehavior"); + } + + void setFormatterBehavior (uint behavior) + { + return invokeObjcSelf!(void, "setFormatterBehavior:", uint)(behavior); + } + + static uint defaultFormatterBehavior () + { + return invokeObjcSelfClass!(uint, "defaultFormatterBehavior"); + } + + static void setDefaultFormatterBehavior (uint behavior) + { + return invokeObjcSelfClass!(void, "setDefaultFormatterBehavior:", uint)(behavior); + } + + void setDateFormat (NSString string) + { + return invokeObjcSelf!(void, "setDateFormat:", NSString)(string); + } + + NSTimeZone timeZone () + { + return invokeObjcSelf!(NSTimeZone, "timeZone"); + } + + void setTimeZone (NSTimeZone tz) + { + return invokeObjcSelf!(void, "setTimeZone:", NSTimeZone)(tz); + } + + NSCalendar calendar () + { + return invokeObjcSelf!(NSCalendar, "calendar"); + } + + void setCalendar (NSCalendar calendar) + { + return invokeObjcSelf!(void, "setCalendar:", NSCalendar)(calendar); + } + + bool isLenient () + { + return invokeObjcSelf!(bool, "isLenient"); + } + + void setLenient (bool b) + { + return invokeObjcSelf!(void, "setLenient:", bool)(b); + } + + NSDate twoDigitStartDate () + { + return invokeObjcSelf!(NSDate, "twoDigitStartDate"); + } + + void setTwoDigitStartDate (NSDate date) + { + return invokeObjcSelf!(void, "setTwoDigitStartDate:", NSDate)(date); + } + + NSDate defaultDate () + { + return invokeObjcSelf!(NSDate, "defaultDate"); + } + + void setDefaultDate (NSDate date) + { + return invokeObjcSelf!(void, "setDefaultDate:", NSDate)(date); + } + + NSArray eraSymbols () + { + return invokeObjcSelf!(NSArray, "eraSymbols"); + } + + void setEraSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setEraSymbols:", NSArray)(array); + } + + NSArray monthSymbols () + { + return invokeObjcSelf!(NSArray, "monthSymbols"); + } + + void setMonthSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setMonthSymbols:", NSArray)(array); + } + + NSArray shortMonthSymbols () + { + return invokeObjcSelf!(NSArray, "shortMonthSymbols"); + } + + void setShortMonthSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setShortMonthSymbols:", NSArray)(array); + } + + NSArray weekdaySymbols () + { + return invokeObjcSelf!(NSArray, "weekdaySymbols"); + } + + void setWeekdaySymbols (NSArray array) + { + return invokeObjcSelf!(void, "setWeekdaySymbols:", NSArray)(array); + } + + NSArray shortWeekdaySymbols () + { + return invokeObjcSelf!(NSArray, "shortWeekdaySymbols"); + } + + void setShortWeekdaySymbols (NSArray array) + { + return invokeObjcSelf!(void, "setShortWeekdaySymbols:", NSArray)(array); + } + + NSString AMSymbol () + { + return invokeObjcSelf!(NSString, "AMSymbol"); + } + + void setAMSymbol (NSString string) + { + return invokeObjcSelf!(void, "setAMSymbol:", NSString)(string); + } + + NSString PMSymbol () + { + return invokeObjcSelf!(NSString, "PMSymbol"); + } + + void setPMSymbol (NSString string) + { + return invokeObjcSelf!(void, "setPMSymbol:", NSString)(string); + } + + NSArray longEraSymbols () + { + return invokeObjcSelf!(NSArray, "longEraSymbols"); + } + + void setLongEraSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setLongEraSymbols:", NSArray)(array); + } + + NSArray veryShortMonthSymbols () + { + return invokeObjcSelf!(NSArray, "veryShortMonthSymbols"); + } + + void setVeryShortMonthSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setVeryShortMonthSymbols:", NSArray)(array); + } + + NSArray standaloneMonthSymbols () + { + return invokeObjcSelf!(NSArray, "standaloneMonthSymbols"); + } + + void setStandaloneMonthSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setStandaloneMonthSymbols:", NSArray)(array); + } + + NSArray shortStandaloneMonthSymbols () + { + return invokeObjcSelf!(NSArray, "shortStandaloneMonthSymbols"); + } + + void setShortStandaloneMonthSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setShortStandaloneMonthSymbols:", NSArray)(array); + } + + NSArray veryShortStandaloneMonthSymbols () + { + return invokeObjcSelf!(NSArray, "veryShortStandaloneMonthSymbols"); + } + + void setVeryShortStandaloneMonthSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setVeryShortStandaloneMonthSymbols:", NSArray)(array); + } + + NSArray veryShortWeekdaySymbols () + { + return invokeObjcSelf!(NSArray, "veryShortWeekdaySymbols"); + } + + void setVeryShortWeekdaySymbols (NSArray array) + { + return invokeObjcSelf!(void, "setVeryShortWeekdaySymbols:", NSArray)(array); + } + + NSArray standaloneWeekdaySymbols () + { + return invokeObjcSelf!(NSArray, "standaloneWeekdaySymbols"); + } + + void setStandaloneWeekdaySymbols (NSArray array) + { + return invokeObjcSelf!(void, "setStandaloneWeekdaySymbols:", NSArray)(array); + } + + NSArray shortStandaloneWeekdaySymbols () + { + return invokeObjcSelf!(NSArray, "shortStandaloneWeekdaySymbols"); + } + + void setShortStandaloneWeekdaySymbols (NSArray array) + { + return invokeObjcSelf!(void, "setShortStandaloneWeekdaySymbols:", NSArray)(array); + } + + NSArray veryShortStandaloneWeekdaySymbols () + { + return invokeObjcSelf!(NSArray, "veryShortStandaloneWeekdaySymbols"); + } + + void setVeryShortStandaloneWeekdaySymbols (NSArray array) + { + return invokeObjcSelf!(void, "setVeryShortStandaloneWeekdaySymbols:", NSArray)(array); + } + + NSArray quarterSymbols () + { + return invokeObjcSelf!(NSArray, "quarterSymbols"); + } + + void setQuarterSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setQuarterSymbols:", NSArray)(array); + } + + NSArray shortQuarterSymbols () + { + return invokeObjcSelf!(NSArray, "shortQuarterSymbols"); + } + + void setShortQuarterSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setShortQuarterSymbols:", NSArray)(array); + } + + NSArray standaloneQuarterSymbols () + { + return invokeObjcSelf!(NSArray, "standaloneQuarterSymbols"); + } + + void setStandaloneQuarterSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setStandaloneQuarterSymbols:", NSArray)(array); + } + + NSArray shortStandaloneQuarterSymbols () + { + return invokeObjcSelf!(NSArray, "shortStandaloneQuarterSymbols"); + } + + void setShortStandaloneQuarterSymbols (NSArray array) + { + return invokeObjcSelf!(void, "setShortStandaloneQuarterSymbols:", NSArray)(array); + } + + NSDate gregorianStartDate () + { + return invokeObjcSelf!(NSDate, "gregorianStartDate"); + } + + void setGregorianStartDate (NSDate date) + { + return invokeObjcSelf!(void, "setGregorianStartDate:", NSDate)(date); + } +} + +template TNSDateFormatterCompatibility () +{ + Object initWithDateFormat (NSString format, bool flag) + { + return invokeObjcSelf!(Object, "initWithDateFormat:allowNaturalLanguage:", NSString, bool)(format, flag); + } + + this (NSString format, bool flag) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDateFormat:allowNaturalLanguage:", NSString, bool)(objcObject, format, flag); + + if (result) + objcObject = ret; + + dObject = this; + } + + bool allowsNaturalLanguage () + { + return invokeObjcSelf!(bool, "allowsNaturalLanguage"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDebug.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDebug.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,106 @@ +/** + * 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.NSDebug; + +import dstep.foundation.NSAutoreleasePool; +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSDebug_bindings; + +extern (C) +{ + extern + { + bool NSDebugEnabled; + bool NSZombieEnabled; + bool NSDeallocateZombies; + bool NSHangOnUncaughtException; + bool NSKeepAllocationStatistics; + } +} + +template TNSAutoreleasePoolDebugging () +{ + static void enableRelease (bool enable) + { + return invokeObjcSelfClass!(void, "enableRelease:", bool)(enable); + } + + static void showPools () + { + return invokeObjcSelfClass!(void, "showPools"); + } + + static void resetTotalAutoreleasedObjects () + { + return invokeObjcSelfClass!(void, "resetTotalAutoreleasedObjects"); + } + + static NSUInteger totalAutoreleasedObjects () + { + return invokeObjcSelfClass!(NSUInteger, "totalAutoreleasedObjects"); + } + + static void enableFreedObjectCheck (bool enable) + { + return invokeObjcSelfClass!(void, "enableFreedObjectCheck:", bool)(enable); + } + + static NSUInteger autoreleasedObjectCount () + { + return invokeObjcSelfClass!(NSUInteger, "autoreleasedObjectCount"); + } + + static NSUInteger topAutoreleasePoolCount () + { + return invokeObjcSelfClass!(NSUInteger, "topAutoreleasePoolCount"); + } + + static NSUInteger poolCountHighWaterMark () + { + return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterMark"); + } + + static void setPoolCountHighWaterMark (NSUInteger count) + { + return invokeObjcSelfClass!(void, "setPoolCountHighWaterMark:", NSUInteger)(count); + } + + static NSUInteger poolCountHighWaterResolution () + { + return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterResolution"); + } + + static void setPoolCountHighWaterResolution (NSUInteger res) + { + return invokeObjcSelfClass!(void, "setPoolCountHighWaterResolution:", NSUInteger)(res); + } +} + +bool NSIsFreedObject (Object anObject) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSIsFreedObject, Object)(anObject); +} + +void NSRecordAllocationEvent (int eventType, Object object) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSRecordAllocationEvent, int, Object)(eventType, object); +} + +extern (C) +{ + void* NSFrameAddress (NSUInteger frame); + void* NSReturnAddress (NSUInteger frame); + NSUInteger NSCountFrames (); + void _NSAutoreleaseNoPool (void* object); + void _NSAutoreleaseFreedObject (void* freedObject); + void _NSAutoreleaseHighWaterLog (NSUInteger count); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDebug_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDebug_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,22 @@ +module dstep.foundation.NSDebug_bindings; + +import dstep.foundation.NSAutoreleasePool; +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + } +} + +extern (C) +{ + private bool NSIsFreedObject (id anObject); + private void NSRecordAllocationEvent (int eventType, id object); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDecimal.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDecimal.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,63 @@ +/** + * 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.NSDecimal; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObjCRuntime; +import dstep.limits; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSRoundingMode; +alias NSUInteger NSCalculationError; + +enum +{ + NSRoundPlain, + NSRoundDown, + NSRoundUp, + NSRoundBankers +} + +enum +{ + NSCalculationNoError = 0, + NSCalculationLossOfPrecision, + NSCalculationUnderflow, + NSCalculationOverflow, + NSCalculationDivideByZero +} + +struct NSDecimal +{ + int _exponent; + uint _length; + uint _isNegative; + uint _isCompact; + uint _reserved; + unsigned short* _mantissa; +} + +NSString NSDecimalString (NSDecimal* dcm, Object locale) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSDecimalString, NSDecimal*, Object)(dcm, locale); +} + +extern (C) +{ + void NSDecimalCopy (NSDecimal* destination, NSDecimal* source); + void NSDecimalCompact (NSDecimal* number); + int NSDecimalCompare (NSDecimal* leftOperand, NSDecimal* rightOperand); + void NSDecimalRound (NSDecimal* result, NSDecimal* number, NSInteger scale, uint roundingMode); + uint NSDecimalNormalize (NSDecimal* number1, NSDecimal* number2, uint roundingMode); + uint NSDecimalAdd (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); + uint NSDecimalSubtract (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); + uint NSDecimalMultiply (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); + uint NSDecimalDivide (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); + uint NSDecimalPower (NSDecimal* result, NSDecimal* number, NSUInteger power, uint roundingMode); + uint NSDecimalMultiplyByPowerOf10 (NSDecimal* result, NSDecimal* number, short power, uint roundingMode); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDecimalNumber.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDecimalNumber.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,312 @@ +/** + * 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.NSDecimalNumber; + +import dstep.foundation.NSDecimal; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSScanner; +import dstep.foundation.NSValue; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSDecimalNumber_bindings; + +const NSString NSDecimalNumberExactnessException; +const NSString NSDecimalNumberOverflowException; +const NSString NSDecimalNumberUnderflowException; +const NSString NSDecimalNumberDivideByZeroException; + +static this () +{ + NSDecimalNumberExactnessException = new NSString(bindings.NSDecimalNumberExactnessException); + NSDecimalNumberOverflowException = new NSString(bindings.NSDecimalNumberOverflowException); + NSDecimalNumberUnderflowException = new NSString(bindings.NSDecimalNumberUnderflowException); + NSDecimalNumberDivideByZeroException = new NSString(bindings.NSDecimalNumberDivideByZeroException); +} + +class NSDecimalNumber : NSNumber +{ + mixin ObjcWrap; + + Object initWithMantissa (ulong mantissa, short exponent, bool flag) + { + return invokeObjcSelf!(Object, "initWithMantissa:exponent:isNegative:", ulong, short, bool)(mantissa, exponent, flag); + } + + this (ulong mantissa, short exponent, bool flag) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithMantissa:exponent:isNegative:", ulong, short, bool)(objcObject, mantissa, exponent, flag); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithDecimal (NSDecimal dcm) + { + return invokeObjcSelf!(Object, "initWithDecimal:", NSDecimal)(dcm); + } + + this (NSDecimal dcm) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDecimal:", NSDecimal)(objcObject, dcm); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString numberValue) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(numberValue); + } + + this (NSString numberValue) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, numberValue); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString numberValue, Object locale) + { + return invokeObjcSelf!(Object, "initWithString:locale:", NSString, Object)(numberValue, locale); + } + + this (NSString numberValue, Object locale) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:locale:", NSString, Object)(objcObject, numberValue, locale); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSDecimal decimalValue () + { + return invokeObjcSelf!(NSDecimal, "decimalValue"); + } + + static NSDecimalNumber decimalNumberWithMantissa (ulong mantissa, short exponent, bool flag) + { + return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithMantissa:exponent:isNegative:", ulong, short, bool)(mantissa, exponent, flagreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber decimalNumberWithDecimal (NSDecimal dcm) + { + return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithDecimal:", NSDecimal)(dcmreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber decimalNumberWithString (NSString numberValue) + { + return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithString:", NSString)(numberValuereturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber decimalNumberWithString (NSString numberValue, Object locale) + { + return invokeObjcSelfClass!(NSDecimalNumber, "decimalNumberWithString:locale:", NSString, Object)(numberValue, localereturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber zero () + { + return invokeObjcSelfClass!(NSDecimalNumber, "zero"return result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber one () + { + return invokeObjcSelfClass!(NSDecimalNumber, "one"return result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber minimumDecimalNumber () + { + return invokeObjcSelfClass!(NSDecimalNumber, "minimumDecimalNumber"return result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber maximumDecimalNumber () + { + return invokeObjcSelfClass!(NSDecimalNumber, "maximumDecimalNumber"return result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + static NSDecimalNumber notANumber () + { + return invokeObjcSelfClass!(NSDecimalNumber, "notANumber"return result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByAdding (NSDecimalNumber decimalNumber) + { + id result = invokeObjcSelf!(id, "decimalNumberByAdding:", NSDecimalNumber)(decimalNumberreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByAdding (NSDecimalNumber decimalNumber, INSDecimalNumberBehaviors behavior) + { + id result = invokeObjcSelf!(id, "decimalNumberByAdding:withBehavior:", NSDecimalNumber, INSDecimalNumberBehaviors)(decimalNumber, behaviorreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberBySubtracting (NSDecimalNumber decimalNumber) + { + id result = invokeObjcSelf!(id, "decimalNumberBySubtracting:", NSDecimalNumber)(decimalNumberreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberBySubtracting (NSDecimalNumber decimalNumber, INSDecimalNumberBehaviors behavior) + { + id result = invokeObjcSelf!(id, "decimalNumberBySubtracting:withBehavior:", NSDecimalNumber, INSDecimalNumberBehaviors)(decimalNumber, behaviorreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByMultiplyingBy (NSDecimalNumber decimalNumber) + { + id result = invokeObjcSelf!(id, "decimalNumberByMultiplyingBy:", NSDecimalNumber)(decimalNumberreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByMultiplyingBy (NSDecimalNumber decimalNumber, INSDecimalNumberBehaviors behavior) + { + id result = invokeObjcSelf!(id, "decimalNumberByMultiplyingBy:withBehavior:", NSDecimalNumber, INSDecimalNumberBehaviors)(decimalNumber, behaviorreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByDividingBy (NSDecimalNumber decimalNumber) + { + id result = invokeObjcSelf!(id, "decimalNumberByDividingBy:", NSDecimalNumber)(decimalNumberreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByDividingBy (NSDecimalNumber decimalNumber, INSDecimalNumberBehaviors behavior) + { + id result = invokeObjcSelf!(id, "decimalNumberByDividingBy:withBehavior:", NSDecimalNumber, INSDecimalNumberBehaviors)(decimalNumber, behaviorreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByRaisingToPower (NSUInteger power) + { + id result = invokeObjcSelf!(id, "decimalNumberByRaisingToPower:", NSUInteger)(powerreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByRaisingToPower (NSUInteger power, INSDecimalNumberBehaviors behavior) + { + id result = invokeObjcSelf!(id, "decimalNumberByRaisingToPower:withBehavior:", NSUInteger, INSDecimalNumberBehaviors)(power, behaviorreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByMultiplyingByPowerOf10 (short power) + { + id result = invokeObjcSelf!(id, "decimalNumberByMultiplyingByPowerOf10:", short)(powerreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByMultiplyingByPowerOf10 (short power, INSDecimalNumberBehaviors behavior) + { + id result = invokeObjcSelf!(id, "decimalNumberByMultiplyingByPowerOf10:withBehavior:", short, INSDecimalNumberBehaviors)(power, behaviorreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + NSDecimalNumber decimalNumberByRoundingAccordingToBehavior (INSDecimalNumberBehaviors behavior) + { + id result = invokeObjcSelf!(id, "decimalNumberByRoundingAccordingToBehavior:", INSDecimalNumberBehaviors)(behaviorreturn result is this.objcObject ? this : (result !is null ? new NSDecimalNumber(result) : null); } + + int compare (NSNumber decimalNumber) + { + return invokeObjcSelf!(int, "compare:", NSNumber)(decimalNumber); + } + + static void setDefaultBehavior (INSDecimalNumberBehaviors behavior) + { + return invokeObjcSelfClass!(void, "setDefaultBehavior:", INSDecimalNumberBehaviors)(behavior); + } + + static INSDecimalNumberBehaviors defaultBehavior () + { + return invokeObjcSelfClass!(INSDecimalNumberBehaviors, "defaultBehavior"); + } + + char* objCType () + { + return invokeObjcSelf!(char*, "objCType"); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } +} + +class NSDecimalNumberHandler : NSObject, INSDecimalNumberBehaviors, INSCoding +{ + mixin ObjcWrap; + + static Object defaultDecimalNumberHandler () + { + return invokeObjcSelfClass!(Object, "defaultDecimalNumberHandler"); + } + + Object initWithRoundingMode (uint roundingMode, short scale, bool exact, bool overflow, bool underflow, bool divideByZero) + { + return invokeObjcSelf!(Object, "initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", uint, short, bool, bool, bool, bool)(roundingMode, scale, exact, overflow, underflow, divideByZero); + } + + this (uint roundingMode, short scale, bool exact, bool overflow, bool underflow, bool divideByZero) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", uint, short, bool, bool, bool, bool)(objcObject, roundingMode, scale, exact, overflow, underflow, divideByZero); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object decimalNumberHandlerWithRoundingMode (uint roundingMode, short scale, bool exact, bool overflow, bool underflow, bool divideByZero) + { + return invokeObjcSelfClass!(Object, "decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:", uint, short, bool, bool, bool, bool)(roundingMode, scale, exact, overflow, underflow, divideByZero); + } + + uint roundingMode () + { + return invokeObjcSelf!(uint, "roundingMode"); + } + + short scale () + { + return invokeObjcSelf!(short, "scale"); + } + + NSDecimalNumber exceptionDuringOperation (SEL operation, uint error, NSDecimalNumber leftOperand, NSDecimalNumber rightOperand) + { + return invokeObjcSelf!(NSDecimalNumber, "exceptionDuringOperation:error:leftOperand:rightOperand:", SEL, uint, NSDecimalNumber, NSDecimalNumber)(operation, error, leftOperand, rightOperand); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +interface INSDecimalNumberBehaviors +{ + uint roundingMode (); + short scale (); + NSDecimalNumber exceptionDuringOperation (SEL operation, uint error, NSDecimalNumber leftOperand, NSDecimalNumber rightOperand); +} + +template TNSDecimalNumberExtensions () +{ + NSDecimal decimalValue () + { + return invokeObjcSelf!(NSDecimal, "decimalValue"); + } +} + +template TNSDecimalNumberScanning () +{ + bool scanDecimal (NSDecimal* dcm) + { + return invokeObjcSelf!(bool, "scanDecimal:", NSDecimal*)(dcm); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDecimalNumber_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDecimalNumber_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSDecimalNumber_bindings; + +import dstep.foundation.NSDecimal; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSScanner; +import dstep.foundation.NSValue; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSDecimalNumberExactnessException; + package const id NSDecimalNumberOverflowException; + package const id NSDecimalNumberUnderflowException; + package const id NSDecimalNumberDivideByZeroException; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDictionary.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDictionary.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,367 @@ +/** + * 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.NSDictionary; + +import dstep.foundation.NSArray; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSMutableDictionary : NSDictionary +{ + mixin ObjcWrap; + mixin TNSMutableDictionaryCreation; + mixin TNSExtendedMutableDictionary; + + void removeObjectForKey (Object aKey) + { + return invokeObjcSelf!(void, "removeObjectForKey:", Object)(aKey); + } + + void setObject (Object anObject, Object aKey) + { + return invokeObjcSelf!(void, "setObject:forKey:", Object, Object)(anObject, aKey); + } +} + +class NSDictionary : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration +{ + mixin ObjcWrap; + mixin TNSDictionaryCreation; + mixin TNSFileAttributes; + mixin TNSExtendedDictionary; + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + Object objectForKey (Object aKey) + { + return invokeObjcSelf!(Object, "objectForKey:", Object)(aKey); + } + + NSEnumerator keyEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "keyEnumerator"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } +} + +template TNSDictionaryCreation () +{ + static Object dictionary () + { + return invokeObjcSelfClass!(Object, "dictionary"); + } + + static Object dictionaryWithObject (Object object, Object key) + { + return invokeObjcSelfClass!(Object, "dictionaryWithObject:forKey:", Object, Object)(object, key); + } + + static Object dictionaryWithObjects (id* objects, id* keys, NSUInteger cnt) + { + return invokeObjcSelfClass!(Object, "dictionaryWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt); + } + + static Object dictionaryWithObjectsAndKeys (Object dictionaryWithObjectsAndKeys, ...) + { + return invokeObjcSelfClass!(Object, "dictionaryWithObjectsAndKeys:", Object)(dictionaryWithObjectsAndKeys); + } + + static Object dictionaryWithDictionary (NSDictionary dict) + { + return invokeObjcSelfClass!(Object, "dictionaryWithDictionary:", NSDictionary)(dict); + } + + static Object dictionaryWithObjects (NSArray objects, NSArray keys) + { + return invokeObjcSelfClass!(Object, "dictionaryWithObjects:forKeys:", NSArray, NSArray)(objects, keys); + } + + Object initWithObjects (id* objects, id* keys, NSUInteger cnt) + { + return invokeObjcSelf!(Object, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt); + } + + this (id* objects, id* keys, NSUInteger cnt) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objcObject, objects, keys, cnt); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithObjectsAndKeys (Object initWithObjectsAndKeys, ...) + { + return invokeObjcSelf!(Object, "initWithObjectsAndKeys:", Object)(initWithObjectsAndKeys); + } + + this (Object initWithObjectsAndKeys, ...) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjectsAndKeys:", Object)(objcObject, initWithObjectsAndKeys); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(Object, "initWithDictionary:", NSDictionary)(otherDictionary); + } + + this (NSDictionary otherDictionary) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDictionary:", NSDictionary)(objcObject, otherDictionary); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithDictionary (NSDictionary otherDictionary, bool flag) + { + return invokeObjcSelf!(Object, "initWithDictionary:copyItems:", NSDictionary, bool)(otherDictionary, flag); + } + + this (NSDictionary otherDictionary, bool flag) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDictionary:copyItems:", NSDictionary, bool)(objcObject, otherDictionary, flag); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithObjects (NSArray objects, NSArray keys) + { + return invokeObjcSelf!(Object, "initWithObjects:forKeys:", NSArray, NSArray)(objects, keys); + } + + this (NSArray objects, NSArray keys) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjects:forKeys:", NSArray, NSArray)(objcObject, objects, keys); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object dictionaryWithContentsOfFile (NSString path) + { + return invokeObjcSelfClass!(Object, "dictionaryWithContentsOfFile:", NSString)(path); + } + + static Object dictionaryWithContentsOfURL (NSURL url) + { + return invokeObjcSelfClass!(Object, "dictionaryWithContentsOfURL:", NSURL)(url); + } + + Object initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSMutableDictionaryCreation () +{ + static Object dictionaryWithCapacity (NSUInteger numItems) + { + return invokeObjcSelfClass!(Object, "dictionaryWithCapacity:", NSUInteger)(numItems); + } + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedMutableDictionary () +{ + void addEntriesFromDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(void, "addEntriesFromDictionary:", NSDictionary)(otherDictionary); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + void removeObjectsForKeys (NSArray keyArray) + { + return invokeObjcSelf!(void, "removeObjectsForKeys:", NSArray)(keyArray); + } + + void setDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(void, "setDictionary:", NSDictionary)(otherDictionary); + } +} + +template TNSExtendedDictionary () +{ + NSArray allKeys () + { + return invokeObjcSelf!(NSArray, "allKeys"); + } + + NSArray allKeysForObject (Object anObject) + { + return invokeObjcSelf!(NSArray, "allKeysForObject:", Object)(anObject); + } + + NSArray allValues () + { + return invokeObjcSelf!(NSArray, "allValues"); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString descriptionInStringsFileFormat () + { + return invokeObjcSelf!(NSString, "descriptionInStringsFileFormat"); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + NSString descriptionWithLocale (Object locale, NSUInteger level) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level); + } + + bool isEqualToDictionary (NSDictionary otherDictionary) + { + return invokeObjcSelf!(bool, "isEqualToDictionary:", NSDictionary)(otherDictionary); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + NSArray objectsForKeys (NSArray keys, Object marker) + { + return invokeObjcSelf!(NSArray, "objectsForKeys:notFoundMarker:", NSArray, Object)(keys, marker); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + NSArray keysSortedByValueUsingSelector (SEL comparator) + { + return invokeObjcSelf!(NSArray, "keysSortedByValueUsingSelector:", SEL)(comparator); + } + + void getObjects (id* objects, id* keys) + { + return invokeObjcSelf!(void, "getObjects:andKeys:", id*, id*)(objects, keys); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDistantObject.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDistantObject.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,91 @@ +/** + * 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.NSDistantObject; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSConnection; +import dstep.foundation.NSProxy; +import dstep.foundation.Protocol; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSDistantObject : NSProxy, INSCoding +{ + mixin ObjcWrap; + + static NSDistantObject proxyWithTarget (Object target, NSConnection connection) + { + return invokeObjcSelfClass!(NSDistantObject, "proxyWithTarget:connection:", Object, NSConnection)(target, connectionreturn result is this.objcObject ? this : (result !is null ? new NSDistantObject(result) : null); } + + Object initWithTarget (Object target, NSConnection connection) + { + return invokeObjcSelf!(Object, "initWithTarget:connection:", Object, NSConnection)(target, connection); + } + + this (Object target, NSConnection connection) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTarget:connection:", Object, NSConnection)(objcObject, target, connection); + + if (result) + objcObject = ret; + + dObject = this; + } + + static NSDistantObject proxyWithLocal (Object target, NSConnection connection) + { + return invokeObjcSelfClass!(NSDistantObject, "proxyWithLocal:connection:", Object, NSConnection)(target, connectionreturn result is this.objcObject ? this : (result !is null ? new NSDistantObject(result) : null); } + + Object initWithLocal (Object target, NSConnection connection) + { + return invokeObjcSelf!(Object, "initWithLocal:connection:", Object, NSConnection)(target, connection); + } + + this (Object target, NSConnection connection) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithLocal:connection:", Object, NSConnection)(objcObject, target, connection); + + if (result) + objcObject = ret; + + dObject = this; + } + + void setProtocolForProxy (Protocol proto) + { + return invokeObjcSelf!(void, "setProtocolForProxy:", Protocol)(proto); + } + + NSConnection connectionForProxy () + { + return invokeObjcSelf!(NSConnection, "connectionForProxy"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDistributedLock.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDistributedLock.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,58 @@ +/** + * 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.NSDistributedLock; + +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSDistributedLock : NSObject +{ + mixin ObjcWrap; + + static NSDistributedLock lockWithPath (NSString path) + { + return invokeObjcSelfClass!(NSDistributedLock, "lockWithPath:", NSString)(pathreturn result is this.objcObject ? this : (result !is null ? new NSDistributedLock(result) : null); } + + Object initWithPath (NSString path) + { + return invokeObjcSelf!(Object, "initWithPath:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithPath:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + bool tryLock () + { + return invokeObjcSelf!(bool, "tryLock"); + } + + void unlock () + { + return invokeObjcSelf!(void, "unlock"); + } + + void breakLock () + { + return invokeObjcSelf!(void, "breakLock"); + } + + NSDate lockDate () + { + return invokeObjcSelf!(NSDate, "lockDate"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDistributedNotificationCenter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDistributedNotificationCenter.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,98 @@ +/** + * 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.NSDistributedNotificationCenter; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSNotification; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSDistributedNotificationCenter_bindings; + +alias NSUInteger NSNotificationSuspensionBehavior; + +const NSString NSLocalNotificationCenterType; + +enum +{ + NSNotificationSuspensionBehaviorDrop = 1, + NSNotificationSuspensionBehaviorCoalesce = 2, + NSNotificationSuspensionBehaviorHold = 3, + NSNotificationSuspensionBehaviorDeliverImmediately = 4 +} + +enum +{ + NSNotificationDeliverImmediately = (1 << 0), + NSNotificationPostToAllSessions = (1 << 1) +} + +static this () +{ + NSLocalNotificationCenterType = new NSString(bindings.NSLocalNotificationCenterType); +} + +class NSDistributedNotificationCenter : NSNotificationCenter +{ + mixin ObjcWrap; + + static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType) + { + return invokeObjcSelfClass!(NSDistributedNotificationCenter, "notificationCenterForType:", NSString)(notificationCenterTypereturn result is this.objcObject ? this : (result !is null ? new NSDistributedNotificationCenter(result) : null); } + + static Object defaultCenter () + { + return invokeObjcSelfClass!(Object, "defaultCenter"); + } + + void addObserver (Object observer, SEL selector, NSString name, NSString object, uint suspensionBehavior) + { + return invokeObjcSelf!(void, "addObserver:selector:name:object:suspensionBehavior:", Object, SEL, NSString, NSString, uint)(observer, selector, name, object, suspensionBehavior); + } + + void postNotificationName (NSString name, NSString object, NSDictionary userInfo, bool deliverImmediately) + { + return invokeObjcSelf!(void, "postNotificationName:object:userInfo:deliverImmediately:", NSString, NSString, NSDictionary, bool)(name, object, userInfo, deliverImmediately); + } + + void postNotificationName (NSString name, NSString object, NSDictionary userInfo, NSUInteger options) + { + return invokeObjcSelf!(void, "postNotificationName:object:userInfo:options:", NSString, NSString, NSDictionary, NSUInteger)(name, object, userInfo, options); + } + + void setSuspended (bool suspended) + { + return invokeObjcSelf!(void, "setSuspended:", bool)(suspended); + } + + bool suspended () + { + return invokeObjcSelf!(bool, "suspended"); + } + + void addObserver (Object observer, SEL aSelector, NSString aName, NSString anObject) + { + return invokeObjcSelf!(void, "addObserver:selector:name:object:", Object, SEL, NSString, NSString)(observer, aSelector, aName, anObject); + } + + void postNotificationName (NSString aName, NSString anObject) + { + return invokeObjcSelf!(void, "postNotificationName:object:", NSString, NSString)(aName, anObject); + } + + void postNotificationName (NSString aName, NSString anObject, NSDictionary aUserInfo) + { + return invokeObjcSelf!(void, "postNotificationName:object:userInfo:", NSString, NSString, NSDictionary)(aName, anObject, aUserInfo); + } + + void removeObserver (Object observer, NSString aName, NSString anObject) + { + return invokeObjcSelf!(void, "removeObserver:name:object:", Object, NSString, NSString)(observer, aName, anObject); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSDistributedNotificationCenter_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSDistributedNotificationCenter_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,17 @@ +module dstep.foundation.NSDistributedNotificationCenter_bindings; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSNotification; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSLocalNotificationCenterType; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSEnumerator.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSEnumerator.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,50 @@ +/** + * 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.NSEnumerator; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +struct NSFastEnumerationState +{ + uint state; + id* itemsPtr; + unsigned long* mutationsPtr; + unsigned long* extra; +} + +class NSEnumerator : NSObject, INSFastEnumeration +{ + mixin ObjcWrap; + mixin TNSExtendedEnumerator; + + Object nextObject () + { + return invokeObjcSelf!(Object, "nextObject"); + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } +} + +interface INSFastEnumeration +{ + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len); +} + +template TNSExtendedEnumerator () +{ + NSArray allObjects () + { + return invokeObjcSelf!(NSArray, "allObjects"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSError.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSError.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,145 @@ +/** + * 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.NSError; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSError_bindings; + +const NSString NSCocoaErrorDomain; +const NSString NSPOSIXErrorDomain; +const NSString NSOSStatusErrorDomain; +const NSString NSMachErrorDomain; +const NSString NSUnderlyingErrorKey; +const NSString NSLocalizedDescriptionKey; +const NSString NSLocalizedFailureReasonErrorKey; +const NSString NSLocalizedRecoverySuggestionErrorKey; +const NSString NSLocalizedRecoveryOptionsErrorKey; +const NSString NSRecoveryAttempterErrorKey; +const NSString NSStringEncodingErrorKey; +const NSString NSURLErrorKey; +const NSString NSFilePathErrorKey; + +static this () +{ + NSCocoaErrorDomain = new NSString(bindings.NSCocoaErrorDomain); + NSPOSIXErrorDomain = new NSString(bindings.NSPOSIXErrorDomain); + NSOSStatusErrorDomain = new NSString(bindings.NSOSStatusErrorDomain); + NSMachErrorDomain = new NSString(bindings.NSMachErrorDomain); + NSUnderlyingErrorKey = new NSString(bindings.NSUnderlyingErrorKey); + NSLocalizedDescriptionKey = new NSString(bindings.NSLocalizedDescriptionKey); + NSLocalizedFailureReasonErrorKey = new NSString(bindings.NSLocalizedFailureReasonErrorKey); + NSLocalizedRecoverySuggestionErrorKey = new NSString(bindings.NSLocalizedRecoverySuggestionErrorKey); + NSLocalizedRecoveryOptionsErrorKey = new NSString(bindings.NSLocalizedRecoveryOptionsErrorKey); + NSRecoveryAttempterErrorKey = new NSString(bindings.NSRecoveryAttempterErrorKey); + NSStringEncodingErrorKey = new NSString(bindings.NSStringEncodingErrorKey); + NSURLErrorKey = new NSString(bindings.NSURLErrorKey); + NSFilePathErrorKey = new NSString(bindings.NSFilePathErrorKey); +} + +class NSError : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + Object initWithDomain (NSString domain, NSInteger code, NSDictionary dict) + { + return invokeObjcSelf!(Object, "initWithDomain:code:userInfo:", NSString, NSInteger, NSDictionary)(domain, code, dict); + } + + this (NSString domain, NSInteger code, NSDictionary dict) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDomain:code:userInfo:", NSString, NSInteger, NSDictionary)(objcObject, domain, code, dict); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object errorWithDomain (NSString domain, NSInteger code, NSDictionary dict) + { + return invokeObjcSelfClass!(Object, "errorWithDomain:code:userInfo:", NSString, NSInteger, NSDictionary)(domain, code, dict); + } + + NSString domain () + { + return invokeObjcSelf!(NSString, "domain"); + } + + NSInteger code () + { + return invokeObjcSelf!(NSInteger, "code"); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + NSString localizedDescription () + { + return invokeObjcSelf!(NSString, "localizedDescription"); + } + + NSString localizedFailureReason () + { + return invokeObjcSelf!(NSString, "localizedFailureReason"); + } + + NSString localizedRecoverySuggestion () + { + return invokeObjcSelf!(NSString, "localizedRecoverySuggestion"); + } + + NSArray localizedRecoveryOptions () + { + return invokeObjcSelf!(NSArray, "localizedRecoveryOptions"); + } + + Object recoveryAttempter () + { + return invokeObjcSelf!(Object, "recoveryAttempter"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSErrorRecoveryAttempting () +{ + void attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex, Object delegate_, SEL didRecoverSelector, void* contextInfo); + bool attemptRecoveryFromError (NSError error, NSUInteger recoveryOptionIndex); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSError_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSError_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,29 @@ +module dstep.foundation.NSError_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSCocoaErrorDomain; + package const id NSPOSIXErrorDomain; + package const id NSOSStatusErrorDomain; + package const id NSMachErrorDomain; + package const id NSUnderlyingErrorKey; + package const id NSLocalizedDescriptionKey; + package const id NSLocalizedFailureReasonErrorKey; + package const id NSLocalizedRecoverySuggestionErrorKey; + package const id NSLocalizedRecoveryOptionsErrorKey; + package const id NSRecoveryAttempterErrorKey; + package const id NSStringEncodingErrorKey; + package const id NSURLErrorKey; + package const id NSFilePathErrorKey; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSException.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSException.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,172 @@ +/** + * 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.NSException; + +import dstep.foundation.NSArray; +import dstep.foundation.NSAssertionHandler; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.setjmp; +import dstep.stdarg; + +import bindings = dstep.foundation.NSException_bindings; + +extern (C) +{ + alias void function (id) NSUncaughtExceptionHandler *; +} + +const NSString NSGenericException; +const NSString NSRangeException; +const NSString NSInvalidArgumentException; +const NSString NSInternalInconsistencyException; +const NSString NSMallocException; +const NSString NSObjectInaccessibleException; +const NSString NSObjectNotAvailableException; +const NSString NSDestinationInvalidException; +const NSString NSPortTimeoutException; +const NSString NSInvalidSendPortException; +const NSString NSInvalidReceivePortException; +const NSString NSPortSendException; +const NSString NSPortReceiveException; +const NSString NSOldStyleException; + +static this () +{ + NSGenericException = new NSString(bindings.NSGenericException); + NSRangeException = new NSString(bindings.NSRangeException); + NSInvalidArgumentException = new NSString(bindings.NSInvalidArgumentException); + NSInternalInconsistencyException = new NSString(bindings.NSInternalInconsistencyException); + NSMallocException = new NSString(bindings.NSMallocException); + NSObjectInaccessibleException = new NSString(bindings.NSObjectInaccessibleException); + NSObjectNotAvailableException = new NSString(bindings.NSObjectNotAvailableException); + NSDestinationInvalidException = new NSString(bindings.NSDestinationInvalidException); + NSPortTimeoutException = new NSString(bindings.NSPortTimeoutException); + NSInvalidSendPortException = new NSString(bindings.NSInvalidSendPortException); + NSInvalidReceivePortException = new NSString(bindings.NSInvalidReceivePortException); + NSPortSendException = new NSString(bindings.NSPortSendException); + NSPortReceiveException = new NSString(bindings.NSPortReceiveException); + NSOldStyleException = new NSString(bindings.NSOldStyleException); +} + +class NSAssertionHandler : NSObject +{ + mixin ObjcWrap; + + static NSAssertionHandler currentHandler () + { + return invokeObjcSelfClass!(NSAssertionHandler, "currentHandler"return result is this.objcObject ? this : (result !is null ? new NSAssertionHandler(result) : null); } + + void handleFailureInMethod (SEL selector, Object object, NSString fileName, NSInteger line, NSString description, ...) + { + return invokeObjcSelf!(void, "handleFailureInMethod:object:file:lineNumber:description:", SEL, Object, NSString, NSInteger, NSString)(selector, object, fileName, line, description); + } + + void handleFailureInFunction (NSString functionName, NSString fileName, NSInteger line, NSString description, ...) + { + return invokeObjcSelf!(void, "handleFailureInFunction:file:lineNumber:description:", NSString, NSString, NSInteger, NSString)(functionName, fileName, line, description); + } +} + +class NSException : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSExceptionRaisingConveniences; + + static NSException exceptionWithName (NSString name, NSString reason, NSDictionary userInfo) + { + return invokeObjcSelfClass!(NSException, "exceptionWithName:reason:userInfo:", NSString, NSString, NSDictionary)(name, reason, userInforeturn result is this.objcObject ? this : (result !is null ? new NSException(result) : null); } + + Object initWithName (NSString aName, NSString aReason, NSDictionary aUserInfo) + { + return invokeObjcSelf!(Object, "initWithName:reason:userInfo:", NSString, NSString, NSDictionary)(aName, aReason, aUserInfo); + } + + this (NSString aName, NSString aReason, NSDictionary aUserInfo) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithName:reason:userInfo:", NSString, NSString, NSDictionary)(objcObject, aName, aReason, aUserInfo); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSString reason () + { + return invokeObjcSelf!(NSString, "reason"); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + NSArray callStackReturnAddresses () + { + return invokeObjcSelf!(NSArray, "callStackReturnAddresses"); + } + + void raise () + { + return invokeObjcSelf!(void, "raise"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExceptionRaisingConveniences () +{ + static void raise (NSString name, NSString format, ...) + { + return invokeObjcSelfClass!(void, "raise:format:", NSString, NSString)(name, format); + } + + static void raise (NSString name, NSString format, char* argList) + { + return invokeObjcSelfClass!(void, "raise:format:arguments:", NSString, NSString, char*)(name, format, argList); + } +} + +extern (C) +{ + NSUncaughtExceptionHandler* NSGetUncaughtExceptionHandler (); + void NSSetUncaughtExceptionHandler (NSUncaughtExceptionHandler* dummy); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSException_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSException_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,37 @@ +module dstep.foundation.NSException_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSAssertionHandler; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.setjmp; +import dstep.stdarg; + + +extern (C) +{ + extern + { + package const id NSGenericException; + package const id NSRangeException; + package const id NSInvalidArgumentException; + package const id NSInternalInconsistencyException; + package const id NSMallocException; + package const id NSObjectInaccessibleException; + package const id NSObjectNotAvailableException; + package const id NSDestinationInvalidException; + package const id NSPortTimeoutException; + package const id NSInvalidSendPortException; + package const id NSInvalidReceivePortException; + package const id NSPortSendException; + package const id NSPortReceiveException; + package const id NSOldStyleException; + } +} + +extern (C) +{ +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSExpression.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSExpression.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,180 @@ +/** + * 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.NSExpression; + +import dstep.foundation.NSArray; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSExpressionType; + +enum +{ + NSConstantValueExpressionType = 0, + NSEvaluatedObjectExpressionType, + NSVariableExpressionType, + NSKeyPathExpressionType, + NSFunctionExpressionType, + NSUnionSetExpressionType, + NSIntersectSetExpressionType, + NSMinusSetExpressionType, + NSSubqueryExpressionType = 13, + NSAggregateExpressionType +} + +class NSExpression : NSObject, INSCoding, INSCopying +{ + mixin ObjcWrap; + + static NSExpression expressionForConstantValue (Object obj) + { + return invokeObjcSelfClass!(NSExpression, "expressionForConstantValue:", Object)(objreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForEvaluatedObject () + { + return invokeObjcSelfClass!(NSExpression, "expressionForEvaluatedObject"return result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForVariable (NSString string) + { + return invokeObjcSelfClass!(NSExpression, "expressionForVariable:", NSString)(stringreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForKeyPath (NSString keyPath) + { + return invokeObjcSelfClass!(NSExpression, "expressionForKeyPath:", NSString)(keyPathreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForFunction (NSString name, NSArray parameters) + { + return invokeObjcSelfClass!(NSExpression, "expressionForFunction:arguments:", NSString, NSArray)(name, parametersreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForAggregate (NSArray subexpressions) + { + return invokeObjcSelfClass!(NSExpression, "expressionForAggregate:", NSArray)(subexpressionsreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForUnionSet (NSExpression left, NSExpression right) + { + return invokeObjcSelfClass!(NSExpression, "expressionForUnionSet:with:", NSExpression, NSExpression)(left, rightreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForIntersectSet (NSExpression left, NSExpression right) + { + return invokeObjcSelfClass!(NSExpression, "expressionForIntersectSet:with:", NSExpression, NSExpression)(left, rightreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForMinusSet (NSExpression left, NSExpression right) + { + return invokeObjcSelfClass!(NSExpression, "expressionForMinusSet:with:", NSExpression, NSExpression)(left, rightreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForSubquery (NSExpression expression, NSString variable, Object predicate) + { + return invokeObjcSelfClass!(NSExpression, "expressionForSubquery:usingIteratorVariable:predicate:", NSExpression, NSString, Object)(expression, variable, predicatereturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + static NSExpression expressionForFunction (NSExpression target, NSString name, NSArray parameters) + { + return invokeObjcSelfClass!(NSExpression, "expressionForFunction:selectorName:arguments:", NSExpression, NSString, NSArray)(target, name, parametersreturn result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + Object initWithExpressionType (uint type) + { + return invokeObjcSelf!(Object, "initWithExpressionType:", uint)(type); + } + + this (uint type) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithExpressionType:", uint)(objcObject, type); + + if (result) + objcObject = ret; + + dObject = this; + } + + uint expressionType () + { + return invokeObjcSelf!(uint, "expressionType"); + } + + Object constantValue () + { + return invokeObjcSelf!(Object, "constantValue"); + } + + NSString keyPath () + { + return invokeObjcSelf!(NSString, "keyPath"); + } + + NSString function_ () + { + return invokeObjcSelf!(NSString, "function"); + } + + NSString variable () + { + return invokeObjcSelf!(NSString, "variable"); + } + + NSExpression operand () + { + id result = invokeObjcSelf!(id, "operand"return result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + NSArray arguments () + { + return invokeObjcSelf!(NSArray, "arguments"); + } + + Object collection () + { + return invokeObjcSelf!(Object, "collection"); + } + + NSPredicate predicate () + { + return invokeObjcSelf!(NSPredicate, "predicate"); + } + + NSExpression leftExpression () + { + id result = invokeObjcSelf!(id, "leftExpression"return result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + NSExpression rightExpression () + { + id result = invokeObjcSelf!(id, "rightExpression"return result is this.objcObject ? this : (result !is null ? new NSExpression(result) : null); } + + Object expressionValueWithObject (Object object, NSMutableDictionary context) + { + return invokeObjcSelf!(Object, "expressionValueWithObject:context:", Object, NSMutableDictionary)(object, context); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSFileHandle.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSFileHandle.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,254 @@ +/** + * 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.NSFileHandle; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSFileHandle_bindings; + +const NSString NSFileHandleOperationException; +const NSString NSFileHandleReadCompletionNotification; +const NSString NSFileHandleReadToEndOfFileCompletionNotification; +const NSString NSFileHandleConnectionAcceptedNotification; +const NSString NSFileHandleDataAvailableNotification; +const NSString NSFileHandleNotificationDataItem; +const NSString NSFileHandleNotificationFileHandleItem; +const NSString NSFileHandleNotificationMonitorModes; + +static this () +{ + NSFileHandleOperationException = new NSString(bindings.NSFileHandleOperationException); + NSFileHandleReadCompletionNotification = new NSString(bindings.NSFileHandleReadCompletionNotification); + NSFileHandleReadToEndOfFileCompletionNotification = new NSString(bindings.NSFileHandleReadToEndOfFileCompletionNotification); + NSFileHandleConnectionAcceptedNotification = new NSString(bindings.NSFileHandleConnectionAcceptedNotification); + NSFileHandleDataAvailableNotification = new NSString(bindings.NSFileHandleDataAvailableNotification); + NSFileHandleNotificationDataItem = new NSString(bindings.NSFileHandleNotificationDataItem); + NSFileHandleNotificationFileHandleItem = new NSString(bindings.NSFileHandleNotificationFileHandleItem); + NSFileHandleNotificationMonitorModes = new NSString(bindings.NSFileHandleNotificationMonitorModes); +} + +class NSPipe : NSObject +{ + mixin ObjcWrap; + + NSFileHandle fileHandleForReading () + { + return invokeObjcSelf!(NSFileHandle, "fileHandleForReading"); + } + + NSFileHandle fileHandleForWriting () + { + return invokeObjcSelf!(NSFileHandle, "fileHandleForWriting"); + } + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object pipe () + { + return invokeObjcSelfClass!(Object, "pipe"); + } +} + +class NSFileHandle : NSObject +{ + mixin ObjcWrap; + mixin TNSFileHandleAsynchronousAccess; + mixin TNSFileHandleCreation; + mixin TNSFileHandlePlatformSpecific; + + NSData availableData () + { + return invokeObjcSelf!(NSData, "availableData"); + } + + NSData readDataToEndOfFile () + { + return invokeObjcSelf!(NSData, "readDataToEndOfFile"); + } + + NSData readDataOfLength (NSUInteger length) + { + return invokeObjcSelf!(NSData, "readDataOfLength:", NSUInteger)(length); + } + + void writeData (NSData data) + { + return invokeObjcSelf!(void, "writeData:", NSData)(data); + } + + ulong offsetInFile () + { + return invokeObjcSelf!(ulong, "offsetInFile"); + } + + ulong seekToEndOfFile () + { + return invokeObjcSelf!(ulong, "seekToEndOfFile"); + } + + void seekToFileOffset (ulong offset) + { + return invokeObjcSelf!(void, "seekToFileOffset:", ulong)(offset); + } + + void truncateFileAtOffset (ulong offset) + { + return invokeObjcSelf!(void, "truncateFileAtOffset:", ulong)(offset); + } + + void synchronizeFile () + { + return invokeObjcSelf!(void, "synchronizeFile"); + } + + void closeFile () + { + return invokeObjcSelf!(void, "closeFile"); + } +} + +template TNSFileHandleAsynchronousAccess () +{ + void readInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "readInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void readInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "readInBackgroundAndNotify"); + } + + void readToEndOfFileInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "readToEndOfFileInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void readToEndOfFileInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "readToEndOfFileInBackgroundAndNotify"); + } + + void acceptConnectionInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "acceptConnectionInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void acceptConnectionInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "acceptConnectionInBackgroundAndNotify"); + } + + void waitForDataInBackgroundAndNotifyForModes (NSArray modes) + { + return invokeObjcSelf!(void, "waitForDataInBackgroundAndNotifyForModes:", NSArray)(modes); + } + + void waitForDataInBackgroundAndNotify () + { + return invokeObjcSelf!(void, "waitForDataInBackgroundAndNotify"); + } +} + +template TNSFileHandleCreation () +{ + static Object fileHandleWithStandardInput () + { + return invokeObjcSelfClass!(Object, "fileHandleWithStandardInput"); + } + + static Object fileHandleWithStandardOutput () + { + return invokeObjcSelfClass!(Object, "fileHandleWithStandardOutput"); + } + + static Object fileHandleWithStandardError () + { + return invokeObjcSelfClass!(Object, "fileHandleWithStandardError"); + } + + static Object fileHandleWithNullDevice () + { + return invokeObjcSelfClass!(Object, "fileHandleWithNullDevice"); + } + + static Object fileHandleForReadingAtPath (NSString path) + { + return invokeObjcSelfClass!(Object, "fileHandleForReadingAtPath:", NSString)(path); + } + + static Object fileHandleForWritingAtPath (NSString path) + { + return invokeObjcSelfClass!(Object, "fileHandleForWritingAtPath:", NSString)(path); + } + + static Object fileHandleForUpdatingAtPath (NSString path) + { + return invokeObjcSelfClass!(Object, "fileHandleForUpdatingAtPath:", NSString)(path); + } +} + +template TNSFileHandlePlatformSpecific () +{ + Object initWithFileDescriptor (int fd, bool closeopt) + { + return invokeObjcSelf!(Object, "initWithFileDescriptor:closeOnDealloc:", int, bool)(fd, closeopt); + } + + this (int fd, bool closeopt) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFileDescriptor:closeOnDealloc:", int, bool)(objcObject, fd, closeopt); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithFileDescriptor (int fd) + { + return invokeObjcSelf!(Object, "initWithFileDescriptor:", int)(fd); + } + + this (int fd) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFileDescriptor:", int)(objcObject, fd); + + if (result) + objcObject = ret; + + dObject = this; + } + + int fileDescriptor () + { + return invokeObjcSelf!(int, "fileDescriptor"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSFileHandle_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSFileHandle_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,26 @@ +module dstep.foundation.NSFileHandle_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSFileHandleOperationException; + package const id NSFileHandleReadCompletionNotification; + package const id NSFileHandleReadToEndOfFileCompletionNotification; + package const id NSFileHandleConnectionAcceptedNotification; + package const id NSFileHandleDataAvailableNotification; + package const id NSFileHandleNotificationDataItem; + package const id NSFileHandleNotificationFileHandleItem; + package const id NSFileHandleNotificationMonitorModes; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSFileManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSFileManager.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,428 @@ +/** + * 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.NSFileManager; + +import dstep.corefoundation.CFBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSDirectoryEnumerator; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSError; +import dstep.foundation.NSNumber; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSFileManager_bindings; + +const NSString NSFileType; +const NSString NSFileTypeDirectory; +const NSString NSFileTypeRegular; +const NSString NSFileTypeSymbolicLink; +const NSString NSFileTypeSocket; +const NSString NSFileTypeCharacterSpecial; +const NSString NSFileTypeBlockSpecial; +const NSString NSFileTypeUnknown; +const NSString NSFileSize; +const NSString NSFileModificationDate; +const NSString NSFileReferenceCount; +const NSString NSFileDeviceIdentifier; +const NSString NSFileOwnerAccountName; +const NSString NSFileGroupOwnerAccountName; +const NSString NSFilePosixPermissions; +const NSString NSFileSystemNumber; +const NSString NSFileSystemFileNumber; +const NSString NSFileExtensionHidden; +const NSString NSFileHFSCreatorCode; +const NSString NSFileHFSTypeCode; +const NSString NSFileImmutable; +const NSString NSFileAppendOnly; +const NSString NSFileCreationDate; +const NSString NSFileOwnerAccountID; +const NSString NSFileGroupOwnerAccountID; +const NSString NSFileBusy; +const NSString NSFileSystemSize; +const NSString NSFileSystemFreeSize; +const NSString NSFileSystemNodes; +const NSString NSFileSystemFreeNodes; + +static this () +{ + NSFileType = new NSString(bindings.NSFileType); + NSFileTypeDirectory = new NSString(bindings.NSFileTypeDirectory); + NSFileTypeRegular = new NSString(bindings.NSFileTypeRegular); + NSFileTypeSymbolicLink = new NSString(bindings.NSFileTypeSymbolicLink); + NSFileTypeSocket = new NSString(bindings.NSFileTypeSocket); + NSFileTypeCharacterSpecial = new NSString(bindings.NSFileTypeCharacterSpecial); + NSFileTypeBlockSpecial = new NSString(bindings.NSFileTypeBlockSpecial); + NSFileTypeUnknown = new NSString(bindings.NSFileTypeUnknown); + NSFileSize = new NSString(bindings.NSFileSize); + NSFileModificationDate = new NSString(bindings.NSFileModificationDate); + NSFileReferenceCount = new NSString(bindings.NSFileReferenceCount); + NSFileDeviceIdentifier = new NSString(bindings.NSFileDeviceIdentifier); + NSFileOwnerAccountName = new NSString(bindings.NSFileOwnerAccountName); + NSFileGroupOwnerAccountName = new NSString(bindings.NSFileGroupOwnerAccountName); + NSFilePosixPermissions = new NSString(bindings.NSFilePosixPermissions); + NSFileSystemNumber = new NSString(bindings.NSFileSystemNumber); + NSFileSystemFileNumber = new NSString(bindings.NSFileSystemFileNumber); + NSFileExtensionHidden = new NSString(bindings.NSFileExtensionHidden); + NSFileHFSCreatorCode = new NSString(bindings.NSFileHFSCreatorCode); + NSFileHFSTypeCode = new NSString(bindings.NSFileHFSTypeCode); + NSFileImmutable = new NSString(bindings.NSFileImmutable); + NSFileAppendOnly = new NSString(bindings.NSFileAppendOnly); + NSFileCreationDate = new NSString(bindings.NSFileCreationDate); + NSFileOwnerAccountID = new NSString(bindings.NSFileOwnerAccountID); + NSFileGroupOwnerAccountID = new NSString(bindings.NSFileGroupOwnerAccountID); + NSFileBusy = new NSString(bindings.NSFileBusy); + NSFileSystemSize = new NSString(bindings.NSFileSystemSize); + NSFileSystemFreeSize = new NSString(bindings.NSFileSystemFreeSize); + NSFileSystemNodes = new NSString(bindings.NSFileSystemNodes); + NSFileSystemFreeNodes = new NSString(bindings.NSFileSystemFreeNodes); +} + +class NSFileManager : NSObject +{ + mixin ObjcWrap; + + static NSFileManager defaultManager () + { + return invokeObjcSelfClass!(NSFileManager, "defaultManager"return result is this.objcObject ? this : (result !is null ? new NSFileManager(result) : null); } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + bool setAttributes (NSDictionary attributes, NSString path, NSError** error) + { + return invokeObjcSelf!(bool, "setAttributes:ofItemAtPath:error:", NSDictionary, NSString, NSError**)(attributes, path, error); + } + + bool createDirectoryAtPath (NSString path, bool createIntermediates, NSDictionary attributes, NSError** error) + { + return invokeObjcSelf!(bool, "createDirectoryAtPath:withIntermediateDirectories:attributes:error:", NSString, bool, NSDictionary, NSError**)(path, createIntermediates, attributes, error); + } + + NSArray contentsOfDirectoryAtPath (NSString path, NSError** error) + { + return invokeObjcSelf!(NSArray, "contentsOfDirectoryAtPath:error:", NSString, NSError**)(path, error); + } + + NSArray subpathsOfDirectoryAtPath (NSString path, NSError** error) + { + return invokeObjcSelf!(NSArray, "subpathsOfDirectoryAtPath:error:", NSString, NSError**)(path, error); + } + + NSDictionary attributesOfItemAtPath (NSString path, NSError** error) + { + return invokeObjcSelf!(NSDictionary, "attributesOfItemAtPath:error:", NSString, NSError**)(path, error); + } + + NSDictionary attributesOfFileSystemForPath (NSString path, NSError** error) + { + return invokeObjcSelf!(NSDictionary, "attributesOfFileSystemForPath:error:", NSString, NSError**)(path, error); + } + + bool createSymbolicLinkAtPath (NSString path, NSString destPath, NSError** error) + { + return invokeObjcSelf!(bool, "createSymbolicLinkAtPath:withDestinationPath:error:", NSString, NSString, NSError**)(path, destPath, error); + } + + NSString destinationOfSymbolicLinkAtPath (NSString path, NSError** error) + { + return invokeObjcSelf!(NSString, "destinationOfSymbolicLinkAtPath:error:", NSString, NSError**)(path, error); + } + + bool copyItemAtPath (NSString srcPath, NSString dstPath, NSError** error) + { + return invokeObjcSelf!(bool, "copyItemAtPath:toPath:error:", NSString, NSString, NSError**)(srcPath, dstPath, error); + } + + bool moveItemAtPath (NSString srcPath, NSString dstPath, NSError** error) + { + return invokeObjcSelf!(bool, "moveItemAtPath:toPath:error:", NSString, NSString, NSError**)(srcPath, dstPath, error); + } + + bool linkItemAtPath (NSString srcPath, NSString dstPath, NSError** error) + { + return invokeObjcSelf!(bool, "linkItemAtPath:toPath:error:", NSString, NSString, NSError**)(srcPath, dstPath, error); + } + + bool removeItemAtPath (NSString path, NSError** error) + { + return invokeObjcSelf!(bool, "removeItemAtPath:error:", NSString, NSError**)(path, error); + } + + NSDictionary fileAttributesAtPath (NSString path, bool yorn) + { + return invokeObjcSelf!(NSDictionary, "fileAttributesAtPath:traverseLink:", NSString, bool)(path, yorn); + } + + bool changeFileAttributes (NSDictionary attributes, NSString path) + { + return invokeObjcSelf!(bool, "changeFileAttributes:atPath:", NSDictionary, NSString)(attributes, path); + } + + NSArray directoryContentsAtPath (NSString path) + { + return invokeObjcSelf!(NSArray, "directoryContentsAtPath:", NSString)(path); + } + + NSDictionary fileSystemAttributesAtPath (NSString path) + { + return invokeObjcSelf!(NSDictionary, "fileSystemAttributesAtPath:", NSString)(path); + } + + NSString pathContentOfSymbolicLinkAtPath (NSString path) + { + return invokeObjcSelf!(NSString, "pathContentOfSymbolicLinkAtPath:", NSString)(path); + } + + bool createSymbolicLinkAtPath (NSString path, NSString otherpath) + { + return invokeObjcSelf!(bool, "createSymbolicLinkAtPath:pathContent:", NSString, NSString)(path, otherpath); + } + + bool createDirectoryAtPath (NSString path, NSDictionary attributes) + { + return invokeObjcSelf!(bool, "createDirectoryAtPath:attributes:", NSString, NSDictionary)(path, attributes); + } + + bool linkPath (NSString src, NSString dest, Object handler) + { + return invokeObjcSelf!(bool, "linkPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); + } + + bool copyPath (NSString src, NSString dest, Object handler) + { + return invokeObjcSelf!(bool, "copyPath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); + } + + bool movePath (NSString src, NSString dest, Object handler) + { + return invokeObjcSelf!(bool, "movePath:toPath:handler:", NSString, NSString, Object)(src, dest, handler); + } + + bool removeFileAtPath (NSString path, Object handler) + { + return invokeObjcSelf!(bool, "removeFileAtPath:handler:", NSString, Object)(path, handler); + } + + NSString currentDirectoryPath () + { + return invokeObjcSelf!(NSString, "currentDirectoryPath"); + } + + bool changeCurrentDirectoryPath (NSString path) + { + return invokeObjcSelf!(bool, "changeCurrentDirectoryPath:", NSString)(path); + } + + bool fileExistsAtPath (NSString path) + { + return invokeObjcSelf!(bool, "fileExistsAtPath:", NSString)(path); + } + + bool fileExistsAtPath (NSString path, bool* isDirectory) + { + return invokeObjcSelf!(bool, "fileExistsAtPath:isDirectory:", NSString, bool*)(path, isDirectory); + } + + bool isReadableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isReadableFileAtPath:", NSString)(path); + } + + bool isWritableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isWritableFileAtPath:", NSString)(path); + } + + bool isExecutableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isExecutableFileAtPath:", NSString)(path); + } + + bool isDeletableFileAtPath (NSString path) + { + return invokeObjcSelf!(bool, "isDeletableFileAtPath:", NSString)(path); + } + + bool contentsEqualAtPath (NSString path1, NSString path2) + { + return invokeObjcSelf!(bool, "contentsEqualAtPath:andPath:", NSString, NSString)(path1, path2); + } + + NSString displayNameAtPath (NSString path) + { + return invokeObjcSelf!(NSString, "displayNameAtPath:", NSString)(path); + } + + NSArray componentsToDisplayForPath (NSString path) + { + return invokeObjcSelf!(NSArray, "componentsToDisplayForPath:", NSString)(path); + } + + NSDirectoryEnumerator enumeratorAtPath (NSString path) + { + return invokeObjcSelf!(NSDirectoryEnumerator, "enumeratorAtPath:", NSString)(path); + } + + NSArray subpathsAtPath (NSString path) + { + return invokeObjcSelf!(NSArray, "subpathsAtPath:", NSString)(path); + } + + NSData contentsAtPath (NSString path) + { + return invokeObjcSelf!(NSData, "contentsAtPath:", NSString)(path); + } + + bool createFileAtPath (NSString path, NSData data, NSDictionary attr) + { + return invokeObjcSelf!(bool, "createFileAtPath:contents:attributes:", NSString, NSData, NSDictionary)(path, data, attr); + } + + char* fileSystemRepresentationWithPath (NSString path) + { + return invokeObjcSelf!(char*, "fileSystemRepresentationWithPath:", NSString)(path); + } + + NSString stringWithFileSystemRepresentation (char* str, NSUInteger len) + { + return invokeObjcSelf!(NSString, "stringWithFileSystemRepresentation:length:", char*, NSUInteger)(str, len); + } +} + +class NSDirectoryEnumerator : NSEnumerator +{ + mixin ObjcWrap; + + NSDictionary fileAttributes () + { + return invokeObjcSelf!(NSDictionary, "fileAttributes"); + } + + NSDictionary directoryAttributes () + { + return invokeObjcSelf!(NSDictionary, "directoryAttributes"); + } + + void skipDescendents () + { + return invokeObjcSelf!(void, "skipDescendents"); + } +} + +template TNSFileManagerFileOperationAdditions () +{ + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath); + bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath); + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath); + bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath); + bool fileManager (NSFileManager fileManager, NSString srcPath, NSString dstPath); + bool fileManager (NSFileManager fileManager, NSError error, NSString srcPath, NSString dstPath); + bool fileManager (NSFileManager fileManager, NSString path); + bool fileManager (NSFileManager fileManager, NSError error, NSString path); +} + +template TNSCopyLinkMoveHandler () +{ + bool fileManager (NSFileManager fm, NSDictionary errorInfo); + void fileManager (NSFileManager fm, NSString path); +} + +template TNSFileAttributes () +{ + ulong fileSize () + { + return invokeObjcSelf!(ulong, "fileSize"); + } + + NSDate fileModificationDate () + { + return invokeObjcSelf!(NSDate, "fileModificationDate"); + } + + NSString fileType () + { + return invokeObjcSelf!(NSString, "fileType"); + } + + NSUInteger filePosixPermissions () + { + return invokeObjcSelf!(NSUInteger, "filePosixPermissions"); + } + + NSString fileOwnerAccountName () + { + return invokeObjcSelf!(NSString, "fileOwnerAccountName"); + } + + NSString fileGroupOwnerAccountName () + { + return invokeObjcSelf!(NSString, "fileGroupOwnerAccountName"); + } + + NSInteger fileSystemNumber () + { + return invokeObjcSelf!(NSInteger, "fileSystemNumber"); + } + + NSUInteger fileSystemFileNumber () + { + return invokeObjcSelf!(NSUInteger, "fileSystemFileNumber"); + } + + bool fileExtensionHidden () + { + return invokeObjcSelf!(bool, "fileExtensionHidden"); + } + + uint fileHFSCreatorCode () + { + return invokeObjcSelf!(uint, "fileHFSCreatorCode"); + } + + uint fileHFSTypeCode () + { + return invokeObjcSelf!(uint, "fileHFSTypeCode"); + } + + bool fileIsImmutable () + { + return invokeObjcSelf!(bool, "fileIsImmutable"); + } + + bool fileIsAppendOnly () + { + return invokeObjcSelf!(bool, "fileIsAppendOnly"); + } + + NSDate fileCreationDate () + { + return invokeObjcSelf!(NSDate, "fileCreationDate"); + } + + NSNumber fileOwnerAccountID () + { + return invokeObjcSelf!(NSNumber, "fileOwnerAccountID"); + } + + NSNumber fileGroupOwnerAccountID () + { + return invokeObjcSelf!(NSNumber, "fileGroupOwnerAccountID"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSFileManager_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSFileManager_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,53 @@ +module dstep.foundation.NSFileManager_bindings; + +import dstep.corefoundation.CFBase; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSDirectoryEnumerator; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSError; +import dstep.foundation.NSNumber; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSFileType; + package const id NSFileTypeDirectory; + package const id NSFileTypeRegular; + package const id NSFileTypeSymbolicLink; + package const id NSFileTypeSocket; + package const id NSFileTypeCharacterSpecial; + package const id NSFileTypeBlockSpecial; + package const id NSFileTypeUnknown; + package const id NSFileSize; + package const id NSFileModificationDate; + package const id NSFileReferenceCount; + package const id NSFileDeviceIdentifier; + package const id NSFileOwnerAccountName; + package const id NSFileGroupOwnerAccountName; + package const id NSFilePosixPermissions; + package const id NSFileSystemNumber; + package const id NSFileSystemFileNumber; + package const id NSFileExtensionHidden; + package const id NSFileHFSCreatorCode; + package const id NSFileHFSTypeCode; + package const id NSFileImmutable; + package const id NSFileAppendOnly; + package const id NSFileCreationDate; + package const id NSFileOwnerAccountID; + package const id NSFileGroupOwnerAccountID; + package const id NSFileBusy; + package const id NSFileSystemSize; + package const id NSFileSystemFreeSize; + package const id NSFileSystemNodes; + package const id NSFileSystemFreeNodes; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSFormatter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSFormatter.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,77 @@ +/** + * 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.NSFormatter; + +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSFormatter : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + NSString stringForObjectValue (Object obj) + { + return invokeObjcSelf!(NSString, "stringForObjectValue:", Object)(obj); + } + + NSAttributedString attributedStringForObjectValue (Object obj, NSDictionary attrs) + { + return invokeObjcSelf!(NSAttributedString, "attributedStringForObjectValue:withDefaultAttributes:", Object, NSDictionary)(obj, attrs); + } + + NSString editingStringForObjectValue (Object obj) + { + return invokeObjcSelf!(NSString, "editingStringForObjectValue:", Object)(obj); + } + + bool getObjectValue (id* obj, NSString string, NSString** error) + { + return invokeObjcSelf!(bool, "getObjectValue:forString:errorDescription:", id*, NSString, NSString**)(obj, string, error); + } + + bool isPartialStringValid (NSString partialString, NSString** newString, NSString** error) + { + return invokeObjcSelf!(bool, "isPartialStringValid:newEditingString:errorDescription:", NSString, NSString**, NSString**)(partialString, newString, error); + } + + bool isPartialStringValid (NSString** partialStringPtr, NSRangePointer proposedSelRangePtr, NSString origString, NSRange origSelRange, NSString** error) + { + return invokeObjcSelf!(bool, "isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:", NSString**, NSRangePointer, NSString, NSRange, NSString**)(partialStringPtr, proposedSelRangePtr, origString, origSelRange, error); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSGarbageCollector.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSGarbageCollector.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,67 @@ +/** + * 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.NSGarbageCollector; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSGarbageCollector : NSObject +{ + mixin ObjcWrap; + + static Object defaultCollector () + { + return invokeObjcSelfClass!(Object, "defaultCollector"); + } + + bool isCollecting () + { + return invokeObjcSelf!(bool, "isCollecting"); + } + + void disable () + { + return invokeObjcSelf!(void, "disable"); + } + + void enable () + { + return invokeObjcSelf!(void, "enable"); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void collectIfNeeded () + { + return invokeObjcSelf!(void, "collectIfNeeded"); + } + + void collectExhaustively () + { + return invokeObjcSelf!(void, "collectExhaustively"); + } + + void disableCollectorForPointer (void* ptr) + { + return invokeObjcSelf!(void, "disableCollectorForPointer:", void*)(ptr); + } + + void enableCollectorForPointer (void* ptr) + { + return invokeObjcSelf!(void, "enableCollectorForPointer:", void*)(ptr); + } + + NSZone* zone () + { + return invokeObjcSelf!(NSZone*, "zone"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSGeometry.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSGeometry.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,153 @@ +/** + * 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.NSGeometry; + +import dstep.AvailabilityMacros; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSCoder; +import dstep.foundation.NSString; +import dstep.foundation.NSValue; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSGeometry_bindings; + +alias CGPoint NSPoint; +alias NSPoint* NSPointPointer; +alias NSPoint* NSPointArray; +alias CGSize NSSize; +alias NSSize* NSSizePointer; +alias NSSize* NSSizeArray; +alias CGRect NSRect; +alias NSRect* NSRectPointer; +alias NSRect* NSRectArray; +alias NSUInteger NSRectEdge; + +extern (C) +{ + extern + { + const NSPoint NSZeroPoint; + const NSSize NSZeroSize; + const NSRect NSZeroRect; + } +} + +template TNSGeometryCoding () +{ + void encodePoint (NSPoint point) + { + return invokeObjcSelf!(void, "encodePoint:", NSPoint)(point); + } + + NSPoint decodePoint () + { + return invokeObjcSelf!(NSPoint, "decodePoint"); + } + + void encodeSize (NSSize size) + { + return invokeObjcSelf!(void, "encodeSize:", NSSize)(size); + } + + NSSize decodeSize () + { + return invokeObjcSelf!(NSSize, "decodeSize"); + } + + void encodeRect (NSRect rect) + { + return invokeObjcSelf!(void, "encodeRect:", NSRect)(rect); + } + + NSRect decodeRect () + { + return invokeObjcSelf!(NSRect, "decodeRect"); + } +} + +template TNSValueGeometryExtensions () +{ + static NSValue valueWithPoint (NSPoint point) + { + return invokeObjcSelfClass!(NSValue, "valueWithPoint:", NSPoint)(point); + } + + static NSValue valueWithSize (NSSize size) + { + return invokeObjcSelfClass!(NSValue, "valueWithSize:", NSSize)(size); + } + + static NSValue valueWithRect (NSRect rect) + { + return invokeObjcSelfClass!(NSValue, "valueWithRect:", NSRect)(rect); + } + + NSPoint pointValue () + { + return invokeObjcSelf!(NSPoint, "pointValue"); + } + + NSSize sizeValue () + { + return invokeObjcSelf!(NSSize, "sizeValue"); + } + + NSRect rectValue () + { + return invokeObjcSelf!(NSRect, "rectValue"); + } +} + +NSString NSStringFromPoint (NSPoint aPoint) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromPoint, NSPoint)(aPoint); +} + +NSString NSStringFromSize (NSSize aSize) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromSize, NSSize)(aSize); +} + +NSString NSStringFromRect (NSRect aRect) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromRect, NSRect)(aRect); +} + +NSPoint NSPointFromString (NSString aString) +{ + return Bridge.invokeObjcFunction!(NSPoint, bindings.NSPointFromString, NSString)(aString); +} + +NSSize NSSizeFromString (NSString aString) +{ + return Bridge.invokeObjcFunction!(NSSize, bindings.NSSizeFromString, NSString)(aString); +} + +NSRect NSRectFromString (NSString aString) +{ + return Bridge.invokeObjcFunction!(NSRect, bindings.NSRectFromString, NSString)(aString); +} + +extern (C) +{ + bool NSEqualPoints (NSPoint aPoint, NSPoint bPoint); + bool NSEqualSizes (NSSize aSize, NSSize bSize); + bool NSEqualRects (NSRect aRect, NSRect bRect); + bool NSIsEmptyRect (NSRect aRect); + NSRect NSInsetRect (NSRect aRect, CGFloat dX, CGFloat dY); + NSRect NSIntegralRect (NSRect aRect); + NSRect NSUnionRect (NSRect aRect, NSRect bRect); + NSRect NSIntersectionRect (NSRect aRect, NSRect bRect); + NSRect NSOffsetRect (NSRect aRect, CGFloat dX, CGFloat dY); + void NSDivideRect (NSRect inRect, NSRect* slice, NSRect* rem, CGFloat amount, int edge); + bool NSPointInRect (NSPoint aPoint, NSRect aRect); + bool NSMouseInRect (NSPoint aPoint, NSRect aRect, bool flipped); + bool NSContainsRect (NSRect aRect, NSRect bRect); + bool NSIntersectsRect (NSRect aRect, NSRect bRect); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSGeometry_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSGeometry_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,28 @@ +module dstep.foundation.NSGeometry_bindings; + +import dstep.AvailabilityMacros; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.applicationservices.coregraphics.CGGeometry; +import dstep.foundation.NSCoder; +import dstep.foundation.NSString; +import dstep.foundation.NSValue; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + } +} + +extern (C) +{ + private id NSStringFromPoint (NSPoint aPoint); + private id NSStringFromSize (NSSize aSize); + private id NSStringFromRect (NSRect aRect); + private NSPoint NSPointFromString (id aString); + private NSSize NSSizeFromString (id aString); + private NSRect NSRectFromString (id aString); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHFSFileTypes.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHFSFileTypes.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,29 @@ +/** + * 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.NSHFSFileTypes; + +import dstep.corefoundation.CFBase; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +NSString NSFileTypeForHFSTypeCode (uint hfsFileTypeCode) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSFileTypeForHFSTypeCode, uint)(hfsFileTypeCode); +} + +uint NSHFSTypeCodeFromFileType (NSString fileTypeString) +{ + return Bridge.invokeObjcFunction!(uint, bindings.NSHFSTypeCodeFromFileType, NSString)(fileTypeString); +} + +NSString NSHFSTypeOfFile (NSString fullFilePath) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSHFSTypeOfFile, NSString)(fullFilePath); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHTTPCookie.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHTTPCookie.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,148 @@ +/** + * 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.NSHTTPCookie; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSHTTPCookieInternal; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSHTTPCookie_bindings; + +const NSString NSHTTPCookieName; +const NSString NSHTTPCookieValue; +const NSString NSHTTPCookieOriginURL; +const NSString NSHTTPCookieVersion; +const NSString NSHTTPCookieDomain; +const NSString NSHTTPCookiePath; +const NSString NSHTTPCookieSecure; +const NSString NSHTTPCookieExpires; +const NSString NSHTTPCookieComment; +const NSString NSHTTPCookieCommentURL; +const NSString NSHTTPCookieDiscard; +const NSString NSHTTPCookieMaximumAge; +const NSString NSHTTPCookiePort; + +static this () +{ + NSHTTPCookieName = new NSString(bindings.NSHTTPCookieName); + NSHTTPCookieValue = new NSString(bindings.NSHTTPCookieValue); + NSHTTPCookieOriginURL = new NSString(bindings.NSHTTPCookieOriginURL); + NSHTTPCookieVersion = new NSString(bindings.NSHTTPCookieVersion); + NSHTTPCookieDomain = new NSString(bindings.NSHTTPCookieDomain); + NSHTTPCookiePath = new NSString(bindings.NSHTTPCookiePath); + NSHTTPCookieSecure = new NSString(bindings.NSHTTPCookieSecure); + NSHTTPCookieExpires = new NSString(bindings.NSHTTPCookieExpires); + NSHTTPCookieComment = new NSString(bindings.NSHTTPCookieComment); + NSHTTPCookieCommentURL = new NSString(bindings.NSHTTPCookieCommentURL); + NSHTTPCookieDiscard = new NSString(bindings.NSHTTPCookieDiscard); + NSHTTPCookieMaximumAge = new NSString(bindings.NSHTTPCookieMaximumAge); + NSHTTPCookiePort = new NSString(bindings.NSHTTPCookiePort); +} + +class NSHTTPCookie : NSObject +{ + mixin ObjcWrap; + + Object initWithProperties (NSDictionary properties) + { + return invokeObjcSelf!(Object, "initWithProperties:", NSDictionary)(properties); + } + + this (NSDictionary properties) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithProperties:", NSDictionary)(objcObject, properties); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object cookieWithProperties (NSDictionary properties) + { + return invokeObjcSelfClass!(Object, "cookieWithProperties:", NSDictionary)(properties); + } + + static NSDictionary requestHeaderFieldsWithCookies (NSArray cookies) + { + return invokeObjcSelfClass!(NSDictionary, "requestHeaderFieldsWithCookies:", NSArray)(cookies); + } + + static NSArray cookiesWithResponseHeaderFields (NSDictionary headerFields, NSURL URL) + { + return invokeObjcSelfClass!(NSArray, "cookiesWithResponseHeaderFields:forURL:", NSDictionary, NSURL)(headerFields, URL); + } + + NSDictionary properties () + { + return invokeObjcSelf!(NSDictionary, "properties"); + } + + NSUInteger version_ () + { + return invokeObjcSelf!(NSUInteger, "version"); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSString value () + { + return invokeObjcSelf!(NSString, "value"); + } + + NSDate expiresDate () + { + return invokeObjcSelf!(NSDate, "expiresDate"); + } + + bool isSessionOnly () + { + return invokeObjcSelf!(bool, "isSessionOnly"); + } + + NSString domain () + { + return invokeObjcSelf!(NSString, "domain"); + } + + NSString path () + { + return invokeObjcSelf!(NSString, "path"); + } + + bool isSecure () + { + return invokeObjcSelf!(bool, "isSecure"); + } + + NSString comment () + { + return invokeObjcSelf!(NSString, "comment"); + } + + NSURL commentURL () + { + return invokeObjcSelf!(NSURL, "commentURL"); + } + + NSArray portList () + { + return invokeObjcSelf!(NSArray, "portList"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHTTPCookieStorage.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHTTPCookieStorage.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,81 @@ +/** + * 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.NSHTTPCookieStorage; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSArray; +import dstep.foundation.NSHTTPCookie; +import dstep.foundation.NSHTTPCookieStorageInternal; +import dstep.foundation.NSObject; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSHTTPCookieStorage_bindings; + +alias NSUInteger NSHTTPCookieAcceptPolicy; + +const NSString NSHTTPCookieManagerAcceptPolicyChangedNotification; +const NSString NSHTTPCookieManagerCookiesChangedNotification; + +enum +{ + NSHTTPCookieAcceptPolicyAlways, + NSHTTPCookieAcceptPolicyNever, + NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain +} + +static this () +{ + NSHTTPCookieManagerAcceptPolicyChangedNotification = new NSString(bindings.NSHTTPCookieManagerAcceptPolicyChangedNotification); + NSHTTPCookieManagerCookiesChangedNotification = new NSString(bindings.NSHTTPCookieManagerCookiesChangedNotification); +} + +class NSHTTPCookieStorage : NSObject +{ + mixin ObjcWrap; + + static NSHTTPCookieStorage sharedHTTPCookieStorage () + { + return invokeObjcSelfClass!(NSHTTPCookieStorage, "sharedHTTPCookieStorage"return result is this.objcObject ? this : (result !is null ? new NSHTTPCookieStorage(result) : null); } + + NSArray cookies () + { + return invokeObjcSelf!(NSArray, "cookies"); + } + + void setCookie (NSHTTPCookie cookie) + { + return invokeObjcSelf!(void, "setCookie:", NSHTTPCookie)(cookie); + } + + void deleteCookie (NSHTTPCookie cookie) + { + return invokeObjcSelf!(void, "deleteCookie:", NSHTTPCookie)(cookie); + } + + NSArray cookiesForURL (NSURL URL) + { + return invokeObjcSelf!(NSArray, "cookiesForURL:", NSURL)(URL); + } + + void setCookies (NSArray cookies, NSURL URL, NSURL mainDocumentURL) + { + return invokeObjcSelf!(void, "setCookies:forURL:mainDocumentURL:", NSArray, NSURL, NSURL)(cookies, URL, mainDocumentURL); + } + + uint cookieAcceptPolicy () + { + return invokeObjcSelf!(uint, "cookieAcceptPolicy"); + } + + void setCookieAcceptPolicy (uint cookieAcceptPolicy) + { + return invokeObjcSelf!(void, "setCookieAcceptPolicy:", uint)(cookieAcceptPolicy); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHTTPCookieStorage_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHTTPCookieStorage_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSHTTPCookieStorage_bindings; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSArray; +import dstep.foundation.NSHTTPCookie; +import dstep.foundation.NSHTTPCookieStorageInternal; +import dstep.foundation.NSObject; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSHTTPCookieManagerAcceptPolicyChangedNotification; + package const id NSHTTPCookieManagerCookiesChangedNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHTTPCookie_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHTTPCookie_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,34 @@ +module dstep.foundation.NSHTTPCookie_bindings; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSHTTPCookieInternal; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSHTTPCookieName; + package const id NSHTTPCookieValue; + package const id NSHTTPCookieOriginURL; + package const id NSHTTPCookieVersion; + package const id NSHTTPCookieDomain; + package const id NSHTTPCookiePath; + package const id NSHTTPCookieSecure; + package const id NSHTTPCookieExpires; + package const id NSHTTPCookieComment; + package const id NSHTTPCookieCommentURL; + package const id NSHTTPCookieDiscard; + package const id NSHTTPCookieMaximumAge; + package const id NSHTTPCookiePort; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHashTable.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHashTable.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,299 @@ +/** + * 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.NSHashTable; + +import dstep.foundation.NSArray; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSHashTable; +import dstep.foundation.NSPointerFunctions; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSHashTable_bindings; + +alias NSUInteger NSHashTableOptions; +alias {NSUInteger _pi; NSUInteger _si; void*_bs;} NSHashEnumerator; + +extern (C) +{ + extern + { + const NSHashTableCallBacks NSIntegerHashCallBacks; + const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks; + const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks; + const NSHashTableCallBacks NSObjectHashCallBacks; + const NSHashTableCallBacks NSOwnedObjectIdentityHashCallBacks; + const NSHashTableCallBacks NSOwnedPointerHashCallBacks; + const NSHashTableCallBacks NSPointerToStructHashCallBacks; + } +} + +enum +{ + NSHashTableStrongMemory = 0, + NSHashTableZeroingWeakMemory = NSPointerFunctionsZeroingWeakMemory, + NSHashTableCopyIn = NSPointerFunctionsCopyIn, + NSHashTableObjectPointerPersonality = NSPointerFunctionsObjectPointerPersonality +} + +struct NSHashEnumerator +{ + NSUInteger _pi; + NSUInteger _si; + void* _bs; +} + + +struct NSHashTableCallBacks +{ +} + +class NSHashTable : NSObject, INSCopying, INSCoding, INSFastEnumeration +{ + mixin ObjcWrap; + + Object initWithOptions (uint options, NSUInteger initialCapacity) + { + return invokeObjcSelf!(Object, "initWithOptions:capacity:", uint, NSUInteger)(options, initialCapacity); + } + + this (uint options, NSUInteger initialCapacity) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithOptions:capacity:", uint, NSUInteger)(objcObject, options, initialCapacity); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithPointerFunctions (NSPointerFunctions functions, NSUInteger initialCapacity) + { + return invokeObjcSelf!(Object, "initWithPointerFunctions:capacity:", NSPointerFunctions, NSUInteger)(functions, initialCapacity); + } + + this (NSPointerFunctions functions, NSUInteger initialCapacity) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithPointerFunctions:capacity:", NSPointerFunctions, NSUInteger)(objcObject, functions, initialCapacity); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object hashTableWithOptions (uint options) + { + return invokeObjcSelfClass!(Object, "hashTableWithOptions:", uint)(options); + } + + static Object hashTableWithWeakObjects () + { + return invokeObjcSelfClass!(Object, "hashTableWithWeakObjects"); + } + + NSPointerFunctions pointerFunctions () + { + return invokeObjcSelf!(NSPointerFunctions, "pointerFunctions"); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + Object member (Object object) + { + return invokeObjcSelf!(Object, "member:", Object)(object); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + void addObject (Object object) + { + return invokeObjcSelf!(void, "addObject:", Object)(object); + } + + void removeObject (Object object) + { + return invokeObjcSelf!(void, "removeObject:", Object)(object); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + NSArray allObjects () + { + return invokeObjcSelf!(NSArray, "allObjects"); + } + + Object anyObject () + { + return invokeObjcSelf!(Object, "anyObject"); + } + + bool containsObject (Object anObject) + { + return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); + } + + bool intersectsHashTable (NSHashTable other) + { + return invokeObjcSelf!(bool, "intersectsHashTable:", NSHashTable)(other); + } + + bool isEqualToHashTable (NSHashTable other) + { + return invokeObjcSelf!(bool, "isEqualToHashTable:", NSHashTable)(other); + } + + bool isSubsetOfHashTable (NSHashTable other) + { + return invokeObjcSelf!(bool, "isSubsetOfHashTable:", NSHashTable)(other); + } + + void intersectHashTable (NSHashTable other) + { + return invokeObjcSelf!(void, "intersectHashTable:", NSHashTable)(other); + } + + void unionHashTable (NSHashTable other) + { + return invokeObjcSelf!(void, "unionHashTable:", NSHashTable)(other); + } + + void minusHashTable (NSHashTable other) + { + return invokeObjcSelf!(void, "minusHashTable:", NSHashTable)(other); + } + + NSSet setRepresentation () + { + return invokeObjcSelf!(NSSet, "setRepresentation"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } +} + +void NSFreeHashTable (NSHashTable table) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSFreeHashTable, NSHashTable)(table); +} + +void NSResetHashTable (NSHashTable table) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSResetHashTable, NSHashTable)(table); +} + +bool NSCompareHashTables (NSHashTable table1, NSHashTable table2) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSCompareHashTables, NSHashTable, NSHashTable)(table1, table2); +} + +NSHashTable NSCopyHashTableWithZone (NSHashTable table, NSZone* zone) +{ + return Bridge.invokeObjcFunction!(NSHashTable, bindings.NSCopyHashTableWithZone, NSHashTable, NSZone*)(table, zone); +} + +void* NSHashGet (NSHashTable table, void* pointer) +{ + return Bridge.invokeObjcFunction!(void*, bindings.NSHashGet, NSHashTable, void*)(table, pointer); +} + +void NSHashInsert (NSHashTable table, void* pointer) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSHashInsert, NSHashTable, void*)(table, pointer); +} + +void NSHashInsertKnownAbsent (NSHashTable table, void* pointer) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSHashInsertKnownAbsent, NSHashTable, void*)(table, pointer); +} + +void* NSHashInsertIfAbsent (NSHashTable table, void* pointer) +{ + return Bridge.invokeObjcFunction!(void*, bindings.NSHashInsertIfAbsent, NSHashTable, void*)(table, pointer); +} + +void NSHashRemove (NSHashTable table, void* pointer) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSHashRemove, NSHashTable, void*)(table, pointer); +} + +NSHashEnumerator NSEnumerateHashTable (NSHashTable table) +{ + return Bridge.invokeObjcFunction!(NSHashEnumerator, bindings.NSEnumerateHashTable, NSHashTable)(table); +} + +NSUInteger NSCountHashTable (NSHashTable table) +{ + return Bridge.invokeObjcFunction!(NSUInteger, bindings.NSCountHashTable, NSHashTable)(table); +} + +NSString NSStringFromHashTable (NSHashTable table) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromHashTable, NSHashTable)(table); +} + +NSArray NSAllHashTableObjects (NSHashTable table) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSAllHashTableObjects, NSHashTable)(table); +} + +NSHashTable NSCreateHashTableWithZone (NSHashTableCallBacks callBacks, NSUInteger capacity, NSZone* zone) +{ + return Bridge.invokeObjcFunction!(NSHashTable, bindings.NSCreateHashTableWithZone, NSHashTableCallBacks, NSUInteger, NSZone*)(callBacks, capacity, zone); +} + +NSHashTable NSCreateHashTable (NSHashTableCallBacks callBacks, NSUInteger capacity) +{ + return Bridge.invokeObjcFunction!(NSHashTable, bindings.NSCreateHashTable, NSHashTableCallBacks, NSUInteger)(callBacks, capacity); +} + +extern (C) +{ + void* NSNextHashEnumeratorItem (NSHashEnumerator* enumerator); + void NSEndHashTableEnumeration (NSHashEnumerator* enumerator); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHashTable_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHashTable_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,37 @@ +module dstep.foundation.NSHashTable_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSHashTable; +import dstep.foundation.NSPointerFunctions; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + } +} + +extern (C) +{ + private void NSFreeHashTable (id table); + private void NSResetHashTable (id table); + private bool NSCompareHashTables (id table1, id table2); + private id NSCopyHashTableWithZone (id table, NSZone* zone); + private void* NSHashGet (id table, void* pointer); + private void NSHashInsert (id table, void* pointer); + private void NSHashInsertKnownAbsent (id table, void* pointer); + private void* NSHashInsertIfAbsent (id table, void* pointer); + private void NSHashRemove (id table, void* pointer); + private NSHashEnumerator NSEnumerateHashTable (id table); + private NSUInteger NSCountHashTable (id table); + private id NSStringFromHashTable (id table); + private id NSAllHashTableObjects (id table); + private id NSCreateHashTableWithZone (NSHashTableCallBacks callBacks, NSUInteger capacity, NSZone* zone); + private id NSCreateHashTable (NSHashTableCallBacks callBacks, NSUInteger capacity); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSHost.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSHost.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,72 @@ +/** + * 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.NSHost; + +import dstep.foundation.NSArray; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSHost : NSObject +{ + mixin ObjcWrap; + + static NSHost currentHost () + { + return invokeObjcSelfClass!(NSHost, "currentHost"return result is this.objcObject ? this : (result !is null ? new NSHost(result) : null); } + + static NSHost hostWithName (NSString name) + { + return invokeObjcSelfClass!(NSHost, "hostWithName:", NSString)(namereturn result is this.objcObject ? this : (result !is null ? new NSHost(result) : null); } + + static NSHost hostWithAddress (NSString address) + { + return invokeObjcSelfClass!(NSHost, "hostWithAddress:", NSString)(addressreturn result is this.objcObject ? this : (result !is null ? new NSHost(result) : null); } + + static void setHostCacheEnabled (bool flag) + { + return invokeObjcSelfClass!(void, "setHostCacheEnabled:", bool)(flag); + } + + static bool isHostCacheEnabled () + { + return invokeObjcSelfClass!(bool, "isHostCacheEnabled"); + } + + static void flushHostCache () + { + return invokeObjcSelfClass!(void, "flushHostCache"); + } + + bool isEqualToHost (NSHost aHost) + { + return invokeObjcSelf!(bool, "isEqualToHost:", NSHost)(aHost); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSArray names () + { + return invokeObjcSelf!(NSArray, "names"); + } + + NSString address () + { + return invokeObjcSelf!(NSString, "address"); + } + + NSArray addresses () + { + return invokeObjcSelf!(NSArray, "addresses"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSIndexPath.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSIndexPath.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,113 @@ +/** + * 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.NSIndexPath; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSIndexPath : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + static Object indexPathWithIndex (NSUInteger index) + { + return invokeObjcSelfClass!(Object, "indexPathWithIndex:", NSUInteger)(index); + } + + static Object indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) + { + return invokeObjcSelfClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); + } + + Object initWithIndex (NSUInteger index) + { + return invokeObjcSelf!(Object, "initWithIndex:", NSUInteger)(index); + } + + this (NSUInteger index) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithIndex:", NSUInteger)(objcObject, index); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithIndexes (NSUInteger* indexes, NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); + } + + this (NSUInteger* indexes, NSUInteger length) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithIndexes:length:", NSUInteger*, NSUInteger)(objcObject, indexes, length); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSIndexPath indexPathByAddingIndex (NSUInteger index) + { + id result = invokeObjcSelf!(id, "indexPathByAddingIndex:", NSUInteger)(indexreturn result is this.objcObject ? this : (result !is null ? new NSIndexPath(result) : null); } + + NSIndexPath indexPathByRemovingLastIndex () + { + id result = invokeObjcSelf!(id, "indexPathByRemovingLastIndex"return result is this.objcObject ? this : (result !is null ? new NSIndexPath(result) : null); } + + NSUInteger indexAtPosition (NSUInteger position) + { + return invokeObjcSelf!(NSUInteger, "indexAtPosition:", NSUInteger)(position); + } + + NSUInteger length () + { + return invokeObjcSelf!(NSUInteger, "length"); + } + + void getIndexes (NSUInteger* indexes) + { + return invokeObjcSelf!(void, "getIndexes:", NSUInteger*)(indexes); + } + + int compare (NSIndexPath otherObject) + { + return invokeObjcSelf!(int, "compare:", NSIndexPath)(otherObject); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSIndexSet.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSIndexSet.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,243 @@ +/** + * 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.NSIndexSet; + +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSMutableIndexSet : NSIndexSet +{ + mixin ObjcWrap; + + void addIndexes (NSIndexSet indexSet) + { + return invokeObjcSelf!(void, "addIndexes:", NSIndexSet)(indexSet); + } + + void removeIndexes (NSIndexSet indexSet) + { + return invokeObjcSelf!(void, "removeIndexes:", NSIndexSet)(indexSet); + } + + void removeAllIndexes () + { + return invokeObjcSelf!(void, "removeAllIndexes"); + } + + void addIndex (NSUInteger value) + { + return invokeObjcSelf!(void, "addIndex:", NSUInteger)(value); + } + + void removeIndex (NSUInteger value) + { + return invokeObjcSelf!(void, "removeIndex:", NSUInteger)(value); + } + + void addIndexesInRange (NSRange range) + { + return invokeObjcSelf!(void, "addIndexesInRange:", NSRange)(range); + } + + void removeIndexesInRange (NSRange range) + { + return invokeObjcSelf!(void, "removeIndexesInRange:", NSRange)(range); + } + + void shiftIndexesStartingAtIndex (NSUInteger index, NSInteger delta) + { + return invokeObjcSelf!(void, "shiftIndexesStartingAtIndex:by:", NSUInteger, NSInteger)(index, delta); + } +} + +class NSIndexSet : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin ObjcWrap; + + static Object indexSet () + { + return invokeObjcSelfClass!(Object, "indexSet"); + } + + static Object indexSetWithIndex (NSUInteger value) + { + return invokeObjcSelfClass!(Object, "indexSetWithIndex:", NSUInteger)(value); + } + + static Object indexSetWithIndexesInRange (NSRange range) + { + return invokeObjcSelfClass!(Object, "indexSetWithIndexesInRange:", NSRange)(range); + } + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithIndex (NSUInteger value) + { + return invokeObjcSelf!(Object, "initWithIndex:", NSUInteger)(value); + } + + this (NSUInteger value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithIndex:", NSUInteger)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithIndexesInRange (NSRange range) + { + return invokeObjcSelf!(Object, "initWithIndexesInRange:", NSRange)(range); + } + + this (NSRange range) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithIndexesInRange:", NSRange)(objcObject, range); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithIndexSet (NSIndexSet indexSet) + { + return invokeObjcSelf!(Object, "initWithIndexSet:", NSIndexSet)(indexSet); + } + + this (NSIndexSet indexSet) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithIndexSet:", NSIndexSet)(objcObject, indexSet); + + if (result) + objcObject = ret; + + dObject = this; + } + + bool isEqualToIndexSet (NSIndexSet indexSet) + { + return invokeObjcSelf!(bool, "isEqualToIndexSet:", NSIndexSet)(indexSet); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + NSUInteger firstIndex () + { + return invokeObjcSelf!(NSUInteger, "firstIndex"); + } + + NSUInteger lastIndex () + { + return invokeObjcSelf!(NSUInteger, "lastIndex"); + } + + NSUInteger indexGreaterThanIndex (NSUInteger value) + { + return invokeObjcSelf!(NSUInteger, "indexGreaterThanIndex:", NSUInteger)(value); + } + + NSUInteger indexLessThanIndex (NSUInteger value) + { + return invokeObjcSelf!(NSUInteger, "indexLessThanIndex:", NSUInteger)(value); + } + + NSUInteger indexGreaterThanOrEqualToIndex (NSUInteger value) + { + return invokeObjcSelf!(NSUInteger, "indexGreaterThanOrEqualToIndex:", NSUInteger)(value); + } + + NSUInteger indexLessThanOrEqualToIndex (NSUInteger value) + { + return invokeObjcSelf!(NSUInteger, "indexLessThanOrEqualToIndex:", NSUInteger)(value); + } + + NSUInteger getIndexes (NSUInteger* indexBuffer, NSUInteger bufferSize, NSRangePointer range) + { + return invokeObjcSelf!(NSUInteger, "getIndexes:maxCount:inIndexRange:", NSUInteger*, NSUInteger, NSRangePointer)(indexBuffer, bufferSize, range); + } + + NSUInteger countOfIndexesInRange (NSRange range) + { + return invokeObjcSelf!(NSUInteger, "countOfIndexesInRange:", NSRange)(range); + } + + bool containsIndex (NSUInteger value) + { + return invokeObjcSelf!(bool, "containsIndex:", NSUInteger)(value); + } + + bool containsIndexesInRange (NSRange range) + { + return invokeObjcSelf!(bool, "containsIndexesInRange:", NSRange)(range); + } + + bool containsIndexes (NSIndexSet indexSet) + { + return invokeObjcSelf!(bool, "containsIndexes:", NSIndexSet)(indexSet); + } + + bool intersectsIndexesInRange (NSRange range) + { + return invokeObjcSelf!(bool, "intersectsIndexesInRange:", NSRange)(range); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSInvocation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSInvocation.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,88 @@ +/** + * 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.NSInvocation; + +import dstep.foundation.NSMethodSignature; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.stdbool; + +class NSInvocation : NSObject +{ + mixin ObjcWrap; + + static NSInvocation invocationWithMethodSignature (NSMethodSignature sig) + { + return invokeObjcSelfClass!(NSInvocation, "invocationWithMethodSignature:", NSMethodSignature)(sigreturn result is this.objcObject ? this : (result !is null ? new NSInvocation(result) : null); } + + NSMethodSignature methodSignature () + { + return invokeObjcSelf!(NSMethodSignature, "methodSignature"); + } + + void retainArguments () + { + return invokeObjcSelf!(void, "retainArguments"); + } + + bool argumentsRetained () + { + return invokeObjcSelf!(bool, "argumentsRetained"); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object target) + { + return invokeObjcSelf!(void, "setTarget:", Object)(target); + } + + SEL selector () + { + return invokeObjcSelf!(SEL, "selector"); + } + + void setSelector (SEL selector) + { + return invokeObjcSelf!(void, "setSelector:", SEL)(selector); + } + + void getReturnValue (void* retLoc) + { + return invokeObjcSelf!(void, "getReturnValue:", void*)(retLoc); + } + + void setReturnValue (void* retLoc) + { + return invokeObjcSelf!(void, "setReturnValue:", void*)(retLoc); + } + + void getArgument (void* argumentLocation, NSInteger idx) + { + return invokeObjcSelf!(void, "getArgument:atIndex:", void*, NSInteger)(argumentLocation, idx); + } + + void setArgument (void* argumentLocation, NSInteger idx) + { + return invokeObjcSelf!(void, "setArgument:atIndex:", void*, NSInteger)(argumentLocation, idx); + } + + void invoke () + { + return invokeObjcSelf!(void, "invoke"); + } + + void invokeWithTarget (Object target) + { + return invokeObjcSelf!(void, "invokeWithTarget:", Object)(target); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSJavaSetup.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSJavaSetup.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,66 @@ +/** + * 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.NSJavaSetup; + +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +bool NSJavaNeedsVirtualMachine (NSDictionary plist) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSJavaNeedsVirtualMachine, NSDictionary)(plist); +} + +bool NSJavaProvidesClasses (NSDictionary plist) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSJavaProvidesClasses, NSDictionary)(plist); +} + +bool NSJavaNeedsToLoadClasses (NSDictionary plist) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSJavaNeedsToLoadClasses, NSDictionary)(plist); +} + +Object NSJavaSetup (NSDictionary plist) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSJavaSetup, NSDictionary)(plist); +} + +Object NSJavaSetupVirtualMachine () +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSJavaSetupVirtualMachine); +} + +Object NSJavaObjectNamedInPath (NSString name, NSArray path) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSJavaObjectNamedInPath, NSString, NSArray)(name, path); +} + +NSArray NSJavaClassesFromPath (NSArray path, NSArray wanted, bool usesyscl, id* vm) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSJavaClassesFromPath, NSArray, NSArray, bool, id*)(path, wanted, usesyscl, vm); +} + +NSArray NSJavaClassesForBundle (NSBundle bundle, bool usesyscl, id* vm) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSJavaClassesForBundle, NSBundle, bool, id*)(bundle, usesyscl, vm); +} + +Object NSJavaBundleSetup (NSBundle bundle, NSDictionary plist) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSJavaBundleSetup, NSBundle, NSDictionary)(bundle, plist); +} + +void NSJavaBundleCleanup (NSBundle bundle, NSDictionary plist) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSJavaBundleCleanup, NSBundle, NSDictionary)(bundle, plist); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSKeyValueCoding.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSKeyValueCoding.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,81 @@ +/** + * 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.NSKeyValueCoding; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSKeyValueCoding_bindings; + +const NSString NSUndefinedKeyException; +const NSString NSAverageKeyValueOperator; +const NSString NSCountKeyValueOperator; +const NSString NSDistinctUnionOfArraysKeyValueOperator; +const NSString NSDistinctUnionOfObjectsKeyValueOperator; +const NSString NSDistinctUnionOfSetsKeyValueOperator; +const NSString NSMaximumKeyValueOperator; +const NSString NSMinimumKeyValueOperator; +const NSString NSSumKeyValueOperator; +const NSString NSUnionOfArraysKeyValueOperator; +const NSString NSUnionOfObjectsKeyValueOperator; +const NSString NSUnionOfSetsKeyValueOperator; + +static this () +{ + NSUndefinedKeyException = new NSString(bindings.NSUndefinedKeyException); + NSAverageKeyValueOperator = new NSString(bindings.NSAverageKeyValueOperator); + NSCountKeyValueOperator = new NSString(bindings.NSCountKeyValueOperator); + NSDistinctUnionOfArraysKeyValueOperator = new NSString(bindings.NSDistinctUnionOfArraysKeyValueOperator); + NSDistinctUnionOfObjectsKeyValueOperator = new NSString(bindings.NSDistinctUnionOfObjectsKeyValueOperator); + NSDistinctUnionOfSetsKeyValueOperator = new NSString(bindings.NSDistinctUnionOfSetsKeyValueOperator); + NSMaximumKeyValueOperator = new NSString(bindings.NSMaximumKeyValueOperator); + NSMinimumKeyValueOperator = new NSString(bindings.NSMinimumKeyValueOperator); + NSSumKeyValueOperator = new NSString(bindings.NSSumKeyValueOperator); + NSUnionOfArraysKeyValueOperator = new NSString(bindings.NSUnionOfArraysKeyValueOperator); + NSUnionOfObjectsKeyValueOperator = new NSString(bindings.NSUnionOfObjectsKeyValueOperator); + NSUnionOfSetsKeyValueOperator = new NSString(bindings.NSUnionOfSetsKeyValueOperator); +} + +template TNSDeprecatedKeyValueCoding () +{ + static bool useStoredAccessor (); + Object storedValueForKey (NSString key); + void takeStoredValue (Object value, NSString key); + void takeValue (Object value, NSString key); + void takeValue (Object value, NSString keyPath); + Object handleQueryWithUnboundKey (NSString key); + void handleTakeValue (Object value, NSString key); + void unableToSetNilForKey (NSString key); + NSDictionary valuesForKeys (NSArray keys); + void takeValuesFromDictionary (NSDictionary properties); +} + +template TNSKeyValueCoding () +{ + static bool accessInstanceVariablesDirectly (); + Object valueForKey (NSString key); + void setValue (Object value, NSString key); + bool validateValue (id* ioValue, NSString inKey, NSError** outError); + NSMutableArray mutableArrayValueForKey (NSString key); + NSMutableSet mutableSetValueForKey (NSString key); + Object valueForKeyPath (NSString keyPath); + void setValue (Object value, NSString keyPath); + bool validateValue (id* ioValue, NSString inKeyPath, NSError** outError); + NSMutableArray mutableArrayValueForKeyPath (NSString keyPath); + NSMutableSet mutableSetValueForKeyPath (NSString keyPath); + Object valueForUndefinedKey (NSString key); + void setValue (Object value, NSString key); + void setNilValueForKey (NSString key); + NSDictionary dictionaryWithValuesForKeys (NSArray keys); + void setValuesForKeysWithDictionary (NSDictionary keyedValues); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSKeyValueCoding_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSKeyValueCoding_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,30 @@ +module dstep.foundation.NSKeyValueCoding_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSUndefinedKeyException; + package const id NSAverageKeyValueOperator; + package const id NSCountKeyValueOperator; + package const id NSDistinctUnionOfArraysKeyValueOperator; + package const id NSDistinctUnionOfObjectsKeyValueOperator; + package const id NSDistinctUnionOfSetsKeyValueOperator; + package const id NSMaximumKeyValueOperator; + package const id NSMinimumKeyValueOperator; + package const id NSSumKeyValueOperator; + package const id NSUnionOfArraysKeyValueOperator; + package const id NSUnionOfObjectsKeyValueOperator; + package const id NSUnionOfSetsKeyValueOperator; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSKeyValueObserving.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSKeyValueObserving.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,101 @@ +/** + * 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.NSKeyValueObserving; + +import dstep.foundation.NSArray; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSKeyValueObserving_bindings; + +alias NSUInteger NSKeyValueObservingOptions; +alias NSUInteger NSKeyValueChange; +alias NSUInteger NSKeyValueSetMutationKind; + +const NSString NSKeyValueChangeKindKey; +const NSString NSKeyValueChangeNewKey; +const NSString NSKeyValueChangeOldKey; +const NSString NSKeyValueChangeIndexesKey; +const NSString NSKeyValueChangeNotificationIsPriorKey; + +enum +{ + NSKeyValueObservingOptionNew = 0x01, + NSKeyValueObservingOptionOld = 0x02, + NSKeyValueObservingOptionInitial = 0x04, + NSKeyValueObservingOptionPrior = 0x08 +} + +enum +{ + NSKeyValueChangeSetting = 1, + NSKeyValueChangeInsertion = 2, + NSKeyValueChangeRemoval = 3, + NSKeyValueChangeReplacement = 4 +} + +enum +{ + NSKeyValueUnionSetMutation = 1, + NSKeyValueMinusSetMutation = 2, + NSKeyValueIntersectSetMutation = 3, + NSKeyValueSetSetMutation = 4 +} + +static this () +{ + NSKeyValueChangeKindKey = new NSString(bindings.NSKeyValueChangeKindKey); + NSKeyValueChangeNewKey = new NSString(bindings.NSKeyValueChangeNewKey); + NSKeyValueChangeOldKey = new NSString(bindings.NSKeyValueChangeOldKey); + NSKeyValueChangeIndexesKey = new NSString(bindings.NSKeyValueChangeIndexesKey); + NSKeyValueChangeNotificationIsPriorKey = new NSString(bindings.NSKeyValueChangeNotificationIsPriorKey); +} + +template TNSKeyValueObserverNotification () +{ + void willChangeValueForKey (NSString key); + void didChangeValueForKey (NSString key); + void willChange (uint changeKind, NSIndexSet indexes, NSString key); + void didChange (uint changeKind, NSIndexSet indexes, NSString key); + void willChangeValueForKey (NSString key, uint mutationKind, NSSet objects); + void didChangeValueForKey (NSString key, uint mutationKind, NSSet objects); +} + +template TNSKeyValueObservingCustomization () +{ + static NSSet keyPathsForValuesAffectingValueForKey (NSString key); + static bool automaticallyNotifiesObserversForKey (NSString key); + void setObservationInfo (void* observationInfo); + void* observationInfo (); +} + +template TNSKeyValueObserverRegistration () +{ + void addObserver (NSObject observer, NSString keyPath, uint options, void* context) + { + return invokeObjcSelf!(void, "addObserver:forKeyPath:options:context:", NSObject, NSString, uint, void*)(observer, keyPath, options, context); + } + + void removeObserver (NSObject observer, NSString keyPath) + { + return invokeObjcSelf!(void, "removeObserver:forKeyPath:", NSObject, NSString)(observer, keyPath); + } +} + +template TNSDeprecatedKeyValueObservingCustomization () +{ + static void setKeys (NSArray keys, NSString dependentKey); +} + +template TNSKeyValueObserving () +{ + void observeValueForKeyPath (NSString keyPath, Object object, NSDictionary change, void* context); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSKeyValueObserving_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSKeyValueObserving_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,22 @@ +module dstep.foundation.NSKeyValueObserving_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSIndexSet; +import dstep.foundation.NSSet; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSKeyValueChangeKindKey; + package const id NSKeyValueChangeNewKey; + package const id NSKeyValueChangeOldKey; + package const id NSKeyValueChangeIndexesKey; + package const id NSKeyValueChangeNotificationIsPriorKey; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSKeyedArchiver.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSKeyedArchiver.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,323 @@ +/** + * 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.NSKeyedArchiver; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSMutableData; +import dstep.foundation.NSPropertyList; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSKeyedArchiver_bindings; + +const NSString NSInvalidArchiveOperationException; +const NSString NSInvalidUnarchiveOperationException; + +static this () +{ + NSInvalidArchiveOperationException = new NSString(bindings.NSInvalidArchiveOperationException); + NSInvalidUnarchiveOperationException = new NSString(bindings.NSInvalidUnarchiveOperationException); +} + +class NSKeyedArchiver : NSCoder +{ + mixin ObjcWrap; + + static NSData archivedDataWithRootObject (Object rootObject) + { + return invokeObjcSelfClass!(NSData, "archivedDataWithRootObject:", Object)(rootObject); + } + + static bool archiveRootObject (Object rootObject, NSString path) + { + return invokeObjcSelfClass!(bool, "archiveRootObject:toFile:", Object, NSString)(rootObject, path); + } + + Object initForWritingWithMutableData (NSMutableData data) + { + return invokeObjcSelf!(Object, "initForWritingWithMutableData:", NSMutableData)(data); + } + + this (NSMutableData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initForWritingWithMutableData:", NSMutableData)(objcObject, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setOutputFormat (uint format) + { + return invokeObjcSelf!(void, "setOutputFormat:", uint)(format); + } + + uint outputFormat () + { + return invokeObjcSelf!(uint, "outputFormat"); + } + + void finishEncoding () + { + return invokeObjcSelf!(void, "finishEncoding"); + } + + static void setClassName (NSString codedName, Class cls) + { + return invokeObjcSelfClass!(void, "setClassName:forClass:", NSString, Class)(codedName, cls); + } + + void setClassName (NSString codedName, Class cls) + { + return invokeObjcSelf!(void, "setClassName:forClass:", NSString, Class)(codedName, cls); + } + + static NSString classNameForClass (Class cls) + { + return invokeObjcSelfClass!(NSString, "classNameForClass:", Class)(cls); + } + + NSString classNameForClass (Class cls) + { + return invokeObjcSelf!(NSString, "classNameForClass:", Class)(cls); + } + + void encodeObject (Object objv, NSString key) + { + return invokeObjcSelf!(void, "encodeObject:forKey:", Object, NSString)(objv, key); + } + + void encodeConditionalObject (Object objv, NSString key) + { + return invokeObjcSelf!(void, "encodeConditionalObject:forKey:", Object, NSString)(objv, key); + } + + void encodeBool (bool boolv, NSString key) + { + return invokeObjcSelf!(void, "encodeBool:forKey:", bool, NSString)(boolv, key); + } + + void encodeInt (int intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt:forKey:", int, NSString)(intv, key); + } + + void encodeInt32 (int intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt32:forKey:", int, NSString)(intv, key); + } + + void encodeInt64 (long intv, NSString key) + { + return invokeObjcSelf!(void, "encodeInt64:forKey:", long, NSString)(intv, key); + } + + void encodeFloat (float realv, NSString key) + { + return invokeObjcSelf!(void, "encodeFloat:forKey:", float, NSString)(realv, key); + } + + void encodeDouble (double realv, NSString key) + { + return invokeObjcSelf!(void, "encodeDouble:forKey:", double, NSString)(realv, key); + } + + void encodeBytes (char* bytesp, NSUInteger lenv, NSString key) + { + return invokeObjcSelf!(void, "encodeBytes:length:forKey:", char*, NSUInteger, NSString)(bytesp, lenv, key); + } +} + +class NSKeyedUnarchiver : NSCoder +{ + mixin ObjcWrap; + + static Object unarchiveObjectWithData (NSData data) + { + return invokeObjcSelfClass!(Object, "unarchiveObjectWithData:", NSData)(data); + } + + static Object unarchiveObjectWithFile (NSString path) + { + return invokeObjcSelfClass!(Object, "unarchiveObjectWithFile:", NSString)(path); + } + + Object initForReadingWithData (NSData data) + { + return invokeObjcSelf!(Object, "initForReadingWithData:", NSData)(data); + } + + this (NSData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initForReadingWithData:", NSData)(objcObject, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void finishDecoding () + { + return invokeObjcSelf!(void, "finishDecoding"); + } + + static void setClass (Class cls, NSString codedName) + { + return invokeObjcSelfClass!(void, "setClass:forClassName:", Class, NSString)(cls, codedName); + } + + void setClass (Class cls, NSString codedName) + { + return invokeObjcSelf!(void, "setClass:forClassName:", Class, NSString)(cls, codedName); + } + + static Class classForClassName (NSString codedName) + { + return invokeObjcSelfClass!(Class, "classForClassName:", NSString)(codedName); + } + + Class classForClassName (NSString codedName) + { + return invokeObjcSelf!(Class, "classForClassName:", NSString)(codedName); + } + + bool containsValueForKey (NSString key) + { + return invokeObjcSelf!(bool, "containsValueForKey:", NSString)(key); + } + + Object decodeObjectForKey (NSString key) + { + return invokeObjcSelf!(Object, "decodeObjectForKey:", NSString)(key); + } + + bool decodeBoolForKey (NSString key) + { + return invokeObjcSelf!(bool, "decodeBoolForKey:", NSString)(key); + } + + int decodeIntForKey (NSString key) + { + return invokeObjcSelf!(int, "decodeIntForKey:", NSString)(key); + } + + int decodeInt32ForKey (NSString key) + { + return invokeObjcSelf!(int, "decodeInt32ForKey:", NSString)(key); + } + + long decodeInt64ForKey (NSString key) + { + return invokeObjcSelf!(long, "decodeInt64ForKey:", NSString)(key); + } + + float decodeFloatForKey (NSString key) + { + return invokeObjcSelf!(float, "decodeFloatForKey:", NSString)(key); + } + + double decodeDoubleForKey (NSString key) + { + return invokeObjcSelf!(double, "decodeDoubleForKey:", NSString)(key); + } + + char* decodeBytesForKey (NSString key, NSUInteger* lengthp) + { + return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); + } +} + +template TNSKeyedArchiverObjectSubstitution () +{ + Class classForKeyedArchiver (); + Object replacementObjectForKeyedArchiver (NSKeyedArchiver archiver); + static NSArray classFallbacksForKeyedArchiver (); +} + +template TNSKeyedUnarchiverObjectSubstitution () +{ + static Class classForKeyedUnarchiver (); +} + +template TNSKeyedUnarchiverDelegate () +{ + Class unarchiver (NSKeyedUnarchiver unarchiver, NSString name, NSArray classNames); + Object unarchiver (NSKeyedUnarchiver unarchiver, Object object); + void unarchiver (NSKeyedUnarchiver unarchiver, Object object, Object newObject); + void unarchiverWillFinish (NSKeyedUnarchiver unarchiver); + void unarchiverDidFinish (NSKeyedUnarchiver unarchiver); +} + +template TNSKeyedArchiverDelegate () +{ + Object archiver (NSKeyedArchiver archiver, Object object); + void archiver (NSKeyedArchiver archiver, Object object); + void archiver (NSKeyedArchiver archiver, Object object, Object newObject); + void archiverWillFinish (NSKeyedArchiver archiver); + void archiverDidFinish (NSKeyedArchiver archiver); +} + +template TNSGeometryKeyedCoding () +{ + void encodePoint (NSPoint point, NSString key) + { + return invokeObjcSelf!(void, "encodePoint:forKey:", NSPoint, NSString)(point, key); + } + + void encodeSize (NSSize size, NSString key) + { + return invokeObjcSelf!(void, "encodeSize:forKey:", NSSize, NSString)(size, key); + } + + void encodeRect (NSRect rect, NSString key) + { + return invokeObjcSelf!(void, "encodeRect:forKey:", NSRect, NSString)(rect, key); + } + + NSPoint decodePointForKey (NSString key) + { + return invokeObjcSelf!(NSPoint, "decodePointForKey:", NSString)(key); + } + + NSSize decodeSizeForKey (NSString key) + { + return invokeObjcSelf!(NSSize, "decodeSizeForKey:", NSString)(key); + } + + NSRect decodeRectForKey (NSString key) + { + return invokeObjcSelf!(NSRect, "decodeRectForKey:", NSString)(key); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSKeyedArchiver_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSKeyedArchiver_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSKeyedArchiver_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSMutableData; +import dstep.foundation.NSPropertyList; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSInvalidArchiveOperationException; + package const id NSInvalidUnarchiveOperationException; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSLocale.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSLocale.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,200 @@ +/** + * 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.NSLocale; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSLocale_bindings; + +const NSString NSCurrentLocaleDidChangeNotification; +const NSString NSLocaleIdentifier; +const NSString NSLocaleLanguageCode; +const NSString NSLocaleCountryCode; +const NSString NSLocaleScriptCode; +const NSString NSLocaleVariantCode; +const NSString NSLocaleExemplarCharacterSet; +const NSString NSLocaleCalendar; +const NSString NSLocaleCollationIdentifier; +const NSString NSLocaleUsesMetricSystem; +const NSString NSLocaleMeasurementSystem; +const NSString NSLocaleDecimalSeparator; +const NSString NSLocaleGroupingSeparator; +const NSString NSLocaleCurrencySymbol; +const NSString NSLocaleCurrencyCode; +const NSString NSGregorianCalendar; +const NSString NSBuddhistCalendar; +const NSString NSChineseCalendar; +const NSString NSHebrewCalendar; +const NSString NSIslamicCalendar; +const NSString NSIslamicCivilCalendar; +const NSString NSJapaneseCalendar; + +static this () +{ + NSCurrentLocaleDidChangeNotification = new NSString(bindings.NSCurrentLocaleDidChangeNotification); + NSLocaleIdentifier = new NSString(bindings.NSLocaleIdentifier); + NSLocaleLanguageCode = new NSString(bindings.NSLocaleLanguageCode); + NSLocaleCountryCode = new NSString(bindings.NSLocaleCountryCode); + NSLocaleScriptCode = new NSString(bindings.NSLocaleScriptCode); + NSLocaleVariantCode = new NSString(bindings.NSLocaleVariantCode); + NSLocaleExemplarCharacterSet = new NSString(bindings.NSLocaleExemplarCharacterSet); + NSLocaleCalendar = new NSString(bindings.NSLocaleCalendar); + NSLocaleCollationIdentifier = new NSString(bindings.NSLocaleCollationIdentifier); + NSLocaleUsesMetricSystem = new NSString(bindings.NSLocaleUsesMetricSystem); + NSLocaleMeasurementSystem = new NSString(bindings.NSLocaleMeasurementSystem); + NSLocaleDecimalSeparator = new NSString(bindings.NSLocaleDecimalSeparator); + NSLocaleGroupingSeparator = new NSString(bindings.NSLocaleGroupingSeparator); + NSLocaleCurrencySymbol = new NSString(bindings.NSLocaleCurrencySymbol); + NSLocaleCurrencyCode = new NSString(bindings.NSLocaleCurrencyCode); + NSGregorianCalendar = new NSString(bindings.NSGregorianCalendar); + NSBuddhistCalendar = new NSString(bindings.NSBuddhistCalendar); + NSChineseCalendar = new NSString(bindings.NSChineseCalendar); + NSHebrewCalendar = new NSString(bindings.NSHebrewCalendar); + NSIslamicCalendar = new NSString(bindings.NSIslamicCalendar); + NSIslamicCivilCalendar = new NSString(bindings.NSIslamicCivilCalendar); + NSJapaneseCalendar = new NSString(bindings.NSJapaneseCalendar); +} + +class NSLocale : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSLocaleCreation; + mixin TNSLocaleGeneralInfo; + mixin TNSExtendedLocale; + + Object objectForKey (Object key) + { + return invokeObjcSelf!(Object, "objectForKey:", Object)(key); + } + + NSString displayNameForKey (Object key, Object value) + { + return invokeObjcSelf!(NSString, "displayNameForKey:value:", Object, Object)(key, value); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSLocaleCreation () +{ + static Object systemLocale () + { + return invokeObjcSelfClass!(Object, "systemLocale"); + } + + static Object currentLocale () + { + return invokeObjcSelfClass!(Object, "currentLocale"); + } + + static Object autoupdatingCurrentLocale () + { + return invokeObjcSelfClass!(Object, "autoupdatingCurrentLocale"); + } + + Object initWithLocaleIdentifier (NSString string) + { + return invokeObjcSelf!(Object, "initWithLocaleIdentifier:", NSString)(string); + } + + this (NSString string) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithLocaleIdentifier:", NSString)(objcObject, string); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSLocaleGeneralInfo () +{ + static NSArray availableLocaleIdentifiers () + { + return invokeObjcSelfClass!(NSArray, "availableLocaleIdentifiers"); + } + + static NSArray ISOLanguageCodes () + { + return invokeObjcSelfClass!(NSArray, "ISOLanguageCodes"); + } + + static NSArray ISOCountryCodes () + { + return invokeObjcSelfClass!(NSArray, "ISOCountryCodes"); + } + + static NSArray ISOCurrencyCodes () + { + return invokeObjcSelfClass!(NSArray, "ISOCurrencyCodes"); + } + + static NSArray commonISOCurrencyCodes () + { + return invokeObjcSelfClass!(NSArray, "commonISOCurrencyCodes"); + } + + static NSArray preferredLanguages () + { + return invokeObjcSelfClass!(NSArray, "preferredLanguages"); + } + + static NSDictionary componentsFromLocaleIdentifier (NSString string) + { + return invokeObjcSelfClass!(NSDictionary, "componentsFromLocaleIdentifier:", NSString)(string); + } + + static NSString localeIdentifierFromComponents (NSDictionary dict) + { + return invokeObjcSelfClass!(NSString, "localeIdentifierFromComponents:", NSDictionary)(dict); + } + + static NSString canonicalLocaleIdentifierFromString (NSString string) + { + return invokeObjcSelfClass!(NSString, "canonicalLocaleIdentifierFromString:", NSString)(string); + } +} + +template TNSExtendedLocale () +{ + NSString localeIdentifier () + { + return invokeObjcSelf!(NSString, "localeIdentifier"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSLocale_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSLocale_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,39 @@ +module dstep.foundation.NSLocale_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSCurrentLocaleDidChangeNotification; + package const id NSLocaleIdentifier; + package const id NSLocaleLanguageCode; + package const id NSLocaleCountryCode; + package const id NSLocaleScriptCode; + package const id NSLocaleVariantCode; + package const id NSLocaleExemplarCharacterSet; + package const id NSLocaleCalendar; + package const id NSLocaleCollationIdentifier; + package const id NSLocaleUsesMetricSystem; + package const id NSLocaleMeasurementSystem; + package const id NSLocaleDecimalSeparator; + package const id NSLocaleGroupingSeparator; + package const id NSLocaleCurrencySymbol; + package const id NSLocaleCurrencyCode; + package const id NSGregorianCalendar; + package const id NSBuddhistCalendar; + package const id NSChineseCalendar; + package const id NSHebrewCalendar; + package const id NSIslamicCalendar; + package const id NSIslamicCivilCalendar; + package const id NSJapaneseCalendar; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSLock.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSLock.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,210 @@ +/** + * 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.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSLock : NSObject, INSLocking +{ + mixin ObjcWrap; + + 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; + + 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; + + Object initWithCondition (NSInteger condition) + { + return invokeObjcSelf!(Object, "initWithCondition:", NSInteger)(condition); + } + + this (NSInteger condition) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCondition:", NSInteger)(objcObject, condition); + + if (result) + objcObject = ret; + + dObject = this; + } + + 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; + + 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 (); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSMapTable.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSMapTable.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,299 @@ +/** + * 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.NSMapTable; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSMapTable; +import dstep.foundation.NSPointerFunctions; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSMapTable_bindings; + +alias NSUInteger NSMapTableOptions; +alias {NSUInteger _pi; NSUInteger _si; void*_bs;} NSMapEnumerator; + +extern (C) +{ + extern + { + const NSMapTableKeyCallBacks NSIntegerMapKeyCallBacks; + const NSMapTableKeyCallBacks NSNonOwnedPointerMapKeyCallBacks; + const NSMapTableKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks; + const NSMapTableKeyCallBacks NSNonRetainedObjectMapKeyCallBacks; + const NSMapTableKeyCallBacks NSObjectMapKeyCallBacks; + const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks; + const NSMapTableValueCallBacks NSIntegerMapValueCallBacks; + const NSMapTableValueCallBacks NSNonOwnedPointerMapValueCallBacks; + const NSMapTableValueCallBacks NSObjectMapValueCallBacks; + const NSMapTableValueCallBacks NSNonRetainedObjectMapValueCallBacks; + const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks; + } +} + +enum +{ + NSMapTableStrongMemory = 0, + NSMapTableZeroingWeakMemory = NSPointerFunctionsZeroingWeakMemory, + NSMapTableCopyIn = NSPointerFunctionsCopyIn, + NSMapTableObjectPointerPersonality = NSPointerFunctionsObjectPointerPersonality +} + +struct NSMapEnumerator +{ + NSUInteger _pi; + NSUInteger _si; + void* _bs; +} + + +struct NSMapTableKeyCallBacks +{ + void* notAKeyMarker; +} + + +struct NSMapTableValueCallBacks +{ +} + +class NSMapTable : NSObject, INSCopying, INSCoding, INSFastEnumeration +{ + mixin ObjcWrap; + + Object initWithKeyOptions (uint keyOptions, uint valueOptions, NSUInteger initialCapacity) + { + return invokeObjcSelf!(Object, "initWithKeyOptions:valueOptions:capacity:", uint, uint, NSUInteger)(keyOptions, valueOptions, initialCapacity); + } + + this (uint keyOptions, uint valueOptions, NSUInteger initialCapacity) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithKeyOptions:valueOptions:capacity:", uint, uint, NSUInteger)(objcObject, keyOptions, valueOptions, initialCapacity); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithKeyPointerFunctions (NSPointerFunctions keyFunctions, NSPointerFunctions valueFunctions, NSUInteger initialCapacity) + { + return invokeObjcSelf!(Object, "initWithKeyPointerFunctions:valuePointerFunctions:capacity:", NSPointerFunctions, NSPointerFunctions, NSUInteger)(keyFunctions, valueFunctions, initialCapacity); + } + + this (NSPointerFunctions keyFunctions, NSPointerFunctions valueFunctions, NSUInteger initialCapacity) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithKeyPointerFunctions:valuePointerFunctions:capacity:", NSPointerFunctions, NSPointerFunctions, NSUInteger)(objcObject, keyFunctions, valueFunctions, initialCapacity); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object mapTableWithKeyOptions (uint keyOptions, uint valueOptions) + { + return invokeObjcSelfClass!(Object, "mapTableWithKeyOptions:valueOptions:", uint, uint)(keyOptions, valueOptions); + } + + static Object mapTableWithStrongToStrongObjects () + { + return invokeObjcSelfClass!(Object, "mapTableWithStrongToStrongObjects"); + } + + static Object mapTableWithWeakToStrongObjects () + { + return invokeObjcSelfClass!(Object, "mapTableWithWeakToStrongObjects"); + } + + static Object mapTableWithStrongToWeakObjects () + { + return invokeObjcSelfClass!(Object, "mapTableWithStrongToWeakObjects"); + } + + static Object mapTableWithWeakToWeakObjects () + { + return invokeObjcSelfClass!(Object, "mapTableWithWeakToWeakObjects"); + } + + NSPointerFunctions keyPointerFunctions () + { + return invokeObjcSelf!(NSPointerFunctions, "keyPointerFunctions"); + } + + NSPointerFunctions valuePointerFunctions () + { + return invokeObjcSelf!(NSPointerFunctions, "valuePointerFunctions"); + } + + Object objectForKey (Object aKey) + { + return invokeObjcSelf!(Object, "objectForKey:", Object)(aKey); + } + + void removeObjectForKey (Object aKey) + { + return invokeObjcSelf!(void, "removeObjectForKey:", Object)(aKey); + } + + void setObject (Object anObject, Object aKey) + { + return invokeObjcSelf!(void, "setObject:forKey:", Object, Object)(anObject, aKey); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + NSEnumerator keyEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "keyEnumerator"); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + NSDictionary dictionaryRepresentation () + { + return invokeObjcSelf!(NSDictionary, "dictionaryRepresentation"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } +} + +void NSFreeMapTable (NSMapTable table) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSFreeMapTable, NSMapTable)(table); +} + +void NSResetMapTable (NSMapTable table) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSResetMapTable, NSMapTable)(table); +} + +bool NSCompareMapTables (NSMapTable table1, NSMapTable table2) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSCompareMapTables, NSMapTable, NSMapTable)(table1, table2); +} + +NSMapTable NSCopyMapTableWithZone (NSMapTable table, NSZone* zone) +{ + return Bridge.invokeObjcFunction!(NSMapTable, bindings.NSCopyMapTableWithZone, NSMapTable, NSZone*)(table, zone); +} + +bool NSMapMember (NSMapTable table, void* key, void** originalKey, void** value) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSMapMember, NSMapTable, void*, void**, void**)(table, key, originalKey, value); +} + +void* NSMapGet (NSMapTable table, void* key) +{ + return Bridge.invokeObjcFunction!(void*, bindings.NSMapGet, NSMapTable, void*)(table, key); +} + +void NSMapInsert (NSMapTable table, void* key, void* value) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSMapInsert, NSMapTable, void*, void*)(table, key, value); +} + +void NSMapInsertKnownAbsent (NSMapTable table, void* key, void* value) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSMapInsertKnownAbsent, NSMapTable, void*, void*)(table, key, value); +} + +void* NSMapInsertIfAbsent (NSMapTable table, void* key, void* value) +{ + return Bridge.invokeObjcFunction!(void*, bindings.NSMapInsertIfAbsent, NSMapTable, void*, void*)(table, key, value); +} + +void NSMapRemove (NSMapTable table, void* key) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSMapRemove, NSMapTable, void*)(table, key); +} + +NSMapEnumerator NSEnumerateMapTable (NSMapTable table) +{ + return Bridge.invokeObjcFunction!(NSMapEnumerator, bindings.NSEnumerateMapTable, NSMapTable)(table); +} + +NSUInteger NSCountMapTable (NSMapTable table) +{ + return Bridge.invokeObjcFunction!(NSUInteger, bindings.NSCountMapTable, NSMapTable)(table); +} + +NSString NSStringFromMapTable (NSMapTable table) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromMapTable, NSMapTable)(table); +} + +NSArray NSAllMapTableKeys (NSMapTable table) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSAllMapTableKeys, NSMapTable)(table); +} + +NSArray NSAllMapTableValues (NSMapTable table) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSAllMapTableValues, NSMapTable)(table); +} + +NSMapTable NSCreateMapTableWithZone (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity, NSZone* zone) +{ + return Bridge.invokeObjcFunction!(NSMapTable, bindings.NSCreateMapTableWithZone, NSMapTableKeyCallBacks, NSMapTableValueCallBacks, NSUInteger, NSZone*)(keyCallBacks, valueCallBacks, capacity, zone); +} + +NSMapTable NSCreateMapTable (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity) +{ + return Bridge.invokeObjcFunction!(NSMapTable, bindings.NSCreateMapTable, NSMapTableKeyCallBacks, NSMapTableValueCallBacks, NSUInteger)(keyCallBacks, valueCallBacks, capacity); +} + +extern (C) +{ + bool NSNextMapEnumeratorPair (NSMapEnumerator* enumerator, void** key, void** value); + void NSEndMapTableEnumeration (NSMapEnumerator* enumerator); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSMapTable_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSMapTable_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,39 @@ +module dstep.foundation.NSMapTable_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSMapTable; +import dstep.foundation.NSPointerFunctions; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + } +} + +extern (C) +{ + private void NSFreeMapTable (id table); + private void NSResetMapTable (id table); + private bool NSCompareMapTables (id table1, id table2); + private id NSCopyMapTableWithZone (id table, NSZone* zone); + private bool NSMapMember (id table, void* key, void** originalKey, void** value); + private void* NSMapGet (id table, void* key); + private void NSMapInsert (id table, void* key, void* value); + private void NSMapInsertKnownAbsent (id table, void* key, void* value); + private void* NSMapInsertIfAbsent (id table, void* key, void* value); + private void NSMapRemove (id table, void* key); + private NSMapEnumerator NSEnumerateMapTable (id table); + private NSUInteger NSCountMapTable (id table); + private id NSStringFromMapTable (id table); + private id NSAllMapTableKeys (id table); + private id NSAllMapTableValues (id table); + private id NSCreateMapTableWithZone (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity, NSZone* zone); + private id NSCreateMapTable (NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSMetadata.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSMetadata.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,285 @@ +/** + * 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.NSMetadata; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSMetadataItem; +import dstep.foundation.NSMetadataQueryAttributeValueTuple; +import dstep.foundation.NSMetadataQueryResultGroup; +import dstep.foundation.NSObject; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSMetadata_bindings; + +const NSString NSMetadataQueryDidStartGatheringNotification; +const NSString NSMetadataQueryGatheringProgressNotification; +const NSString NSMetadataQueryDidFinishGatheringNotification; +const NSString NSMetadataQueryDidUpdateNotification; +const NSString NSMetadataQueryResultContentRelevanceAttribute; +const NSString NSMetadataQueryUserHomeScope; +const NSString NSMetadataQueryLocalComputerScope; +const NSString NSMetadataQueryNetworkScope; + +static this () +{ + NSMetadataQueryDidStartGatheringNotification = new NSString(bindings.NSMetadataQueryDidStartGatheringNotification); + NSMetadataQueryGatheringProgressNotification = new NSString(bindings.NSMetadataQueryGatheringProgressNotification); + NSMetadataQueryDidFinishGatheringNotification = new NSString(bindings.NSMetadataQueryDidFinishGatheringNotification); + NSMetadataQueryDidUpdateNotification = new NSString(bindings.NSMetadataQueryDidUpdateNotification); + NSMetadataQueryResultContentRelevanceAttribute = new NSString(bindings.NSMetadataQueryResultContentRelevanceAttribute); + NSMetadataQueryUserHomeScope = new NSString(bindings.NSMetadataQueryUserHomeScope); + NSMetadataQueryLocalComputerScope = new NSString(bindings.NSMetadataQueryLocalComputerScope); + NSMetadataQueryNetworkScope = new NSString(bindings.NSMetadataQueryNetworkScope); +} + +class NSMetadataQueryResultGroup : NSObject +{ + mixin ObjcWrap; + + NSString attribute () + { + return invokeObjcSelf!(NSString, "attribute"); + } + + Object value () + { + return invokeObjcSelf!(Object, "value"); + } + + NSArray subgroups () + { + return invokeObjcSelf!(NSArray, "subgroups"); + } + + NSUInteger resultCount () + { + return invokeObjcSelf!(NSUInteger, "resultCount"); + } + + Object resultAtIndex (NSUInteger idx) + { + return invokeObjcSelf!(Object, "resultAtIndex:", NSUInteger)(idx); + } + + NSArray results () + { + return invokeObjcSelf!(NSArray, "results"); + } +} + +class NSMetadataItem : NSObject +{ + mixin ObjcWrap; + + Object valueForAttribute (NSString key) + { + return invokeObjcSelf!(Object, "valueForAttribute:", NSString)(key); + } + + NSDictionary valuesForAttributes (NSArray keys) + { + return invokeObjcSelf!(NSDictionary, "valuesForAttributes:", NSArray)(keys); + } + + NSArray attributes () + { + return invokeObjcSelf!(NSArray, "attributes"); + } +} + +class NSMetadataQuery : NSObject +{ + mixin ObjcWrap; + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + NSPredicate predicate () + { + return invokeObjcSelf!(NSPredicate, "predicate"); + } + + void setPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "setPredicate:", NSPredicate)(predicate); + } + + NSArray sortDescriptors () + { + return invokeObjcSelf!(NSArray, "sortDescriptors"); + } + + void setSortDescriptors (NSArray descriptors) + { + return invokeObjcSelf!(void, "setSortDescriptors:", NSArray)(descriptors); + } + + NSArray valueListAttributes () + { + return invokeObjcSelf!(NSArray, "valueListAttributes"); + } + + void setValueListAttributes (NSArray attrs) + { + return invokeObjcSelf!(void, "setValueListAttributes:", NSArray)(attrs); + } + + NSArray groupingAttributes () + { + return invokeObjcSelf!(NSArray, "groupingAttributes"); + } + + void setGroupingAttributes (NSArray attrs) + { + return invokeObjcSelf!(void, "setGroupingAttributes:", NSArray)(attrs); + } + + double notificationBatchingInterval () + { + return invokeObjcSelf!(double, "notificationBatchingInterval"); + } + + void setNotificationBatchingInterval (double ti) + { + return invokeObjcSelf!(void, "setNotificationBatchingInterval:", double)(ti); + } + + NSArray searchScopes () + { + return invokeObjcSelf!(NSArray, "searchScopes"); + } + + void setSearchScopes (NSArray scopes) + { + return invokeObjcSelf!(void, "setSearchScopes:", NSArray)(scopes); + } + + bool startQuery () + { + return invokeObjcSelf!(bool, "startQuery"); + } + + void stopQuery () + { + return invokeObjcSelf!(void, "stopQuery"); + } + + bool isStarted () + { + return invokeObjcSelf!(bool, "isStarted"); + } + + bool isGathering () + { + return invokeObjcSelf!(bool, "isGathering"); + } + + bool isStopped () + { + return invokeObjcSelf!(bool, "isStopped"); + } + + void disableUpdates () + { + return invokeObjcSelf!(void, "disableUpdates"); + } + + void enableUpdates () + { + return invokeObjcSelf!(void, "enableUpdates"); + } + + NSUInteger resultCount () + { + return invokeObjcSelf!(NSUInteger, "resultCount"); + } + + Object resultAtIndex (NSUInteger idx) + { + return invokeObjcSelf!(Object, "resultAtIndex:", NSUInteger)(idx); + } + + NSArray results () + { + return invokeObjcSelf!(NSArray, "results"); + } + + NSUInteger indexOfResult (Object result) + { + return invokeObjcSelf!(NSUInteger, "indexOfResult:", Object)(result); + } + + NSDictionary valueLists () + { + return invokeObjcSelf!(NSDictionary, "valueLists"); + } + + NSArray groupedResults () + { + return invokeObjcSelf!(NSArray, "groupedResults"); + } + + Object valueOfAttribute (NSString attrName, NSUInteger idx) + { + return invokeObjcSelf!(Object, "valueOfAttribute:forResultAtIndex:", NSString, NSUInteger)(attrName, idx); + } +} + +class NSMetadataQueryAttributeValueTuple : NSObject +{ + mixin ObjcWrap; + + NSString attribute () + { + return invokeObjcSelf!(NSString, "attribute"); + } + + Object value () + { + return invokeObjcSelf!(Object, "value"); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } +} + +template TNSMetadataQueryDelegate () +{ + Object metadataQuery (NSMetadataQuery query, NSMetadataItem result); + Object metadataQuery (NSMetadataQuery query, NSString attrName, Object attrValue); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSMetadata_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSMetadata_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,30 @@ +module dstep.foundation.NSMetadata_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSMetadataItem; +import dstep.foundation.NSMetadataQueryAttributeValueTuple; +import dstep.foundation.NSMetadataQueryResultGroup; +import dstep.foundation.NSObject; +import dstep.foundation.NSPredicate; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSMetadataQueryDidStartGatheringNotification; + package const id NSMetadataQueryGatheringProgressNotification; + package const id NSMetadataQueryDidFinishGatheringNotification; + package const id NSMetadataQueryDidUpdateNotification; + package const id NSMetadataQueryResultContentRelevanceAttribute; + package const id NSMetadataQueryUserHomeScope; + package const id NSMetadataQueryLocalComputerScope; + package const id NSMetadataQueryNetworkScope; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSMethodSignature.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSMethodSignature.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,51 @@ +/** + * 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.NSMethodSignature; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSMethodSignature : NSObject +{ + mixin ObjcWrap; + + static NSMethodSignature signatureWithObjCTypes (char* types) + { + return invokeObjcSelfClass!(NSMethodSignature, "signatureWithObjCTypes:", char*)(typesreturn result is this.objcObject ? this : (result !is null ? new NSMethodSignature(result) : null); } + + NSUInteger numberOfArguments () + { + return invokeObjcSelf!(NSUInteger, "numberOfArguments"); + } + + char* getArgumentTypeAtIndex (NSUInteger idx) + { + return invokeObjcSelf!(char*, "getArgumentTypeAtIndex:", NSUInteger)(idx); + } + + NSUInteger frameLength () + { + return invokeObjcSelf!(NSUInteger, "frameLength"); + } + + bool isOneway () + { + return invokeObjcSelf!(bool, "isOneway"); + } + + char* methodReturnType () + { + return invokeObjcSelf!(char*, "methodReturnType"); + } + + NSUInteger methodReturnLength () + { + return invokeObjcSelf!(NSUInteger, "methodReturnLength"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSNetServices.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSNetServices.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,291 @@ +/** + * 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.NSNetServices; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSInputStream; +import dstep.foundation.NSObject; +import dstep.foundation.NSOutputStream; +import dstep.foundation.NSRunLoop; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSNetServices_bindings; + +alias NSInteger NSNetServicesError; +alias NSUInteger NSNetServiceOptions; + +const NSString NSNetServicesErrorCode; +const NSString NSNetServicesErrorDomain; + +enum +{ + NSNetServicesUnknownError = -72000, + NSNetServicesCollisionError = -72001, + NSNetServicesNotFoundError = -72002, + NSNetServicesActivityInProgress = -72003, + NSNetServicesBadArgumentError = -72004, + NSNetServicesCancelledError = -72005, + NSNetServicesInvalidError = -72006, + NSNetServicesTimeoutError = -72007 +} + +enum +{ + NSNetServiceNoAutoRename = 1 << 0 +} + +static this () +{ + NSNetServicesErrorCode = new NSString(bindings.NSNetServicesErrorCode); + NSNetServicesErrorDomain = new NSString(bindings.NSNetServicesErrorDomain); +} + +class NSNetService : NSObject +{ + mixin ObjcWrap; + + Object initWithDomain (NSString domain, NSString type, NSString name, int port) + { + return invokeObjcSelf!(Object, "initWithDomain:type:name:port:", NSString, NSString, NSString, int)(domain, type, name, port); + } + + this (NSString domain, NSString type, NSString name, int port) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDomain:type:name:port:", NSString, NSString, NSString, int)(objcObject, domain, type, name, port); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithDomain (NSString domain, NSString type, NSString name) + { + return invokeObjcSelf!(Object, "initWithDomain:type:name:", NSString, NSString, NSString)(domain, type, name); + } + + this (NSString domain, NSString type, NSString name) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDomain:type:name:", NSString, NSString, NSString)(objcObject, domain, type, name); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + void scheduleInRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "scheduleInRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } + + void removeFromRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "removeFromRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } + + NSString domain () + { + return invokeObjcSelf!(NSString, "domain"); + } + + NSString type () + { + return invokeObjcSelf!(NSString, "type"); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSArray addresses () + { + return invokeObjcSelf!(NSArray, "addresses"); + } + + NSInteger port () + { + return invokeObjcSelf!(NSInteger, "port"); + } + + void publish () + { + return invokeObjcSelf!(void, "publish"); + } + + void publishWithOptions (uint options) + { + return invokeObjcSelf!(void, "publishWithOptions:", uint)(options); + } + + void resolve () + { + return invokeObjcSelf!(void, "resolve"); + } + + void stop () + { + return invokeObjcSelf!(void, "stop"); + } + + static NSDictionary dictionaryFromTXTRecordData (NSData txtData) + { + return invokeObjcSelfClass!(NSDictionary, "dictionaryFromTXTRecordData:", NSData)(txtData); + } + + static NSData dataFromTXTRecordDictionary (NSDictionary txtDictionary) + { + return invokeObjcSelfClass!(NSData, "dataFromTXTRecordDictionary:", NSDictionary)(txtDictionary); + } + + NSString hostName () + { + return invokeObjcSelf!(NSString, "hostName"); + } + + void resolveWithTimeout (double timeout) + { + return invokeObjcSelf!(void, "resolveWithTimeout:", double)(timeout); + } + + bool getInputStream (NSInputStream** inputStream, NSOutputStream** outputStream) + { + return invokeObjcSelf!(bool, "getInputStream:outputStream:", NSInputStream**, NSOutputStream**)(inputStream, outputStream); + } + + bool setTXTRecordData (NSData recordData) + { + return invokeObjcSelf!(bool, "setTXTRecordData:", NSData)(recordData); + } + + NSData TXTRecordData () + { + return invokeObjcSelf!(NSData, "TXTRecordData"); + } + + void startMonitoring () + { + return invokeObjcSelf!(void, "startMonitoring"); + } + + void stopMonitoring () + { + return invokeObjcSelf!(void, "stopMonitoring"); + } +} + +class NSNetServiceBrowser : NSObject +{ + mixin ObjcWrap; + mixin TNSDeprecated; + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + void scheduleInRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "scheduleInRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } + + void removeFromRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "removeFromRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } + + void searchForBrowsableDomains () + { + return invokeObjcSelf!(void, "searchForBrowsableDomains"); + } + + void searchForRegistrationDomains () + { + return invokeObjcSelf!(void, "searchForRegistrationDomains"); + } + + void searchForServicesOfType (NSString type, NSString domainString) + { + return invokeObjcSelf!(void, "searchForServicesOfType:inDomain:", NSString, NSString)(type, domainString); + } + + void stop () + { + return invokeObjcSelf!(void, "stop"); + } +} + +template TNSDeprecated () +{ + void searchForAllDomains () + { + return invokeObjcSelf!(void, "searchForAllDomains"); + } +} + +template TNSNetServiceDelegateMethods () +{ + void netServiceWillPublish (NSNetService sender); + void netServiceDidPublish (NSNetService sender); + void netService (NSNetService sender, NSDictionary errorDict); + void netServiceWillResolve (NSNetService sender); + void netServiceDidResolveAddress (NSNetService sender); + void netService (NSNetService sender, NSDictionary errorDict); + void netServiceDidStop (NSNetService sender); + void netService (NSNetService sender, NSData data); +} + +template TNSNetServiceBrowserDelegateMethods () +{ + void netServiceBrowserWillSearch (NSNetServiceBrowser aNetServiceBrowser); + void netServiceBrowserDidStopSearch (NSNetServiceBrowser aNetServiceBrowser); + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSDictionary errorDict); + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing); + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing); + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSString domainString, bool moreComing); + void netServiceBrowser (NSNetServiceBrowser aNetServiceBrowser, NSNetService aNetService, bool moreComing); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSNetServices_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSNetServices_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,24 @@ +module dstep.foundation.NSNetServices_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSInputStream; +import dstep.foundation.NSObject; +import dstep.foundation.NSOutputStream; +import dstep.foundation.NSRunLoop; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSNetServicesErrorCode; + package const id NSNetServicesErrorDomain; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSNotification.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSNotification.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,114 @@ +/** + * 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.NSNotification; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSNotification : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSNotificationCreation; + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + Object object () + { + return invokeObjcSelf!(Object, "object"); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSNotificationCenter : NSObject +{ + mixin ObjcWrap; + + static Object defaultCenter () + { + return invokeObjcSelfClass!(Object, "defaultCenter"); + } + + void addObserver (Object observer, SEL aSelector, NSString aName, Object anObject) + { + return invokeObjcSelf!(void, "addObserver:selector:name:object:", Object, SEL, NSString, Object)(observer, aSelector, aName, anObject); + } + + void postNotification (NSNotification notification) + { + return invokeObjcSelf!(void, "postNotification:", NSNotification)(notification); + } + + void postNotificationName (NSString aName, Object anObject) + { + return invokeObjcSelf!(void, "postNotificationName:object:", NSString, Object)(aName, anObject); + } + + void postNotificationName (NSString aName, Object anObject, NSDictionary aUserInfo) + { + return invokeObjcSelf!(void, "postNotificationName:object:userInfo:", NSString, Object, NSDictionary)(aName, anObject, aUserInfo); + } + + void removeObserver (Object observer) + { + return invokeObjcSelf!(void, "removeObserver:", Object)(observer); + } + + void removeObserver (Object observer, NSString aName, Object anObject) + { + return invokeObjcSelf!(void, "removeObserver:name:object:", Object, NSString, Object)(observer, aName, anObject); + } +} + +template TNSNotificationCreation () +{ + static Object notificationWithName (NSString aName, Object anObject) + { + return invokeObjcSelfClass!(Object, "notificationWithName:object:", NSString, Object)(aName, anObject); + } + + static Object notificationWithName (NSString aName, Object anObject, NSDictionary aUserInfo) + { + return invokeObjcSelfClass!(Object, "notificationWithName:object:userInfo:", NSString, Object, NSDictionary)(aName, anObject, aUserInfo); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSNotificationQueue.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSNotificationQueue.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,73 @@ +/** + * 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.NSNotificationQueue; + +import dstep.foundation.NSArray; +import dstep.foundation.NSNotification; +import dstep.foundation.NSNotificationCenter; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSPostingStyle; +alias NSUInteger NSNotificationCoalescing; + +enum +{ + NSPostWhenIdle = 1, + NSPostASAP = 2, + NSPostNow = 3 +} + +enum +{ + NSNotificationNoCoalescing = 0, + NSNotificationCoalescingOnName = 1, + NSNotificationCoalescingOnSender = 2 +} + +class NSNotificationQueue : NSObject +{ + mixin ObjcWrap; + + static Object defaultQueue () + { + return invokeObjcSelfClass!(Object, "defaultQueue"); + } + + Object initWithNotificationCenter (NSNotificationCenter notificationCenter) + { + return invokeObjcSelf!(Object, "initWithNotificationCenter:", NSNotificationCenter)(notificationCenter); + } + + this (NSNotificationCenter notificationCenter) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithNotificationCenter:", NSNotificationCenter)(objcObject, notificationCenter); + + if (result) + objcObject = ret; + + dObject = this; + } + + void enqueueNotification (NSNotification notification, uint postingStyle) + { + return invokeObjcSelf!(void, "enqueueNotification:postingStyle:", NSNotification, uint)(notification, postingStyle); + } + + void enqueueNotification (NSNotification notification, uint postingStyle, NSUInteger coalesceMask, NSArray modes) + { + return invokeObjcSelf!(void, "enqueueNotification:postingStyle:coalesceMask:forModes:", NSNotification, uint, NSUInteger, NSArray)(notification, postingStyle, coalesceMask, modes); + } + + void dequeueNotificationsMatching (NSNotification notification, NSUInteger coalesceMask) + { + return invokeObjcSelf!(void, "dequeueNotificationsMatching:coalesceMask:", NSNotification, NSUInteger)(notification, coalesceMask); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSNull.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSNull.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,47 @@ +/** + * 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.NSNull; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSNull : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + static NSNull null_ () + { + return invokeObjcSelfClass!(NSNull, "null"return result is this.objcObject ? this : (result !is null ? new NSNull(result) : null); } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSNumberFormatter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSNumberFormatter.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,748 @@ +/** + * 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.NSNumberFormatter; + +import dstep.corefoundation.CFNumberFormatter; +import dstep.foundation.NSDecimalNumberHandler; +import dstep.foundation.NSError; +import dstep.foundation.NSFormatter; +import dstep.foundation.NSLocale; +import dstep.foundation.NSMutableDictionary; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSNumberFormatterStyle; +alias NSUInteger NSNumberFormatterBehavior; +alias NSUInteger NSNumberFormatterPadPosition; +alias NSUInteger NSNumberFormatterRoundingMode; + +enum +{ + NSNumberFormatterNoStyle = kCFNumberFormatterNoStyle, + NSNumberFormatterDecimalStyle = kCFNumberFormatterDecimalStyle, + NSNumberFormatterCurrencyStyle = kCFNumberFormatterCurrencyStyle, + NSNumberFormatterPercentStyle = kCFNumberFormatterPercentStyle, + NSNumberFormatterScientificStyle = kCFNumberFormatterScientificStyle, + NSNumberFormatterSpellOutStyle = kCFNumberFormatterSpellOutStyle +} + +enum +{ + NSNumberFormatterBehaviorDefault = 0, + NSNumberFormatterBehavior10_0 = 1000, + NSNumberFormatterBehavior10_4 = 1040 +} + +enum +{ + NSNumberFormatterPadBeforePrefix = kCFNumberFormatterPadBeforePrefix, + NSNumberFormatterPadAfterPrefix = kCFNumberFormatterPadAfterPrefix, + NSNumberFormatterPadBeforeSuffix = kCFNumberFormatterPadBeforeSuffix, + NSNumberFormatterPadAfterSuffix = kCFNumberFormatterPadAfterSuffix +} + +enum +{ + NSNumberFormatterRoundCeiling = kCFNumberFormatterRoundCeiling, + NSNumberFormatterRoundFloor = kCFNumberFormatterRoundFloor, + NSNumberFormatterRoundDown = kCFNumberFormatterRoundDown, + NSNumberFormatterRoundUp = kCFNumberFormatterRoundUp, + NSNumberFormatterRoundHalfEven = kCFNumberFormatterRoundHalfEven, + NSNumberFormatterRoundHalfDown = kCFNumberFormatterRoundHalfDown, + NSNumberFormatterRoundHalfUp = kCFNumberFormatterRoundHalfUp +} + +class NSNumberFormatter : NSFormatter +{ + mixin ObjcWrap; + mixin TNSNumberFormatterCompatibility; + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + bool getObjectValue (id* obj, NSString string, NSRange* rangep, NSError** error) + { + return invokeObjcSelf!(bool, "getObjectValue:forString:range:error:", id*, NSString, NSRange*, NSError**)(obj, string, rangep, error); + } + + NSString stringFromNumber (NSNumber number) + { + return invokeObjcSelf!(NSString, "stringFromNumber:", NSNumber)(number); + } + + NSNumber numberFromString (NSString string) + { + return invokeObjcSelf!(NSNumber, "numberFromString:", NSString)(string); + } + + uint numberStyle () + { + return invokeObjcSelf!(uint, "numberStyle"); + } + + void setNumberStyle (uint style) + { + return invokeObjcSelf!(void, "setNumberStyle:", uint)(style); + } + + NSLocale locale () + { + return invokeObjcSelf!(NSLocale, "locale"); + } + + void setLocale (NSLocale locale) + { + return invokeObjcSelf!(void, "setLocale:", NSLocale)(locale); + } + + bool generatesDecimalNumbers () + { + return invokeObjcSelf!(bool, "generatesDecimalNumbers"); + } + + void setGeneratesDecimalNumbers (bool b) + { + return invokeObjcSelf!(void, "setGeneratesDecimalNumbers:", bool)(b); + } + + uint formatterBehavior () + { + return invokeObjcSelf!(uint, "formatterBehavior"); + } + + void setFormatterBehavior (uint behavior) + { + return invokeObjcSelf!(void, "setFormatterBehavior:", uint)(behavior); + } + + static uint defaultFormatterBehavior () + { + return invokeObjcSelfClass!(uint, "defaultFormatterBehavior"); + } + + static void setDefaultFormatterBehavior (uint behavior) + { + return invokeObjcSelfClass!(void, "setDefaultFormatterBehavior:", uint)(behavior); + } + + NSString negativeFormat () + { + return invokeObjcSelf!(NSString, "negativeFormat"); + } + + void setNegativeFormat (NSString format) + { + return invokeObjcSelf!(void, "setNegativeFormat:", NSString)(format); + } + + NSDictionary textAttributesForNegativeValues () + { + return invokeObjcSelf!(NSDictionary, "textAttributesForNegativeValues"); + } + + void setTextAttributesForNegativeValues (NSDictionary newAttributes) + { + return invokeObjcSelf!(void, "setTextAttributesForNegativeValues:", NSDictionary)(newAttributes); + } + + NSString positiveFormat () + { + return invokeObjcSelf!(NSString, "positiveFormat"); + } + + void setPositiveFormat (NSString format) + { + return invokeObjcSelf!(void, "setPositiveFormat:", NSString)(format); + } + + NSDictionary textAttributesForPositiveValues () + { + return invokeObjcSelf!(NSDictionary, "textAttributesForPositiveValues"); + } + + void setTextAttributesForPositiveValues (NSDictionary newAttributes) + { + return invokeObjcSelf!(void, "setTextAttributesForPositiveValues:", NSDictionary)(newAttributes); + } + + bool allowsFloats () + { + return invokeObjcSelf!(bool, "allowsFloats"); + } + + void setAllowsFloats (bool flag) + { + return invokeObjcSelf!(void, "setAllowsFloats:", bool)(flag); + } + + NSString decimalSeparator () + { + return invokeObjcSelf!(NSString, "decimalSeparator"); + } + + void setDecimalSeparator (NSString string) + { + return invokeObjcSelf!(void, "setDecimalSeparator:", NSString)(string); + } + + bool alwaysShowsDecimalSeparator () + { + return invokeObjcSelf!(bool, "alwaysShowsDecimalSeparator"); + } + + void setAlwaysShowsDecimalSeparator (bool b) + { + return invokeObjcSelf!(void, "setAlwaysShowsDecimalSeparator:", bool)(b); + } + + NSString currencyDecimalSeparator () + { + return invokeObjcSelf!(NSString, "currencyDecimalSeparator"); + } + + void setCurrencyDecimalSeparator (NSString string) + { + return invokeObjcSelf!(void, "setCurrencyDecimalSeparator:", NSString)(string); + } + + bool usesGroupingSeparator () + { + return invokeObjcSelf!(bool, "usesGroupingSeparator"); + } + + void setUsesGroupingSeparator (bool b) + { + return invokeObjcSelf!(void, "setUsesGroupingSeparator:", bool)(b); + } + + NSString groupingSeparator () + { + return invokeObjcSelf!(NSString, "groupingSeparator"); + } + + void setGroupingSeparator (NSString string) + { + return invokeObjcSelf!(void, "setGroupingSeparator:", NSString)(string); + } + + NSString zeroSymbol () + { + return invokeObjcSelf!(NSString, "zeroSymbol"); + } + + void setZeroSymbol (NSString string) + { + return invokeObjcSelf!(void, "setZeroSymbol:", NSString)(string); + } + + NSDictionary textAttributesForZero () + { + return invokeObjcSelf!(NSDictionary, "textAttributesForZero"); + } + + void setTextAttributesForZero (NSDictionary newAttributes) + { + return invokeObjcSelf!(void, "setTextAttributesForZero:", NSDictionary)(newAttributes); + } + + NSString nilSymbol () + { + return invokeObjcSelf!(NSString, "nilSymbol"); + } + + void setNilSymbol (NSString string) + { + return invokeObjcSelf!(void, "setNilSymbol:", NSString)(string); + } + + NSDictionary textAttributesForNil () + { + return invokeObjcSelf!(NSDictionary, "textAttributesForNil"); + } + + void setTextAttributesForNil (NSDictionary newAttributes) + { + return invokeObjcSelf!(void, "setTextAttributesForNil:", NSDictionary)(newAttributes); + } + + NSString notANumberSymbol () + { + return invokeObjcSelf!(NSString, "notANumberSymbol"); + } + + void setNotANumberSymbol (NSString string) + { + return invokeObjcSelf!(void, "setNotANumberSymbol:", NSString)(string); + } + + NSDictionary textAttributesForNotANumber () + { + return invokeObjcSelf!(NSDictionary, "textAttributesForNotANumber"); + } + + void setTextAttributesForNotANumber (NSDictionary newAttributes) + { + return invokeObjcSelf!(void, "setTextAttributesForNotANumber:", NSDictionary)(newAttributes); + } + + NSString positiveInfinitySymbol () + { + return invokeObjcSelf!(NSString, "positiveInfinitySymbol"); + } + + void setPositiveInfinitySymbol (NSString string) + { + return invokeObjcSelf!(void, "setPositiveInfinitySymbol:", NSString)(string); + } + + NSDictionary textAttributesForPositiveInfinity () + { + return invokeObjcSelf!(NSDictionary, "textAttributesForPositiveInfinity"); + } + + void setTextAttributesForPositiveInfinity (NSDictionary newAttributes) + { + return invokeObjcSelf!(void, "setTextAttributesForPositiveInfinity:", NSDictionary)(newAttributes); + } + + NSString negativeInfinitySymbol () + { + return invokeObjcSelf!(NSString, "negativeInfinitySymbol"); + } + + void setNegativeInfinitySymbol (NSString string) + { + return invokeObjcSelf!(void, "setNegativeInfinitySymbol:", NSString)(string); + } + + NSDictionary textAttributesForNegativeInfinity () + { + return invokeObjcSelf!(NSDictionary, "textAttributesForNegativeInfinity"); + } + + void setTextAttributesForNegativeInfinity (NSDictionary newAttributes) + { + return invokeObjcSelf!(void, "setTextAttributesForNegativeInfinity:", NSDictionary)(newAttributes); + } + + NSString positivePrefix () + { + return invokeObjcSelf!(NSString, "positivePrefix"); + } + + void setPositivePrefix (NSString string) + { + return invokeObjcSelf!(void, "setPositivePrefix:", NSString)(string); + } + + NSString positiveSuffix () + { + return invokeObjcSelf!(NSString, "positiveSuffix"); + } + + void setPositiveSuffix (NSString string) + { + return invokeObjcSelf!(void, "setPositiveSuffix:", NSString)(string); + } + + NSString negativePrefix () + { + return invokeObjcSelf!(NSString, "negativePrefix"); + } + + void setNegativePrefix (NSString string) + { + return invokeObjcSelf!(void, "setNegativePrefix:", NSString)(string); + } + + NSString negativeSuffix () + { + return invokeObjcSelf!(NSString, "negativeSuffix"); + } + + void setNegativeSuffix (NSString string) + { + return invokeObjcSelf!(void, "setNegativeSuffix:", NSString)(string); + } + + NSString currencyCode () + { + return invokeObjcSelf!(NSString, "currencyCode"); + } + + void setCurrencyCode (NSString string) + { + return invokeObjcSelf!(void, "setCurrencyCode:", NSString)(string); + } + + NSString currencySymbol () + { + return invokeObjcSelf!(NSString, "currencySymbol"); + } + + void setCurrencySymbol (NSString string) + { + return invokeObjcSelf!(void, "setCurrencySymbol:", NSString)(string); + } + + NSString internationalCurrencySymbol () + { + return invokeObjcSelf!(NSString, "internationalCurrencySymbol"); + } + + void setInternationalCurrencySymbol (NSString string) + { + return invokeObjcSelf!(void, "setInternationalCurrencySymbol:", NSString)(string); + } + + NSString percentSymbol () + { + return invokeObjcSelf!(NSString, "percentSymbol"); + } + + void setPercentSymbol (NSString string) + { + return invokeObjcSelf!(void, "setPercentSymbol:", NSString)(string); + } + + NSString perMillSymbol () + { + return invokeObjcSelf!(NSString, "perMillSymbol"); + } + + void setPerMillSymbol (NSString string) + { + return invokeObjcSelf!(void, "setPerMillSymbol:", NSString)(string); + } + + NSString minusSign () + { + return invokeObjcSelf!(NSString, "minusSign"); + } + + void setMinusSign (NSString string) + { + return invokeObjcSelf!(void, "setMinusSign:", NSString)(string); + } + + NSString plusSign () + { + return invokeObjcSelf!(NSString, "plusSign"); + } + + void setPlusSign (NSString string) + { + return invokeObjcSelf!(void, "setPlusSign:", NSString)(string); + } + + NSString exponentSymbol () + { + return invokeObjcSelf!(NSString, "exponentSymbol"); + } + + void setExponentSymbol (NSString string) + { + return invokeObjcSelf!(void, "setExponentSymbol:", NSString)(string); + } + + NSUInteger groupingSize () + { + return invokeObjcSelf!(NSUInteger, "groupingSize"); + } + + void setGroupingSize (NSUInteger number) + { + return invokeObjcSelf!(void, "setGroupingSize:", NSUInteger)(number); + } + + NSUInteger secondaryGroupingSize () + { + return invokeObjcSelf!(NSUInteger, "secondaryGroupingSize"); + } + + void setSecondaryGroupingSize (NSUInteger number) + { + return invokeObjcSelf!(void, "setSecondaryGroupingSize:", NSUInteger)(number); + } + + NSNumber multiplier () + { + return invokeObjcSelf!(NSNumber, "multiplier"); + } + + void setMultiplier (NSNumber number) + { + return invokeObjcSelf!(void, "setMultiplier:", NSNumber)(number); + } + + NSUInteger formatWidth () + { + return invokeObjcSelf!(NSUInteger, "formatWidth"); + } + + void setFormatWidth (NSUInteger number) + { + return invokeObjcSelf!(void, "setFormatWidth:", NSUInteger)(number); + } + + NSString paddingCharacter () + { + return invokeObjcSelf!(NSString, "paddingCharacter"); + } + + void setPaddingCharacter (NSString string) + { + return invokeObjcSelf!(void, "setPaddingCharacter:", NSString)(string); + } + + uint paddingPosition () + { + return invokeObjcSelf!(uint, "paddingPosition"); + } + + void setPaddingPosition (uint position) + { + return invokeObjcSelf!(void, "setPaddingPosition:", uint)(position); + } + + uint roundingMode () + { + return invokeObjcSelf!(uint, "roundingMode"); + } + + void setRoundingMode (uint mode) + { + return invokeObjcSelf!(void, "setRoundingMode:", uint)(mode); + } + + NSNumber roundingIncrement () + { + return invokeObjcSelf!(NSNumber, "roundingIncrement"); + } + + void setRoundingIncrement (NSNumber number) + { + return invokeObjcSelf!(void, "setRoundingIncrement:", NSNumber)(number); + } + + NSUInteger minimumIntegerDigits () + { + return invokeObjcSelf!(NSUInteger, "minimumIntegerDigits"); + } + + void setMinimumIntegerDigits (NSUInteger number) + { + return invokeObjcSelf!(void, "setMinimumIntegerDigits:", NSUInteger)(number); + } + + NSUInteger maximumIntegerDigits () + { + return invokeObjcSelf!(NSUInteger, "maximumIntegerDigits"); + } + + void setMaximumIntegerDigits (NSUInteger number) + { + return invokeObjcSelf!(void, "setMaximumIntegerDigits:", NSUInteger)(number); + } + + NSUInteger minimumFractionDigits () + { + return invokeObjcSelf!(NSUInteger, "minimumFractionDigits"); + } + + void setMinimumFractionDigits (NSUInteger number) + { + return invokeObjcSelf!(void, "setMinimumFractionDigits:", NSUInteger)(number); + } + + NSUInteger maximumFractionDigits () + { + return invokeObjcSelf!(NSUInteger, "maximumFractionDigits"); + } + + void setMaximumFractionDigits (NSUInteger number) + { + return invokeObjcSelf!(void, "setMaximumFractionDigits:", NSUInteger)(number); + } + + NSNumber minimum () + { + return invokeObjcSelf!(NSNumber, "minimum"); + } + + void setMinimum (NSNumber number) + { + return invokeObjcSelf!(void, "setMinimum:", NSNumber)(number); + } + + NSNumber maximum () + { + return invokeObjcSelf!(NSNumber, "maximum"); + } + + void setMaximum (NSNumber number) + { + return invokeObjcSelf!(void, "setMaximum:", NSNumber)(number); + } + + NSString currencyGroupingSeparator () + { + return invokeObjcSelf!(NSString, "currencyGroupingSeparator"); + } + + void setCurrencyGroupingSeparator (NSString string) + { + return invokeObjcSelf!(void, "setCurrencyGroupingSeparator:", NSString)(string); + } + + bool isLenient () + { + return invokeObjcSelf!(bool, "isLenient"); + } + + void setLenient (bool b) + { + return invokeObjcSelf!(void, "setLenient:", bool)(b); + } + + bool usesSignificantDigits () + { + return invokeObjcSelf!(bool, "usesSignificantDigits"); + } + + void setUsesSignificantDigits (bool b) + { + return invokeObjcSelf!(void, "setUsesSignificantDigits:", bool)(b); + } + + NSUInteger minimumSignificantDigits () + { + return invokeObjcSelf!(NSUInteger, "minimumSignificantDigits"); + } + + void setMinimumSignificantDigits (NSUInteger number) + { + return invokeObjcSelf!(void, "setMinimumSignificantDigits:", NSUInteger)(number); + } + + NSUInteger maximumSignificantDigits () + { + return invokeObjcSelf!(NSUInteger, "maximumSignificantDigits"); + } + + void setMaximumSignificantDigits (NSUInteger number) + { + return invokeObjcSelf!(void, "setMaximumSignificantDigits:", NSUInteger)(number); + } + + bool isPartialStringValidationEnabled () + { + return invokeObjcSelf!(bool, "isPartialStringValidationEnabled"); + } + + void setPartialStringValidationEnabled (bool b) + { + return invokeObjcSelf!(void, "setPartialStringValidationEnabled:", bool)(b); + } +} + +template TNSNumberFormatterCompatibility () +{ + bool hasThousandSeparators () + { + return invokeObjcSelf!(bool, "hasThousandSeparators"); + } + + void setHasThousandSeparators (bool flag) + { + return invokeObjcSelf!(void, "setHasThousandSeparators:", bool)(flag); + } + + NSString thousandSeparator () + { + return invokeObjcSelf!(NSString, "thousandSeparator"); + } + + void setThousandSeparator (NSString newSeparator) + { + return invokeObjcSelf!(void, "setThousandSeparator:", NSString)(newSeparator); + } + + bool localizesFormat () + { + return invokeObjcSelf!(bool, "localizesFormat"); + } + + void setLocalizesFormat (bool flag) + { + return invokeObjcSelf!(void, "setLocalizesFormat:", bool)(flag); + } + + NSString format () + { + return invokeObjcSelf!(NSString, "format"); + } + + void setFormat (NSString string) + { + return invokeObjcSelf!(void, "setFormat:", NSString)(string); + } + + NSAttributedString attributedStringForZero () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringForZero"); + } + + void setAttributedStringForZero (NSAttributedString newAttributedString) + { + return invokeObjcSelf!(void, "setAttributedStringForZero:", NSAttributedString)(newAttributedString); + } + + NSAttributedString attributedStringForNil () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringForNil"); + } + + void setAttributedStringForNil (NSAttributedString newAttributedString) + { + return invokeObjcSelf!(void, "setAttributedStringForNil:", NSAttributedString)(newAttributedString); + } + + NSAttributedString attributedStringForNotANumber () + { + return invokeObjcSelf!(NSAttributedString, "attributedStringForNotANumber"); + } + + void setAttributedStringForNotANumber (NSAttributedString newAttributedString) + { + return invokeObjcSelf!(void, "setAttributedStringForNotANumber:", NSAttributedString)(newAttributedString); + } + + NSDecimalNumberHandler roundingBehavior () + { + return invokeObjcSelf!(NSDecimalNumberHandler, "roundingBehavior"); + } + + void setRoundingBehavior (NSDecimalNumberHandler newRoundingBehavior) + { + return invokeObjcSelf!(void, "setRoundingBehavior:", NSDecimalNumberHandler)(newRoundingBehavior); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSObjCRuntime.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSObjCRuntime.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,88 @@ +/** + * 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.NSObjCRuntime; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSString; +import dstep.foundation.Protocol; +import dstep.limits; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.objc.objc; +import dstep.stdarg; +import dstep.stdint; + +import bindings = dstep.foundation.NSObjCRuntime_bindings; + +alias int NSInteger; +alias uint NSUInteger; +alias NSInteger NSComparisonResult; + +extern (C) +{ + extern + { + double NSFoundationVersionNumber; + } +} + +enum _NSComparisonResult +{ + NSOrderedAscending = -1, + NSOrderedSame, + NSOrderedDescending +} + +enum +{ + NSNotFound = 2147483647L +} + +NSString NSStringFromSelector (SEL aSelector) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromSelector, SEL)(aSelector); +} + +SEL NSSelectorFromString (NSString aSelectorName) +{ + return Bridge.invokeObjcFunction!(SEL, bindings.NSSelectorFromString, NSString)(aSelectorName); +} + +NSString NSStringFromClass (Class aClass) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromClass, Class)(aClass); +} + +Class NSClassFromString (NSString aClassName) +{ + return Bridge.invokeObjcFunction!(Class, bindings.NSClassFromString, NSString)(aClassName); +} + +NSString NSStringFromProtocol (Protocol proto) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromProtocol, Protocol)(proto); +} + +Protocol NSProtocolFromString (NSString namestr) +{ + return Bridge.invokeObjcFunction!(Protocol, bindings.NSProtocolFromString, NSString)(namestr); +} + +void NSLog (NSString format, ...) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSLog, NSString)(format); +} + +void NSLogv (NSString format, char* args) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSLogv, NSString, char*)(format, args); +} + +extern (C) +{ + char* NSGetSizeAndAlignment (char* typePtr, NSUInteger* sizep, NSUInteger* alignp); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSObjCRuntime_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSObjCRuntime_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,31 @@ +module dstep.foundation.NSObjCRuntime_bindings; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSString; +import dstep.foundation.Protocol; +import dstep.limits; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.objc.objc; +import dstep.stdarg; +import dstep.stdint; + + +extern (C) +{ + extern + { + } +} + +extern (C) +{ + private id NSStringFromSelector (SEL aSelector); + private SEL NSSelectorFromString (id aSelectorName); + private id NSStringFromClass (Class aClass); + private Class NSClassFromString (id aClassName); + private id NSStringFromProtocol (id proto); + private id NSProtocolFromString (id namestr); + private void NSLog (id format, ...); + private void NSLogv (id format, char* args); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSObject.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSObject.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,387 @@ +/** + * 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.NSObject; + +import dstep.foundation.NSCoder; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSInvocation; +import dstep.foundation.NSMethodSignature; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.foundation.NSZone; +import dstep.foundation.Protocol; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSObject : INSObject +{ + mixin ObjcWrap; + mixin TNSURLConnectionDelegate; + mixin TNSFileManagerFileOperationAdditions; + mixin TNSDeprecatedKeyValueCoding; + mixin TNSDistributedObjects; + mixin TNSArchiverCallback; + mixin TNSKeyValueObserverNotification; + mixin TNSMetadataQueryDelegate; + mixin TNSKeyValueObservingCustomization; + mixin TNSKeyedArchiverObjectSubstitution; + mixin TNSScriptClassDescription; + mixin TNSDelayedPerforming; + mixin TNSStreamDelegateEventExtensions; + mixin TNSCopyLinkMoveHandler; + mixin TNSMachPortDelegateMethods; + mixin TNSComparisonMethods; + mixin TNSSpellServerDelegate; + mixin TNSScriptKeyValueCoding; + mixin TNSDistantObjectRequestMethods; + mixin TNSClassDescriptionPrimitives; + mixin TNSKeyedUnarchiverObjectSubstitution; + mixin TNSScriptObjectSpecifiers; + mixin TNSNetServiceDelegateMethods; + mixin TNSConnectionDelegateMethods; + mixin TNSXMLParserDelegateEventAdditions; + mixin TNSErrorRecoveryAttempting; + mixin TNSDeprecatedMethods; + mixin TNSPortDelegateMethods; + mixin TNSURLClient; + mixin TNSScriptingComparisonMethods; + mixin TNSNetServiceBrowserDelegateMethods; + mixin TNSCoderMethods; + mixin TNSDeprecatedKeyValueObservingCustomization; + mixin TNSKeyedUnarchiverDelegate; + mixin TNSScripting; + mixin TNSURLDownloadDelegate; + mixin TNSKeyValueCoding; + mixin TNSKeyedArchiverDelegate; + mixin TNSThreadPerformAdditions; + mixin TNSKeyValueObserving; + + static void load () + { + return invokeObjcSelfClass!(void, "load"); + } + + static void initialize () + { + return invokeObjcSelfClass!(void, "initialize"); + } + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object new_ () + { + return invokeObjcSelfClass!(Object, "new"); + } + + static Object allocWithZone (NSZone* zone) + { + return invokeObjcSelfClass!(Object, "allocWithZone:", NSZone*)(zone); + } + + static Object alloc () + { + return invokeObjcSelfClass!(Object, "alloc"); + } + + void dealloc () + { + return invokeObjcSelf!(void, "dealloc"); + } + + void finalize () + { + return invokeObjcSelf!(void, "finalize"); + } + + Object copy () + { + return invokeObjcSelf!(Object, "copy"); + } + + Object mutableCopy () + { + return invokeObjcSelf!(Object, "mutableCopy"); + } + + static Object copyWithZone (NSZone* zone) + { + return invokeObjcSelfClass!(Object, "copyWithZone:", NSZone*)(zone); + } + + static Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelfClass!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + static Class superclass () + { + return invokeObjcSelfClass!(Class, "superclass"); + } + + static Class class_ () + { + return invokeObjcSelfClass!(Class, "class"); + } + + static bool instancesRespondToSelector (SEL aSelector) + { + return invokeObjcSelfClass!(bool, "instancesRespondToSelector:", SEL)(aSelector); + } + + static bool conformsToProtocol (Protocol protocol) + { + return invokeObjcSelfClass!(bool, "conformsToProtocol:", Protocol)(protocol); + } + + IMP methodForSelector (SEL aSelector) + { + return invokeObjcSelf!(IMP, "methodForSelector:", SEL)(aSelector); + } + + static IMP instanceMethodForSelector (SEL aSelector) + { + return invokeObjcSelfClass!(IMP, "instanceMethodForSelector:", SEL)(aSelector); + } + + void doesNotRecognizeSelector (SEL aSelector) + { + return invokeObjcSelf!(void, "doesNotRecognizeSelector:", SEL)(aSelector); + } + + void forwardInvocation (NSInvocation anInvocation) + { + return invokeObjcSelf!(void, "forwardInvocation:", NSInvocation)(anInvocation); + } + + NSMethodSignature methodSignatureForSelector (SEL aSelector) + { + return invokeObjcSelf!(NSMethodSignature, "methodSignatureForSelector:", SEL)(aSelector); + } + + static NSMethodSignature instanceMethodSignatureForSelector (SEL aSelector) + { + return invokeObjcSelfClass!(NSMethodSignature, "instanceMethodSignatureForSelector:", SEL)(aSelector); + } + + static NSString description () + { + return invokeObjcSelfClass!(NSString, "description"); + } + + static bool isSubclassOfClass (Class aClass) + { + return invokeObjcSelfClass!(bool, "isSubclassOfClass:", Class)(aClass); + } + + static bool resolveClassMethod (SEL sel) + { + return invokeObjcSelfClass!(bool, "resolveClassMethod:", SEL)(sel); + } + + static bool resolveInstanceMethod (SEL sel) + { + return invokeObjcSelfClass!(bool, "resolveInstanceMethod:", SEL)(sel); + } + + bool isEqual (Object object) + { + return invokeObjcSelf!(bool, "isEqual:", Object)(object); + } + + NSUInteger hash () + { + return invokeObjcSelf!(NSUInteger, "hash"); + } + + Class superclass () + { + return invokeObjcSelf!(Class, "superclass"); + } + + Class class_ () + { + return invokeObjcSelf!(Class, "class"); + } + + Object self () + { + return invokeObjcSelf!(Object, "self"); + } + + NSZone* zone () + { + return invokeObjcSelf!(NSZone*, "zone"); + } + + Object performSelector (SEL aSelector) + { + return invokeObjcSelf!(Object, "performSelector:", SEL)(aSelector); + } + + Object performSelector (SEL aSelector, Object object) + { + return invokeObjcSelf!(Object, "performSelector:withObject:", SEL, Object)(aSelector, object); + } + + Object performSelector (SEL aSelector, Object object1, Object object2) + { + return invokeObjcSelf!(Object, "performSelector:withObject:withObject:", SEL, Object, Object)(aSelector, object1, object2); + } + + bool isProxy () + { + return invokeObjcSelf!(bool, "isProxy"); + } + + bool isKindOfClass (Class aClass) + { + return invokeObjcSelf!(bool, "isKindOfClass:", Class)(aClass); + } + + bool isMemberOfClass (Class aClass) + { + return invokeObjcSelf!(bool, "isMemberOfClass:", Class)(aClass); + } + + bool conformsToProtocol (Protocol aProtocol) + { + return invokeObjcSelf!(bool, "conformsToProtocol:", Protocol)(aProtocol); + } + + bool respondsToSelector (SEL aSelector) + { + return invokeObjcSelf!(bool, "respondsToSelector:", SEL)(aSelector); + } + + Object retain () + { + return invokeObjcSelf!(Object, "retain"); + } + + void release () + { + return invokeObjcSelf!(void, "release"); + } + + Object autorelease () + { + return invokeObjcSelf!(Object, "autorelease"); + } + + NSUInteger retainCount () + { + return invokeObjcSelf!(NSUInteger, "retainCount"); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } +} + +interface INSCopying +{ + Object copyWithZone (NSZone* zone); +} + +interface INSObject +{ + bool isEqual (Object object); + NSUInteger hash (); + Class superclass (); + Class class_ (); + Object self (); + NSZone* zone (); + Object performSelector (SEL aSelector); + Object performSelector (SEL aSelector, Object object); + Object performSelector (SEL aSelector, Object object1, Object object2); + bool isProxy (); + bool isKindOfClass (Class aClass); + bool isMemberOfClass (Class aClass); + bool conformsToProtocol (Protocol aProtocol); + bool respondsToSelector (SEL aSelector); + Object retain (); + void release (); + Object autorelease (); + NSUInteger retainCount (); + NSString description (); +} + +interface INSMutableCopying +{ + Object mutableCopyWithZone (NSZone* zone); +} + +interface INSCoding +{ + void encodeWithCoder (NSCoder aCoder); + Object initWithCoder (NSCoder aDecoder); +} + +template TNSDeprecatedMethods () +{ + static void poseAsClass (Class aClass); +} + +template TNSCoderMethods () +{ + static NSInteger version_ (); + static void setVersion (NSInteger aVersion); + Class classForCoder (); + Object replacementObjectForCoder (NSCoder aCoder); + Object awakeAfterUsingCoder (NSCoder aDecoder); +} + +Object NSAllocateObject (Class aClass, NSUInteger extraBytes, NSZone* zone) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSAllocateObject, Class, NSUInteger, NSZone*)(aClass, extraBytes, zone); +} + +void NSDeallocateObject (Object object) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSDeallocateObject, Object)(object); +} + +Object NSCopyObject (Object object, NSUInteger extraBytes, NSZone* zone) +{ + return Bridge.invokeObjcFunction!(Object, bindings.NSCopyObject, Object, NSUInteger, NSZone*)(object, extraBytes, zone); +} + +bool NSShouldRetainWithZone (Object anObject, NSZone* requestedZone) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSShouldRetainWithZone, Object, NSZone*)(anObject, requestedZone); +} + +void NSIncrementExtraRefCount (Object object) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSIncrementExtraRefCount, Object)(object); +} + +bool NSDecrementExtraRefCountWasZero (Object object) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSDecrementExtraRefCountWasZero, Object)(object); +} + +NSUInteger NSExtraRefCount (Object object) +{ + return Bridge.invokeObjcFunction!(NSUInteger, bindings.NSExtraRefCount, Object)(object); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSObjectScripting.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSObjectScripting.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,23 @@ +/** + * 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.NSObjectScripting; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptObjectSpecifier; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +template TNSScripting () +{ + Object scriptingValueForSpecifier (NSScriptObjectSpecifier objectSpecifier); + NSDictionary scriptingProperties (); + void setScriptingProperties (NSDictionary properties); + Object copyScriptingValue (Object value, NSString key, NSDictionary properties); + Object newScriptingObjectOfClass (Class objectClass, NSString key, Object contentsValue, NSDictionary properties); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSOperation.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSOperation.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,219 @@ +/** + * 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.NSOperation; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSSet; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSOperation_bindings; + +alias NSInteger NSOperationQueuePriority; + +const NSString NSInvocationOperationVoidResultException; +const NSString NSInvocationOperationCancelledException; + +enum +{ + NSOperationQueuePriorityVeryLow = -8, + NSOperationQueuePriorityLow = -4, + NSOperationQueuePriorityNormal = 0, + NSOperationQueuePriorityHigh = 4, + NSOperationQueuePriorityVeryHigh = 8 +} + +enum +{ + NSOperationQueueDefaultMaxConcurrentOperationCount = -1 +} + +static this () +{ + NSInvocationOperationVoidResultException = new NSString(bindings.NSInvocationOperationVoidResultException); + NSInvocationOperationCancelledException = new NSString(bindings.NSInvocationOperationCancelledException); +} + +class NSOperation : NSObject +{ + mixin ObjcWrap; + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + void start () + { + return invokeObjcSelf!(void, "start"); + } + + void main () + { + return invokeObjcSelf!(void, "main"); + } + + bool isCancelled () + { + return invokeObjcSelf!(bool, "isCancelled"); + } + + void cancel () + { + return invokeObjcSelf!(void, "cancel"); + } + + bool isExecuting () + { + return invokeObjcSelf!(bool, "isExecuting"); + } + + bool isFinished () + { + return invokeObjcSelf!(bool, "isFinished"); + } + + bool isConcurrent () + { + return invokeObjcSelf!(bool, "isConcurrent"); + } + + bool isReady () + { + return invokeObjcSelf!(bool, "isReady"); + } + + void addDependency (NSOperation op) + { + return invokeObjcSelf!(void, "addDependency:", NSOperation)(op); + } + + void removeDependency (NSOperation op) + { + return invokeObjcSelf!(void, "removeDependency:", NSOperation)(op); + } + + NSArray dependencies () + { + return invokeObjcSelf!(NSArray, "dependencies"); + } + + int queuePriority () + { + return invokeObjcSelf!(int, "queuePriority"); + } + + void setQueuePriority (int p) + { + return invokeObjcSelf!(void, "setQueuePriority:", int)(p); + } +} + +class NSOperationQueue : NSObject +{ + mixin ObjcWrap; + + void addOperation (NSOperation op) + { + return invokeObjcSelf!(void, "addOperation:", NSOperation)(op); + } + + NSArray operations () + { + return invokeObjcSelf!(NSArray, "operations"); + } + + NSInteger maxConcurrentOperationCount () + { + return invokeObjcSelf!(NSInteger, "maxConcurrentOperationCount"); + } + + void setMaxConcurrentOperationCount (NSInteger cnt) + { + return invokeObjcSelf!(void, "setMaxConcurrentOperationCount:", NSInteger)(cnt); + } + + void setSuspended (bool b) + { + return invokeObjcSelf!(void, "setSuspended:", bool)(b); + } + + bool isSuspended () + { + return invokeObjcSelf!(bool, "isSuspended"); + } + + void cancelAllOperations () + { + return invokeObjcSelf!(void, "cancelAllOperations"); + } + + void waitUntilAllOperationsAreFinished () + { + return invokeObjcSelf!(void, "waitUntilAllOperationsAreFinished"); + } +} + +class NSInvocationOperation : NSOperation +{ + mixin ObjcWrap; + + Object initWithTarget (Object target, SEL sel, Object arg) + { + return invokeObjcSelf!(Object, "initWithTarget:selector:object:", Object, SEL, Object)(target, sel, arg); + } + + this (Object target, SEL sel, Object arg) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTarget:selector:object:", Object, SEL, Object)(objcObject, target, sel, arg); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithInvocation (NSInvocation inv) + { + return invokeObjcSelf!(Object, "initWithInvocation:", NSInvocation)(inv); + } + + this (NSInvocation inv) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithInvocation:", NSInvocation)(objcObject, inv); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSInvocation invocation () + { + return invokeObjcSelf!(NSInvocation, "invocation"); + } + + Object result () + { + return invokeObjcSelf!(Object, "result"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSOperation_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSOperation_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,18 @@ +module dstep.foundation.NSOperation_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSSet; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSInvocationOperationVoidResultException; + package const id NSInvocationOperationCancelledException; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPathUtilities.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPathUtilities.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,176 @@ +/** + * 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.NSPathUtilities; + +import dstep.foundation.NSArray; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSSearchPathDirectory; +alias NSUInteger NSSearchPathDomainMask; + +enum +{ + NSApplicationDirectory = 1, + NSDemoApplicationDirectory, + NSDeveloperApplicationDirectory, + NSAdminApplicationDirectory, + NSLibraryDirectory, + NSDeveloperDirectory, + NSUserDirectory, + NSDocumentationDirectory, + NSDocumentDirectory, + NSCoreServiceDirectory, + NSDesktopDirectory = 12, + NSCachesDirectory = 13, + NSApplicationSupportDirectory = 14, + NSDownloadsDirectory = 15, + NSAllApplicationsDirectory = 100, + NSAllLibrariesDirectory = 101 +} + +enum +{ + NSUserDomainMask = 1, + NSLocalDomainMask = 2, + NSNetworkDomainMask = 4, + NSSystemDomainMask = 8, + NSAllDomainsMask = 0x0ffff +} + +template TNSStringPathExtensions () +{ + static NSString pathWithComponents (NSArray components) + { + return invokeObjcSelfClass!(NSString, "pathWithComponents:", NSArray)(components); + } + + NSArray pathComponents () + { + return invokeObjcSelf!(NSArray, "pathComponents"); + } + + bool isAbsolutePath () + { + return invokeObjcSelf!(bool, "isAbsolutePath"); + } + + NSString lastPathComponent () + { + return invokeObjcSelf!(NSString, "lastPathComponent"); + } + + NSString stringByDeletingLastPathComponent () + { + return invokeObjcSelf!(NSString, "stringByDeletingLastPathComponent"); + } + + NSString stringByAppendingPathComponent (NSString str) + { + return invokeObjcSelf!(NSString, "stringByAppendingPathComponent:", NSString)(str); + } + + NSString pathExtension () + { + return invokeObjcSelf!(NSString, "pathExtension"); + } + + NSString stringByDeletingPathExtension () + { + return invokeObjcSelf!(NSString, "stringByDeletingPathExtension"); + } + + NSString stringByAppendingPathExtension (NSString str) + { + return invokeObjcSelf!(NSString, "stringByAppendingPathExtension:", NSString)(str); + } + + NSString stringByAbbreviatingWithTildeInPath () + { + return invokeObjcSelf!(NSString, "stringByAbbreviatingWithTildeInPath"); + } + + NSString stringByExpandingTildeInPath () + { + return invokeObjcSelf!(NSString, "stringByExpandingTildeInPath"); + } + + NSString stringByStandardizingPath () + { + return invokeObjcSelf!(NSString, "stringByStandardizingPath"); + } + + NSString stringByResolvingSymlinksInPath () + { + return invokeObjcSelf!(NSString, "stringByResolvingSymlinksInPath"); + } + + NSArray stringsByAppendingPaths (NSArray paths) + { + return invokeObjcSelf!(NSArray, "stringsByAppendingPaths:", NSArray)(paths); + } + + NSUInteger completePathIntoString (NSString** outputName, bool flag, NSArray** outputArray, NSArray filterTypes) + { + return invokeObjcSelf!(NSUInteger, "completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:", NSString**, bool, NSArray**, NSArray)(outputName, flag, outputArray, filterTypes); + } + + char* fileSystemRepresentation () + { + return invokeObjcSelf!(char*, "fileSystemRepresentation"); + } + + bool getFileSystemRepresentation (char* cname, NSUInteger max) + { + return invokeObjcSelf!(bool, "getFileSystemRepresentation:maxLength:", char*, NSUInteger)(cname, max); + } +} + +template TNSArrayPathExtensions () +{ + NSArray pathsMatchingExtensions (NSArray filterTypes) + { + return invokeObjcSelf!(NSArray, "pathsMatchingExtensions:", NSArray)(filterTypes); + } +} + +NSString NSUserName () +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSUserName); +} + +NSString NSFullUserName () +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSFullUserName); +} + +NSString NSHomeDirectory () +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSHomeDirectory); +} + +NSString NSHomeDirectoryForUser (NSString userName) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSHomeDirectoryForUser, NSString)(userName); +} + +NSString NSTemporaryDirectory () +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSTemporaryDirectory); +} + +NSString NSOpenStepRootDirectory () +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSOpenStepRootDirectory); +} + +NSArray NSSearchPathForDirectoriesInDomains (uint directory, uint domainMask, bool expandTilde) +{ + return Bridge.invokeObjcFunction!(NSArray, bindings.NSSearchPathForDirectoriesInDomains, uint, uint, bool)(directory, domainMask, expandTilde); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPointerArray.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPointerArray.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,156 @@ +/** + * 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.NSPointerArray; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSPointerFunctions; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSPointerArray : NSObject, INSFastEnumeration, INSCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSArrayConveniences; + + 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 = ret; + + dObject = this; + } + + Object initWithPointerFunctions (NSPointerFunctions functions) + { + return invokeObjcSelf!(Object, "initWithPointerFunctions:", NSPointerFunctions)(functions); + } + + this (NSPointerFunctions functions) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithPointerFunctions:", NSPointerFunctions)(objcObject, functions); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object pointerArrayWithOptions (uint options) + { + return invokeObjcSelfClass!(Object, "pointerArrayWithOptions:", uint)(options); + } + + static Object pointerArrayWithPointerFunctions (NSPointerFunctions functions) + { + return invokeObjcSelfClass!(Object, "pointerArrayWithPointerFunctions:", NSPointerFunctions)(functions); + } + + NSPointerFunctions pointerFunctions () + { + return invokeObjcSelf!(NSPointerFunctions, "pointerFunctions"); + } + + void* pointerAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void*, "pointerAtIndex:", NSUInteger)(index); + } + + void addPointer (void* pointer) + { + return invokeObjcSelf!(void, "addPointer:", void*)(pointer); + } + + void removePointerAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removePointerAtIndex:", NSUInteger)(index); + } + + void insertPointer (void* item, NSUInteger index) + { + return invokeObjcSelf!(void, "insertPointer:atIndex:", void*, NSUInteger)(item, index); + } + + void replacePointerAtIndex (NSUInteger index, void* item) + { + return invokeObjcSelf!(void, "replacePointerAtIndex:withPointer:", NSUInteger, void*)(index, item); + } + + void compact () + { + return invokeObjcSelf!(void, "compact"); + } + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + void setCount (NSUInteger count) + { + return invokeObjcSelf!(void, "setCount:", NSUInteger)(count); + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSArrayConveniences () +{ + static Object pointerArrayWithStrongObjects () + { + return invokeObjcSelfClass!(Object, "pointerArrayWithStrongObjects"); + } + + static Object pointerArrayWithWeakObjects () + { + return invokeObjcSelfClass!(Object, "pointerArrayWithWeakObjects"); + } + + NSArray allObjects () + { + return invokeObjcSelf!(NSArray, "allObjects"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPointerFunctions.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPointerFunctions.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,81 @@ +/** + * 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.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +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; + + 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 = ret; + + dObject = this; + } + + static Object pointerFunctionsWithOptions (uint options) + { + return invokeObjcSelfClass!(Object, "pointerFunctionsWithOptions:", uint)(options); + } + + bool usesStrongWriteBarrier () + { + return invokeObjcSelf!(bool, "usesStrongWriteBarrier"); + } + + void setUsesStrongWriteBarrier (bool ) + { + return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)(); + } + + bool usesWeakReadAndWriteBarriers () + { + return invokeObjcSelf!(bool, "usesWeakReadAndWriteBarriers"); + } + + void setUsesWeakReadAndWriteBarriers (bool ) + { + return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)(); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPort.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPort.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,329 @@ +/** + * 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.NSPort; + +import dstep.foundation.NSConnection; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSPortMessage; +import dstep.foundation.NSRunLoop; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSPort_bindings; + +alias int NSSocketNativeHandle; + +const NSString NSPortDidBecomeInvalidNotification; + +enum +{ + NSMachPortDeallocateNone = 0, + NSMachPortDeallocateSendRight = (1 << 0), + NSMachPortDeallocateReceiveRight = (1 << 1) +} + +static this () +{ + NSPortDidBecomeInvalidNotification = new NSString(bindings.NSPortDidBecomeInvalidNotification); +} + +class NSPort : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + + static Object allocWithZone (NSZone* zone) + { + return invokeObjcSelfClass!(Object, "allocWithZone:", NSZone*)(zone); + } + + static NSPort port () + { + return invokeObjcSelfClass!(NSPort, "port"return result is this.objcObject ? this : (result !is null ? new NSPort(result) : null); } + + void invalidate () + { + return invokeObjcSelf!(void, "invalidate"); + } + + bool isValid () + { + return invokeObjcSelf!(bool, "isValid"); + } + + void setDelegate (Object anId) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anId); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void scheduleInRunLoop (NSRunLoop runLoop, NSString mode) + { + return invokeObjcSelf!(void, "scheduleInRunLoop:forMode:", NSRunLoop, NSString)(runLoop, mode); + } + + void removeFromRunLoop (NSRunLoop runLoop, NSString mode) + { + return invokeObjcSelf!(void, "removeFromRunLoop:forMode:", NSRunLoop, NSString)(runLoop, mode); + } + + NSUInteger reservedSpaceLength () + { + return invokeObjcSelf!(NSUInteger, "reservedSpaceLength"); + } + + bool sendBeforeDate (NSDate limitDate, NSMutableArray components, NSPort receivePort, NSUInteger headerSpaceReserved) + { + return invokeObjcSelf!(bool, "sendBeforeDate:components:from:reserved:", NSDate, NSMutableArray, NSPort, NSUInteger)(limitDate, components, receivePort, headerSpaceReserved); + } + + bool sendBeforeDate (NSDate limitDate, NSUInteger msgID, NSMutableArray components, NSPort receivePort, NSUInteger headerSpaceReserved) + { + return invokeObjcSelf!(bool, "sendBeforeDate:msgid:components:from:reserved:", NSDate, NSUInteger, NSMutableArray, NSPort, NSUInteger)(limitDate, msgID, components, receivePort, headerSpaceReserved); + } + + void addConnection (NSConnection conn, NSRunLoop runLoop, NSString mode) + { + return invokeObjcSelf!(void, "addConnection:toRunLoop:forMode:", NSConnection, NSRunLoop, NSString)(conn, runLoop, mode); + } + + void removeConnection (NSConnection conn, NSRunLoop runLoop, NSString mode) + { + return invokeObjcSelf!(void, "removeConnection:fromRunLoop:forMode:", NSConnection, NSRunLoop, NSString)(conn, runLoop, mode); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSSocketPort : NSPort +{ + mixin ObjcWrap; + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithTCPPort (ushort port) + { + return invokeObjcSelf!(Object, "initWithTCPPort:", ushort)(port); + } + + this (ushort port) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTCPPort:", ushort)(objcObject, port); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithProtocolFamily (int family, int type, int protocol, NSData address) + { + return invokeObjcSelf!(Object, "initWithProtocolFamily:socketType:protocol:address:", int, int, int, NSData)(family, type, protocol, address); + } + + this (int family, int type, int protocol, NSData address) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithProtocolFamily:socketType:protocol:address:", int, int, int, NSData)(objcObject, family, type, protocol, address); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithProtocolFamily (int family, int type, int protocol, int sock) + { + return invokeObjcSelf!(Object, "initWithProtocolFamily:socketType:protocol:socket:", int, int, int, int)(family, type, protocol, sock); + } + + this (int family, int type, int protocol, int sock) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithProtocolFamily:socketType:protocol:socket:", int, int, int, int)(objcObject, family, type, protocol, sock); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initRemoteWithTCPPort (ushort port, NSString hostName) + { + return invokeObjcSelf!(Object, "initRemoteWithTCPPort:host:", ushort, NSString)(port, hostName); + } + + this (ushort port, NSString hostName) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initRemoteWithTCPPort:host:", ushort, NSString)(objcObject, port, hostName); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initRemoteWithProtocolFamily (int family, int type, int protocol, NSData address) + { + return invokeObjcSelf!(Object, "initRemoteWithProtocolFamily:socketType:protocol:address:", int, int, int, NSData)(family, type, protocol, address); + } + + this (int family, int type, int protocol, NSData address) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initRemoteWithProtocolFamily:socketType:protocol:address:", int, int, int, NSData)(objcObject, family, type, protocol, address); + + if (result) + objcObject = ret; + + dObject = this; + } + + int protocolFamily () + { + return invokeObjcSelf!(int, "protocolFamily"); + } + + int socketType () + { + return invokeObjcSelf!(int, "socketType"); + } + + int protocol () + { + return invokeObjcSelf!(int, "protocol"); + } + + NSData address () + { + return invokeObjcSelf!(NSData, "address"); + } + + int socket () + { + return invokeObjcSelf!(int, "socket"); + } +} + +class NSMachPort : NSPort +{ + mixin ObjcWrap; + + static NSPort portWithMachPort (uint machPort) + { + return invokeObjcSelfClass!(NSPort, "portWithMachPort:", uint)(machPort); + } + + Object initWithMachPort (uint machPort) + { + return invokeObjcSelf!(Object, "initWithMachPort:", uint)(machPort); + } + + this (uint machPort) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithMachPort:", uint)(objcObject, machPort); + + if (result) + objcObject = ret; + + dObject = this; + } + + static NSPort portWithMachPort (uint machPort, NSUInteger f) + { + return invokeObjcSelfClass!(NSPort, "portWithMachPort:options:", uint, NSUInteger)(machPort, f); + } + + Object initWithMachPort (uint machPort, NSUInteger f) + { + return invokeObjcSelf!(Object, "initWithMachPort:options:", uint, NSUInteger)(machPort, f); + } + + this (uint machPort, NSUInteger f) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithMachPort:options:", uint, NSUInteger)(objcObject, machPort, f); + + if (result) + objcObject = ret; + + dObject = this; + } + + uint machPort () + { + return invokeObjcSelf!(uint, "machPort"); + } + + void scheduleInRunLoop (NSRunLoop runLoop, NSString mode) + { + return invokeObjcSelf!(void, "scheduleInRunLoop:forMode:", NSRunLoop, NSString)(runLoop, mode); + } + + void removeFromRunLoop (NSRunLoop runLoop, NSString mode) + { + return invokeObjcSelf!(void, "removeFromRunLoop:forMode:", NSRunLoop, NSString)(runLoop, mode); + } +} + +template TNSMachPortDelegateMethods () +{ + void handleMachMessage (void* msg); +} + +template TNSPortDelegateMethods () +{ + void handlePortMessage (NSPortMessage message); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPortCoder.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPortCoder.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,77 @@ +/** + * 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.NSPortCoder; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCoder; +import dstep.foundation.NSConnection; +import dstep.foundation.NSPort; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSPortCoder : NSCoder +{ + mixin ObjcWrap; + + bool isBycopy () + { + return invokeObjcSelf!(bool, "isBycopy"); + } + + bool isByref () + { + return invokeObjcSelf!(bool, "isByref"); + } + + NSConnection connection () + { + return invokeObjcSelf!(NSConnection, "connection"); + } + + void encodePortObject (NSPort aport) + { + return invokeObjcSelf!(void, "encodePortObject:", NSPort)(aport); + } + + NSPort decodePortObject () + { + return invokeObjcSelf!(NSPort, "decodePortObject"); + } + + static Object portCoderWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps) + { + return invokeObjcSelfClass!(Object, "portCoderWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps); + } + + Object initWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps) + { + return invokeObjcSelf!(Object, "initWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps); + } + + this (NSPort rcvPort, NSPort sndPort, NSArray comps) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(objcObject, rcvPort, sndPort, comps); + + if (result) + objcObject = ret; + + dObject = this; + } + + void dispatch () + { + return invokeObjcSelf!(void, "dispatch"); + } +} + +template TNSDistributedObjects () +{ + Class classForPortCoder (); + Object replacementObjectForPortCoder (NSPortCoder coder); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPortMessage.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPortMessage.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,67 @@ +/** + * 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.NSPortMessage; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSPortMessage : NSObject +{ + mixin ObjcWrap; + + Object initWithSendPort (NSPort sendPort, NSPort replyPort, NSArray components) + { + return invokeObjcSelf!(Object, "initWithSendPort:receivePort:components:", NSPort, NSPort, NSArray)(sendPort, replyPort, components); + } + + this (NSPort sendPort, NSPort replyPort, NSArray components) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithSendPort:receivePort:components:", NSPort, NSPort, NSArray)(objcObject, sendPort, replyPort, components); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSArray components () + { + return invokeObjcSelf!(NSArray, "components"); + } + + NSPort receivePort () + { + return invokeObjcSelf!(NSPort, "receivePort"); + } + + NSPort sendPort () + { + return invokeObjcSelf!(NSPort, "sendPort"); + } + + bool sendBeforeDate (NSDate date) + { + return invokeObjcSelf!(bool, "sendBeforeDate:", NSDate)(date); + } + + uint msgid () + { + return invokeObjcSelf!(uint, "msgid"); + } + + void setMsgid (uint msgid) + { + return invokeObjcSelf!(void, "setMsgid:", uint)(msgid); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPortNameServer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPortNameServer.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,143 @@ +/** + * 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.NSPortNameServer; + +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSPortNameServer : NSObject +{ + mixin ObjcWrap; + + static NSPortNameServer systemDefaultPortNameServer () + { + return invokeObjcSelfClass!(NSPortNameServer, "systemDefaultPortNameServer"return result is this.objcObject ? this : (result !is null ? new NSPortNameServer(result) : null); } + + NSPort portForName (NSString name) + { + return invokeObjcSelf!(NSPort, "portForName:", NSString)(name); + } + + NSPort portForName (NSString name, NSString host) + { + return invokeObjcSelf!(NSPort, "portForName:host:", NSString, NSString)(name, host); + } + + bool registerPort (NSPort port, NSString name) + { + return invokeObjcSelf!(bool, "registerPort:name:", NSPort, NSString)(port, name); + } + + bool removePortForName (NSString name) + { + return invokeObjcSelf!(bool, "removePortForName:", NSString)(name); + } +} + +class NSMachBootstrapServer : NSPortNameServer +{ + mixin ObjcWrap; + + static Object sharedInstance () + { + return invokeObjcSelfClass!(Object, "sharedInstance"); + } + + NSPort portForName (NSString name) + { + return invokeObjcSelf!(NSPort, "portForName:", NSString)(name); + } + + NSPort portForName (NSString name, NSString host) + { + return invokeObjcSelf!(NSPort, "portForName:host:", NSString, NSString)(name, host); + } + + bool registerPort (NSPort port, NSString name) + { + return invokeObjcSelf!(bool, "registerPort:name:", NSPort, NSString)(port, name); + } + + NSPort servicePortWithName (NSString name) + { + return invokeObjcSelf!(NSPort, "servicePortWithName:", NSString)(name); + } +} + +class NSSocketPortNameServer : NSPortNameServer +{ + mixin ObjcWrap; + + static Object sharedInstance () + { + return invokeObjcSelfClass!(Object, "sharedInstance"); + } + + NSPort portForName (NSString name) + { + return invokeObjcSelf!(NSPort, "portForName:", NSString)(name); + } + + NSPort portForName (NSString name, NSString host) + { + return invokeObjcSelf!(NSPort, "portForName:host:", NSString, NSString)(name, host); + } + + bool registerPort (NSPort port, NSString name) + { + return invokeObjcSelf!(bool, "registerPort:name:", NSPort, NSString)(port, name); + } + + bool removePortForName (NSString name) + { + return invokeObjcSelf!(bool, "removePortForName:", NSString)(name); + } + + NSPort portForName (NSString name, NSString host, ushort portNumber) + { + return invokeObjcSelf!(NSPort, "portForName:host:nameServerPortNumber:", NSString, NSString, ushort)(name, host, portNumber); + } + + bool registerPort (NSPort port, NSString name, ushort portNumber) + { + return invokeObjcSelf!(bool, "registerPort:name:nameServerPortNumber:", NSPort, NSString, ushort)(port, name, portNumber); + } + + void setDefaultNameServerPortNumber (ushort portNumber) + { + return invokeObjcSelf!(void, "setDefaultNameServerPortNumber:", ushort)(portNumber); + } + + ushort defaultNameServerPortNumber () + { + return invokeObjcSelf!(ushort, "defaultNameServerPortNumber"); + } +} + +class NSMessagePortNameServer : NSPortNameServer +{ + mixin ObjcWrap; + + static Object sharedInstance () + { + return invokeObjcSelfClass!(Object, "sharedInstance"); + } + + NSPort portForName (NSString name) + { + return invokeObjcSelf!(NSPort, "portForName:", NSString)(name); + } + + NSPort portForName (NSString name, NSString host) + { + return invokeObjcSelf!(NSPort, "portForName:host:", NSString, NSString)(name, host); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPort_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPort_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSPort_bindings; + +import dstep.foundation.NSConnection; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSPortMessage; +import dstep.foundation.NSRunLoop; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSPortDidBecomeInvalidNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPredicate.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPredicate.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,88 @@ +/** + * 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.NSPredicate; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSSet; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSPredicate : NSObject, INSCoding, INSCopying +{ + mixin ObjcWrap; + + static NSPredicate predicateWithFormat (NSString predicateFormat, NSArray arguments) + { + return invokeObjcSelfClass!(NSPredicate, "predicateWithFormat:argumentArray:", NSString, NSArray)(predicateFormat, argumentsreturn result is this.objcObject ? this : (result !is null ? new NSPredicate(result) : null); } + + static NSPredicate predicateWithFormat (NSString predicateWithFormat, ...) + { + return invokeObjcSelfClass!(NSPredicate, "predicateWithFormat:", NSString)(predicateWithFormatreturn result is this.objcObject ? this : (result !is null ? new NSPredicate(result) : null); } + + static NSPredicate predicateWithFormat (NSString predicateFormat, char* argList) + { + return invokeObjcSelfClass!(NSPredicate, "predicateWithFormat:arguments:", NSString, char*)(predicateFormat, argListreturn result is this.objcObject ? this : (result !is null ? new NSPredicate(result) : null); } + + static NSPredicate predicateWithValue (bool value) + { + return invokeObjcSelfClass!(NSPredicate, "predicateWithValue:", bool)(valuereturn result is this.objcObject ? this : (result !is null ? new NSPredicate(result) : null); } + + NSString predicateFormat () + { + return invokeObjcSelf!(NSString, "predicateFormat"); + } + + NSPredicate predicateWithSubstitutionVariables (NSDictionary variables) + { + id result = invokeObjcSelf!(id, "predicateWithSubstitutionVariables:", NSDictionary)(variablesreturn result is this.objcObject ? this : (result !is null ? new NSPredicate(result) : null); } + + bool evaluateWithObject (Object object) + { + return invokeObjcSelf!(bool, "evaluateWithObject:", Object)(object); + } + + bool evaluateWithObject (Object object, NSDictionary bindings) + { + return invokeObjcSelf!(bool, "evaluateWithObject:substitutionVariables:", Object, NSDictionary)(object, bindings); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + +template TNSPredicateSupport () +{ + void filterUsingPredicate (NSPredicate predicate) + { + return invokeObjcSelf!(void, "filterUsingPredicate:", NSPredicate)(predicate); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSProcessInfo.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSProcessInfo.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,100 @@ +/** + * 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.NSProcessInfo; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +enum +{ + NSWindowsNTOperatingSystem = 1, + NSWindows95OperatingSystem, + NSSolarisOperatingSystem, + NSHPUXOperatingSystem, + NSMACHOperatingSystem, + NSSunOSOperatingSystem, + NSOSF1OperatingSystem +} + +class NSProcessInfo : NSObject +{ + mixin ObjcWrap; + + static NSProcessInfo processInfo () + { + return invokeObjcSelfClass!(NSProcessInfo, "processInfo"return result is this.objcObject ? this : (result !is null ? new NSProcessInfo(result) : null); } + + NSDictionary environment () + { + return invokeObjcSelf!(NSDictionary, "environment"); + } + + NSArray arguments () + { + return invokeObjcSelf!(NSArray, "arguments"); + } + + NSString hostName () + { + return invokeObjcSelf!(NSString, "hostName"); + } + + NSString processName () + { + return invokeObjcSelf!(NSString, "processName"); + } + + int processIdentifier () + { + return invokeObjcSelf!(int, "processIdentifier"); + } + + void setProcessName (NSString newName) + { + return invokeObjcSelf!(void, "setProcessName:", NSString)(newName); + } + + NSString globallyUniqueString () + { + return invokeObjcSelf!(NSString, "globallyUniqueString"); + } + + NSUInteger operatingSystem () + { + return invokeObjcSelf!(NSUInteger, "operatingSystem"); + } + + NSString operatingSystemName () + { + return invokeObjcSelf!(NSString, "operatingSystemName"); + } + + NSString operatingSystemVersionString () + { + return invokeObjcSelf!(NSString, "operatingSystemVersionString"); + } + + NSUInteger processorCount () + { + return invokeObjcSelf!(NSUInteger, "processorCount"); + } + + NSUInteger activeProcessorCount () + { + return invokeObjcSelf!(NSUInteger, "activeProcessorCount"); + } + + ulong physicalMemory () + { + return invokeObjcSelf!(ulong, "physicalMemory"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSPropertyList.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSPropertyList.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,52 @@ +/** + * 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.NSPropertyList; + +import dstep.corefoundation.CFPropertyList; +import dstep.foundation.NSData; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSPropertyListMutabilityOptions; +alias NSUInteger NSPropertyListFormat; + +enum +{ + NSPropertyListImmutable = kCFPropertyListImmutable, + NSPropertyListMutableContainers = kCFPropertyListMutableContainers, + NSPropertyListMutableContainersAndLeaves = kCFPropertyListMutableContainersAndLeaves +} + +enum +{ + NSPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat, + NSPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0, + NSPropertyListBinaryFormat_v1_0 = kCFPropertyListBinaryFormat_v1_0 +} + +class NSPropertyListSerialization : NSObject +{ + mixin ObjcWrap; + + static bool propertyList (Object plist, uint format) + { + return invokeObjcSelfClass!(bool, "propertyList:isValidForFormat:", Object, uint)(plist, format); + } + + static NSData dataFromPropertyList (Object plist, uint format, NSString** errorString) + { + return invokeObjcSelfClass!(NSData, "dataFromPropertyList:format:errorDescription:", Object, uint, NSString**)(plist, format, errorString); + } + + static Object propertyListFromData (NSData data, uint opt, NSPropertyListFormat* format, NSString** errorString) + { + return invokeObjcSelfClass!(Object, "propertyListFromData:mutabilityOption:format:errorDescription:", NSData, uint, NSPropertyListFormat*, NSString**)(data, opt, format, errorString); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSProtocolChecker.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSProtocolChecker.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,53 @@ +/** + * 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.NSProtocolChecker; + +import dstep.foundation.NSObject; +import dstep.foundation.NSProxy; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSProtocolChecker : NSProxy +{ + mixin ObjcWrap; + mixin TNSProtocolCheckerCreation; + + Protocol protocol () + { + return invokeObjcSelf!(Protocol, "protocol"); + } + + NSObject target () + { + return invokeObjcSelf!(NSObject, "target"); + } +} + +template TNSProtocolCheckerCreation () +{ + static Object protocolCheckerWithTarget (NSObject anObject, Protocol aProtocol) + { + return invokeObjcSelfClass!(Object, "protocolCheckerWithTarget:protocol:", NSObject, Protocol)(anObject, aProtocol); + } + + Object initWithTarget (NSObject anObject, Protocol aProtocol) + { + return invokeObjcSelf!(Object, "initWithTarget:protocol:", NSObject, Protocol)(anObject, aProtocol); + } + + this (NSObject anObject, Protocol aProtocol) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTarget:protocol:", NSObject, Protocol)(objcObject, anObject, aProtocol); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSProxy.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSProxy.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,159 @@ +/** + * 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.NSProxy; + +import dstep.foundation.NSInvocation; +import dstep.foundation.NSMethodSignature; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSProxy : INSObject +{ + mixin ObjcWrap; + + static Object alloc () + { + return invokeObjcSelfClass!(Object, "alloc"); + } + + static Object allocWithZone (NSZone* zone) + { + return invokeObjcSelfClass!(Object, "allocWithZone:", NSZone*)(zone); + } + + static Class class_ () + { + return invokeObjcSelfClass!(Class, "class"); + } + + void forwardInvocation (NSInvocation invocation) + { + return invokeObjcSelf!(void, "forwardInvocation:", NSInvocation)(invocation); + } + + NSMethodSignature methodSignatureForSelector (SEL sel) + { + return invokeObjcSelf!(NSMethodSignature, "methodSignatureForSelector:", SEL)(sel); + } + + void dealloc () + { + return invokeObjcSelf!(void, "dealloc"); + } + + void finalize () + { + return invokeObjcSelf!(void, "finalize"); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + static bool respondsToSelector (SEL aSelector) + { + return invokeObjcSelfClass!(bool, "respondsToSelector:", SEL)(aSelector); + } + + bool isEqual (Object object) + { + return invokeObjcSelf!(bool, "isEqual:", Object)(object); + } + + NSUInteger hash () + { + return invokeObjcSelf!(NSUInteger, "hash"); + } + + Class superclass () + { + return invokeObjcSelf!(Class, "superclass"); + } + + Class class_ () + { + return invokeObjcSelf!(Class, "class"); + } + + Object self () + { + return invokeObjcSelf!(Object, "self"); + } + + NSZone* zone () + { + return invokeObjcSelf!(NSZone*, "zone"); + } + + Object performSelector (SEL aSelector) + { + return invokeObjcSelf!(Object, "performSelector:", SEL)(aSelector); + } + + Object performSelector (SEL aSelector, Object object) + { + return invokeObjcSelf!(Object, "performSelector:withObject:", SEL, Object)(aSelector, object); + } + + Object performSelector (SEL aSelector, Object object1, Object object2) + { + return invokeObjcSelf!(Object, "performSelector:withObject:withObject:", SEL, Object, Object)(aSelector, object1, object2); + } + + bool isProxy () + { + return invokeObjcSelf!(bool, "isProxy"); + } + + bool isKindOfClass (Class aClass) + { + return invokeObjcSelf!(bool, "isKindOfClass:", Class)(aClass); + } + + bool isMemberOfClass (Class aClass) + { + return invokeObjcSelf!(bool, "isMemberOfClass:", Class)(aClass); + } + + bool conformsToProtocol (Protocol aProtocol) + { + return invokeObjcSelf!(bool, "conformsToProtocol:", Protocol)(aProtocol); + } + + bool respondsToSelector (SEL aSelector) + { + return invokeObjcSelf!(bool, "respondsToSelector:", SEL)(aSelector); + } + + Object retain () + { + return invokeObjcSelf!(Object, "retain"); + } + + void release () + { + return invokeObjcSelf!(void, "release"); + } + + Object autorelease () + { + return invokeObjcSelf!(Object, "autorelease"); + } + + NSUInteger retainCount () + { + return invokeObjcSelf!(NSUInteger, "retainCount"); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSRange.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSRange.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,50 @@ +/** + * 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 : id; + +alias NSRange* NSRangePointer; + +struct NSRange +{ + NSUInteger location; + NSUInteger length; +} + +template TNSValueRangeExtensions () +{ + static NSValue valueWithRange (NSRange range) + { + return invokeObjcSelfClass!(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); +} \ No newline at end of file diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSRunLoop.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSRunLoop.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,127 @@ +/** + * 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.NSRunLoop; + +import dstep.corefoundation.CFRunLoop; +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.foundation.NSTimer; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSRunLoop_bindings; + +const NSString NSDefaultRunLoopMode; +const NSString NSRunLoopCommonModes; + +static this () +{ + NSDefaultRunLoopMode = new NSString(bindings.NSDefaultRunLoopMode); + NSRunLoopCommonModes = new NSString(bindings.NSRunLoopCommonModes); +} + +class NSRunLoop : NSObject +{ + mixin ObjcWrap; + mixin TNSOrderedPerform; + mixin TNSRunLoopConveniences; + + static NSRunLoop currentRunLoop () + { + return invokeObjcSelfClass!(NSRunLoop, "currentRunLoop"return result is this.objcObject ? this : (result !is null ? new NSRunLoop(result) : null); } + + static NSRunLoop mainRunLoop () + { + return invokeObjcSelfClass!(NSRunLoop, "mainRunLoop"return result is this.objcObject ? this : (result !is null ? new NSRunLoop(result) : null); } + + NSString currentMode () + { + return invokeObjcSelf!(NSString, "currentMode"); + } + + CFRunLoopRef getCFRunLoop () + { + return invokeObjcSelf!(CFRunLoopRef, "getCFRunLoop"); + } + + void addTimer (NSTimer timer, NSString mode) + { + return invokeObjcSelf!(void, "addTimer:forMode:", NSTimer, NSString)(timer, mode); + } + + void addPort (NSPort aPort, NSString mode) + { + return invokeObjcSelf!(void, "addPort:forMode:", NSPort, NSString)(aPort, mode); + } + + void removePort (NSPort aPort, NSString mode) + { + return invokeObjcSelf!(void, "removePort:forMode:", NSPort, NSString)(aPort, mode); + } + + NSDate limitDateForMode (NSString mode) + { + return invokeObjcSelf!(NSDate, "limitDateForMode:", NSString)(mode); + } + + void acceptInputForMode (NSString mode, NSDate limitDate) + { + return invokeObjcSelf!(void, "acceptInputForMode:beforeDate:", NSString, NSDate)(mode, limitDate); + } +} + +template TNSOrderedPerform () +{ + void performSelector (SEL aSelector, Object target, Object arg, NSUInteger order, NSArray modes) + { + return invokeObjcSelf!(void, "performSelector:target:argument:order:modes:", SEL, Object, Object, NSUInteger, NSArray)(aSelector, target, arg, order, modes); + } + + void cancelPerformSelector (SEL aSelector, Object target, Object arg) + { + return invokeObjcSelf!(void, "cancelPerformSelector:target:argument:", SEL, Object, Object)(aSelector, target, arg); + } + + void cancelPerformSelectorsWithTarget (Object target) + { + return invokeObjcSelf!(void, "cancelPerformSelectorsWithTarget:", Object)(target); + } +} + +template TNSDelayedPerforming () +{ + void performSelector (SEL aSelector, Object anArgument, double delay, NSArray modes); + void performSelector (SEL aSelector, Object anArgument, double delay); + static void cancelPreviousPerformRequestsWithTarget (Object aTarget, SEL aSelector, Object anArgument); + static void cancelPreviousPerformRequestsWithTarget (Object aTarget); +} + +template TNSRunLoopConveniences () +{ + void run () + { + return invokeObjcSelf!(void, "run"); + } + + void runUntilDate (NSDate limitDate) + { + return invokeObjcSelf!(void, "runUntilDate:", NSDate)(limitDate); + } + + bool runMode (NSString mode, NSDate limitDate) + { + return invokeObjcSelf!(bool, "runMode:beforeDate:", NSString, NSDate)(mode, limitDate); + } + + void configureAsServer () + { + return invokeObjcSelf!(void, "configureAsServer"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSRunLoop_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSRunLoop_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSRunLoop_bindings; + +import dstep.corefoundation.CFRunLoop; +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.foundation.NSTimer; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSDefaultRunLoopMode; + package const id NSRunLoopCommonModes; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScanner.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScanner.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,171 @@ +/** + * 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.NSScanner; + +import dstep.foundation.NSCharacterSet; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSScanner : NSObject, INSCopying +{ + mixin ObjcWrap; + mixin TNSDecimalNumberScanning; + mixin TNSExtendedScanner; + + NSString string () + { + return invokeObjcSelf!(NSString, "string"); + } + + NSUInteger scanLocation () + { + return invokeObjcSelf!(NSUInteger, "scanLocation"); + } + + void setScanLocation (NSUInteger pos) + { + return invokeObjcSelf!(void, "setScanLocation:", NSUInteger)(pos); + } + + void setCharactersToBeSkipped (NSCharacterSet set) + { + return invokeObjcSelf!(void, "setCharactersToBeSkipped:", NSCharacterSet)(set); + } + + void setCaseSensitive (bool flag) + { + return invokeObjcSelf!(void, "setCaseSensitive:", bool)(flag); + } + + void setLocale (Object locale) + { + return invokeObjcSelf!(void, "setLocale:", Object)(locale); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + +template TNSExtendedScanner () +{ + NSCharacterSet charactersToBeSkipped () + { + return invokeObjcSelf!(NSCharacterSet, "charactersToBeSkipped"); + } + + bool caseSensitive () + { + return invokeObjcSelf!(bool, "caseSensitive"); + } + + Object locale () + { + return invokeObjcSelf!(Object, "locale"); + } + + bool scanInt (int* value) + { + return invokeObjcSelf!(bool, "scanInt:", int*)(value); + } + + bool scanInteger (NSInteger* value) + { + return invokeObjcSelf!(bool, "scanInteger:", NSInteger*)(value); + } + + bool scanHexLongLong (unsigned long long* result) + { + return invokeObjcSelf!(bool, "scanHexLongLong:", unsigned long long*)(result); + } + + bool scanHexFloat (float* result) + { + return invokeObjcSelf!(bool, "scanHexFloat:", float*)(result); + } + + bool scanHexDouble (double* result) + { + return invokeObjcSelf!(bool, "scanHexDouble:", double*)(result); + } + + bool scanHexInt (unsigned* value) + { + return invokeObjcSelf!(bool, "scanHexInt:", unsigned*)(value); + } + + bool scanLongLong (long long* value) + { + return invokeObjcSelf!(bool, "scanLongLong:", long long*)(value); + } + + bool scanFloat (float* value) + { + return invokeObjcSelf!(bool, "scanFloat:", float*)(value); + } + + bool scanDouble (double* value) + { + return invokeObjcSelf!(bool, "scanDouble:", double*)(value); + } + + bool scanString (NSString string, NSString** value) + { + return invokeObjcSelf!(bool, "scanString:intoString:", NSString, NSString**)(string, value); + } + + bool scanCharactersFromSet (NSCharacterSet set, NSString** value) + { + return invokeObjcSelf!(bool, "scanCharactersFromSet:intoString:", NSCharacterSet, NSString**)(set, value); + } + + bool scanUpToString (NSString string, NSString** value) + { + return invokeObjcSelf!(bool, "scanUpToString:intoString:", NSString, NSString**)(string, value); + } + + bool scanUpToCharactersFromSet (NSCharacterSet set, NSString** value) + { + return invokeObjcSelf!(bool, "scanUpToCharactersFromSet:intoString:", NSCharacterSet, NSString**)(set, value); + } + + bool isAtEnd () + { + return invokeObjcSelf!(bool, "isAtEnd"); + } + + Object initWithString (NSString string) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(string); + } + + this (NSString string) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, string); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object scannerWithString (NSString string) + { + return invokeObjcSelfClass!(Object, "scannerWithString:", NSString)(string); + } + + static Object localizedScannerWithString (NSString string) + { + return invokeObjcSelfClass!(Object, "localizedScannerWithString:", NSString)(string); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptClassDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptClassDescription.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,132 @@ +/** + * 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.NSScriptClassDescription; + +import dstep.foundation.NSClassDescription; +import dstep.foundation.NSScriptCommandDescription; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSScriptClassDescription : NSClassDescription +{ + mixin ObjcWrap; + + static NSScriptClassDescription classDescriptionForClass (Class aClass) + { + return invokeObjcSelfClass!(NSScriptClassDescription, "classDescriptionForClass:", Class)(aClassreturn result is this.objcObject ? this : (result !is null ? new NSScriptClassDescription(result) : null); } + + Object initWithSuiteName (NSString suiteName, NSString className, NSDictionary classDeclaration) + { + return invokeObjcSelf!(Object, "initWithSuiteName:className:dictionary:", NSString, NSString, NSDictionary)(suiteName, className, classDeclaration); + } + + this (NSString suiteName, NSString className, NSDictionary classDeclaration) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithSuiteName:className:dictionary:", NSString, NSString, NSDictionary)(objcObject, suiteName, className, classDeclaration); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString suiteName () + { + return invokeObjcSelf!(NSString, "suiteName"); + } + + NSString className () + { + return invokeObjcSelf!(NSString, "className"); + } + + NSString implementationClassName () + { + return invokeObjcSelf!(NSString, "implementationClassName"); + } + + NSScriptClassDescription superclassDescription () + { + id result = invokeObjcSelf!(id, "superclassDescription"return result is this.objcObject ? this : (result !is null ? new NSScriptClassDescription(result) : null); } + + uint appleEventCode () + { + return invokeObjcSelf!(uint, "appleEventCode"); + } + + bool matchesAppleEventCode (uint appleEventCode) + { + return invokeObjcSelf!(bool, "matchesAppleEventCode:", uint)(appleEventCode); + } + + bool supportsCommand (NSScriptCommandDescription commandDescription) + { + return invokeObjcSelf!(bool, "supportsCommand:", NSScriptCommandDescription)(commandDescription); + } + + SEL selectorForCommand (NSScriptCommandDescription commandDescription) + { + return invokeObjcSelf!(SEL, "selectorForCommand:", NSScriptCommandDescription)(commandDescription); + } + + NSString typeForKey (NSString key) + { + return invokeObjcSelf!(NSString, "typeForKey:", NSString)(key); + } + + NSScriptClassDescription classDescriptionForKey (NSString key) + { + id result = invokeObjcSelf!(id, "classDescriptionForKey:", NSString)(keyreturn result is this.objcObject ? this : (result !is null ? new NSScriptClassDescription(result) : null); } + + uint appleEventCodeForKey (NSString key) + { + return invokeObjcSelf!(uint, "appleEventCodeForKey:", NSString)(key); + } + + NSString keyWithAppleEventCode (uint appleEventCode) + { + return invokeObjcSelf!(NSString, "keyWithAppleEventCode:", uint)(appleEventCode); + } + + NSString defaultSubcontainerAttributeKey () + { + return invokeObjcSelf!(NSString, "defaultSubcontainerAttributeKey"); + } + + bool isLocationRequiredToCreateForKey (NSString toManyRelationshipKey) + { + return invokeObjcSelf!(bool, "isLocationRequiredToCreateForKey:", NSString)(toManyRelationshipKey); + } + + bool hasPropertyForKey (NSString key) + { + return invokeObjcSelf!(bool, "hasPropertyForKey:", NSString)(key); + } + + bool hasOrderedToManyRelationshipForKey (NSString key) + { + return invokeObjcSelf!(bool, "hasOrderedToManyRelationshipForKey:", NSString)(key); + } + + bool hasReadablePropertyForKey (NSString key) + { + return invokeObjcSelf!(bool, "hasReadablePropertyForKey:", NSString)(key); + } + + bool hasWritablePropertyForKey (NSString key) + { + return invokeObjcSelf!(bool, "hasWritablePropertyForKey:", NSString)(key); + } +} + +template TNSScriptClassDescription () +{ + uint classCode (); + NSString className (); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptCoercionHandler.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptCoercionHandler.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,31 @@ +/** + * 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.NSScriptCoercionHandler; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSScriptCoercionHandler : NSObject +{ + mixin ObjcWrap; + + static NSScriptCoercionHandler sharedCoercionHandler () + { + return invokeObjcSelfClass!(NSScriptCoercionHandler, "sharedCoercionHandler"return result is this.objcObject ? this : (result !is null ? new NSScriptCoercionHandler(result) : null); } + + Object coerceValue (Object value, Class toClass) + { + return invokeObjcSelf!(Object, "coerceValue:toClass:", Object, Class)(value, toClass); + } + + void registerCoercer (Object coercer, SEL selector, Class fromClass, Class toClass) + { + return invokeObjcSelf!(void, "registerCoercer:selector:toConvertFromClass:toClass:", Object, SEL, Class, Class)(coercer, selector, fromClass, toClass); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptCommand.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptCommand.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,194 @@ +/** + * 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.NSScriptCommand; + +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptCommandDescription; +import dstep.foundation.NSScriptObjectSpecifier; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +enum +{ + NSNoScriptError = 0, + NSReceiverEvaluationScriptError, + NSKeySpecifierEvaluationScriptError, + NSArgumentEvaluationScriptError, + NSReceiversCantHandleCommandScriptError, + NSRequiredArgumentsMissingScriptError, + NSArgumentsWrongScriptError, + NSUnknownKeyScriptError, + NSInternalScriptError, + NSOperationNotSupportedForKeyScriptError, + NSCannotCreateScriptCommandError +} + +class NSScriptCommand : NSObject, INSCoding +{ + mixin ObjcWrap; + + Object initWithCommandDescription (NSScriptCommandDescription commandDef) + { + return invokeObjcSelf!(Object, "initWithCommandDescription:", NSScriptCommandDescription)(commandDef); + } + + this (NSScriptCommandDescription commandDef) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCommandDescription:", NSScriptCommandDescription)(objcObject, commandDef); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSScriptCommandDescription commandDescription () + { + return invokeObjcSelf!(NSScriptCommandDescription, "commandDescription"); + } + + void setDirectParameter (Object directParameter) + { + return invokeObjcSelf!(void, "setDirectParameter:", Object)(directParameter); + } + + Object directParameter () + { + return invokeObjcSelf!(Object, "directParameter"); + } + + void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) + { + return invokeObjcSelf!(void, "setReceiversSpecifier:", NSScriptObjectSpecifier)(receiversRef); + } + + NSScriptObjectSpecifier receiversSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "receiversSpecifier"); + } + + Object evaluatedReceivers () + { + return invokeObjcSelf!(Object, "evaluatedReceivers"); + } + + void setArguments (NSDictionary args) + { + return invokeObjcSelf!(void, "setArguments:", NSDictionary)(args); + } + + NSDictionary arguments () + { + return invokeObjcSelf!(NSDictionary, "arguments"); + } + + NSDictionary evaluatedArguments () + { + return invokeObjcSelf!(NSDictionary, "evaluatedArguments"); + } + + bool isWellFormed () + { + return invokeObjcSelf!(bool, "isWellFormed"); + } + + Object performDefaultImplementation () + { + return invokeObjcSelf!(Object, "performDefaultImplementation"); + } + + Object executeCommand () + { + return invokeObjcSelf!(Object, "executeCommand"); + } + + void setScriptErrorNumber (int errorNumber) + { + return invokeObjcSelf!(void, "setScriptErrorNumber:", int)(errorNumber); + } + + void setScriptErrorOffendingObjectDescriptor (NSAppleEventDescriptor errorOffendingObjectDescriptor) + { + return invokeObjcSelf!(void, "setScriptErrorOffendingObjectDescriptor:", NSAppleEventDescriptor)(errorOffendingObjectDescriptor); + } + + void setScriptErrorExpectedTypeDescriptor (NSAppleEventDescriptor errorExpectedTypeDescriptor) + { + return invokeObjcSelf!(void, "setScriptErrorExpectedTypeDescriptor:", NSAppleEventDescriptor)(errorExpectedTypeDescriptor); + } + + void setScriptErrorString (NSString errorString) + { + return invokeObjcSelf!(void, "setScriptErrorString:", NSString)(errorString); + } + + int scriptErrorNumber () + { + return invokeObjcSelf!(int, "scriptErrorNumber"); + } + + NSAppleEventDescriptor scriptErrorOffendingObjectDescriptor () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "scriptErrorOffendingObjectDescriptor"); + } + + NSAppleEventDescriptor scriptErrorExpectedTypeDescriptor () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "scriptErrorExpectedTypeDescriptor"); + } + + NSString scriptErrorString () + { + return invokeObjcSelf!(NSString, "scriptErrorString"); + } + + static NSScriptCommand currentCommand () + { + return invokeObjcSelfClass!(NSScriptCommand, "currentCommand"return result is this.objcObject ? this : (result !is null ? new NSScriptCommand(result) : null); } + + NSAppleEventDescriptor appleEvent () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "appleEvent"); + } + + void suspendExecution () + { + return invokeObjcSelf!(void, "suspendExecution"); + } + + void resumeExecutionWithResult (Object result) + { + return invokeObjcSelf!(void, "resumeExecutionWithResult:", Object)(result); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptCommandDescription.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptCommandDescription.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,123 @@ +/** + * 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.NSScriptCommandDescription; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptCommand; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSScriptCommandDescription : NSObject, INSCoding +{ + mixin ObjcWrap; + + Object initWithSuiteName (NSString suiteName, NSString commandName, NSDictionary commandDeclaration) + { + return invokeObjcSelf!(Object, "initWithSuiteName:commandName:dictionary:", NSString, NSString, NSDictionary)(suiteName, commandName, commandDeclaration); + } + + this (NSString suiteName, NSString commandName, NSDictionary commandDeclaration) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithSuiteName:commandName:dictionary:", NSString, NSString, NSDictionary)(objcObject, suiteName, commandName, commandDeclaration); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString suiteName () + { + return invokeObjcSelf!(NSString, "suiteName"); + } + + NSString commandName () + { + return invokeObjcSelf!(NSString, "commandName"); + } + + uint appleEventClassCode () + { + return invokeObjcSelf!(uint, "appleEventClassCode"); + } + + uint appleEventCode () + { + return invokeObjcSelf!(uint, "appleEventCode"); + } + + NSString commandClassName () + { + return invokeObjcSelf!(NSString, "commandClassName"); + } + + NSString returnType () + { + return invokeObjcSelf!(NSString, "returnType"); + } + + uint appleEventCodeForReturnType () + { + return invokeObjcSelf!(uint, "appleEventCodeForReturnType"); + } + + NSArray argumentNames () + { + return invokeObjcSelf!(NSArray, "argumentNames"); + } + + NSString typeForArgumentWithName (NSString argumentName) + { + return invokeObjcSelf!(NSString, "typeForArgumentWithName:", NSString)(argumentName); + } + + uint appleEventCodeForArgumentWithName (NSString argumentName) + { + return invokeObjcSelf!(uint, "appleEventCodeForArgumentWithName:", NSString)(argumentName); + } + + bool isOptionalArgumentWithName (NSString argumentName) + { + return invokeObjcSelf!(bool, "isOptionalArgumentWithName:", NSString)(argumentName); + } + + NSScriptCommand createCommandInstance () + { + return invokeObjcSelf!(NSScriptCommand, "createCommandInstance"); + } + + NSScriptCommand createCommandInstanceWithZone (NSZone* zone) + { + return invokeObjcSelf!(NSScriptCommand, "createCommandInstanceWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptExecutionContext.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptExecutionContext.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,52 @@ +/** + * 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.NSScriptExecutionContext; + +import dstep.foundation.NSConnection; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSScriptExecutionContext : NSObject +{ + mixin ObjcWrap; + + static NSScriptExecutionContext sharedScriptExecutionContext () + { + return invokeObjcSelfClass!(NSScriptExecutionContext, "sharedScriptExecutionContext"return result is this.objcObject ? this : (result !is null ? new NSScriptExecutionContext(result) : null); } + + Object topLevelObject () + { + return invokeObjcSelf!(Object, "topLevelObject"); + } + + void setTopLevelObject (Object obj) + { + return invokeObjcSelf!(void, "setTopLevelObject:", Object)(obj); + } + + Object objectBeingTested () + { + return invokeObjcSelf!(Object, "objectBeingTested"); + } + + void setObjectBeingTested (Object obj) + { + return invokeObjcSelf!(void, "setObjectBeingTested:", Object)(obj); + } + + Object rangeContainerObject () + { + return invokeObjcSelf!(Object, "rangeContainerObject"); + } + + void setRangeContainerObject (Object obj) + { + return invokeObjcSelf!(void, "setRangeContainerObject:", Object)(obj); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptKeyValueCoding.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptKeyValueCoding.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,34 @@ +/** + * 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.NSScriptKeyValueCoding; + +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSScriptKeyValueCoding_bindings; + +NSString NSOperationNotSupportedForKeyException; + +static this () +{ + NSOperationNotSupportedForKeyException = new NSString(bindings.NSOperationNotSupportedForKeyException); +} + +template TNSScriptKeyValueCoding () +{ + Object valueAtIndex (NSUInteger index, NSString key); + Object valueWithName (NSString name, NSString key); + Object valueWithUniqueID (Object uniqueID, NSString key); + void insertValue (Object value, NSUInteger index, NSString key); + void removeValueAtIndex (NSUInteger index, NSString key); + void replaceValueAtIndex (NSUInteger index, NSString key, Object value); + void insertValue (Object value, NSString key); + Object coerceValue (Object value, NSString key); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptKeyValueCoding_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptKeyValueCoding_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,16 @@ +module dstep.foundation.NSScriptKeyValueCoding_bindings; + +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package id NSOperationNotSupportedForKeyException; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptObjectSpecifiers.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptObjectSpecifiers.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,528 @@ +/** + * 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.NSScriptObjectSpecifiers; + +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptClassDescription; +import dstep.foundation.NSScriptWhoseTest; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSInsertionPosition; +alias NSUInteger NSRelativePosition; +alias NSUInteger NSWhoseSubelementIdentifier; + +enum +{ + NSNoSpecifierError = 0, + NSNoTopLevelContainersSpecifierError, + NSContainerSpecifierError, + NSUnknownKeySpecifierError, + NSInvalidIndexSpecifierError, + NSInternalSpecifierError, + NSOperationNotSupportedForKeySpecifierError +} + +enum +{ + NSPositionAfter, + NSPositionBefore, + NSPositionBeginning, + NSPositionEnd, + NSPositionReplace +} + +enum +{ + NSRelativeAfter = 0, + NSRelativeBefore +} + +enum +{ + NSIndexSubelement = 0, + NSEverySubelement = 1, + NSMiddleSubelement = 2, + NSRandomSubelement = 3, + NSNoSubelement = 4 +} + +class NSIndexSpecifier : NSScriptObjectSpecifier +{ + mixin ObjcWrap; + + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSInteger index) + { + return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:index:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSInteger)(classDesc, container, property, index); + } + + this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSInteger index) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:index:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSInteger)(objcObject, classDesc, container, property, index); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSInteger index () + { + return invokeObjcSelf!(NSInteger, "index"); + } + + void setIndex (NSInteger index) + { + return invokeObjcSelf!(void, "setIndex:", NSInteger)(index); + } +} + +class NSRangeSpecifier : NSScriptObjectSpecifier +{ + mixin ObjcWrap; + + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptObjectSpecifier startSpec, NSScriptObjectSpecifier endSpec) + { + return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:startSpecifier:endSpecifier:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSScriptObjectSpecifier, NSScriptObjectSpecifier)(classDesc, container, property, startSpec, endSpec); + } + + this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptObjectSpecifier startSpec, NSScriptObjectSpecifier endSpec) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:startSpecifier:endSpecifier:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSScriptObjectSpecifier, NSScriptObjectSpecifier)(objcObject, classDesc, container, property, startSpec, endSpec); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSScriptObjectSpecifier startSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "startSpecifier"); + } + + void setStartSpecifier (NSScriptObjectSpecifier startSpec) + { + return invokeObjcSelf!(void, "setStartSpecifier:", NSScriptObjectSpecifier)(startSpec); + } + + NSScriptObjectSpecifier endSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "endSpecifier"); + } + + void setEndSpecifier (NSScriptObjectSpecifier endSpec) + { + return invokeObjcSelf!(void, "setEndSpecifier:", NSScriptObjectSpecifier)(endSpec); + } +} + +class NSUniqueIDSpecifier : NSScriptObjectSpecifier +{ + mixin ObjcWrap; + + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, Object uniqueID) + { + return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:uniqueID:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, Object)(classDesc, container, property, uniqueID); + } + + this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, Object uniqueID) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:uniqueID:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, Object)(objcObject, classDesc, container, property, uniqueID); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object uniqueID () + { + return invokeObjcSelf!(Object, "uniqueID"); + } + + void setUniqueID (Object uniqueID) + { + return invokeObjcSelf!(void, "setUniqueID:", Object)(uniqueID); + } +} + +class NSRelativeSpecifier : NSScriptObjectSpecifier +{ + mixin ObjcWrap; + + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, uint relPos, NSScriptObjectSpecifier baseSpecifier) + { + return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:relativePosition:baseSpecifier:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, uint, NSScriptObjectSpecifier)(classDesc, container, property, relPos, baseSpecifier); + } + + this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, uint relPos, NSScriptObjectSpecifier baseSpecifier) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:relativePosition:baseSpecifier:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, uint, NSScriptObjectSpecifier)(objcObject, classDesc, container, property, relPos, baseSpecifier); + + if (result) + objcObject = ret; + + dObject = this; + } + + uint relativePosition () + { + return invokeObjcSelf!(uint, "relativePosition"); + } + + void setRelativePosition (uint relPos) + { + return invokeObjcSelf!(void, "setRelativePosition:", uint)(relPos); + } + + NSScriptObjectSpecifier baseSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "baseSpecifier"); + } + + void setBaseSpecifier (NSScriptObjectSpecifier baseSpecifier) + { + return invokeObjcSelf!(void, "setBaseSpecifier:", NSScriptObjectSpecifier)(baseSpecifier); + } +} + +class NSNameSpecifier : NSScriptObjectSpecifier +{ + mixin ObjcWrap; + + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSString name) + { + return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:name:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSString)(classDesc, container, property, name); + } + + this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSString name) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:name:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSString)(objcObject, classDesc, container, property, name); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setName (NSString name) + { + return invokeObjcSelf!(void, "setName:", NSString)(name); + } +} + +class NSPositionalSpecifier : NSObject +{ + mixin ObjcWrap; + + Object initWithPosition (uint position, NSScriptObjectSpecifier specifier) + { + return invokeObjcSelf!(Object, "initWithPosition:objectSpecifier:", uint, NSScriptObjectSpecifier)(position, specifier); + } + + this (uint position, NSScriptObjectSpecifier specifier) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithPosition:objectSpecifier:", uint, NSScriptObjectSpecifier)(objcObject, position, specifier); + + if (result) + objcObject = ret; + + dObject = this; + } + + uint position () + { + return invokeObjcSelf!(uint, "position"); + } + + NSScriptObjectSpecifier objectSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "objectSpecifier"); + } + + void setInsertionClassDescription (NSScriptClassDescription classDescription) + { + return invokeObjcSelf!(void, "setInsertionClassDescription:", NSScriptClassDescription)(classDescription); + } + + void evaluate () + { + return invokeObjcSelf!(void, "evaluate"); + } + + Object insertionContainer () + { + return invokeObjcSelf!(Object, "insertionContainer"); + } + + NSString insertionKey () + { + return invokeObjcSelf!(NSString, "insertionKey"); + } + + NSInteger insertionIndex () + { + return invokeObjcSelf!(NSInteger, "insertionIndex"); + } + + bool insertionReplaces () + { + return invokeObjcSelf!(bool, "insertionReplaces"); + } +} + +class NSScriptObjectSpecifier : NSObject, INSCoding +{ + mixin ObjcWrap; + + static NSScriptObjectSpecifier objectSpecifierWithDescriptor (NSAppleEventDescriptor descriptor) + { + return invokeObjcSelfClass!(NSScriptObjectSpecifier, "objectSpecifierWithDescriptor:", NSAppleEventDescriptor)(descriptorreturn result is this.objcObject ? this : (result !is null ? new NSScriptObjectSpecifier(result) : null); } + + Object initWithContainerSpecifier (NSScriptObjectSpecifier container, NSString property) + { + return invokeObjcSelf!(Object, "initWithContainerSpecifier:key:", NSScriptObjectSpecifier, NSString)(container, property); + } + + this (NSScriptObjectSpecifier container, NSString property) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerSpecifier:key:", NSScriptObjectSpecifier, NSString)(objcObject, container, property); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property) + { + return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString)(classDesc, container, property); + } + + this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString)(objcObject, classDesc, container, property); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSScriptObjectSpecifier childSpecifier () + { + id result = invokeObjcSelf!(id, "childSpecifier"return result is this.objcObject ? this : (result !is null ? new NSScriptObjectSpecifier(result) : null); } + + void setChildSpecifier (NSScriptObjectSpecifier child) + { + return invokeObjcSelf!(void, "setChildSpecifier:", NSScriptObjectSpecifier)(child); + } + + NSScriptObjectSpecifier containerSpecifier () + { + id result = invokeObjcSelf!(id, "containerSpecifier"return result is this.objcObject ? this : (result !is null ? new NSScriptObjectSpecifier(result) : null); } + + void setContainerSpecifier (NSScriptObjectSpecifier subRef) + { + return invokeObjcSelf!(void, "setContainerSpecifier:", NSScriptObjectSpecifier)(subRef); + } + + bool containerIsObjectBeingTested () + { + return invokeObjcSelf!(bool, "containerIsObjectBeingTested"); + } + + void setContainerIsObjectBeingTested (bool flag) + { + return invokeObjcSelf!(void, "setContainerIsObjectBeingTested:", bool)(flag); + } + + bool containerIsRangeContainerObject () + { + return invokeObjcSelf!(bool, "containerIsRangeContainerObject"); + } + + void setContainerIsRangeContainerObject (bool flag) + { + return invokeObjcSelf!(void, "setContainerIsRangeContainerObject:", bool)(flag); + } + + NSString key () + { + return invokeObjcSelf!(NSString, "key"); + } + + void setKey (NSString key) + { + return invokeObjcSelf!(void, "setKey:", NSString)(key); + } + + NSScriptClassDescription containerClassDescription () + { + return invokeObjcSelf!(NSScriptClassDescription, "containerClassDescription"); + } + + void setContainerClassDescription (NSScriptClassDescription classDesc) + { + return invokeObjcSelf!(void, "setContainerClassDescription:", NSScriptClassDescription)(classDesc); + } + + NSScriptClassDescription keyClassDescription () + { + return invokeObjcSelf!(NSScriptClassDescription, "keyClassDescription"); + } + + NSInteger* indicesOfObjectsByEvaluatingWithContainer (Object container, NSInteger* count) + { + return invokeObjcSelf!(NSInteger*, "indicesOfObjectsByEvaluatingWithContainer:count:", Object, NSInteger*)(container, count); + } + + Object objectsByEvaluatingWithContainers (Object containers) + { + return invokeObjcSelf!(Object, "objectsByEvaluatingWithContainers:", Object)(containers); + } + + Object objectsByEvaluatingSpecifier () + { + return invokeObjcSelf!(Object, "objectsByEvaluatingSpecifier"); + } + + NSInteger evaluationErrorNumber () + { + return invokeObjcSelf!(NSInteger, "evaluationErrorNumber"); + } + + void setEvaluationErrorNumber (NSInteger error) + { + return invokeObjcSelf!(void, "setEvaluationErrorNumber:", NSInteger)(error); + } + + NSScriptObjectSpecifier evaluationErrorSpecifier () + { + id result = invokeObjcSelf!(id, "evaluationErrorSpecifier"return result is this.objcObject ? this : (result !is null ? new NSScriptObjectSpecifier(result) : null); } + + NSAppleEventDescriptor descriptor () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "descriptor"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSWhoseSpecifier : NSScriptObjectSpecifier +{ + mixin ObjcWrap; + + Object initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptWhoseTest test) + { + return invokeObjcSelf!(Object, "initWithContainerClassDescription:containerSpecifier:key:test:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSScriptWhoseTest)(classDesc, container, property, test); + } + + this (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, NSScriptWhoseTest test) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContainerClassDescription:containerSpecifier:key:test:", NSScriptClassDescription, NSScriptObjectSpecifier, NSString, NSScriptWhoseTest)(objcObject, classDesc, container, property, test); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSScriptWhoseTest test () + { + return invokeObjcSelf!(NSScriptWhoseTest, "test"); + } + + void setTest (NSScriptWhoseTest test) + { + return invokeObjcSelf!(void, "setTest:", NSScriptWhoseTest)(test); + } + + uint startSubelementIdentifier () + { + return invokeObjcSelf!(uint, "startSubelementIdentifier"); + } + + void setStartSubelementIdentifier (uint subelement) + { + return invokeObjcSelf!(void, "setStartSubelementIdentifier:", uint)(subelement); + } + + NSInteger startSubelementIndex () + { + return invokeObjcSelf!(NSInteger, "startSubelementIndex"); + } + + void setStartSubelementIndex (NSInteger index) + { + return invokeObjcSelf!(void, "setStartSubelementIndex:", NSInteger)(index); + } + + uint endSubelementIdentifier () + { + return invokeObjcSelf!(uint, "endSubelementIdentifier"); + } + + void setEndSubelementIdentifier (uint subelement) + { + return invokeObjcSelf!(void, "setEndSubelementIdentifier:", uint)(subelement); + } + + NSInteger endSubelementIndex () + { + return invokeObjcSelf!(NSInteger, "endSubelementIndex"); + } + + void setEndSubelementIndex (NSInteger index) + { + return invokeObjcSelf!(void, "setEndSubelementIndex:", NSInteger)(index); + } +} + +template TNSScriptObjectSpecifiers () +{ + NSScriptObjectSpecifier objectSpecifier (); + NSArray indicesOfObjectsByEvaluatingObjectSpecifier (NSScriptObjectSpecifier specifier); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptStandardSuiteCommands.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptStandardSuiteCommands.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,119 @@ +/** + * 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.NSScriptStandardSuiteCommands; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSScriptClassDescription; +import dstep.foundation.NSScriptCommand; +import dstep.foundation.NSScriptObjectSpecifier; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSSaveOptions; + +enum +{ + NSSaveOptionsYes = 0, + NSSaveOptionsNo, + NSSaveOptionsAsk +} + +class NSCloneCommand : NSScriptCommand +{ + mixin ObjcWrap; + + void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) + { + return invokeObjcSelf!(void, "setReceiversSpecifier:", NSScriptObjectSpecifier)(receiversRef); + } + + NSScriptObjectSpecifier keySpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "keySpecifier"); + } +} + +class NSSetCommand : NSScriptCommand +{ + mixin ObjcWrap; + + void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) + { + return invokeObjcSelf!(void, "setReceiversSpecifier:", NSScriptObjectSpecifier)(receiversRef); + } + + NSScriptObjectSpecifier keySpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "keySpecifier"); + } +} + +class NSCreateCommand : NSScriptCommand +{ + mixin ObjcWrap; + + NSScriptClassDescription createClassDescription () + { + return invokeObjcSelf!(NSScriptClassDescription, "createClassDescription"); + } + + NSDictionary resolvedKeyDictionary () + { + return invokeObjcSelf!(NSDictionary, "resolvedKeyDictionary"); + } +} + +class NSMoveCommand : NSScriptCommand +{ + mixin ObjcWrap; + + void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) + { + return invokeObjcSelf!(void, "setReceiversSpecifier:", NSScriptObjectSpecifier)(receiversRef); + } + + NSScriptObjectSpecifier keySpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "keySpecifier"); + } +} + +class NSQuitCommand : NSScriptCommand +{ + mixin ObjcWrap; + + uint saveOptions () + { + return invokeObjcSelf!(uint, "saveOptions"); + } +} + +class NSCloseCommand : NSScriptCommand +{ + mixin ObjcWrap; + + uint saveOptions () + { + return invokeObjcSelf!(uint, "saveOptions"); + } +} + +class NSDeleteCommand : NSScriptCommand +{ + mixin ObjcWrap; + + void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef) + { + return invokeObjcSelf!(void, "setReceiversSpecifier:", NSScriptObjectSpecifier)(receiversRef); + } + + NSScriptObjectSpecifier keySpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "keySpecifier"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptSuiteRegistry.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptSuiteRegistry.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,100 @@ +/** + * 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.NSScriptSuiteRegistry; + +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSMutableSet; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptClassDescription; +import dstep.foundation.NSScriptCommandDescription; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSScriptSuiteRegistry : NSObject +{ + mixin ObjcWrap; + + static NSScriptSuiteRegistry sharedScriptSuiteRegistry () + { + return invokeObjcSelfClass!(NSScriptSuiteRegistry, "sharedScriptSuiteRegistry"return result is this.objcObject ? this : (result !is null ? new NSScriptSuiteRegistry(result) : null); } + + static void setSharedScriptSuiteRegistry (NSScriptSuiteRegistry registry) + { + return invokeObjcSelfClass!(void, "setSharedScriptSuiteRegistry:", NSScriptSuiteRegistry)(registry); + } + + void loadSuitesFromBundle (NSBundle bundle) + { + return invokeObjcSelf!(void, "loadSuitesFromBundle:", NSBundle)(bundle); + } + + void loadSuiteWithDictionary (NSDictionary suiteDeclaration, NSBundle bundle) + { + return invokeObjcSelf!(void, "loadSuiteWithDictionary:fromBundle:", NSDictionary, NSBundle)(suiteDeclaration, bundle); + } + + void registerClassDescription (NSScriptClassDescription classDescription) + { + return invokeObjcSelf!(void, "registerClassDescription:", NSScriptClassDescription)(classDescription); + } + + void registerCommandDescription (NSScriptCommandDescription commandDescription) + { + return invokeObjcSelf!(void, "registerCommandDescription:", NSScriptCommandDescription)(commandDescription); + } + + NSArray suiteNames () + { + return invokeObjcSelf!(NSArray, "suiteNames"); + } + + uint appleEventCodeForSuite (NSString suiteName) + { + return invokeObjcSelf!(uint, "appleEventCodeForSuite:", NSString)(suiteName); + } + + NSBundle bundleForSuite (NSString suiteName) + { + return invokeObjcSelf!(NSBundle, "bundleForSuite:", NSString)(suiteName); + } + + NSDictionary classDescriptionsInSuite (NSString suiteName) + { + return invokeObjcSelf!(NSDictionary, "classDescriptionsInSuite:", NSString)(suiteName); + } + + NSDictionary commandDescriptionsInSuite (NSString suiteName) + { + return invokeObjcSelf!(NSDictionary, "commandDescriptionsInSuite:", NSString)(suiteName); + } + + NSString suiteForAppleEventCode (uint appleEventCode) + { + return invokeObjcSelf!(NSString, "suiteForAppleEventCode:", uint)(appleEventCode); + } + + NSScriptClassDescription classDescriptionWithAppleEventCode (uint appleEventCode) + { + return invokeObjcSelf!(NSScriptClassDescription, "classDescriptionWithAppleEventCode:", uint)(appleEventCode); + } + + NSScriptCommandDescription commandDescriptionWithAppleEventClass (uint appleEventClassCode, uint appleEventIDCode) + { + return invokeObjcSelf!(NSScriptCommandDescription, "commandDescriptionWithAppleEventClass:andAppleEventCode:", uint, uint)(appleEventClassCode, appleEventIDCode); + } + + NSData aeteResource (NSString languageName) + { + return invokeObjcSelf!(NSData, "aeteResource:", NSString)(languageName); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSScriptWhoseTests.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSScriptWhoseTests.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,159 @@ +/** + * 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.NSScriptWhoseTests; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptObjectSpecifier; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSTestComparisonOperation; + +enum +{ + NSEqualToComparison = 0, + NSLessThanOrEqualToComparison, + NSLessThanComparison, + NSGreaterThanOrEqualToComparison, + NSGreaterThanComparison, + NSBeginsWithComparison, + NSEndsWithComparison, + NSContainsComparison +} + +class NSLogicalTest : NSScriptWhoseTest +{ + mixin ObjcWrap; + + Object initAndTestWithTests (NSArray subTests) + { + return invokeObjcSelf!(Object, "initAndTestWithTests:", NSArray)(subTests); + } + + this (NSArray subTests) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initAndTestWithTests:", NSArray)(objcObject, subTests); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initOrTestWithTests (NSArray subTests) + { + return invokeObjcSelf!(Object, "initOrTestWithTests:", NSArray)(subTests); + } + + this (NSArray subTests) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initOrTestWithTests:", NSArray)(objcObject, subTests); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initNotTestWithTest (NSScriptWhoseTest subTest) + { + return invokeObjcSelf!(Object, "initNotTestWithTest:", NSScriptWhoseTest)(subTest); + } + + this (NSScriptWhoseTest subTest) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initNotTestWithTest:", NSScriptWhoseTest)(objcObject, subTest); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSSpecifierTest : NSScriptWhoseTest +{ + mixin ObjcWrap; + + Object initWithObjectSpecifier (NSScriptObjectSpecifier obj1, uint compOp, Object obj2) + { + return invokeObjcSelf!(Object, "initWithObjectSpecifier:comparisonOperator:testObject:", NSScriptObjectSpecifier, uint, Object)(obj1, compOp, obj2); + } + + this (NSScriptObjectSpecifier obj1, uint compOp, Object obj2) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjectSpecifier:comparisonOperator:testObject:", NSScriptObjectSpecifier, uint, Object)(objcObject, obj1, compOp, obj2); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +class NSScriptWhoseTest : NSObject, INSCoding +{ + mixin ObjcWrap; + + bool isTrue () + { + return invokeObjcSelf!(bool, "isTrue"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSComparisonMethods () +{ + bool isEqualTo (Object object); + bool isLessThanOrEqualTo (Object object); + bool isLessThan (Object object); + bool isGreaterThanOrEqualTo (Object object); + bool isGreaterThan (Object object); + bool isNotEqualTo (Object object); + bool doesContain (Object object); + bool isLike (NSString object); + bool isCaseInsensitiveLike (NSString object); +} + +template TNSScriptingComparisonMethods () +{ + bool scriptingIsEqualTo (Object object); + bool scriptingIsLessThanOrEqualTo (Object object); + bool scriptingIsLessThan (Object object); + bool scriptingIsGreaterThanOrEqualTo (Object object); + bool scriptingIsGreaterThan (Object object); + bool scriptingBeginsWith (Object object); + bool scriptingEndsWith (Object object); + bool scriptingContains (Object object); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSSet.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSSet.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,404 @@ +/** + * 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.NSSet; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSSet : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration +{ + mixin ObjcWrap; + mixin TNSSetCreation; + mixin TNSExtendedSet; + mixin TNSKeyValueObserverRegistration; + + NSUInteger count () + { + return invokeObjcSelf!(NSUInteger, "count"); + } + + Object member (Object object) + { + return invokeObjcSelf!(Object, "member:", Object)(object); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) + { + return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); + } +} + +class NSMutableSet : NSSet +{ + mixin ObjcWrap; + mixin TNSPredicateSupport; + mixin TNSMutableSetCreation; + mixin TNSExtendedMutableSet; + + void addObject (Object object) + { + return invokeObjcSelf!(void, "addObject:", Object)(object); + } + + void removeObject (Object object) + { + return invokeObjcSelf!(void, "removeObject:", Object)(object); + } +} + +class NSCountedSet : NSMutableSet +{ + mixin ObjcWrap; + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithArray (NSArray array) + { + return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); + } + + this (NSArray array) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithArray:", NSArray)(objcObject, array); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithSet (NSSet set) + { + return invokeObjcSelf!(Object, "initWithSet:", NSSet)(set); + } + + this (NSSet set) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithSet:", NSSet)(objcObject, set); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSUInteger countForObject (Object object) + { + return invokeObjcSelf!(NSUInteger, "countForObject:", Object)(object); + } + + NSEnumerator objectEnumerator () + { + return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); + } + + void addObject (Object object) + { + return invokeObjcSelf!(void, "addObject:", Object)(object); + } + + void removeObject (Object object) + { + return invokeObjcSelf!(void, "removeObject:", Object)(object); + } +} + +template TNSSetCreation () +{ + static Object set () + { + return invokeObjcSelfClass!(Object, "set"); + } + + static Object setWithObject (Object object) + { + return invokeObjcSelfClass!(Object, "setWithObject:", Object)(object); + } + + static Object setWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSelfClass!(Object, "setWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + static Object setWithObjects (Object setWithObjects, ...) + { + return invokeObjcSelfClass!(Object, "setWithObjects:", Object)(setWithObjects); + } + + static Object setWithSet (NSSet set) + { + return invokeObjcSelfClass!(Object, "setWithSet:", NSSet)(set); + } + + static Object setWithArray (NSArray array) + { + return invokeObjcSelfClass!(Object, "setWithArray:", NSArray)(array); + } + + Object initWithObjects (id* objects, NSUInteger cnt) + { + return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); + } + + this (id* objects, NSUInteger cnt) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjects:count:", id*, NSUInteger)(objcObject, objects, cnt); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithObjects (Object initWithObjects, ...) + { + return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); + } + + this (Object initWithObjects, ...) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithObjects:", Object)(objcObject, initWithObjects); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithSet (NSSet set) + { + return invokeObjcSelf!(Object, "initWithSet:", NSSet)(set); + } + + this (NSSet set) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithSet:", NSSet)(objcObject, set); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithSet (NSSet set, bool flag) + { + return invokeObjcSelf!(Object, "initWithSet:copyItems:", NSSet, bool)(set, flag); + } + + this (NSSet set, bool flag) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithSet:copyItems:", NSSet, bool)(objcObject, set, flag); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithArray (NSArray array) + { + return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); + } + + this (NSArray array) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithArray:", NSArray)(objcObject, array); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedSet () +{ + NSArray allObjects () + { + return invokeObjcSelf!(NSArray, "allObjects"); + } + + Object anyObject () + { + return invokeObjcSelf!(Object, "anyObject"); + } + + bool containsObject (Object anObject) + { + return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } + + bool intersectsSet (NSSet otherSet) + { + return invokeObjcSelf!(bool, "intersectsSet:", NSSet)(otherSet); + } + + bool isEqualToSet (NSSet otherSet) + { + return invokeObjcSelf!(bool, "isEqualToSet:", NSSet)(otherSet); + } + + bool isSubsetOfSet (NSSet otherSet) + { + return invokeObjcSelf!(bool, "isSubsetOfSet:", NSSet)(otherSet); + } + + void makeObjectsPerformSelector (SEL aSelector) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:", SEL)(aSelector); + } + + void makeObjectsPerformSelector (SEL aSelector, Object argument) + { + return invokeObjcSelf!(void, "makeObjectsPerformSelector:withObject:", SEL, Object)(aSelector, argument); + } + + NSSet setByAddingObject (Object anObject) + { + return invokeObjcSelf!(NSSet, "setByAddingObject:", Object)(anObject); + } + + NSSet setByAddingObjectsFromSet (NSSet other) + { + return invokeObjcSelf!(NSSet, "setByAddingObjectsFromSet:", NSSet)(other); + } + + NSSet setByAddingObjectsFromArray (NSArray other) + { + return invokeObjcSelf!(NSSet, "setByAddingObjectsFromArray:", NSArray)(other); + } +} + +template TNSMutableSetCreation () +{ + static Object setWithCapacity (NSUInteger numItems) + { + return invokeObjcSelfClass!(Object, "setWithCapacity:", NSUInteger)(numItems); + } + + Object initWithCapacity (NSUInteger numItems) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); + } + + this (NSUInteger numItems) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedMutableSet () +{ + void addObjectsFromArray (NSArray array) + { + return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(array); + } + + void intersectSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "intersectSet:", NSSet)(otherSet); + } + + void minusSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "minusSet:", NSSet)(otherSet); + } + + void removeAllObjects () + { + return invokeObjcSelf!(void, "removeAllObjects"); + } + + void unionSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "unionSet:", NSSet)(otherSet); + } + + void setSet (NSSet otherSet) + { + return invokeObjcSelf!(void, "setSet:", NSSet)(otherSet); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSSortDescriptor.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSSortDescriptor.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,108 @@ +/** + * 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.NSSortDescriptor; + +import dstep.foundation.NSArray; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSSortDescriptor : NSObject, INSCoding, INSCopying +{ + mixin ObjcWrap; + + Object initWithKey (NSString key, bool ascending) + { + return invokeObjcSelf!(Object, "initWithKey:ascending:", NSString, bool)(key, ascending); + } + + 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; + } + + Object initWithKey (NSString key, bool ascending, SEL selector) + { + return invokeObjcSelf!(Object, "initWithKey:ascending:selector:", NSString, bool, SEL)(key, ascending, selector); + } + + 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; + } + + NSString key () + { + return invokeObjcSelf!(NSString, "key"); + } + + bool ascending () + { + return invokeObjcSelf!(bool, "ascending"); + } + + SEL selector () + { + return invokeObjcSelf!(SEL, "selector"); + } + + int compareObject (Object object1, Object object2) + { + return invokeObjcSelf!(int, "compareObject:toObject:", Object, Object)(object1, object2); + } + + Object reversedSortDescriptor () + { + return invokeObjcSelf!(Object, "reversedSortDescriptor"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + +template TNSSortDescriptorSorting () +{ + NSArray sortedArrayUsingDescriptors (NSArray sortDescriptors) + { + return invokeObjcSelf!(NSArray, "sortedArrayUsingDescriptors:", NSArray)(sortDescriptors); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSSpellServer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSSpellServer.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,67 @@ +/** + * 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.NSSpellServer; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSSpellServer_bindings; + +const NSString NSGrammarRange; +const NSString NSGrammarUserDescription; +const NSString NSGrammarCorrections; + +static this () +{ + NSGrammarRange = new NSString(bindings.NSGrammarRange); + NSGrammarUserDescription = new NSString(bindings.NSGrammarUserDescription); + NSGrammarCorrections = new NSString(bindings.NSGrammarCorrections); +} + +class NSSpellServer : NSObject +{ + mixin ObjcWrap; + + void setDelegate (Object anObject) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + bool registerLanguage (NSString language, NSString vendor) + { + return invokeObjcSelf!(bool, "registerLanguage:byVendor:", NSString, NSString)(language, vendor); + } + + bool isWordInUserDictionaries (NSString word, bool flag) + { + return invokeObjcSelf!(bool, "isWordInUserDictionaries:caseSensitive:", NSString, bool)(word, flag); + } + + void run () + { + return invokeObjcSelf!(void, "run"); + } +} + +template TNSSpellServerDelegate () +{ + NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, NSInteger* wordCount, bool countOnly); + NSArray spellServer (NSSpellServer sender, NSString word, NSString language); + void spellServer (NSSpellServer sender, NSString word, NSString language); + void spellServer (NSSpellServer sender, NSString word, NSString language); + NSArray spellServer (NSSpellServer sender, NSRange range, NSString string, NSString language); + NSRange spellServer (NSSpellServer sender, NSString stringToCheck, NSString language, NSArray** details); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSSpellServer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSSpellServer_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,19 @@ +module dstep.foundation.NSSpellServer_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSGrammarRange; + package const id NSGrammarUserDescription; + package const id NSGrammarCorrections; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSStream.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSStream.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,305 @@ +/** + * 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.NSStream; + +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSHost; +import dstep.foundation.NSInputStream; +import dstep.foundation.NSObject; +import dstep.foundation.NSOutputStream; +import dstep.foundation.NSRunLoop; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSStream_bindings; + +alias NSUInteger NSStreamStatus; +alias NSUInteger NSStreamEvent; + +const NSString NSStreamSocketSecurityLevelKey; +const NSString NSStreamSocketSecurityLevelNone; +const NSString NSStreamSocketSecurityLevelSSLv2; +const NSString NSStreamSocketSecurityLevelSSLv3; +const NSString NSStreamSocketSecurityLevelTLSv1; +const NSString NSStreamSocketSecurityLevelNegotiatedSSL; +const NSString NSStreamSOCKSProxyConfigurationKey; +const NSString NSStreamSOCKSProxyHostKey; +const NSString NSStreamSOCKSProxyPortKey; +const NSString NSStreamSOCKSProxyVersionKey; +const NSString NSStreamSOCKSProxyUserKey; +const NSString NSStreamSOCKSProxyPasswordKey; +const NSString NSStreamSOCKSProxyVersion4; +const NSString NSStreamSOCKSProxyVersion5; +const NSString NSStreamDataWrittenToMemoryStreamKey; +const NSString NSStreamFileCurrentOffsetKey; +const NSString NSStreamSocketSSLErrorDomain; +const NSString NSStreamSOCKSErrorDomain; + +enum +{ + NSStreamStatusNotOpen = 0, + NSStreamStatusOpening = 1, + NSStreamStatusOpen = 2, + NSStreamStatusReading = 3, + NSStreamStatusWriting = 4, + NSStreamStatusAtEnd = 5, + NSStreamStatusClosed = 6, + NSStreamStatusError = 7 +} + +enum +{ + NSStreamEventNone = 0, + NSStreamEventOpenCompleted = 1 << 0, + NSStreamEventHasBytesAvailable = 1 << 1, + NSStreamEventHasSpaceAvailable = 1 << 2, + NSStreamEventErrorOccurred = 1 << 3, + NSStreamEventEndEncountered = 1 << 4 +} + +static this () +{ + NSStreamSocketSecurityLevelKey = new NSString(bindings.NSStreamSocketSecurityLevelKey); + NSStreamSocketSecurityLevelNone = new NSString(bindings.NSStreamSocketSecurityLevelNone); + NSStreamSocketSecurityLevelSSLv2 = new NSString(bindings.NSStreamSocketSecurityLevelSSLv2); + NSStreamSocketSecurityLevelSSLv3 = new NSString(bindings.NSStreamSocketSecurityLevelSSLv3); + NSStreamSocketSecurityLevelTLSv1 = new NSString(bindings.NSStreamSocketSecurityLevelTLSv1); + NSStreamSocketSecurityLevelNegotiatedSSL = new NSString(bindings.NSStreamSocketSecurityLevelNegotiatedSSL); + NSStreamSOCKSProxyConfigurationKey = new NSString(bindings.NSStreamSOCKSProxyConfigurationKey); + NSStreamSOCKSProxyHostKey = new NSString(bindings.NSStreamSOCKSProxyHostKey); + NSStreamSOCKSProxyPortKey = new NSString(bindings.NSStreamSOCKSProxyPortKey); + NSStreamSOCKSProxyVersionKey = new NSString(bindings.NSStreamSOCKSProxyVersionKey); + NSStreamSOCKSProxyUserKey = new NSString(bindings.NSStreamSOCKSProxyUserKey); + NSStreamSOCKSProxyPasswordKey = new NSString(bindings.NSStreamSOCKSProxyPasswordKey); + NSStreamSOCKSProxyVersion4 = new NSString(bindings.NSStreamSOCKSProxyVersion4); + NSStreamSOCKSProxyVersion5 = new NSString(bindings.NSStreamSOCKSProxyVersion5); + NSStreamDataWrittenToMemoryStreamKey = new NSString(bindings.NSStreamDataWrittenToMemoryStreamKey); + NSStreamFileCurrentOffsetKey = new NSString(bindings.NSStreamFileCurrentOffsetKey); + NSStreamSocketSSLErrorDomain = new NSString(bindings.NSStreamSocketSSLErrorDomain); + NSStreamSOCKSErrorDomain = new NSString(bindings.NSStreamSOCKSErrorDomain); +} + +class NSStream : NSObject +{ + mixin ObjcWrap; + mixin TNSSocketStreamCreationExtensions; + + void open () + { + return invokeObjcSelf!(void, "open"); + } + + void close () + { + return invokeObjcSelf!(void, "close"); + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + Object propertyForKey (NSString key) + { + return invokeObjcSelf!(Object, "propertyForKey:", NSString)(key); + } + + bool setProperty (Object property, NSString key) + { + return invokeObjcSelf!(bool, "setProperty:forKey:", Object, NSString)(property, key); + } + + void scheduleInRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "scheduleInRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } + + void removeFromRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "removeFromRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } + + uint streamStatus () + { + return invokeObjcSelf!(uint, "streamStatus"); + } + + NSError streamError () + { + return invokeObjcSelf!(NSError, "streamError"); + } +} + +class NSOutputStream : NSStream +{ + mixin ObjcWrap; + mixin TNSOutputStreamExtensions; + + NSInteger write (char* buffer, NSUInteger len) + { + return invokeObjcSelf!(NSInteger, "write:maxLength:", char*, NSUInteger)(buffer, len); + } + + bool hasSpaceAvailable () + { + return invokeObjcSelf!(bool, "hasSpaceAvailable"); + } +} + +class NSInputStream : NSStream +{ + mixin ObjcWrap; + mixin TNSInputStreamExtensions; + + NSInteger read (char* buffer, NSUInteger len) + { + return invokeObjcSelf!(NSInteger, "read:maxLength:", char*, NSUInteger)(buffer, len); + } + + bool getBuffer (uint8_t** buffer, NSUInteger* len) + { + return invokeObjcSelf!(bool, "getBuffer:length:", uint8_t**, NSUInteger*)(buffer, len); + } + + bool hasBytesAvailable () + { + return invokeObjcSelf!(bool, "hasBytesAvailable"); + } +} + +template TNSStreamDelegateEventExtensions () +{ + void stream (NSStream aStream, uint eventCode); +} + +template TNSOutputStreamExtensions () +{ + Object initToMemory () + { + return invokeObjcSelf!(Object, "initToMemory"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initToMemory")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initToBuffer (char* buffer, NSUInteger capacity) + { + return invokeObjcSelf!(Object, "initToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); + } + + this (char* buffer, NSUInteger capacity) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initToBuffer:capacity:", char*, NSUInteger)(objcObject, buffer, capacity); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initToFileAtPath (NSString path, bool shouldAppend) + { + return invokeObjcSelf!(Object, "initToFileAtPath:append:", NSString, bool)(path, shouldAppend); + } + + this (NSString path, bool shouldAppend) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initToFileAtPath:append:", NSString, bool)(objcObject, path, shouldAppend); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object outputStreamToMemory () + { + return invokeObjcSelfClass!(Object, "outputStreamToMemory"); + } + + static Object outputStreamToBuffer (char* buffer, NSUInteger capacity) + { + return invokeObjcSelfClass!(Object, "outputStreamToBuffer:capacity:", char*, NSUInteger)(buffer, capacity); + } + + static Object outputStreamToFileAtPath (NSString path, bool shouldAppend) + { + return invokeObjcSelfClass!(Object, "outputStreamToFileAtPath:append:", NSString, bool)(path, shouldAppend); + } +} + +template TNSSocketStreamCreationExtensions () +{ + static void getStreamsToHost (NSHost host, NSInteger port, NSInputStream** inputStream, NSOutputStream** outputStream) + { + return invokeObjcSelfClass!(void, "getStreamsToHost:port:inputStream:outputStream:", NSHost, NSInteger, NSInputStream**, NSOutputStream**)(host, port, inputStream, outputStream); + } +} + +template TNSInputStreamExtensions () +{ + Object initWithData (NSData data) + { + return invokeObjcSelf!(Object, "initWithData:", NSData)(data); + } + + this (NSData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithData:", NSData)(objcObject, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithFileAtPath (NSString path) + { + return invokeObjcSelf!(Object, "initWithFileAtPath:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFileAtPath:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object inputStreamWithData (NSData data) + { + return invokeObjcSelfClass!(Object, "inputStreamWithData:", NSData)(data); + } + + static Object inputStreamWithFileAtPath (NSString path) + { + return invokeObjcSelfClass!(Object, "inputStreamWithFileAtPath:", NSString)(path); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSStream_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSStream_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,40 @@ +module dstep.foundation.NSStream_bindings; + +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSHost; +import dstep.foundation.NSInputStream; +import dstep.foundation.NSObject; +import dstep.foundation.NSOutputStream; +import dstep.foundation.NSRunLoop; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSStreamSocketSecurityLevelKey; + package const id NSStreamSocketSecurityLevelNone; + package const id NSStreamSocketSecurityLevelSSLv2; + package const id NSStreamSocketSecurityLevelSSLv3; + package const id NSStreamSocketSecurityLevelTLSv1; + package const id NSStreamSocketSecurityLevelNegotiatedSSL; + package const id NSStreamSOCKSProxyConfigurationKey; + package const id NSStreamSOCKSProxyHostKey; + package const id NSStreamSOCKSProxyPortKey; + package const id NSStreamSOCKSProxyVersionKey; + package const id NSStreamSOCKSProxyUserKey; + package const id NSStreamSOCKSProxyPasswordKey; + package const id NSStreamSOCKSProxyVersion4; + package const id NSStreamSOCKSProxyVersion5; + package const id NSStreamDataWrittenToMemoryStreamKey; + package const id NSStreamFileCurrentOffsetKey; + package const id NSStreamSocketSSLErrorDomain; + package const id NSStreamSOCKSErrorDomain; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSString.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSString.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,1035 @@ +/** + * 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.NSString; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCharacterSet; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSLocale; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSURL; +import dstep.limits; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.stdarg; + +import bindings = dstep.foundation.NSString_bindings; + +alias ushort unichar; +alias NSUInteger NSStringCompareOptions; +alias NSUInteger NSStringEncoding; +alias NSUInteger NSStringEncodingConversionOptions; + +const NSString NSParseErrorException; +const NSString NSCharacterConversionException; + +enum +{ + NSCaseInsensitiveSearch = 1, + NSLiteralSearch = 2, + NSBackwardsSearch = 4, + NSAnchoredSearch = 8, + NSNumericSearch = 64, + NSDiacriticInsensitiveSearch = 128, + NSWidthInsensitiveSearch = 256, + NSForcedOrderingSearch = 512 +} + +enum +{ + NSASCIIStringEncoding = 1, + NSNEXTSTEPStringEncoding = 2, + NSJapaneseEUCStringEncoding = 3, + NSUTF8StringEncoding = 4, + NSISOLatin1StringEncoding = 5, + NSSymbolStringEncoding = 6, + NSNonLossyASCIIStringEncoding = 7, + NSShiftJISStringEncoding = 8, + NSISOLatin2StringEncoding = 9, + NSUnicodeStringEncoding = 10, + NSWindowsCP1251StringEncoding = 11, + NSWindowsCP1252StringEncoding = 12, + NSWindowsCP1253StringEncoding = 13, + NSWindowsCP1254StringEncoding = 14, + NSWindowsCP1250StringEncoding = 15, + NSISO2022JPStringEncoding = 21, + NSMacOSRomanStringEncoding = 30, + NSUTF16StringEncoding = NSUnicodeStringEncoding, + NSUTF16BigEndianStringEncoding = 0x90000100, + NSUTF16LittleEndianStringEncoding = 0x94000100, + NSUTF32StringEncoding = 0x8c000100, + NSUTF32BigEndianStringEncoding = 0x98000100, + NSUTF32LittleEndianStringEncoding = 0x9c000100 +} + +enum +{ + NSStringEncodingConversionAllowLossy = 1, + NSStringEncodingConversionExternalRepresentation = 2 +} + +static this () +{ + NSParseErrorException = new NSString(bindings.NSParseErrorException); + NSCharacterConversionException = new NSString(bindings.NSCharacterConversionException); +} + +class NSMutableString : NSString +{ + mixin ObjcWrap; + mixin TNSMutableStringExtensionMethods; + + void replaceCharactersInRange (NSRange range, NSString aString) + { + return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, aString); + } +} + +class NSString : NSObject, INSCopying, INSMutableCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSExtendedStringPropertyListParsing; + mixin TNSStringExtensionMethods; + mixin TNSStringPathExtensions; + mixin TNSURLUtilities; + mixin TNSStringDeprecated; + + NSUInteger length () + { + return invokeObjcSelf!(NSUInteger, "length"); + } + + ushort characterAtIndex (NSUInteger index) + { + return invokeObjcSelf!(ushort, "characterAtIndex:", NSUInteger)(index); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedStringPropertyListParsing () +{ + Object propertyList () + { + return invokeObjcSelf!(Object, "propertyList"); + } + + NSDictionary propertyListFromStringsFileFormat () + { + return invokeObjcSelf!(NSDictionary, "propertyListFromStringsFileFormat"); + } +} + +template TNSMutableStringExtensionMethods () +{ + void insertString (NSString aString, NSUInteger loc) + { + return invokeObjcSelf!(void, "insertString:atIndex:", NSString, NSUInteger)(aString, loc); + } + + void deleteCharactersInRange (NSRange range) + { + return invokeObjcSelf!(void, "deleteCharactersInRange:", NSRange)(range); + } + + void appendString (NSString aString) + { + return invokeObjcSelf!(void, "appendString:", NSString)(aString); + } + + void appendFormat (NSString appendFormat, ...) + { + return invokeObjcSelf!(void, "appendFormat:", NSString)(appendFormat); + } + + void setString (NSString aString) + { + return invokeObjcSelf!(void, "setString:", NSString)(aString); + } + + Object initWithCapacity (NSUInteger capacity) + { + return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(capacity); + } + + this (NSUInteger capacity) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, capacity); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object stringWithCapacity (NSUInteger capacity) + { + return invokeObjcSelfClass!(Object, "stringWithCapacity:", NSUInteger)(capacity); + } + + NSUInteger replaceOccurrencesOfString (NSString target, NSString replacement, uint options, NSRange searchRange) + { + return invokeObjcSelf!(NSUInteger, "replaceOccurrencesOfString:withString:options:range:", NSString, NSString, uint, NSRange)(target, replacement, options, searchRange); + } +} + +template TNSStringExtensionMethods () +{ + void getCharacters (unichar* buffer) + { + return invokeObjcSelf!(void, "getCharacters:", unichar*)(buffer); + } + + void getCharacters (unichar* buffer, NSRange aRange) + { + return invokeObjcSelf!(void, "getCharacters:range:", unichar*, NSRange)(buffer, aRange); + } + + NSString substringFromIndex (NSUInteger from) + { + return invokeObjcSelf!(NSString, "substringFromIndex:", NSUInteger)(from); + } + + NSString substringToIndex (NSUInteger to) + { + return invokeObjcSelf!(NSString, "substringToIndex:", NSUInteger)(to); + } + + NSString substringWithRange (NSRange range) + { + return invokeObjcSelf!(NSString, "substringWithRange:", NSRange)(range); + } + + int compare (NSString string) + { + return invokeObjcSelf!(int, "compare:", NSString)(string); + } + + int compare (NSString string, uint mask) + { + return invokeObjcSelf!(int, "compare:options:", NSString, uint)(string, mask); + } + + int compare (NSString string, uint mask, NSRange compareRange) + { + return invokeObjcSelf!(int, "compare:options:range:", NSString, uint, NSRange)(string, mask, compareRange); + } + + int compare (NSString string, uint mask, NSRange compareRange, Object locale) + { + return invokeObjcSelf!(int, "compare:options:range:locale:", NSString, uint, NSRange, Object)(string, mask, compareRange, locale); + } + + int caseInsensitiveCompare (NSString string) + { + return invokeObjcSelf!(int, "caseInsensitiveCompare:", NSString)(string); + } + + int localizedCompare (NSString string) + { + return invokeObjcSelf!(int, "localizedCompare:", NSString)(string); + } + + int localizedCaseInsensitiveCompare (NSString string) + { + return invokeObjcSelf!(int, "localizedCaseInsensitiveCompare:", NSString)(string); + } + + bool isEqualToString (NSString aString) + { + return invokeObjcSelf!(bool, "isEqualToString:", NSString)(aString); + } + + bool hasPrefix (NSString aString) + { + return invokeObjcSelf!(bool, "hasPrefix:", NSString)(aString); + } + + bool hasSuffix (NSString aString) + { + return invokeObjcSelf!(bool, "hasSuffix:", NSString)(aString); + } + + NSRange rangeOfString (NSString aString) + { + return invokeObjcSelf!(NSRange, "rangeOfString:", NSString)(aString); + } + + NSRange rangeOfString (NSString aString, uint mask) + { + return invokeObjcSelf!(NSRange, "rangeOfString:options:", NSString, uint)(aString, mask); + } + + NSRange rangeOfString (NSString aString, uint mask, NSRange searchRange) + { + return invokeObjcSelf!(NSRange, "rangeOfString:options:range:", NSString, uint, NSRange)(aString, mask, searchRange); + } + + NSRange rangeOfString (NSString aString, uint mask, NSRange searchRange, NSLocale locale) + { + return invokeObjcSelf!(NSRange, "rangeOfString:options:range:locale:", NSString, uint, NSRange, NSLocale)(aString, mask, searchRange, locale); + } + + NSRange rangeOfCharacterFromSet (NSCharacterSet aSet) + { + return invokeObjcSelf!(NSRange, "rangeOfCharacterFromSet:", NSCharacterSet)(aSet); + } + + NSRange rangeOfCharacterFromSet (NSCharacterSet aSet, uint mask) + { + return invokeObjcSelf!(NSRange, "rangeOfCharacterFromSet:options:", NSCharacterSet, uint)(aSet, mask); + } + + NSRange rangeOfCharacterFromSet (NSCharacterSet aSet, uint mask, NSRange searchRange) + { + return invokeObjcSelf!(NSRange, "rangeOfCharacterFromSet:options:range:", NSCharacterSet, uint, NSRange)(aSet, mask, searchRange); + } + + NSRange rangeOfComposedCharacterSequenceAtIndex (NSUInteger index) + { + return invokeObjcSelf!(NSRange, "rangeOfComposedCharacterSequenceAtIndex:", NSUInteger)(index); + } + + NSRange rangeOfComposedCharacterSequencesForRange (NSRange range) + { + return invokeObjcSelf!(NSRange, "rangeOfComposedCharacterSequencesForRange:", NSRange)(range); + } + + NSString stringByAppendingString (NSString aString) + { + return invokeObjcSelf!(NSString, "stringByAppendingString:", NSString)(aString); + } + + NSString stringByAppendingFormat (NSString stringByAppendingFormat, ...) + { + return invokeObjcSelf!(NSString, "stringByAppendingFormat:", NSString)(stringByAppendingFormat); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } + + float floatValue () + { + return invokeObjcSelf!(float, "floatValue"); + } + + int intValue () + { + return invokeObjcSelf!(int, "intValue"); + } + + NSInteger integerValue () + { + return invokeObjcSelf!(NSInteger, "integerValue"); + } + + long longLongValue () + { + return invokeObjcSelf!(long, "longLongValue"); + } + + bool boolValue () + { + return invokeObjcSelf!(bool, "boolValue"); + } + + NSArray componentsSeparatedByString (NSString separator) + { + return invokeObjcSelf!(NSArray, "componentsSeparatedByString:", NSString)(separator); + } + + NSArray componentsSeparatedByCharactersInSet (NSCharacterSet separator) + { + return invokeObjcSelf!(NSArray, "componentsSeparatedByCharactersInSet:", NSCharacterSet)(separator); + } + + NSString commonPrefixWithString (NSString aString, uint mask) + { + return invokeObjcSelf!(NSString, "commonPrefixWithString:options:", NSString, uint)(aString, mask); + } + + NSString uppercaseString () + { + return invokeObjcSelf!(NSString, "uppercaseString"); + } + + NSString lowercaseString () + { + return invokeObjcSelf!(NSString, "lowercaseString"); + } + + NSString capitalizedString () + { + return invokeObjcSelf!(NSString, "capitalizedString"); + } + + NSString stringByTrimmingCharactersInSet (NSCharacterSet set) + { + return invokeObjcSelf!(NSString, "stringByTrimmingCharactersInSet:", NSCharacterSet)(set); + } + + NSString stringByPaddingToLength (NSUInteger newLength, NSString padString, NSUInteger padIndex) + { + return invokeObjcSelf!(NSString, "stringByPaddingToLength:withString:startingAtIndex:", NSUInteger, NSString, NSUInteger)(newLength, padString, padIndex); + } + + void getLineStart (NSUInteger* startPtr, NSUInteger* lineEndPtr, NSUInteger* contentsEndPtr, NSRange range) + { + return invokeObjcSelf!(void, "getLineStart:end:contentsEnd:forRange:", NSUInteger*, NSUInteger*, NSUInteger*, NSRange)(startPtr, lineEndPtr, contentsEndPtr, range); + } + + NSRange lineRangeForRange (NSRange range) + { + return invokeObjcSelf!(NSRange, "lineRangeForRange:", NSRange)(range); + } + + void getParagraphStart (NSUInteger* startPtr, NSUInteger* parEndPtr, NSUInteger* contentsEndPtr, NSRange range) + { + return invokeObjcSelf!(void, "getParagraphStart:end:contentsEnd:forRange:", NSUInteger*, NSUInteger*, NSUInteger*, NSRange)(startPtr, parEndPtr, contentsEndPtr, range); + } + + NSRange paragraphRangeForRange (NSRange range) + { + return invokeObjcSelf!(NSRange, "paragraphRangeForRange:", NSRange)(range); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSUInteger hash () + { + return invokeObjcSelf!(NSUInteger, "hash"); + } + + uint fastestEncoding () + { + return invokeObjcSelf!(uint, "fastestEncoding"); + } + + uint smallestEncoding () + { + return invokeObjcSelf!(uint, "smallestEncoding"); + } + + NSData dataUsingEncoding (uint encoding, bool lossy) + { + return invokeObjcSelf!(NSData, "dataUsingEncoding:allowLossyConversion:", uint, bool)(encoding, lossy); + } + + NSData dataUsingEncoding (uint encoding) + { + return invokeObjcSelf!(NSData, "dataUsingEncoding:", uint)(encoding); + } + + bool canBeConvertedToEncoding (uint encoding) + { + return invokeObjcSelf!(bool, "canBeConvertedToEncoding:", uint)(encoding); + } + + char* cStringUsingEncoding (uint encoding) + { + return invokeObjcSelf!(char*, "cStringUsingEncoding:", uint)(encoding); + } + + bool getCString (char* buffer, NSUInteger maxBufferCount, uint encoding) + { + return invokeObjcSelf!(bool, "getCString:maxLength:encoding:", char*, NSUInteger, uint)(buffer, maxBufferCount, encoding); + } + + bool getBytes (void* buffer, NSUInteger maxBufferCount, NSUInteger* usedBufferCount, uint encoding, uint options, NSRange range, NSRangePointer leftover) + { + return invokeObjcSelf!(bool, "getBytes:maxLength:usedLength:encoding:options:range:remainingRange:", void*, NSUInteger, NSUInteger*, uint, uint, NSRange, NSRangePointer)(buffer, maxBufferCount, usedBufferCount, encoding, options, range, leftover); + } + + NSUInteger maximumLengthOfBytesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSUInteger, "maximumLengthOfBytesUsingEncoding:", uint)(enc); + } + + NSUInteger lengthOfBytesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSUInteger, "lengthOfBytesUsingEncoding:", uint)(enc); + } + + NSString decomposedStringWithCanonicalMapping () + { + return invokeObjcSelf!(NSString, "decomposedStringWithCanonicalMapping"); + } + + NSString precomposedStringWithCanonicalMapping () + { + return invokeObjcSelf!(NSString, "precomposedStringWithCanonicalMapping"); + } + + NSString decomposedStringWithCompatibilityMapping () + { + return invokeObjcSelf!(NSString, "decomposedStringWithCompatibilityMapping"); + } + + NSString precomposedStringWithCompatibilityMapping () + { + return invokeObjcSelf!(NSString, "precomposedStringWithCompatibilityMapping"); + } + + NSString stringByFoldingWithOptions (uint options, NSLocale locale) + { + return invokeObjcSelf!(NSString, "stringByFoldingWithOptions:locale:", uint, NSLocale)(options, locale); + } + + NSString stringByReplacingOccurrencesOfString (NSString target, NSString replacement, uint options, NSRange searchRange) + { + return invokeObjcSelf!(NSString, "stringByReplacingOccurrencesOfString:withString:options:range:", NSString, NSString, uint, NSRange)(target, replacement, options, searchRange); + } + + NSString stringByReplacingOccurrencesOfString (NSString target, NSString replacement) + { + return invokeObjcSelf!(NSString, "stringByReplacingOccurrencesOfString:withString:", NSString, NSString)(target, replacement); + } + + NSString stringByReplacingCharactersInRange (NSRange range, NSString replacement) + { + return invokeObjcSelf!(NSString, "stringByReplacingCharactersInRange:withString:", NSRange, NSString)(range, replacement); + } + + char* UTF8String () + { + return invokeObjcSelf!(char*, "UTF8String"); + } + + static uint defaultCStringEncoding () + { + return invokeObjcSelfClass!(uint, "defaultCStringEncoding"); + } + + static NSStringEncoding* availableStringEncodings () + { + return invokeObjcSelfClass!(NSStringEncoding*, "availableStringEncodings"); + } + + static NSString localizedNameOfStringEncoding (uint encoding) + { + return invokeObjcSelfClass!(NSString, "localizedNameOfStringEncoding:", uint)(encoding); + } + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithCharactersNoCopy (unichar* characters, NSUInteger length, bool freeBuffer) + { + return invokeObjcSelf!(Object, "initWithCharactersNoCopy:length:freeWhenDone:", unichar*, NSUInteger, bool)(characters, length, freeBuffer); + } + + this (unichar* characters, NSUInteger length, bool freeBuffer) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCharactersNoCopy:length:freeWhenDone:", unichar*, NSUInteger, bool)(objcObject, characters, length, freeBuffer); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithCharacters (unichar* characters, NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithCharacters:length:", unichar*, NSUInteger)(characters, length); + } + + this (unichar* characters, NSUInteger length) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCharacters:length:", unichar*, NSUInteger)(objcObject, characters, length); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUTF8String (char* nullTerminatedCString) + { + return invokeObjcSelf!(Object, "initWithUTF8String:", char*)(nullTerminatedCString); + } + + this (char* nullTerminatedCString) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUTF8String:", char*)(objcObject, nullTerminatedCString); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString aString) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(aString); + } + + this (NSString aString) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, aString); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithFormat (NSString initWithFormat, ...) + { + return invokeObjcSelf!(Object, "initWithFormat:", NSString)(initWithFormat); + } + + this (NSString initWithFormat, ...) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFormat:", NSString)(objcObject, initWithFormat); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithFormat (NSString format, char* argList) + { + return invokeObjcSelf!(Object, "initWithFormat:arguments:", NSString, char*)(format, argList); + } + + this (NSString format, char* argList) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFormat:arguments:", NSString, char*)(objcObject, format, argList); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithFormat (NSString format, Object locale, ...) + { + return invokeObjcSelf!(Object, "initWithFormat:locale:", NSString, Object)(format, locale); + } + + this (NSString format, Object locale, ...) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFormat:locale:", NSString, Object)(objcObject, format, locale); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithFormat (NSString format, Object locale, char* argList) + { + return invokeObjcSelf!(Object, "initWithFormat:locale:arguments:", NSString, Object, char*)(format, locale, argList); + } + + this (NSString format, Object locale, char* argList) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFormat:locale:arguments:", NSString, Object, char*)(objcObject, format, locale, argList); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithData (NSData data, uint encoding) + { + return invokeObjcSelf!(Object, "initWithData:encoding:", NSData, uint)(data, encoding); + } + + this (NSData data, uint encoding) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithData:encoding:", NSData, uint)(objcObject, data, encoding); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithBytes (void* bytes, NSUInteger len, uint encoding) + { + return invokeObjcSelf!(Object, "initWithBytes:length:encoding:", void*, NSUInteger, uint)(bytes, len, encoding); + } + + this (void* bytes, NSUInteger len, uint encoding) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithBytes:length:encoding:", void*, NSUInteger, uint)(objcObject, bytes, len, encoding); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithBytesNoCopy (void* bytes, NSUInteger len, uint encoding, bool freeBuffer) + { + return invokeObjcSelf!(Object, "initWithBytesNoCopy:length:encoding:freeWhenDone:", void*, NSUInteger, uint, bool)(bytes, len, encoding, freeBuffer); + } + + this (void* bytes, NSUInteger len, uint encoding, bool freeBuffer) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithBytesNoCopy:length:encoding:freeWhenDone:", void*, NSUInteger, uint, bool)(objcObject, bytes, len, encoding, freeBuffer); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object string () + { + return invokeObjcSelfClass!(Object, "string"); + } + + static Object stringWithString (NSString string) + { + return invokeObjcSelfClass!(Object, "stringWithString:", NSString)(string); + } + + static Object stringWithCharacters (unichar* characters, NSUInteger length) + { + return invokeObjcSelfClass!(Object, "stringWithCharacters:length:", unichar*, NSUInteger)(characters, length); + } + + static Object stringWithUTF8String (char* nullTerminatedCString) + { + return invokeObjcSelfClass!(Object, "stringWithUTF8String:", char*)(nullTerminatedCString); + } + + static Object stringWithFormat (NSString stringWithFormat, ...) + { + return invokeObjcSelfClass!(Object, "stringWithFormat:", NSString)(stringWithFormat); + } + + static Object localizedStringWithFormat (NSString localizedStringWithFormat, ...) + { + return invokeObjcSelfClass!(Object, "localizedStringWithFormat:", NSString)(localizedStringWithFormat); + } + + Object initWithCString (char* nullTerminatedCString, uint encoding) + { + return invokeObjcSelf!(Object, "initWithCString:encoding:", char*, uint)(nullTerminatedCString, encoding); + } + + this (char* nullTerminatedCString, uint encoding) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCString:encoding:", char*, uint)(objcObject, nullTerminatedCString, encoding); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object stringWithCString (char* cString, uint enc) + { + return invokeObjcSelfClass!(Object, "stringWithCString:encoding:", char*, uint)(cString, enc); + } + + Object initWithContentsOfURL (NSURL url, uint enc, NSError** error) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:encoding:error:", NSURL, uint, NSError**)(url, enc, error); + } + + this (NSURL url, uint enc, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:encoding:error:", NSURL, uint, NSError**)(objcObject, url, enc, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfFile (NSString path, uint enc, NSError** error) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:encoding:error:", NSString, uint, NSError**)(path, enc, error); + } + + this (NSString path, uint enc, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:encoding:error:", NSString, uint, NSError**)(objcObject, path, enc, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object stringWithContentsOfURL (NSURL url, uint enc, NSError** error) + { + return invokeObjcSelfClass!(Object, "stringWithContentsOfURL:encoding:error:", NSURL, uint, NSError**)(url, enc, error); + } + + static Object stringWithContentsOfFile (NSString path, uint enc, NSError** error) + { + return invokeObjcSelfClass!(Object, "stringWithContentsOfFile:encoding:error:", NSString, uint, NSError**)(path, enc, error); + } + + Object initWithContentsOfURL (NSURL url, NSStringEncoding* enc, NSError** error) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, NSError**)(url, enc, error); + } + + this (NSURL url, NSStringEncoding* enc, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, NSError**)(objcObject, url, enc, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfFile (NSString path, NSStringEncoding* enc, NSError** error) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, NSError**)(path, enc, error); + } + + this (NSString path, NSStringEncoding* enc, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, NSError**)(objcObject, path, enc, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object stringWithContentsOfURL (NSURL url, NSStringEncoding* enc, NSError** error) + { + return invokeObjcSelfClass!(Object, "stringWithContentsOfURL:usedEncoding:error:", NSURL, NSStringEncoding*, NSError**)(url, enc, error); + } + + static Object stringWithContentsOfFile (NSString path, NSStringEncoding* enc, NSError** error) + { + return invokeObjcSelfClass!(Object, "stringWithContentsOfFile:usedEncoding:error:", NSString, NSStringEncoding*, NSError**)(path, enc, error); + } + + bool writeToURL (NSURL url, bool useAuxiliaryFile, uint enc, NSError** error) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:encoding:error:", NSURL, bool, uint, NSError**)(url, useAuxiliaryFile, enc, error); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile, uint enc, NSError** error) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:encoding:error:", NSString, bool, uint, NSError**)(path, useAuxiliaryFile, enc, error); + } +} + +template TNSStringDeprecated () +{ + char* cString () + { + return invokeObjcSelf!(char*, "cString"); + } + + char* lossyCString () + { + return invokeObjcSelf!(char*, "lossyCString"); + } + + NSUInteger cStringLength () + { + return invokeObjcSelf!(NSUInteger, "cStringLength"); + } + + void getCString (char* bytes) + { + return invokeObjcSelf!(void, "getCString:", char*)(bytes); + } + + void getCString (char* bytes, NSUInteger maxLength) + { + return invokeObjcSelf!(void, "getCString:maxLength:", char*, NSUInteger)(bytes, maxLength); + } + + void getCString (char* bytes, NSUInteger maxLength, NSRange aRange, NSRangePointer leftoverRange) + { + return invokeObjcSelf!(void, "getCString:maxLength:range:remainingRange:", char*, NSUInteger, NSRange, NSRangePointer)(bytes, maxLength, aRange, leftoverRange); + } + + bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); + } + + bool writeToURL (NSURL url, bool atomically) + { + return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); + } + + Object initWithContentsOfFile (NSString path) + { + return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object stringWithContentsOfFile (NSString path) + { + return invokeObjcSelfClass!(Object, "stringWithContentsOfFile:", NSString)(path); + } + + static Object stringWithContentsOfURL (NSURL url) + { + return invokeObjcSelfClass!(Object, "stringWithContentsOfURL:", NSURL)(url); + } + + Object initWithCStringNoCopy (char* bytes, NSUInteger length, bool freeBuffer) + { + return invokeObjcSelf!(Object, "initWithCStringNoCopy:length:freeWhenDone:", char*, NSUInteger, bool)(bytes, length, freeBuffer); + } + + this (char* bytes, NSUInteger length, bool freeBuffer) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCStringNoCopy:length:freeWhenDone:", char*, NSUInteger, bool)(objcObject, bytes, length, freeBuffer); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithCString (char* bytes, NSUInteger length) + { + return invokeObjcSelf!(Object, "initWithCString:length:", char*, NSUInteger)(bytes, length); + } + + this (char* bytes, NSUInteger length) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCString:length:", char*, NSUInteger)(objcObject, bytes, length); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithCString (char* bytes) + { + return invokeObjcSelf!(Object, "initWithCString:", char*)(bytes); + } + + this (char* bytes) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCString:", char*)(objcObject, bytes); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object stringWithCString (char* bytes, NSUInteger length) + { + return invokeObjcSelfClass!(Object, "stringWithCString:length:", char*, NSUInteger)(bytes, length); + } + + static Object stringWithCString (char* bytes) + { + return invokeObjcSelfClass!(Object, "stringWithCString:", char*)(bytes); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSString_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSString_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,26 @@ +module dstep.foundation.NSString_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSCharacterSet; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSLocale; +import dstep.foundation.NSObject; +import dstep.foundation.NSRange; +import dstep.foundation.NSURL; +import dstep.limits; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; +import dstep.stdarg; + + +extern (C) +{ + extern + { + package const id NSParseErrorException; + package const id NSCharacterConversionException; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSTask.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSTask.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,169 @@ +/** + * 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.NSTask; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSTask_bindings; + +const NSString NSTaskDidTerminateNotification; + +static this () +{ + NSTaskDidTerminateNotification = new NSString(bindings.NSTaskDidTerminateNotification); +} + +class NSTask : NSObject +{ + mixin ObjcWrap; + mixin TNSTaskConveniences; + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + void setLaunchPath (NSString path) + { + return invokeObjcSelf!(void, "setLaunchPath:", NSString)(path); + } + + void setArguments (NSArray arguments) + { + return invokeObjcSelf!(void, "setArguments:", NSArray)(arguments); + } + + void setEnvironment (NSDictionary dict) + { + return invokeObjcSelf!(void, "setEnvironment:", NSDictionary)(dict); + } + + void setCurrentDirectoryPath (NSString path) + { + return invokeObjcSelf!(void, "setCurrentDirectoryPath:", NSString)(path); + } + + void setStandardInput (Object input) + { + return invokeObjcSelf!(void, "setStandardInput:", Object)(input); + } + + void setStandardOutput (Object output) + { + return invokeObjcSelf!(void, "setStandardOutput:", Object)(output); + } + + void setStandardError (Object error) + { + return invokeObjcSelf!(void, "setStandardError:", Object)(error); + } + + NSString launchPath () + { + return invokeObjcSelf!(NSString, "launchPath"); + } + + NSArray arguments () + { + return invokeObjcSelf!(NSArray, "arguments"); + } + + NSDictionary environment () + { + return invokeObjcSelf!(NSDictionary, "environment"); + } + + NSString currentDirectoryPath () + { + return invokeObjcSelf!(NSString, "currentDirectoryPath"); + } + + Object standardInput () + { + return invokeObjcSelf!(Object, "standardInput"); + } + + Object standardOutput () + { + return invokeObjcSelf!(Object, "standardOutput"); + } + + Object standardError () + { + return invokeObjcSelf!(Object, "standardError"); + } + + void launch () + { + return invokeObjcSelf!(void, "launch"); + } + + void interrupt () + { + return invokeObjcSelf!(void, "interrupt"); + } + + void terminate () + { + return invokeObjcSelf!(void, "terminate"); + } + + bool suspend () + { + return invokeObjcSelf!(bool, "suspend"); + } + + bool resume () + { + return invokeObjcSelf!(bool, "resume"); + } + + int processIdentifier () + { + return invokeObjcSelf!(int, "processIdentifier"); + } + + bool isRunning () + { + return invokeObjcSelf!(bool, "isRunning"); + } + + int terminationStatus () + { + return invokeObjcSelf!(int, "terminationStatus"); + } +} + +template TNSTaskConveniences () +{ + static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) + { + return invokeObjcSelfClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); + } + + void waitUntilExit () + { + return invokeObjcSelf!(void, "waitUntilExit"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSTask_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSTask_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,18 @@ +module dstep.foundation.NSTask_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSTaskDidTerminateNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSThread.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSThread.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,187 @@ +/** + * 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.NSThread; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSThread_bindings; + +const NSString NSWillBecomeMultiThreadedNotification; +const NSString NSDidBecomeSingleThreadedNotification; +const NSString NSThreadWillExitNotification; + +static this () +{ + NSWillBecomeMultiThreadedNotification = new NSString(bindings.NSWillBecomeMultiThreadedNotification); + NSDidBecomeSingleThreadedNotification = new NSString(bindings.NSDidBecomeSingleThreadedNotification); + NSThreadWillExitNotification = new NSString(bindings.NSThreadWillExitNotification); +} + +class NSThread : NSObject +{ + mixin ObjcWrap; + + static NSThread currentThread () + { + return invokeObjcSelfClass!(NSThread, "currentThread"return result is this.objcObject ? this : (result !is null ? new NSThread(result) : null); } + + static void detachNewThreadSelector (SEL selector, Object target, Object argument) + { + return invokeObjcSelfClass!(void, "detachNewThreadSelector:toTarget:withObject:", SEL, Object, Object)(selector, target, argument); + } + + static bool isMultiThreaded () + { + return invokeObjcSelfClass!(bool, "isMultiThreaded"); + } + + NSMutableDictionary threadDictionary () + { + return invokeObjcSelf!(NSMutableDictionary, "threadDictionary"); + } + + static void sleepUntilDate (NSDate date) + { + return invokeObjcSelfClass!(void, "sleepUntilDate:", NSDate)(date); + } + + static void sleepForTimeInterval (double ti) + { + return invokeObjcSelfClass!(void, "sleepForTimeInterval:", double)(ti); + } + + static void exit () + { + return invokeObjcSelfClass!(void, "exit"); + } + + static double threadPriority () + { + return invokeObjcSelfClass!(double, "threadPriority"); + } + + static bool setThreadPriority (double p) + { + return invokeObjcSelfClass!(bool, "setThreadPriority:", double)(p); + } + + static NSArray callStackReturnAddresses () + { + return invokeObjcSelfClass!(NSArray, "callStackReturnAddresses"); + } + + void setName (NSString n) + { + return invokeObjcSelf!(void, "setName:", NSString)(n); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSUInteger stackSize () + { + return invokeObjcSelf!(NSUInteger, "stackSize"); + } + + void setStackSize (NSUInteger s) + { + return invokeObjcSelf!(void, "setStackSize:", NSUInteger)(s); + } + + bool isMainThread () + { + return invokeObjcSelf!(bool, "isMainThread"); + } + + static bool isMainThread () + { + return invokeObjcSelfClass!(bool, "isMainThread"); + } + + static NSThread mainThread () + { + return invokeObjcSelfClass!(NSThread, "mainThread"return result is this.objcObject ? this : (result !is null ? new NSThread(result) : null); } + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithTarget (Object target, SEL selector, Object argument) + { + return invokeObjcSelf!(Object, "initWithTarget:selector:object:", Object, SEL, Object)(target, selector, argument); + } + + this (Object target, SEL selector, Object argument) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithTarget:selector:object:", Object, SEL, Object)(objcObject, target, selector, argument); + + if (result) + objcObject = ret; + + dObject = this; + } + + bool isExecuting () + { + return invokeObjcSelf!(bool, "isExecuting"); + } + + bool isFinished () + { + return invokeObjcSelf!(bool, "isFinished"); + } + + bool isCancelled () + { + return invokeObjcSelf!(bool, "isCancelled"); + } + + void cancel () + { + return invokeObjcSelf!(void, "cancel"); + } + + void start () + { + return invokeObjcSelf!(void, "start"); + } + + void main () + { + return invokeObjcSelf!(void, "main"); + } +} + +template TNSThreadPerformAdditions () +{ + void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait, NSArray array); + void performSelectorOnMainThread (SEL aSelector, Object arg, bool wait); + void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait, NSArray array); + void performSelector (SEL aSelector, NSThread thr, Object arg, bool wait); + void performSelectorInBackground (SEL aSelector, Object arg); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSThread_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSThread_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,20 @@ +module dstep.foundation.NSThread_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDate; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSWillBecomeMultiThreadedNotification; + package const id NSDidBecomeSingleThreadedNotification; + package const id NSThreadWillExitNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSTimeZone.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSTimeZone.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,238 @@ +/** + * 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.NSTimeZone; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSLocale; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSTimeZone_bindings; + +alias NSInteger NSTimeZoneNameStyle; + +const NSString NSSystemTimeZoneDidChangeNotification; + +enum +{ + NSTimeZoneNameStyleStandard, + NSTimeZoneNameStyleShortStandard, + NSTimeZoneNameStyleDaylightSaving, + NSTimeZoneNameStyleShortDaylightSaving +} + +static this () +{ + NSSystemTimeZoneDidChangeNotification = new NSString(bindings.NSSystemTimeZoneDidChangeNotification); +} + +class NSTimeZone : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSExtendedTimeZone; + mixin TNSTimeZoneCreation; + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + NSData data () + { + return invokeObjcSelf!(NSData, "data"); + } + + NSInteger secondsFromGMTForDate (NSDate aDate) + { + return invokeObjcSelf!(NSInteger, "secondsFromGMTForDate:", NSDate)(aDate); + } + + NSString abbreviationForDate (NSDate aDate) + { + return invokeObjcSelf!(NSString, "abbreviationForDate:", NSDate)(aDate); + } + + bool isDaylightSavingTimeForDate (NSDate aDate) + { + return invokeObjcSelf!(bool, "isDaylightSavingTimeForDate:", NSDate)(aDate); + } + + double daylightSavingTimeOffsetForDate (NSDate aDate) + { + return invokeObjcSelf!(double, "daylightSavingTimeOffsetForDate:", NSDate)(aDate); + } + + NSDate nextDaylightSavingTimeTransitionAfterDate (NSDate aDate) + { + return invokeObjcSelf!(NSDate, "nextDaylightSavingTimeTransitionAfterDate:", NSDate)(aDate); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSExtendedTimeZone () +{ + static NSTimeZone systemTimeZone () + { + return invokeObjcSelfClass!(NSTimeZone, "systemTimeZone"); + } + + static void resetSystemTimeZone () + { + return invokeObjcSelfClass!(void, "resetSystemTimeZone"); + } + + static NSTimeZone defaultTimeZone () + { + return invokeObjcSelfClass!(NSTimeZone, "defaultTimeZone"); + } + + static void setDefaultTimeZone (NSTimeZone aTimeZone) + { + return invokeObjcSelfClass!(void, "setDefaultTimeZone:", NSTimeZone)(aTimeZone); + } + + static NSTimeZone localTimeZone () + { + return invokeObjcSelfClass!(NSTimeZone, "localTimeZone"); + } + + static NSArray knownTimeZoneNames () + { + return invokeObjcSelfClass!(NSArray, "knownTimeZoneNames"); + } + + static NSDictionary abbreviationDictionary () + { + return invokeObjcSelfClass!(NSDictionary, "abbreviationDictionary"); + } + + NSInteger secondsFromGMT () + { + return invokeObjcSelf!(NSInteger, "secondsFromGMT"); + } + + NSString abbreviation () + { + return invokeObjcSelf!(NSString, "abbreviation"); + } + + bool isDaylightSavingTime () + { + return invokeObjcSelf!(bool, "isDaylightSavingTime"); + } + + double daylightSavingTimeOffset () + { + return invokeObjcSelf!(double, "daylightSavingTimeOffset"); + } + + NSDate nextDaylightSavingTimeTransition () + { + return invokeObjcSelf!(NSDate, "nextDaylightSavingTimeTransition"); + } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + bool isEqualToTimeZone (NSTimeZone aTimeZone) + { + return invokeObjcSelf!(bool, "isEqualToTimeZone:", NSTimeZone)(aTimeZone); + } + + NSString localizedName (int style, NSLocale locale) + { + return invokeObjcSelf!(NSString, "localizedName:locale:", int, NSLocale)(style, locale); + } +} + +template TNSTimeZoneCreation () +{ + static Object timeZoneWithName (NSString tzName) + { + return invokeObjcSelfClass!(Object, "timeZoneWithName:", NSString)(tzName); + } + + static Object timeZoneWithName (NSString tzName, NSData aData) + { + return invokeObjcSelfClass!(Object, "timeZoneWithName:data:", NSString, NSData)(tzName, aData); + } + + Object initWithName (NSString tzName) + { + return invokeObjcSelf!(Object, "initWithName:", NSString)(tzName); + } + + this (NSString tzName) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithName:", NSString)(objcObject, tzName); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithName (NSString tzName, NSData aData) + { + return invokeObjcSelf!(Object, "initWithName:data:", NSString, NSData)(tzName, aData); + } + + this (NSString tzName, NSData aData) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithName:data:", NSString, NSData)(objcObject, tzName, aData); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object timeZoneForSecondsFromGMT (NSInteger seconds) + { + return invokeObjcSelfClass!(Object, "timeZoneForSecondsFromGMT:", NSInteger)(seconds); + } + + static Object timeZoneWithAbbreviation (NSString abbreviation) + { + return invokeObjcSelfClass!(Object, "timeZoneWithAbbreviation:", NSString)(abbreviation); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSTimeZone_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSTimeZone_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSTimeZone_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSLocale; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSSystemTimeZoneDidChangeNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSTimer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSTimer.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,85 @@ +/** + * 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.NSTimer; + +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSTimer : NSObject +{ + mixin ObjcWrap; + + static NSTimer timerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) + { + return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); } + + static NSTimer scheduledTimerWithTimeInterval (double ti, NSInvocation invocation, bool yesOrNo) + { + return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:invocation:repeats:", double, NSInvocation, bool)(ti, invocation, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); } + + static NSTimer timerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) + { + return invokeObjcSelfClass!(NSTimer, "timerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); } + + static NSTimer scheduledTimerWithTimeInterval (double ti, Object aTarget, SEL aSelector, Object userInfo, bool yesOrNo) + { + return invokeObjcSelfClass!(NSTimer, "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", double, Object, SEL, Object, bool)(ti, aTarget, aSelector, userInfo, yesOrNoreturn result is this.objcObject ? this : (result !is null ? new NSTimer(result) : null); } + + Object initWithFireDate (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) + { + return invokeObjcSelf!(Object, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(date, ti, t, s, ui, rep); + } + + this (NSDate date, double ti, Object t, SEL s, Object ui, bool rep) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFireDate:interval:target:selector:userInfo:repeats:", NSDate, double, Object, SEL, Object, bool)(objcObject, date, ti, t, s, ui, rep); + + if (result) + objcObject = ret; + + dObject = this; + } + + void fire () + { + return invokeObjcSelf!(void, "fire"); + } + + NSDate fireDate () + { + return invokeObjcSelf!(NSDate, "fireDate"); + } + + void setFireDate (NSDate date) + { + return invokeObjcSelf!(void, "setFireDate:", NSDate)(date); + } + + double timeInterval () + { + return invokeObjcSelf!(double, "timeInterval"); + } + + void invalidate () + { + return invokeObjcSelf!(void, "invalidate"); + } + + bool isValid () + { + return invokeObjcSelf!(bool, "isValid"); + } + + Object userInfo () + { + return invokeObjcSelf!(Object, "userInfo"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURL.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURL.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,319 @@ +/** + * 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.NSURL; + +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSNumber; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLHandle; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSURL_bindings; + +NSString NSURLFileScheme; + +static this () +{ + NSURLFileScheme = new NSString(bindings.NSURLFileScheme); +} + +class NSURL : NSObject, INSCoding, INSCopying, INSURLHandleClient +{ + mixin ObjcWrap; + mixin TNSURLLoading; + + Object initWithScheme (NSString scheme, NSString host, NSString path) + { + return invokeObjcSelf!(Object, "initWithScheme:host:path:", NSString, NSString, NSString)(scheme, host, path); + } + + this (NSString scheme, NSString host, NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithScheme:host:path:", NSString, NSString, NSString)(objcObject, scheme, host, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initFileURLWithPath (NSString path, bool isDir) + { + return invokeObjcSelf!(Object, "initFileURLWithPath:isDirectory:", NSString, bool)(path, isDir); + } + + this (NSString path, bool isDir) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initFileURLWithPath:isDirectory:", NSString, bool)(objcObject, path, isDir); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initFileURLWithPath (NSString path) + { + return invokeObjcSelf!(Object, "initFileURLWithPath:", NSString)(path); + } + + this (NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initFileURLWithPath:", NSString)(objcObject, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object fileURLWithPath (NSString path, bool isDir) + { + return invokeObjcSelfClass!(Object, "fileURLWithPath:isDirectory:", NSString, bool)(path, isDir); + } + + static Object fileURLWithPath (NSString path) + { + return invokeObjcSelfClass!(Object, "fileURLWithPath:", NSString)(path); + } + + Object initWithString (NSString URLString) + { + return invokeObjcSelf!(Object, "initWithString:", NSString)(URLString); + } + + this (NSString URLString) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:", NSString)(objcObject, URLString); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithString (NSString URLString, NSURL baseURL) + { + return invokeObjcSelf!(Object, "initWithString:relativeToURL:", NSString, NSURL)(URLString, baseURL); + } + + this (NSString URLString, NSURL baseURL) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithString:relativeToURL:", NSString, NSURL)(objcObject, URLString, baseURL); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object URLWithString (NSString URLString) + { + return invokeObjcSelfClass!(Object, "URLWithString:", NSString)(URLString); + } + + static Object URLWithString (NSString URLString, NSURL baseURL) + { + return invokeObjcSelfClass!(Object, "URLWithString:relativeToURL:", NSString, NSURL)(URLString, baseURL); + } + + NSString absoluteString () + { + return invokeObjcSelf!(NSString, "absoluteString"); + } + + NSString relativeString () + { + return invokeObjcSelf!(NSString, "relativeString"); + } + + NSURL baseURL () + { + id result = invokeObjcSelf!(id, "baseURL"return result is this.objcObject ? this : (result !is null ? new NSURL(result) : null); } + + NSURL absoluteURL () + { + id result = invokeObjcSelf!(id, "absoluteURL"return result is this.objcObject ? this : (result !is null ? new NSURL(result) : null); } + + NSString scheme () + { + return invokeObjcSelf!(NSString, "scheme"); + } + + NSString resourceSpecifier () + { + return invokeObjcSelf!(NSString, "resourceSpecifier"); + } + + NSString host () + { + return invokeObjcSelf!(NSString, "host"); + } + + NSNumber port () + { + return invokeObjcSelf!(NSNumber, "port"); + } + + NSString user () + { + return invokeObjcSelf!(NSString, "user"); + } + + NSString password () + { + return invokeObjcSelf!(NSString, "password"); + } + + NSString path () + { + return invokeObjcSelf!(NSString, "path"); + } + + NSString fragment () + { + return invokeObjcSelf!(NSString, "fragment"); + } + + NSString parameterString () + { + return invokeObjcSelf!(NSString, "parameterString"); + } + + NSString query () + { + return invokeObjcSelf!(NSString, "query"); + } + + NSString relativePath () + { + return invokeObjcSelf!(NSString, "relativePath"); + } + + bool isFileURL () + { + return invokeObjcSelf!(bool, "isFileURL"); + } + + NSURL standardizedURL () + { + id result = invokeObjcSelf!(id, "standardizedURL"return result is this.objcObject ? this : (result !is null ? new NSURL(result) : null); } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void URLHandle (NSURLHandle sender, NSData newBytes) + { + return invokeObjcSelf!(void, "URLHandle:resourceDataDidBecomeAvailable:", NSURLHandle, NSData)(sender, newBytes); + } + + void URLHandleResourceDidBeginLoading (NSURLHandle sender) + { + return invokeObjcSelf!(void, "URLHandleResourceDidBeginLoading:", NSURLHandle)(sender); + } + + void URLHandleResourceDidFinishLoading (NSURLHandle sender) + { + return invokeObjcSelf!(void, "URLHandleResourceDidFinishLoading:", NSURLHandle)(sender); + } + + void URLHandleResourceDidCancelLoading (NSURLHandle sender) + { + return invokeObjcSelf!(void, "URLHandleResourceDidCancelLoading:", NSURLHandle)(sender); + } + + void URLHandle (NSURLHandle sender, NSString reason) + { + return invokeObjcSelf!(void, "URLHandle:resourceDidFailLoadingWithReason:", NSURLHandle, NSString)(sender, reason); + } +} + +template TNSURLLoading () +{ + NSData resourceDataUsingCache (bool shouldUseCache) + { + return invokeObjcSelf!(NSData, "resourceDataUsingCache:", bool)(shouldUseCache); + } + + void loadResourceDataNotifyingClient (Object client, bool shouldUseCache) + { + return invokeObjcSelf!(void, "loadResourceDataNotifyingClient:usingCache:", Object, bool)(client, shouldUseCache); + } + + Object propertyForKey (NSString propertyKey) + { + return invokeObjcSelf!(Object, "propertyForKey:", NSString)(propertyKey); + } + + bool setResourceData (NSData data) + { + return invokeObjcSelf!(bool, "setResourceData:", NSData)(data); + } + + bool setProperty (Object property, NSString propertyKey) + { + return invokeObjcSelf!(bool, "setProperty:forKey:", Object, NSString)(property, propertyKey); + } + + NSURLHandle URLHandleUsingCache (bool shouldUseCache) + { + return invokeObjcSelf!(NSURLHandle, "URLHandleUsingCache:", bool)(shouldUseCache); + } +} + +template TNSURLClient () +{ + void URL (NSURL sender, NSData newBytes); + void URLResourceDidFinishLoading (NSURL sender); + void URLResourceDidCancelLoading (NSURL sender); + void URL (NSURL sender, NSString reason); +} + +template TNSURLUtilities () +{ + NSString stringByAddingPercentEscapesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSString, "stringByAddingPercentEscapesUsingEncoding:", uint)(enc); + } + + NSString stringByReplacingPercentEscapesUsingEncoding (uint enc) + { + return invokeObjcSelf!(NSString, "stringByReplacingPercentEscapesUsingEncoding:", uint)(enc); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLAuthenticationChallenge.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLAuthenticationChallenge.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,92 @@ +/** + * 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.NSURLAuthenticationChallenge; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSURLAuthenticationChallengeInternal; +import dstep.foundation.NSURLCredential; +import dstep.foundation.NSURLProtectionSpace; +import dstep.foundation.NSURLResponse; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSURLAuthenticationChallenge : NSObject +{ + mixin ObjcWrap; + + Object initWithProtectionSpace (NSURLProtectionSpace space, NSURLCredential credential, NSInteger previousFailureCount, NSURLResponse response, NSError error, INSURLAuthenticationChallengeSender sender) + { + return invokeObjcSelf!(Object, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(space, credential, previousFailureCount, response, error, sender); + } + + this (NSURLProtectionSpace space, NSURLCredential credential, NSInteger previousFailureCount, NSURLResponse response, NSError error, INSURLAuthenticationChallengeSender sender) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(objcObject, space, credential, previousFailureCount, response, error, sender); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithAuthenticationChallenge (NSURLAuthenticationChallenge challenge, INSURLAuthenticationChallengeSender sender) + { + return invokeObjcSelf!(Object, "initWithAuthenticationChallenge:sender:", NSURLAuthenticationChallenge, INSURLAuthenticationChallengeSender)(challenge, sender); + } + + this (NSURLAuthenticationChallenge challenge, INSURLAuthenticationChallengeSender sender) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithAuthenticationChallenge:sender:", NSURLAuthenticationChallenge, INSURLAuthenticationChallengeSender)(objcObject, challenge, sender); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSURLProtectionSpace protectionSpace () + { + return invokeObjcSelf!(NSURLProtectionSpace, "protectionSpace"); + } + + NSURLCredential proposedCredential () + { + return invokeObjcSelf!(NSURLCredential, "proposedCredential"); + } + + NSInteger previousFailureCount () + { + return invokeObjcSelf!(NSInteger, "previousFailureCount"); + } + + NSURLResponse failureResponse () + { + return invokeObjcSelf!(NSURLResponse, "failureResponse"); + } + + NSError error () + { + return invokeObjcSelf!(NSError, "error"); + } + + INSURLAuthenticationChallengeSender sender () + { + return invokeObjcSelf!(INSURLAuthenticationChallengeSender, "sender"); + } +} + +interface INSURLAuthenticationChallengeSender : INSObject +{ + void useCredential (NSURLCredential credential, NSURLAuthenticationChallenge challenge); + void continueWithoutCredentialForAuthenticationChallenge (NSURLAuthenticationChallenge challenge); + void cancelAuthenticationChallenge (NSURLAuthenticationChallenge challenge); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLCache.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLCache.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,191 @@ +/** + * 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.NSURLCache; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSCachedURLResponseInternal; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSURLCacheInternal; +import dstep.foundation.NSURLRequest; +import dstep.foundation.NSURLResponse; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSURLCacheStoragePolicy; + +enum +{ + NSURLCacheStorageAllowed, + NSURLCacheStorageAllowedInMemoryOnly, + NSURLCacheStorageNotAllowed +} + +class NSCachedURLResponse : NSObject, INSCoding, INSCopying +{ + mixin ObjcWrap; + + Object initWithResponse (NSURLResponse response, NSData data) + { + return invokeObjcSelf!(Object, "initWithResponse:data:", NSURLResponse, NSData)(response, data); + } + + this (NSURLResponse response, NSData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithResponse:data:", NSURLResponse, NSData)(objcObject, response, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithResponse (NSURLResponse response, NSData data, NSDictionary userInfo, uint storagePolicy) + { + return invokeObjcSelf!(Object, "initWithResponse:data:userInfo:storagePolicy:", NSURLResponse, NSData, NSDictionary, uint)(response, data, userInfo, storagePolicy); + } + + this (NSURLResponse response, NSData data, NSDictionary userInfo, uint storagePolicy) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithResponse:data:userInfo:storagePolicy:", NSURLResponse, NSData, NSDictionary, uint)(objcObject, response, data, userInfo, storagePolicy); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSURLResponse response () + { + return invokeObjcSelf!(NSURLResponse, "response"); + } + + NSData data () + { + return invokeObjcSelf!(NSData, "data"); + } + + NSDictionary userInfo () + { + return invokeObjcSelf!(NSDictionary, "userInfo"); + } + + uint storagePolicy () + { + return invokeObjcSelf!(uint, "storagePolicy"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + +class NSURLCache : NSObject +{ + mixin ObjcWrap; + + static NSURLCache sharedURLCache () + { + return invokeObjcSelfClass!(NSURLCache, "sharedURLCache"return result is this.objcObject ? this : (result !is null ? new NSURLCache(result) : null); } + + static void setSharedURLCache (NSURLCache cache) + { + return invokeObjcSelfClass!(void, "setSharedURLCache:", NSURLCache)(cache); + } + + Object initWithMemoryCapacity (NSUInteger memoryCapacity, NSUInteger diskCapacity, NSString path) + { + return invokeObjcSelf!(Object, "initWithMemoryCapacity:diskCapacity:diskPath:", NSUInteger, NSUInteger, NSString)(memoryCapacity, diskCapacity, path); + } + + this (NSUInteger memoryCapacity, NSUInteger diskCapacity, NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithMemoryCapacity:diskCapacity:diskPath:", NSUInteger, NSUInteger, NSString)(objcObject, memoryCapacity, diskCapacity, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSCachedURLResponse cachedResponseForRequest (NSURLRequest request) + { + return invokeObjcSelf!(NSCachedURLResponse, "cachedResponseForRequest:", NSURLRequest)(request); + } + + void storeCachedResponse (NSCachedURLResponse cachedResponse, NSURLRequest request) + { + return invokeObjcSelf!(void, "storeCachedResponse:forRequest:", NSCachedURLResponse, NSURLRequest)(cachedResponse, request); + } + + void removeCachedResponseForRequest (NSURLRequest request) + { + return invokeObjcSelf!(void, "removeCachedResponseForRequest:", NSURLRequest)(request); + } + + void removeAllCachedResponses () + { + return invokeObjcSelf!(void, "removeAllCachedResponses"); + } + + NSUInteger memoryCapacity () + { + return invokeObjcSelf!(NSUInteger, "memoryCapacity"); + } + + NSUInteger diskCapacity () + { + return invokeObjcSelf!(NSUInteger, "diskCapacity"); + } + + void setMemoryCapacity (NSUInteger memoryCapacity) + { + return invokeObjcSelf!(void, "setMemoryCapacity:", NSUInteger)(memoryCapacity); + } + + void setDiskCapacity (NSUInteger diskCapacity) + { + return invokeObjcSelf!(void, "setDiskCapacity:", NSUInteger)(diskCapacity); + } + + NSUInteger currentMemoryUsage () + { + return invokeObjcSelf!(NSUInteger, "currentMemoryUsage"); + } + + NSUInteger currentDiskUsage () + { + return invokeObjcSelf!(NSUInteger, "currentDiskUsage"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLConnection.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLConnection.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,108 @@ +/** + * 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.NSURLConnection; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSCachedURLResponse; +import dstep.foundation.NSData; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSRunLoop; +import dstep.foundation.NSURLAuthenticationChallenge; +import dstep.foundation.NSURLConnectionInternal; +import dstep.foundation.NSURLRequest; +import dstep.foundation.NSURLResponse; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSURLConnection : NSObject +{ + mixin ObjcWrap; + mixin TNSURLConnectionSynchronousLoading; + + static bool canHandleRequest (NSURLRequest request) + { + return invokeObjcSelfClass!(bool, "canHandleRequest:", NSURLRequest)(request); + } + + static NSURLConnection connectionWithRequest (NSURLRequest request, Object delegate_) + { + return invokeObjcSelfClass!(NSURLConnection, "connectionWithRequest:delegate:", NSURLRequest, Object)(request, delegate_return result is this.objcObject ? this : (result !is null ? new NSURLConnection(result) : null); } + + Object initWithRequest (NSURLRequest request, Object delegate_) + { + return invokeObjcSelf!(Object, "initWithRequest:delegate:", NSURLRequest, Object)(request, delegate_); + } + + this (NSURLRequest request, Object delegate_) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithRequest:delegate:", NSURLRequest, Object)(objcObject, request, delegate_); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithRequest (NSURLRequest request, Object delegate_, bool startImmediately) + { + return invokeObjcSelf!(Object, "initWithRequest:delegate:startImmediately:", NSURLRequest, Object, bool)(request, delegate_, startImmediately); + } + + this (NSURLRequest request, Object delegate_, bool startImmediately) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithRequest:delegate:startImmediately:", NSURLRequest, Object, bool)(objcObject, request, delegate_, startImmediately); + + if (result) + objcObject = ret; + + dObject = this; + } + + void start () + { + return invokeObjcSelf!(void, "start"); + } + + void cancel () + { + return invokeObjcSelf!(void, "cancel"); + } + + void scheduleInRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "scheduleInRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } + + void unscheduleFromRunLoop (NSRunLoop aRunLoop, NSString mode) + { + return invokeObjcSelf!(void, "unscheduleFromRunLoop:forMode:", NSRunLoop, NSString)(aRunLoop, mode); + } +} + +template TNSURLConnectionDelegate () +{ + NSURLRequest connection (NSURLConnection connection, NSURLRequest request, NSURLResponse response); + void connection (NSURLConnection connection, NSURLAuthenticationChallenge challenge); + void connection (NSURLConnection connection, NSURLAuthenticationChallenge challenge); + void connection (NSURLConnection connection, NSURLResponse response); + void connection (NSURLConnection connection, NSData data); + void connectionDidFinishLoading (NSURLConnection connection); + void connection (NSURLConnection connection, NSError error); + NSCachedURLResponse connection (NSURLConnection connection, NSCachedURLResponse cachedResponse); +} + +template TNSURLConnectionSynchronousLoading () +{ + static NSData sendSynchronousRequest (NSURLRequest request, NSURLResponse** response, NSError** error) + { + return invokeObjcSelfClass!(NSData, "sendSynchronousRequest:returningResponse:error:", NSURLRequest, NSURLResponse**, NSError**)(request, response, error); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLCredential.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLCredential.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,74 @@ +/** + * 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.NSURLCredential; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLCredentialInternal; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSURLCredentialPersistence; + +enum +{ + NSURLCredentialPersistenceNone, + NSURLCredentialPersistenceForSession, + NSURLCredentialPersistencePermanent +} + +class NSURLCredential : NSObject, INSCopying +{ + mixin ObjcWrap; + + Object initWithUser (NSString user, NSString password, uint persistence) + { + return invokeObjcSelf!(Object, "initWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistence); + } + + this (NSString user, NSString password, uint persistence) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUser:password:persistence:", NSString, NSString, uint)(objcObject, user, password, persistence); + + if (result) + objcObject = ret; + + dObject = this; + } + + static NSURLCredential credentialWithUser (NSString user, NSString password, uint persistence) + { + return invokeObjcSelfClass!(NSURLCredential, "credentialWithUser:password:persistence:", NSString, NSString, uint)(user, password, persistencereturn result is this.objcObject ? this : (result !is null ? new NSURLCredential(result) : null); } + + NSString user () + { + return invokeObjcSelf!(NSString, "user"); + } + + NSString password () + { + return invokeObjcSelf!(NSString, "password"); + } + + bool hasPassword () + { + return invokeObjcSelf!(bool, "hasPassword"); + } + + uint persistence () + { + return invokeObjcSelf!(uint, "persistence"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLCredentialStorage.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLCredentialStorage.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,66 @@ +/** + * 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.NSURLCredentialStorage; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLCredential; +import dstep.foundation.NSURLCredentialStorageInternal; +import dstep.foundation.NSURLProtectionSpace; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSURLCredentialStorage_bindings; + +const NSString NSURLCredentialStorageChangedNotification; + +static this () +{ + NSURLCredentialStorageChangedNotification = new NSString(bindings.NSURLCredentialStorageChangedNotification); +} + +class NSURLCredentialStorage : NSObject +{ + mixin ObjcWrap; + + static NSURLCredentialStorage sharedCredentialStorage () + { + return invokeObjcSelfClass!(NSURLCredentialStorage, "sharedCredentialStorage"return result is this.objcObject ? this : (result !is null ? new NSURLCredentialStorage(result) : null); } + + NSDictionary credentialsForProtectionSpace (NSURLProtectionSpace space) + { + return invokeObjcSelf!(NSDictionary, "credentialsForProtectionSpace:", NSURLProtectionSpace)(space); + } + + NSDictionary allCredentials () + { + return invokeObjcSelf!(NSDictionary, "allCredentials"); + } + + void setCredential (NSURLCredential credential, NSURLProtectionSpace space) + { + return invokeObjcSelf!(void, "setCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space); + } + + void removeCredential (NSURLCredential credential, NSURLProtectionSpace space) + { + return invokeObjcSelf!(void, "removeCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space); + } + + NSURLCredential defaultCredentialForProtectionSpace (NSURLProtectionSpace space) + { + return invokeObjcSelf!(NSURLCredential, "defaultCredentialForProtectionSpace:", NSURLProtectionSpace)(space); + } + + void setDefaultCredential (NSURLCredential credential, NSURLProtectionSpace space) + { + return invokeObjcSelf!(void, "setDefaultCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLCredentialStorage_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLCredentialStorage_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSURLCredentialStorage_bindings; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLCredential; +import dstep.foundation.NSURLCredentialStorageInternal; +import dstep.foundation.NSURLProtectionSpace; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSURLCredentialStorageChangedNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLDownload.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLDownload.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,108 @@ +/** + * 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.NSURLDownload; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSData; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLAuthenticationChallenge; +import dstep.foundation.NSURLDownloadInternal; +import dstep.foundation.NSURLRequest; +import dstep.foundation.NSURLResponse; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSURLDownload : NSObject +{ + mixin ObjcWrap; + + static bool canResumeDownloadDecodedWithEncodingMIMEType (NSString MIMEType) + { + return invokeObjcSelfClass!(bool, "canResumeDownloadDecodedWithEncodingMIMEType:", NSString)(MIMEType); + } + + Object initWithRequest (NSURLRequest request, Object delegate_) + { + return invokeObjcSelf!(Object, "initWithRequest:delegate:", NSURLRequest, Object)(request, delegate_); + } + + this (NSURLRequest request, Object delegate_) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithRequest:delegate:", NSURLRequest, Object)(objcObject, request, delegate_); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithResumeData (NSData resumeData, Object delegate_, NSString path) + { + return invokeObjcSelf!(Object, "initWithResumeData:delegate:path:", NSData, Object, NSString)(resumeData, delegate_, path); + } + + this (NSData resumeData, Object delegate_, NSString path) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithResumeData:delegate:path:", NSData, Object, NSString)(objcObject, resumeData, delegate_, path); + + if (result) + objcObject = ret; + + dObject = this; + } + + void cancel () + { + return invokeObjcSelf!(void, "cancel"); + } + + void setDestination (NSString path, bool allowOverwrite) + { + return invokeObjcSelf!(void, "setDestination:allowOverwrite:", NSString, bool)(path, allowOverwrite); + } + + NSURLRequest request () + { + return invokeObjcSelf!(NSURLRequest, "request"); + } + + NSData resumeData () + { + return invokeObjcSelf!(NSData, "resumeData"); + } + + void setDeletesFileUponFailure (bool deletesFileUponFailure) + { + return invokeObjcSelf!(void, "setDeletesFileUponFailure:", bool)(deletesFileUponFailure); + } + + bool deletesFileUponFailure () + { + return invokeObjcSelf!(bool, "deletesFileUponFailure"); + } +} + +template TNSURLDownloadDelegate () +{ + void downloadDidBegin (NSURLDownload download); + NSURLRequest download (NSURLDownload download, NSURLRequest request, NSURLResponse redirectResponse); + void download (NSURLDownload download, NSURLAuthenticationChallenge challenge); + void download (NSURLDownload download, NSURLAuthenticationChallenge challenge); + void download (NSURLDownload download, NSURLResponse response); + void download (NSURLDownload download, NSURLResponse response, long startingByte); + void download (NSURLDownload download, NSUInteger length); + bool download (NSURLDownload download, NSString encodingType); + void download (NSURLDownload download, NSString filename); + void download (NSURLDownload download, NSString path); + void downloadDidFinish (NSURLDownload download); + void download (NSURLDownload download, NSError error); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLError.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLError.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,67 @@ +/** + * 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.NSURLError; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSURLError_bindings; + +const NSString NSURLErrorDomain; +const NSString NSErrorFailingURLStringKey; + +enum +{ + NSURLErrorUnknown = -1, + NSURLErrorCancelled = -999, + NSURLErrorBadURL = -1000, + NSURLErrorTimedOut = -1001, + NSURLErrorUnsupportedURL = -1002, + NSURLErrorCannotFindHost = -1003, + NSURLErrorCannotConnectToHost = -1004, + NSURLErrorNetworkConnectionLost = -1005, + NSURLErrorDNSLookupFailed = -1006, + NSURLErrorHTTPTooManyRedirects = -1007, + NSURLErrorResourceUnavailable = -1008, + NSURLErrorNotConnectedToInternet = -1009, + NSURLErrorRedirectToNonExistentLocation = -1010, + NSURLErrorBadServerResponse = -1011, + NSURLErrorUserCancelledAuthentication = -1012, + NSURLErrorUserAuthenticationRequired = -1013, + NSURLErrorZeroByteResource = -1014, + NSURLErrorCannotDecodeRawData = -1015, + NSURLErrorCannotDecodeContentData = -1016, + NSURLErrorCannotParseResponse = -1017, + NSURLErrorFileDoesNotExist = -1100, + NSURLErrorFileIsDirectory = -1101, + NSURLErrorNoPermissionsToReadFile = -1102, + NSURLErrorDataLengthExceedsMaximum = -1103, + NSURLErrorSecureConnectionFailed = -1200, + NSURLErrorServerCertificateHasBadDate = -1201, + NSURLErrorServerCertificateUntrusted = -1202, + NSURLErrorServerCertificateHasUnknownRoot = -1203, + NSURLErrorServerCertificateNotYetValid = -1204, + NSURLErrorClientCertificateRejected = -1205, + NSURLErrorCannotLoadFromNetwork = -2000, + NSURLErrorCannotCreateFile = -3000, + NSURLErrorCannotOpenFile = -3001, + NSURLErrorCannotCloseFile = -3002, + NSURLErrorCannotWriteToFile = -3003, + NSURLErrorCannotRemoveFile = -3004, + NSURLErrorCannotMoveFile = -3005, + NSURLErrorDownloadDecodingFailedMidStream = -3006, + NSURLErrorDownloadDecodingFailedToComplete = -3007 +} + +static this () +{ + NSURLErrorDomain = new NSString(bindings.NSURLErrorDomain); + NSErrorFailingURLStringKey = new NSString(bindings.NSErrorFailingURLStringKey); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLError_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLError_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,17 @@ +module dstep.foundation.NSURLError_bindings; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSURLErrorDomain; + package const id NSErrorFailingURLStringKey; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLHandle.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLHandle.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,166 @@ +/** + * 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.NSURLHandle; + +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSURLHandleStatus; + +enum +{ + NSURLHandleNotLoaded = 0, + NSURLHandleLoadSucceeded, + NSURLHandleLoadInProgress, + NSURLHandleLoadFailed +} + +class NSURLHandle : NSObject +{ + mixin ObjcWrap; + + static void registerURLHandleClass (Class anURLHandleSubclass) + { + return invokeObjcSelfClass!(void, "registerURLHandleClass:", Class)(anURLHandleSubclass); + } + + static Class URLHandleClassForURL (NSURL anURL) + { + return invokeObjcSelfClass!(Class, "URLHandleClassForURL:", NSURL)(anURL); + } + + uint status () + { + return invokeObjcSelf!(uint, "status"); + } + + NSString failureReason () + { + return invokeObjcSelf!(NSString, "failureReason"); + } + + void addClient (INSURLHandleClient client) + { + return invokeObjcSelf!(void, "addClient:", INSURLHandleClient)(client); + } + + void removeClient (INSURLHandleClient client) + { + return invokeObjcSelf!(void, "removeClient:", INSURLHandleClient)(client); + } + + void loadInBackground () + { + return invokeObjcSelf!(void, "loadInBackground"); + } + + void cancelLoadInBackground () + { + return invokeObjcSelf!(void, "cancelLoadInBackground"); + } + + NSData resourceData () + { + return invokeObjcSelf!(NSData, "resourceData"); + } + + NSData availableResourceData () + { + return invokeObjcSelf!(NSData, "availableResourceData"); + } + + long expectedResourceDataSize () + { + return invokeObjcSelf!(long, "expectedResourceDataSize"); + } + + void flushCachedData () + { + return invokeObjcSelf!(void, "flushCachedData"); + } + + void backgroundLoadDidFailWithReason (NSString reason) + { + return invokeObjcSelf!(void, "backgroundLoadDidFailWithReason:", NSString)(reason); + } + + void didLoadBytes (NSData newBytes, bool yorn) + { + return invokeObjcSelf!(void, "didLoadBytes:loadComplete:", NSData, bool)(newBytes, yorn); + } + + static bool canInitWithURL (NSURL anURL) + { + return invokeObjcSelfClass!(bool, "canInitWithURL:", NSURL)(anURL); + } + + static NSURLHandle cachedHandleForURL (NSURL anURL) + { + return invokeObjcSelfClass!(NSURLHandle, "cachedHandleForURL:", NSURL)(anURLreturn result is this.objcObject ? this : (result !is null ? new NSURLHandle(result) : null); } + + Object initWithURL (NSURL anURL, bool willCache) + { + return invokeObjcSelf!(Object, "initWithURL:cached:", NSURL, bool)(anURL, willCache); + } + + this (NSURL anURL, bool willCache) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithURL:cached:", NSURL, bool)(objcObject, anURL, willCache); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object propertyForKey (NSString propertyKey) + { + return invokeObjcSelf!(Object, "propertyForKey:", NSString)(propertyKey); + } + + Object propertyForKeyIfAvailable (NSString propertyKey) + { + return invokeObjcSelf!(Object, "propertyForKeyIfAvailable:", NSString)(propertyKey); + } + + bool writeProperty (Object propertyValue, NSString propertyKey) + { + return invokeObjcSelf!(bool, "writeProperty:forKey:", Object, NSString)(propertyValue, propertyKey); + } + + bool writeData (NSData data) + { + return invokeObjcSelf!(bool, "writeData:", NSData)(data); + } + + NSData loadInForeground () + { + return invokeObjcSelf!(NSData, "loadInForeground"); + } + + void beginLoadInBackground () + { + return invokeObjcSelf!(void, "beginLoadInBackground"); + } + + void endLoadInBackground () + { + return invokeObjcSelf!(void, "endLoadInBackground"); + } +} + +interface INSURLHandleClient +{ + void URLHandle (NSURLHandle sender, NSData newBytes); + void URLHandleResourceDidBeginLoading (NSURLHandle sender); + void URLHandleResourceDidFinishLoading (NSURLHandle sender); + void URLHandleResourceDidCancelLoading (NSURLHandle sender); + void URLHandle (NSURLHandle sender, NSString reason); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLProtectionSpace.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLProtectionSpace.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,120 @@ +/** + * 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.NSURLProtectionSpace; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLProtectionSpaceInternal; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSURLProtectionSpace_bindings; + +const NSString NSURLProtectionSpaceHTTPProxy; +const NSString NSURLProtectionSpaceHTTPSProxy; +const NSString NSURLProtectionSpaceFTPProxy; +const NSString NSURLProtectionSpaceSOCKSProxy; +const NSString NSURLAuthenticationMethodDefault; +const NSString NSURLAuthenticationMethodHTTPBasic; +const NSString NSURLAuthenticationMethodHTTPDigest; +const NSString NSURLAuthenticationMethodHTMLForm; + +static this () +{ + NSURLProtectionSpaceHTTPProxy = new NSString(bindings.NSURLProtectionSpaceHTTPProxy); + NSURLProtectionSpaceHTTPSProxy = new NSString(bindings.NSURLProtectionSpaceHTTPSProxy); + NSURLProtectionSpaceFTPProxy = new NSString(bindings.NSURLProtectionSpaceFTPProxy); + NSURLProtectionSpaceSOCKSProxy = new NSString(bindings.NSURLProtectionSpaceSOCKSProxy); + NSURLAuthenticationMethodDefault = new NSString(bindings.NSURLAuthenticationMethodDefault); + NSURLAuthenticationMethodHTTPBasic = new NSString(bindings.NSURLAuthenticationMethodHTTPBasic); + NSURLAuthenticationMethodHTTPDigest = new NSString(bindings.NSURLAuthenticationMethodHTTPDigest); + NSURLAuthenticationMethodHTMLForm = new NSString(bindings.NSURLAuthenticationMethodHTMLForm); +} + +class NSURLProtectionSpace : NSObject, INSCopying +{ + mixin ObjcWrap; + + Object initWithHost (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) + { + return invokeObjcSelf!(Object, "initWithHost:port:protocol:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, protocol, realm, authenticationMethod); + } + + this (NSString host, NSInteger port, NSString protocol, NSString realm, NSString authenticationMethod) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithHost:port:protocol:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(objcObject, host, port, protocol, realm, authenticationMethod); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithProxyHost (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) + { + return invokeObjcSelf!(Object, "initWithProxyHost:port:type:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(host, port, type, realm, authenticationMethod); + } + + this (NSString host, NSInteger port, NSString type, NSString realm, NSString authenticationMethod) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithProxyHost:port:type:realm:authenticationMethod:", NSString, NSInteger, NSString, NSString, NSString)(objcObject, host, port, type, realm, authenticationMethod); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSString realm () + { + return invokeObjcSelf!(NSString, "realm"); + } + + bool receivesCredentialSecurely () + { + return invokeObjcSelf!(bool, "receivesCredentialSecurely"); + } + + bool isProxy () + { + return invokeObjcSelf!(bool, "isProxy"); + } + + NSString host () + { + return invokeObjcSelf!(NSString, "host"); + } + + NSInteger port () + { + return invokeObjcSelf!(NSInteger, "port"); + } + + NSString proxyType () + { + return invokeObjcSelf!(NSString, "proxyType"); + } + + NSString protocol () + { + return invokeObjcSelf!(NSString, "protocol"); + } + + NSString authenticationMethod () + { + return invokeObjcSelf!(NSString, "authenticationMethod"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLProtectionSpace_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLProtectionSpace_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,25 @@ +module dstep.foundation.NSURLProtectionSpace_bindings; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLProtectionSpaceInternal; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSURLProtectionSpaceHTTPProxy; + package const id NSURLProtectionSpaceHTTPSProxy; + package const id NSURLProtectionSpaceFTPProxy; + package const id NSURLProtectionSpaceSOCKSProxy; + package const id NSURLAuthenticationMethodDefault; + package const id NSURLAuthenticationMethodHTTPBasic; + package const id NSURLAuthenticationMethodHTTPDigest; + package const id NSURLAuthenticationMethodHTMLForm; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLProtocol.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLProtocol.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,120 @@ +/** + * 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.NSURLProtocol; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSCachedURLResponse; +import dstep.foundation.NSError; +import dstep.foundation.NSMutableURLRequest; +import dstep.foundation.NSObject; +import dstep.foundation.NSURLAuthenticationChallenge; +import dstep.foundation.NSURLCache; +import dstep.foundation.NSURLConnection; +import dstep.foundation.NSURLProtocolInternal; +import dstep.foundation.NSURLRequest; +import dstep.foundation.NSURLResponse; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSURLProtocol : NSObject +{ + mixin ObjcWrap; + + Object initWithRequest (NSURLRequest request, NSCachedURLResponse cachedResponse, INSURLProtocolClient client) + { + return invokeObjcSelf!(Object, "initWithRequest:cachedResponse:client:", NSURLRequest, NSCachedURLResponse, INSURLProtocolClient)(request, cachedResponse, client); + } + + this (NSURLRequest request, NSCachedURLResponse cachedResponse, INSURLProtocolClient client) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithRequest:cachedResponse:client:", NSURLRequest, NSCachedURLResponse, INSURLProtocolClient)(objcObject, request, cachedResponse, client); + + if (result) + objcObject = ret; + + dObject = this; + } + + INSURLProtocolClient client () + { + return invokeObjcSelf!(INSURLProtocolClient, "client"); + } + + NSURLRequest request () + { + return invokeObjcSelf!(NSURLRequest, "request"); + } + + NSCachedURLResponse cachedResponse () + { + return invokeObjcSelf!(NSCachedURLResponse, "cachedResponse"); + } + + static bool canInitWithRequest (NSURLRequest request) + { + return invokeObjcSelfClass!(bool, "canInitWithRequest:", NSURLRequest)(request); + } + + static NSURLRequest canonicalRequestForRequest (NSURLRequest request) + { + return invokeObjcSelfClass!(NSURLRequest, "canonicalRequestForRequest:", NSURLRequest)(request); + } + + static bool requestIsCacheEquivalent (NSURLRequest a, NSURLRequest b) + { + return invokeObjcSelfClass!(bool, "requestIsCacheEquivalent:toRequest:", NSURLRequest, NSURLRequest)(a, b); + } + + void startLoading () + { + return invokeObjcSelf!(void, "startLoading"); + } + + void stopLoading () + { + return invokeObjcSelf!(void, "stopLoading"); + } + + static Object propertyForKey (NSString key, NSURLRequest request) + { + return invokeObjcSelfClass!(Object, "propertyForKey:inRequest:", NSString, NSURLRequest)(key, request); + } + + static void setProperty (Object value, NSString key, NSMutableURLRequest request) + { + return invokeObjcSelfClass!(void, "setProperty:forKey:inRequest:", Object, NSString, NSMutableURLRequest)(value, key, request); + } + + static void removePropertyForKey (NSString key, NSMutableURLRequest request) + { + return invokeObjcSelfClass!(void, "removePropertyForKey:inRequest:", NSString, NSMutableURLRequest)(key, request); + } + + static bool registerClass (Class protocolClass) + { + return invokeObjcSelfClass!(bool, "registerClass:", Class)(protocolClass); + } + + static void unregisterClass (Class protocolClass) + { + return invokeObjcSelfClass!(void, "unregisterClass:", Class)(protocolClass); + } +} + +interface INSURLProtocolClient : INSObject +{ + void URLProtocol (NSURLProtocol protocol, NSURLRequest request, NSURLResponse redirectResponse); + void URLProtocol (NSURLProtocol protocol, NSCachedURLResponse cachedResponse); + void URLProtocol (NSURLProtocol protocol, NSURLResponse response, uint policy); + void URLProtocol (NSURLProtocol protocol, NSData data); + void URLProtocolDidFinishLoading (NSURLProtocol protocol); + void URLProtocol (NSURLProtocol protocol, NSError error); + void URLProtocol (NSURLProtocol protocol, NSURLAuthenticationChallenge challenge); + void URLProtocol (NSURLProtocol protocol, NSURLAuthenticationChallenge challenge); +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLRequest.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLRequest.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,229 @@ +/** + * 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.NSURLRequest; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSInputStream; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSURLRequestInternal; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSURLRequestCachePolicy; + +enum +{ + NSURLRequestUseProtocolCachePolicy = 0, + NSURLRequestReloadIgnoringLocalCacheData = 1, + NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, + NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData, + NSURLRequestReturnCacheDataElseLoad = 2, + NSURLRequestReturnCacheDataDontLoad = 3, + NSURLRequestReloadRevalidatingCacheData = 5 +} + +class NSURLRequest : NSObject, INSCoding, INSCopying, INSMutableCopying +{ + mixin ObjcWrap; + mixin TNSHTTPURLRequest; + + static Object requestWithURL (NSURL URL) + { + return invokeObjcSelfClass!(Object, "requestWithURL:", NSURL)(URL); + } + + static Object requestWithURL (NSURL URL, uint cachePolicy, double timeoutInterval) + { + return invokeObjcSelfClass!(Object, "requestWithURL:cachePolicy:timeoutInterval:", NSURL, uint, double)(URL, cachePolicy, timeoutInterval); + } + + Object initWithURL (NSURL URL) + { + return invokeObjcSelf!(Object, "initWithURL:", NSURL)(URL); + } + + this (NSURL URL) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithURL:", NSURL)(objcObject, URL); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithURL (NSURL URL, uint cachePolicy, double timeoutInterval) + { + return invokeObjcSelf!(Object, "initWithURL:cachePolicy:timeoutInterval:", NSURL, uint, double)(URL, cachePolicy, timeoutInterval); + } + + this (NSURL URL, uint cachePolicy, double timeoutInterval) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithURL:cachePolicy:timeoutInterval:", NSURL, uint, double)(objcObject, URL, cachePolicy, timeoutInterval); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSURL URL () + { + return invokeObjcSelf!(NSURL, "URL"); + } + + uint cachePolicy () + { + return invokeObjcSelf!(uint, "cachePolicy"); + } + + double timeoutInterval () + { + return invokeObjcSelf!(double, "timeoutInterval"); + } + + NSURL mainDocumentURL () + { + return invokeObjcSelf!(NSURL, "mainDocumentURL"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + Object mutableCopyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); + } +} + +class NSMutableURLRequest : NSURLRequest +{ + mixin ObjcWrap; + mixin TNSMutableHTTPURLRequest; + + void setURL (NSURL URL) + { + return invokeObjcSelf!(void, "setURL:", NSURL)(URL); + } + + void setCachePolicy (uint policy) + { + return invokeObjcSelf!(void, "setCachePolicy:", uint)(policy); + } + + void setTimeoutInterval (double seconds) + { + return invokeObjcSelf!(void, "setTimeoutInterval:", double)(seconds); + } + + void setMainDocumentURL (NSURL URL) + { + return invokeObjcSelf!(void, "setMainDocumentURL:", NSURL)(URL); + } +} + +template TNSHTTPURLRequest () +{ + NSString HTTPMethod () + { + return invokeObjcSelf!(NSString, "HTTPMethod"); + } + + NSDictionary allHTTPHeaderFields () + { + return invokeObjcSelf!(NSDictionary, "allHTTPHeaderFields"); + } + + NSString valueForHTTPHeaderField (NSString field) + { + return invokeObjcSelf!(NSString, "valueForHTTPHeaderField:", NSString)(field); + } + + NSData HTTPBody () + { + return invokeObjcSelf!(NSData, "HTTPBody"); + } + + NSInputStream HTTPBodyStream () + { + return invokeObjcSelf!(NSInputStream, "HTTPBodyStream"); + } + + bool HTTPShouldHandleCookies () + { + return invokeObjcSelf!(bool, "HTTPShouldHandleCookies"); + } +} + +template TNSMutableHTTPURLRequest () +{ + void setHTTPMethod (NSString method) + { + return invokeObjcSelf!(void, "setHTTPMethod:", NSString)(method); + } + + void setAllHTTPHeaderFields (NSDictionary headerFields) + { + return invokeObjcSelf!(void, "setAllHTTPHeaderFields:", NSDictionary)(headerFields); + } + + void setValue (NSString value, NSString field) + { + return invokeObjcSelf!(void, "setValue:forHTTPHeaderField:", NSString, NSString)(value, field); + } + + void addValue (NSString value, NSString field) + { + return invokeObjcSelf!(void, "addValue:forHTTPHeaderField:", NSString, NSString)(value, field); + } + + void setHTTPBody (NSData data) + { + return invokeObjcSelf!(void, "setHTTPBody:", NSData)(data); + } + + void setHTTPBodyStream (NSInputStream inputStream) + { + return invokeObjcSelf!(void, "setHTTPBodyStream:", NSInputStream)(inputStream); + } + + void setHTTPShouldHandleCookies (bool should) + { + return invokeObjcSelf!(void, "setHTTPShouldHandleCookies:", bool)(should); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURLResponse.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURLResponse.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,111 @@ +/** + * 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.NSURLResponse; + +import dstep.AvailabilityMacros; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSHTTPURLResponseInternal; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSURLRequest; +import dstep.foundation.NSURLResponseInternal; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSHTTPURLResponse : NSURLResponse +{ + mixin ObjcWrap; + + NSInteger statusCode () + { + return invokeObjcSelf!(NSInteger, "statusCode"); + } + + NSDictionary allHeaderFields () + { + return invokeObjcSelf!(NSDictionary, "allHeaderFields"); + } + + static NSString localizedStringForStatusCode (NSInteger statusCode) + { + return invokeObjcSelfClass!(NSString, "localizedStringForStatusCode:", NSInteger)(statusCode); + } +} + +class NSURLResponse : NSObject, INSCoding, INSCopying +{ + mixin ObjcWrap; + + Object initWithURL (NSURL URL, NSString MIMEType, NSInteger length, NSString name) + { + return invokeObjcSelf!(Object, "initWithURL:MIMEType:expectedContentLength:textEncodingName:", NSURL, NSString, NSInteger, NSString)(URL, MIMEType, length, name); + } + + this (NSURL URL, NSString MIMEType, NSInteger length, NSString name) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithURL:MIMEType:expectedContentLength:textEncodingName:", NSURL, NSString, NSInteger, NSString)(objcObject, URL, MIMEType, length, name); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSURL URL () + { + return invokeObjcSelf!(NSURL, "URL"); + } + + NSString MIMEType () + { + return invokeObjcSelf!(NSString, "MIMEType"); + } + + long expectedContentLength () + { + return invokeObjcSelf!(long, "expectedContentLength"); + } + + NSString textEncodingName () + { + return invokeObjcSelf!(NSString, "textEncodingName"); + } + + NSString suggestedFilename () + { + return invokeObjcSelf!(NSString, "suggestedFilename"); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSURL_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSURL_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,20 @@ +module dstep.foundation.NSURL_bindings; + +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSNumber; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURLHandle; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package id NSURLFileScheme; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSUndoManager.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSUndoManager.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,195 @@ +/** + * 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.NSUndoManager; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSUndoManager_bindings; + +const NSString NSUndoManagerCheckpointNotification; +const NSString NSUndoManagerWillUndoChangeNotification; +const NSString NSUndoManagerWillRedoChangeNotification; +const NSString NSUndoManagerDidUndoChangeNotification; +const NSString NSUndoManagerDidRedoChangeNotification; +const NSString NSUndoManagerDidOpenUndoGroupNotification; +const NSString NSUndoManagerWillCloseUndoGroupNotification; + +enum +{ + NSUndoCloseGroupingRunLoopOrdering = 350000 +} + +static this () +{ + NSUndoManagerCheckpointNotification = new NSString(bindings.NSUndoManagerCheckpointNotification); + NSUndoManagerWillUndoChangeNotification = new NSString(bindings.NSUndoManagerWillUndoChangeNotification); + NSUndoManagerWillRedoChangeNotification = new NSString(bindings.NSUndoManagerWillRedoChangeNotification); + NSUndoManagerDidUndoChangeNotification = new NSString(bindings.NSUndoManagerDidUndoChangeNotification); + NSUndoManagerDidRedoChangeNotification = new NSString(bindings.NSUndoManagerDidRedoChangeNotification); + NSUndoManagerDidOpenUndoGroupNotification = new NSString(bindings.NSUndoManagerDidOpenUndoGroupNotification); + NSUndoManagerWillCloseUndoGroupNotification = new NSString(bindings.NSUndoManagerWillCloseUndoGroupNotification); +} + +class NSUndoManager : NSObject +{ + mixin ObjcWrap; + + void beginUndoGrouping () + { + return invokeObjcSelf!(void, "beginUndoGrouping"); + } + + void endUndoGrouping () + { + return invokeObjcSelf!(void, "endUndoGrouping"); + } + + NSInteger groupingLevel () + { + return invokeObjcSelf!(NSInteger, "groupingLevel"); + } + + void disableUndoRegistration () + { + return invokeObjcSelf!(void, "disableUndoRegistration"); + } + + void enableUndoRegistration () + { + return invokeObjcSelf!(void, "enableUndoRegistration"); + } + + bool isUndoRegistrationEnabled () + { + return invokeObjcSelf!(bool, "isUndoRegistrationEnabled"); + } + + bool groupsByEvent () + { + return invokeObjcSelf!(bool, "groupsByEvent"); + } + + void setGroupsByEvent (bool groupsByEvent) + { + return invokeObjcSelf!(void, "setGroupsByEvent:", bool)(groupsByEvent); + } + + void setLevelsOfUndo (NSUInteger levels) + { + return invokeObjcSelf!(void, "setLevelsOfUndo:", NSUInteger)(levels); + } + + NSUInteger levelsOfUndo () + { + return invokeObjcSelf!(NSUInteger, "levelsOfUndo"); + } + + void setRunLoopModes (NSArray runLoopModes) + { + return invokeObjcSelf!(void, "setRunLoopModes:", NSArray)(runLoopModes); + } + + NSArray runLoopModes () + { + return invokeObjcSelf!(NSArray, "runLoopModes"); + } + + void undo () + { + return invokeObjcSelf!(void, "undo"); + } + + void redo () + { + return invokeObjcSelf!(void, "redo"); + } + + void undoNestedGroup () + { + return invokeObjcSelf!(void, "undoNestedGroup"); + } + + bool canUndo () + { + return invokeObjcSelf!(bool, "canUndo"); + } + + bool canRedo () + { + return invokeObjcSelf!(bool, "canRedo"); + } + + bool isUndoing () + { + return invokeObjcSelf!(bool, "isUndoing"); + } + + bool isRedoing () + { + return invokeObjcSelf!(bool, "isRedoing"); + } + + void removeAllActions () + { + return invokeObjcSelf!(void, "removeAllActions"); + } + + void removeAllActionsWithTarget (Object target) + { + return invokeObjcSelf!(void, "removeAllActionsWithTarget:", Object)(target); + } + + void registerUndoWithTarget (Object target, SEL selector, Object anObject) + { + return invokeObjcSelf!(void, "registerUndoWithTarget:selector:object:", Object, SEL, Object)(target, selector, anObject); + } + + Object prepareWithInvocationTarget (Object target) + { + return invokeObjcSelf!(Object, "prepareWithInvocationTarget:", Object)(target); + } + + NSString undoActionName () + { + return invokeObjcSelf!(NSString, "undoActionName"); + } + + NSString redoActionName () + { + return invokeObjcSelf!(NSString, "redoActionName"); + } + + void setActionName (NSString actionName) + { + return invokeObjcSelf!(void, "setActionName:", NSString)(actionName); + } + + NSString undoMenuItemTitle () + { + return invokeObjcSelf!(NSString, "undoMenuItemTitle"); + } + + NSString redoMenuItemTitle () + { + return invokeObjcSelf!(NSString, "redoMenuItemTitle"); + } + + NSString undoMenuTitleForUndoActionName (NSString actionName) + { + return invokeObjcSelf!(NSString, "undoMenuTitleForUndoActionName:", NSString)(actionName); + } + + NSString redoMenuTitleForUndoActionName (NSString actionName) + { + return invokeObjcSelf!(NSString, "redoMenuTitleForUndoActionName:", NSString)(actionName); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSUndoManager_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSUndoManager_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,23 @@ +module dstep.foundation.NSUndoManager_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSUndoManagerCheckpointNotification; + package const id NSUndoManagerWillUndoChangeNotification; + package const id NSUndoManagerWillRedoChangeNotification; + package const id NSUndoManagerDidUndoChangeNotification; + package const id NSUndoManagerDidRedoChangeNotification; + package const id NSUndoManagerDidOpenUndoGroupNotification; + package const id NSUndoManagerWillCloseUndoGroupNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSUserDefaults.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSUserDefaults.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,233 @@ +/** + * 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.NSUserDefaults; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSUserDefaults_bindings; + +const NSString NSGlobalDomain; +const NSString NSArgumentDomain; +const NSString NSRegistrationDomain; +const NSString NSUserDefaultsDidChangeNotification; + +static this () +{ + NSGlobalDomain = new NSString(bindings.NSGlobalDomain); + NSArgumentDomain = new NSString(bindings.NSArgumentDomain); + NSRegistrationDomain = new NSString(bindings.NSRegistrationDomain); + NSUserDefaultsDidChangeNotification = new NSString(bindings.NSUserDefaultsDidChangeNotification); +} + +class NSUserDefaults : NSObject +{ + mixin ObjcWrap; + + static NSUserDefaults standardUserDefaults () + { + return invokeObjcSelfClass!(NSUserDefaults, "standardUserDefaults"return result is this.objcObject ? this : (result !is null ? new NSUserDefaults(result) : null); } + + static void resetStandardUserDefaults () + { + return invokeObjcSelfClass!(void, "resetStandardUserDefaults"); + } + + Object init () + { + return invokeObjcSelf!(Object, "init"); + } + + this () + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUser (NSString username) + { + return invokeObjcSelf!(Object, "initWithUser:", NSString)(username); + } + + this (NSString username) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUser:", NSString)(objcObject, username); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object objectForKey (NSString defaultName) + { + return invokeObjcSelf!(Object, "objectForKey:", NSString)(defaultName); + } + + void setObject (Object value, NSString defaultName) + { + return invokeObjcSelf!(void, "setObject:forKey:", Object, NSString)(value, defaultName); + } + + void removeObjectForKey (NSString defaultName) + { + return invokeObjcSelf!(void, "removeObjectForKey:", NSString)(defaultName); + } + + NSString stringForKey (NSString defaultName) + { + return invokeObjcSelf!(NSString, "stringForKey:", NSString)(defaultName); + } + + NSArray arrayForKey (NSString defaultName) + { + return invokeObjcSelf!(NSArray, "arrayForKey:", NSString)(defaultName); + } + + NSDictionary dictionaryForKey (NSString defaultName) + { + return invokeObjcSelf!(NSDictionary, "dictionaryForKey:", NSString)(defaultName); + } + + NSData dataForKey (NSString defaultName) + { + return invokeObjcSelf!(NSData, "dataForKey:", NSString)(defaultName); + } + + NSArray stringArrayForKey (NSString defaultName) + { + return invokeObjcSelf!(NSArray, "stringArrayForKey:", NSString)(defaultName); + } + + NSInteger integerForKey (NSString defaultName) + { + return invokeObjcSelf!(NSInteger, "integerForKey:", NSString)(defaultName); + } + + float floatForKey (NSString defaultName) + { + return invokeObjcSelf!(float, "floatForKey:", NSString)(defaultName); + } + + double doubleForKey (NSString defaultName) + { + return invokeObjcSelf!(double, "doubleForKey:", NSString)(defaultName); + } + + bool boolForKey (NSString defaultName) + { + return invokeObjcSelf!(bool, "boolForKey:", NSString)(defaultName); + } + + void setInteger (NSInteger value, NSString defaultName) + { + return invokeObjcSelf!(void, "setInteger:forKey:", NSInteger, NSString)(value, defaultName); + } + + void setFloat (float value, NSString defaultName) + { + return invokeObjcSelf!(void, "setFloat:forKey:", float, NSString)(value, defaultName); + } + + void setDouble (double value, NSString defaultName) + { + return invokeObjcSelf!(void, "setDouble:forKey:", double, NSString)(value, defaultName); + } + + void setBool (bool value, NSString defaultName) + { + return invokeObjcSelf!(void, "setBool:forKey:", bool, NSString)(value, defaultName); + } + + void registerDefaults (NSDictionary registrationDictionary) + { + return invokeObjcSelf!(void, "registerDefaults:", NSDictionary)(registrationDictionary); + } + + void addSuiteNamed (NSString suiteName) + { + return invokeObjcSelf!(void, "addSuiteNamed:", NSString)(suiteName); + } + + void removeSuiteNamed (NSString suiteName) + { + return invokeObjcSelf!(void, "removeSuiteNamed:", NSString)(suiteName); + } + + NSDictionary dictionaryRepresentation () + { + return invokeObjcSelf!(NSDictionary, "dictionaryRepresentation"); + } + + NSArray volatileDomainNames () + { + return invokeObjcSelf!(NSArray, "volatileDomainNames"); + } + + NSDictionary volatileDomainForName (NSString domainName) + { + return invokeObjcSelf!(NSDictionary, "volatileDomainForName:", NSString)(domainName); + } + + void setVolatileDomain (NSDictionary domain, NSString domainName) + { + return invokeObjcSelf!(void, "setVolatileDomain:forName:", NSDictionary, NSString)(domain, domainName); + } + + void removeVolatileDomainForName (NSString domainName) + { + return invokeObjcSelf!(void, "removeVolatileDomainForName:", NSString)(domainName); + } + + NSArray persistentDomainNames () + { + return invokeObjcSelf!(NSArray, "persistentDomainNames"); + } + + NSDictionary persistentDomainForName (NSString domainName) + { + return invokeObjcSelf!(NSDictionary, "persistentDomainForName:", NSString)(domainName); + } + + void setPersistentDomain (NSDictionary domain, NSString domainName) + { + return invokeObjcSelf!(void, "setPersistentDomain:forName:", NSDictionary, NSString)(domain, domainName); + } + + void removePersistentDomainForName (NSString domainName) + { + return invokeObjcSelf!(void, "removePersistentDomainForName:", NSString)(domainName); + } + + bool synchronize () + { + return invokeObjcSelf!(bool, "synchronize"); + } + + bool objectIsForcedForKey (NSString key) + { + return invokeObjcSelf!(bool, "objectIsForcedForKey:", NSString)(key); + } + + bool objectIsForcedForKey (NSString key, NSString domain) + { + return invokeObjcSelf!(bool, "objectIsForcedForKey:inDomain:", NSString, NSString)(key, domain); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSUserDefaults_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSUserDefaults_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,23 @@ +module dstep.foundation.NSUserDefaults_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSGlobalDomain; + package const id NSArgumentDomain; + package const id NSRegistrationDomain; + package const id NSUserDefaultsDidChangeNotification; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSValue.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSValue.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,536 @@ +/** + * 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.NSValue; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSNumber : NSValue +{ + mixin ObjcWrap; + mixin TNSDecimalNumberExtensions; + mixin TNSNumberCreation; + + byte charValue () + { + return invokeObjcSelf!(byte, "charValue"); + } + + ubyte unsignedCharValue () + { + return invokeObjcSelf!(ubyte, "unsignedCharValue"); + } + + short shortValue () + { + return invokeObjcSelf!(short, "shortValue"); + } + + ushort unsignedShortValue () + { + return invokeObjcSelf!(ushort, "unsignedShortValue"); + } + + int intValue () + { + return invokeObjcSelf!(int, "intValue"); + } + + uint unsignedIntValue () + { + return invokeObjcSelf!(uint, "unsignedIntValue"); + } + + int longValue () + { + return invokeObjcSelf!(int, "longValue"); + } + + uint unsignedLongValue () + { + return invokeObjcSelf!(uint, "unsignedLongValue"); + } + + long longLongValue () + { + return invokeObjcSelf!(long, "longLongValue"); + } + + ulong unsignedLongLongValue () + { + return invokeObjcSelf!(ulong, "unsignedLongLongValue"); + } + + float floatValue () + { + return invokeObjcSelf!(float, "floatValue"); + } + + double doubleValue () + { + return invokeObjcSelf!(double, "doubleValue"); + } + + bool boolValue () + { + return invokeObjcSelf!(bool, "boolValue"); + } + + NSInteger integerValue () + { + return invokeObjcSelf!(NSInteger, "integerValue"); + } + + NSUInteger unsignedIntegerValue () + { + return invokeObjcSelf!(NSUInteger, "unsignedIntegerValue"); + } + + NSString stringValue () + { + return invokeObjcSelf!(NSString, "stringValue"); + } + + int compare (NSNumber otherNumber) + { + return invokeObjcSelf!(int, "compare:", NSNumber)(otherNumber); + } + + bool isEqualToNumber (NSNumber number) + { + return invokeObjcSelf!(bool, "isEqualToNumber:", NSNumber)(number); + } + + NSString descriptionWithLocale (Object locale) + { + return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); + } +} + +class NSValue : NSObject, INSCopying, INSCoding +{ + mixin ObjcWrap; + mixin TNSValueGeometryExtensions; + mixin TNSValueCreation; + mixin TNSValueRangeExtensions; + mixin TNSValueExtensionMethods; + + void getValue (void* value) + { + return invokeObjcSelf!(void, "getValue:", void*)(value); + } + + char* objCType () + { + return invokeObjcSelf!(char*, "objCType"); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + Object initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); + } + + this (NSCoder aDecoder) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); + + if (result) + objcObject = ret; + + dObject = this; + } +} + +template TNSNumberCreation () +{ + Object initWithChar (byte value) + { + return invokeObjcSelf!(Object, "initWithChar:", byte)(value); + } + + this (byte value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithChar:", byte)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUnsignedChar (ubyte value) + { + return invokeObjcSelf!(Object, "initWithUnsignedChar:", ubyte)(value); + } + + this (ubyte value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedChar:", ubyte)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithShort (short value) + { + return invokeObjcSelf!(Object, "initWithShort:", short)(value); + } + + this (short value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithShort:", short)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUnsignedShort (ushort value) + { + return invokeObjcSelf!(Object, "initWithUnsignedShort:", ushort)(value); + } + + this (ushort value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedShort:", ushort)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithInt (int value) + { + return invokeObjcSelf!(Object, "initWithInt:", int)(value); + } + + this (int value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithInt:", int)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUnsignedInt (uint value) + { + return invokeObjcSelf!(Object, "initWithUnsignedInt:", uint)(value); + } + + this (uint value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedInt:", uint)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithLong (int value) + { + return invokeObjcSelf!(Object, "initWithLong:", int)(value); + } + + this (int value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithLong:", int)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUnsignedLong (uint value) + { + return invokeObjcSelf!(Object, "initWithUnsignedLong:", uint)(value); + } + + this (uint value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedLong:", uint)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithLongLong (long value) + { + return invokeObjcSelf!(Object, "initWithLongLong:", long)(value); + } + + this (long value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithLongLong:", long)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUnsignedLongLong (ulong value) + { + return invokeObjcSelf!(Object, "initWithUnsignedLongLong:", ulong)(value); + } + + this (ulong value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedLongLong:", ulong)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithFloat (float value) + { + return invokeObjcSelf!(Object, "initWithFloat:", float)(value); + } + + this (float value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithFloat:", float)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithDouble (double value) + { + return invokeObjcSelf!(Object, "initWithDouble:", double)(value); + } + + this (double value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithDouble:", double)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithBool (bool value) + { + return invokeObjcSelf!(Object, "initWithBool:", bool)(value); + } + + this (bool value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithBool:", bool)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithInteger (NSInteger value) + { + return invokeObjcSelf!(Object, "initWithInteger:", NSInteger)(value); + } + + this (NSInteger value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithInteger:", NSInteger)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithUnsignedInteger (NSUInteger value) + { + return invokeObjcSelf!(Object, "initWithUnsignedInteger:", NSUInteger)(value); + } + + this (NSUInteger value) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedInteger:", NSUInteger)(objcObject, value); + + if (result) + objcObject = ret; + + dObject = this; + } + + static NSNumber numberWithChar (byte value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithChar:", byte)(value); + } + + static NSNumber numberWithUnsignedChar (ubyte value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedChar:", ubyte)(value); + } + + static NSNumber numberWithShort (short value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithShort:", short)(value); + } + + static NSNumber numberWithUnsignedShort (ushort value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedShort:", ushort)(value); + } + + static NSNumber numberWithInt (int value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithInt:", int)(value); + } + + static NSNumber numberWithUnsignedInt (uint value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedInt:", uint)(value); + } + + static NSNumber numberWithLong (int value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithLong:", int)(value); + } + + static NSNumber numberWithUnsignedLong (uint value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedLong:", uint)(value); + } + + static NSNumber numberWithLongLong (long value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithLongLong:", long)(value); + } + + static NSNumber numberWithUnsignedLongLong (ulong value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedLongLong:", ulong)(value); + } + + static NSNumber numberWithFloat (float value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithFloat:", float)(value); + } + + static NSNumber numberWithDouble (double value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithDouble:", double)(value); + } + + static NSNumber numberWithBool (bool value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithBool:", bool)(value); + } + + static NSNumber numberWithInteger (NSInteger value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithInteger:", NSInteger)(value); + } + + static NSNumber numberWithUnsignedInteger (NSUInteger value) + { + return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedInteger:", NSUInteger)(value); + } +} + +template TNSValueCreation () +{ + Object initWithBytes (void* value, char* type) + { + return invokeObjcSelf!(Object, "initWithBytes:objCType:", void*, char*)(value, type); + } + + this (void* value, char* type) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithBytes:objCType:", void*, char*)(objcObject, value, type); + + if (result) + objcObject = ret; + + dObject = this; + } + + static NSValue valueWithBytes (void* value, char* type) + { + return invokeObjcSelfClass!(NSValue, "valueWithBytes:objCType:", void*, char*)(value, type); + } + + static NSValue value (void* value, char* type) + { + return invokeObjcSelfClass!(NSValue, "value:withObjCType:", void*, char*)(value, type); + } +} + +template TNSValueExtensionMethods () +{ + static NSValue valueWithNonretainedObject (Object anObject) + { + return invokeObjcSelfClass!(NSValue, "valueWithNonretainedObject:", Object)(anObject); + } + + Object nonretainedObjectValue () + { + return invokeObjcSelf!(Object, "nonretainedObjectValue"); + } + + static NSValue valueWithPointer (void* pointer) + { + return invokeObjcSelfClass!(NSValue, "valueWithPointer:", void*)(pointer); + } + + void* pointerValue () + { + return invokeObjcSelf!(void*, "pointerValue"); + } + + bool isEqualToValue (NSValue value) + { + return invokeObjcSelf!(bool, "isEqualToValue:", NSValue)(value); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSValueTransformer.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSValueTransformer.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,70 @@ +/** + * 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.NSValueTransformer; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSValueTransformer_bindings; + +const NSString NSNegateBooleanTransformerName; +const NSString NSIsNilTransformerName; +const NSString NSIsNotNilTransformerName; +const NSString NSUnarchiveFromDataTransformerName; +const NSString NSKeyedUnarchiveFromDataTransformerName; + +static this () +{ + NSNegateBooleanTransformerName = new NSString(bindings.NSNegateBooleanTransformerName); + NSIsNilTransformerName = new NSString(bindings.NSIsNilTransformerName); + NSIsNotNilTransformerName = new NSString(bindings.NSIsNotNilTransformerName); + NSUnarchiveFromDataTransformerName = new NSString(bindings.NSUnarchiveFromDataTransformerName); + NSKeyedUnarchiveFromDataTransformerName = new NSString(bindings.NSKeyedUnarchiveFromDataTransformerName); +} + +class NSValueTransformer : NSObject +{ + mixin ObjcWrap; + + static void setValueTransformer (NSValueTransformer transformer, NSString name) + { + return invokeObjcSelfClass!(void, "setValueTransformer:forName:", NSValueTransformer, NSString)(transformer, name); + } + + static NSValueTransformer valueTransformerForName (NSString name) + { + return invokeObjcSelfClass!(NSValueTransformer, "valueTransformerForName:", NSString)(namereturn result is this.objcObject ? this : (result !is null ? new NSValueTransformer(result) : null); } + + static NSArray valueTransformerNames () + { + return invokeObjcSelfClass!(NSArray, "valueTransformerNames"); + } + + static Class transformedValueClass () + { + return invokeObjcSelfClass!(Class, "transformedValueClass"); + } + + static bool allowsReverseTransformation () + { + return invokeObjcSelfClass!(bool, "allowsReverseTransformation"); + } + + Object transformedValue (Object value) + { + return invokeObjcSelf!(Object, "transformedValue:", Object)(value); + } + + Object reverseTransformedValue (Object value) + { + return invokeObjcSelf!(Object, "reverseTransformedValue:", Object)(value); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSValueTransformer_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSValueTransformer_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,21 @@ +module dstep.foundation.NSValueTransformer_bindings; + +import dstep.foundation.NSArray; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSNegateBooleanTransformerName; + package const id NSIsNilTransformerName; + package const id NSIsNotNilTransformerName; + package const id NSUnarchiveFromDataTransformerName; + package const id NSKeyedUnarchiveFromDataTransformerName; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLDTD.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLDTD.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,127 @@ +/** + * 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.NSXMLDTD; + +import dstep.foundation.NSData; +import dstep.foundation.NSMutableDictionary; +import dstep.foundation.NSXMLDTDNode; +import dstep.foundation.NSXMLNode; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSXMLDTD : NSXMLNode +{ + mixin ObjcWrap; + + Object initWithContentsOfURL (NSURL url, NSUInteger mask, NSError** error) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, mask, error); + } + + this (NSURL url, NSUInteger mask, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(objcObject, url, mask, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithData (NSData data, NSUInteger mask, NSError** error) + { + return invokeObjcSelf!(Object, "initWithData:options:error:", NSData, NSUInteger, NSError**)(data, mask, error); + } + + this (NSData data, NSUInteger mask, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithData:options:error:", NSData, NSUInteger, NSError**)(objcObject, data, mask, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + void setPublicID (NSString publicID) + { + return invokeObjcSelf!(void, "setPublicID:", NSString)(publicID); + } + + NSString publicID () + { + return invokeObjcSelf!(NSString, "publicID"); + } + + void setSystemID (NSString systemID) + { + return invokeObjcSelf!(void, "setSystemID:", NSString)(systemID); + } + + NSString systemID () + { + return invokeObjcSelf!(NSString, "systemID"); + } + + void insertChild (NSXMLNode child, NSUInteger index) + { + return invokeObjcSelf!(void, "insertChild:atIndex:", NSXMLNode, NSUInteger)(child, index); + } + + void insertChildren (NSArray children, NSUInteger index) + { + return invokeObjcSelf!(void, "insertChildren:atIndex:", NSArray, NSUInteger)(children, index); + } + + void removeChildAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removeChildAtIndex:", NSUInteger)(index); + } + + void setChildren (NSArray children) + { + return invokeObjcSelf!(void, "setChildren:", NSArray)(children); + } + + void addChild (NSXMLNode child) + { + return invokeObjcSelf!(void, "addChild:", NSXMLNode)(child); + } + + void replaceChildAtIndex (NSUInteger index, NSXMLNode node) + { + return invokeObjcSelf!(void, "replaceChildAtIndex:withNode:", NSUInteger, NSXMLNode)(index, node); + } + + NSXMLDTDNode entityDeclarationForName (NSString name) + { + return invokeObjcSelf!(NSXMLDTDNode, "entityDeclarationForName:", NSString)(name); + } + + NSXMLDTDNode notationDeclarationForName (NSString name) + { + return invokeObjcSelf!(NSXMLDTDNode, "notationDeclarationForName:", NSString)(name); + } + + NSXMLDTDNode elementDeclarationForName (NSString name) + { + return invokeObjcSelf!(NSXMLDTDNode, "elementDeclarationForName:", NSString)(name); + } + + NSXMLDTDNode attributeDeclarationForName (NSString name, NSString elementName) + { + return invokeObjcSelf!(NSXMLDTDNode, "attributeDeclarationForName:elementName:", NSString, NSString)(name, elementName); + } + + static NSXMLDTDNode predefinedEntityDeclarationForName (NSString name) + { + return invokeObjcSelfClass!(NSXMLDTDNode, "predefinedEntityDeclarationForName:", NSString)(name); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLDTDNode.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLDTDNode.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,104 @@ +/** + * 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.NSXMLDTDNode; + +import dstep.foundation.NSXMLNode; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSXMLDTDNodeKind; + +enum +{ + NSXMLEntityGeneralKind = 1, + NSXMLEntityParsedKind, + NSXMLEntityUnparsedKind, + NSXMLEntityParameterKind, + NSXMLEntityPredefined, + NSXMLAttributeCDATAKind, + NSXMLAttributeIDKind, + NSXMLAttributeIDRefKind, + NSXMLAttributeIDRefsKind, + NSXMLAttributeEntityKind, + NSXMLAttributeEntitiesKind, + NSXMLAttributeNMTokenKind, + NSXMLAttributeNMTokensKind, + NSXMLAttributeEnumerationKind, + NSXMLAttributeNotationKind, + NSXMLElementDeclarationUndefinedKind, + NSXMLElementDeclarationEmptyKind, + NSXMLElementDeclarationAnyKind, + NSXMLElementDeclarationMixedKind, + NSXMLElementDeclarationElementKind +} + +class NSXMLDTDNode : NSXMLNode +{ + mixin ObjcWrap; + + Object initWithXMLString (NSString string) + { + return invokeObjcSelf!(Object, "initWithXMLString:", NSString)(string); + } + + this (NSString string) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithXMLString:", NSString)(objcObject, string); + + if (result) + objcObject = ret; + + dObject = this; + } + + void setDTDKind (uint kind) + { + return invokeObjcSelf!(void, "setDTDKind:", uint)(kind); + } + + uint DTDKind () + { + return invokeObjcSelf!(uint, "DTDKind"); + } + + bool isExternal () + { + return invokeObjcSelf!(bool, "isExternal"); + } + + void setPublicID (NSString publicID) + { + return invokeObjcSelf!(void, "setPublicID:", NSString)(publicID); + } + + NSString publicID () + { + return invokeObjcSelf!(NSString, "publicID"); + } + + void setSystemID (NSString systemID) + { + return invokeObjcSelf!(void, "setSystemID:", NSString)(systemID); + } + + NSString systemID () + { + return invokeObjcSelf!(NSString, "systemID"); + } + + void setNotationName (NSString notationName) + { + return invokeObjcSelf!(void, "setNotationName:", NSString)(notationName); + } + + NSString notationName () + { + return invokeObjcSelf!(NSString, "notationName"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLDocument.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLDocument.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,228 @@ +/** + * 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.NSXMLDocument; + +import dstep.foundation.NSData; +import dstep.foundation.NSXMLDTD; +import dstep.foundation.NSXMLNode; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSXMLDocumentContentKind; + +enum +{ + NSXMLDocumentXMLKind = 0, + NSXMLDocumentXHTMLKind, + NSXMLDocumentHTMLKind, + NSXMLDocumentTextKind +} + +class NSXMLDocument : NSXMLNode +{ + mixin ObjcWrap; + + Object initWithXMLString (NSString string, NSUInteger mask, NSError** error) + { + return invokeObjcSelf!(Object, "initWithXMLString:options:error:", NSString, NSUInteger, NSError**)(string, mask, error); + } + + this (NSString string, NSUInteger mask, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithXMLString:options:error:", NSString, NSUInteger, NSError**)(objcObject, string, mask, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithContentsOfURL (NSURL url, NSUInteger mask, NSError** error) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(url, mask, error); + } + + this (NSURL url, NSUInteger mask, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:options:error:", NSURL, NSUInteger, NSError**)(objcObject, url, mask, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithData (NSData data, NSUInteger mask, NSError** error) + { + return invokeObjcSelf!(Object, "initWithData:options:error:", NSData, NSUInteger, NSError**)(data, mask, error); + } + + this (NSData data, NSUInteger mask, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithData:options:error:", NSData, NSUInteger, NSError**)(objcObject, data, mask, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithRootElement (NSXMLElement element) + { + return invokeObjcSelf!(Object, "initWithRootElement:", NSXMLElement)(element); + } + + this (NSXMLElement element) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithRootElement:", NSXMLElement)(objcObject, element); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Class replacementClassForClass (Class cls) + { + return invokeObjcSelfClass!(Class, "replacementClassForClass:", Class)(cls); + } + + void setCharacterEncoding (NSString encoding) + { + return invokeObjcSelf!(void, "setCharacterEncoding:", NSString)(encoding); + } + + NSString characterEncoding () + { + return invokeObjcSelf!(NSString, "characterEncoding"); + } + + void setVersion (NSString version_) + { + return invokeObjcSelf!(void, "setVersion:", NSString)(version_); + } + + NSString version_ () + { + return invokeObjcSelf!(NSString, "version"); + } + + void setStandalone (bool standalone) + { + return invokeObjcSelf!(void, "setStandalone:", bool)(standalone); + } + + bool isStandalone () + { + return invokeObjcSelf!(bool, "isStandalone"); + } + + void setDocumentContentKind (uint kind) + { + return invokeObjcSelf!(void, "setDocumentContentKind:", uint)(kind); + } + + uint documentContentKind () + { + return invokeObjcSelf!(uint, "documentContentKind"); + } + + void setMIMEType (NSString MIMEType) + { + return invokeObjcSelf!(void, "setMIMEType:", NSString)(MIMEType); + } + + NSString MIMEType () + { + return invokeObjcSelf!(NSString, "MIMEType"); + } + + void setDTD (NSXMLDTD documentTypeDeclaration) + { + return invokeObjcSelf!(void, "setDTD:", NSXMLDTD)(documentTypeDeclaration); + } + + NSXMLDTD DTD () + { + return invokeObjcSelf!(NSXMLDTD, "DTD"); + } + + void setRootElement (NSXMLNode root) + { + return invokeObjcSelf!(void, "setRootElement:", NSXMLNode)(root); + } + + NSXMLElement rootElement () + { + return invokeObjcSelf!(NSXMLElement, "rootElement"); + } + + void insertChild (NSXMLNode child, NSUInteger index) + { + return invokeObjcSelf!(void, "insertChild:atIndex:", NSXMLNode, NSUInteger)(child, index); + } + + void insertChildren (NSArray children, NSUInteger index) + { + return invokeObjcSelf!(void, "insertChildren:atIndex:", NSArray, NSUInteger)(children, index); + } + + void removeChildAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removeChildAtIndex:", NSUInteger)(index); + } + + void setChildren (NSArray children) + { + return invokeObjcSelf!(void, "setChildren:", NSArray)(children); + } + + void addChild (NSXMLNode child) + { + return invokeObjcSelf!(void, "addChild:", NSXMLNode)(child); + } + + void replaceChildAtIndex (NSUInteger index, NSXMLNode node) + { + return invokeObjcSelf!(void, "replaceChildAtIndex:withNode:", NSUInteger, NSXMLNode)(index, node); + } + + NSData XMLData () + { + return invokeObjcSelf!(NSData, "XMLData"); + } + + NSData XMLDataWithOptions (NSUInteger options) + { + return invokeObjcSelf!(NSData, "XMLDataWithOptions:", NSUInteger)(options); + } + + Object objectByApplyingXSLT (NSData xslt, NSDictionary arguments, NSError** error) + { + return invokeObjcSelf!(Object, "objectByApplyingXSLT:arguments:error:", NSData, NSDictionary, NSError**)(xslt, arguments, error); + } + + Object objectByApplyingXSLTString (NSString xslt, NSDictionary arguments, NSError** error) + { + return invokeObjcSelf!(Object, "objectByApplyingXSLTString:arguments:error:", NSString, NSDictionary, NSError**)(xslt, arguments, error); + } + + Object objectByApplyingXSLTAtURL (NSURL xsltURL, NSDictionary argument, NSError** error) + { + return invokeObjcSelf!(Object, "objectByApplyingXSLTAtURL:arguments:error:", NSURL, NSDictionary, NSError**)(xsltURL, argument, error); + } + + bool validateAndReturnError (NSError** error) + { + return invokeObjcSelf!(bool, "validateAndReturnError:", NSError**)(error); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLElement.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLElement.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,199 @@ +/** + * 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.NSXMLElement; + +import dstep.foundation.NSDictionary; +import dstep.foundation.NSEnumerator; +import dstep.foundation.NSMutableArray; +import dstep.foundation.NSXMLNode; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +class NSXMLElement : NSXMLNode +{ + mixin ObjcWrap; + + Object initWithName (NSString name) + { + return invokeObjcSelf!(Object, "initWithName:", NSString)(name); + } + + this (NSString name) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithName:", NSString)(objcObject, name); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithName (NSString name, NSString URI) + { + return invokeObjcSelf!(Object, "initWithName:URI:", NSString, NSString)(name, URI); + } + + this (NSString name, NSString URI) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithName:URI:", NSString, NSString)(objcObject, name, URI); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithName (NSString name, NSString string) + { + return invokeObjcSelf!(Object, "initWithName:stringValue:", NSString, NSString)(name, string); + } + + this (NSString name, NSString string) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithName:stringValue:", NSString, NSString)(objcObject, name, string); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithXMLString (NSString string, NSError** error) + { + return invokeObjcSelf!(Object, "initWithXMLString:error:", NSString, NSError**)(string, error); + } + + this (NSString string, NSError** error) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithXMLString:error:", NSString, NSError**)(objcObject, string, error); + + if (result) + objcObject = ret; + + dObject = this; + } + + NSArray elementsForName (NSString name) + { + return invokeObjcSelf!(NSArray, "elementsForName:", NSString)(name); + } + + NSArray elementsForLocalName (NSString localName, NSString URI) + { + return invokeObjcSelf!(NSArray, "elementsForLocalName:URI:", NSString, NSString)(localName, URI); + } + + void addAttribute (NSXMLNode attribute) + { + return invokeObjcSelf!(void, "addAttribute:", NSXMLNode)(attribute); + } + + void removeAttributeForName (NSString name) + { + return invokeObjcSelf!(void, "removeAttributeForName:", NSString)(name); + } + + void setAttributes (NSArray attributes) + { + return invokeObjcSelf!(void, "setAttributes:", NSArray)(attributes); + } + + void setAttributesAsDictionary (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setAttributesAsDictionary:", NSDictionary)(attributes); + } + + NSArray attributes () + { + return invokeObjcSelf!(NSArray, "attributes"); + } + + NSXMLNode attributeForName (NSString name) + { + return invokeObjcSelf!(NSXMLNode, "attributeForName:", NSString)(name); + } + + NSXMLNode attributeForLocalName (NSString localName, NSString URI) + { + return invokeObjcSelf!(NSXMLNode, "attributeForLocalName:URI:", NSString, NSString)(localName, URI); + } + + void addNamespace (NSXMLNode aNamespace) + { + return invokeObjcSelf!(void, "addNamespace:", NSXMLNode)(aNamespace); + } + + void removeNamespaceForPrefix (NSString name) + { + return invokeObjcSelf!(void, "removeNamespaceForPrefix:", NSString)(name); + } + + void setNamespaces (NSArray namespaces) + { + return invokeObjcSelf!(void, "setNamespaces:", NSArray)(namespaces); + } + + NSArray namespaces () + { + return invokeObjcSelf!(NSArray, "namespaces"); + } + + NSXMLNode namespaceForPrefix (NSString name) + { + return invokeObjcSelf!(NSXMLNode, "namespaceForPrefix:", NSString)(name); + } + + NSXMLNode resolveNamespaceForName (NSString name) + { + return invokeObjcSelf!(NSXMLNode, "resolveNamespaceForName:", NSString)(name); + } + + NSString resolvePrefixForNamespaceURI (NSString namespaceURI) + { + return invokeObjcSelf!(NSString, "resolvePrefixForNamespaceURI:", NSString)(namespaceURI); + } + + void insertChild (NSXMLNode child, NSUInteger index) + { + return invokeObjcSelf!(void, "insertChild:atIndex:", NSXMLNode, NSUInteger)(child, index); + } + + void insertChildren (NSArray children, NSUInteger index) + { + return invokeObjcSelf!(void, "insertChildren:atIndex:", NSArray, NSUInteger)(children, index); + } + + void removeChildAtIndex (NSUInteger index) + { + return invokeObjcSelf!(void, "removeChildAtIndex:", NSUInteger)(index); + } + + void setChildren (NSArray children) + { + return invokeObjcSelf!(void, "setChildren:", NSArray)(children); + } + + void addChild (NSXMLNode child) + { + return invokeObjcSelf!(void, "addChild:", NSXMLNode)(child); + } + + void replaceChildAtIndex (NSUInteger index, NSXMLNode node) + { + return invokeObjcSelf!(void, "replaceChildAtIndex:withNode:", NSUInteger, NSXMLNode)(index, node); + } + + void normalizeAdjacentTextNodesPreservingCDATA (bool preserve) + { + return invokeObjcSelf!(void, "normalizeAdjacentTextNodesPreservingCDATA:", bool)(preserve); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLNode.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLNode.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,314 @@ +/** + * 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.NSXMLNode; + +import dstep.foundation.NSArray; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.foundation.NSXMLDocument; +import dstep.foundation.NSXMLElement; +import dstep.foundation.NSXMLNodeOptions; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias NSUInteger NSXMLNodeKind; + +enum +{ + NSXMLInvalidKind = 0, + NSXMLDocumentKind, + NSXMLElementKind, + NSXMLAttributeKind, + NSXMLNamespaceKind, + NSXMLProcessingInstructionKind, + NSXMLCommentKind, + NSXMLTextKind, + NSXMLDTDKind, + NSXMLEntityDeclarationKind, + NSXMLAttributeDeclarationKind, + NSXMLElementDeclarationKind, + NSXMLNotationDeclarationKind +} + +class NSXMLNode : NSObject, INSCopying +{ + mixin ObjcWrap; + + Object initWithKind (uint kind) + { + return invokeObjcSelf!(Object, "initWithKind:", uint)(kind); + } + + this (uint kind) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithKind:", uint)(objcObject, kind); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithKind (uint kind, NSUInteger options) + { + return invokeObjcSelf!(Object, "initWithKind:options:", uint, NSUInteger)(kind, options); + } + + this (uint kind, NSUInteger options) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithKind:options:", uint, NSUInteger)(objcObject, kind, options); + + if (result) + objcObject = ret; + + dObject = this; + } + + static Object document () + { + return invokeObjcSelfClass!(Object, "document"); + } + + static Object documentWithRootElement (NSXMLElement element) + { + return invokeObjcSelfClass!(Object, "documentWithRootElement:", NSXMLElement)(element); + } + + static Object elementWithName (NSString name) + { + return invokeObjcSelfClass!(Object, "elementWithName:", NSString)(name); + } + + static Object elementWithName (NSString name, NSString URI) + { + return invokeObjcSelfClass!(Object, "elementWithName:URI:", NSString, NSString)(name, URI); + } + + static Object elementWithName (NSString name, NSString string) + { + return invokeObjcSelfClass!(Object, "elementWithName:stringValue:", NSString, NSString)(name, string); + } + + static Object elementWithName (NSString name, NSArray children, NSArray attributes) + { + return invokeObjcSelfClass!(Object, "elementWithName:children:attributes:", NSString, NSArray, NSArray)(name, children, attributes); + } + + static Object attributeWithName (NSString name, NSString stringValue) + { + return invokeObjcSelfClass!(Object, "attributeWithName:stringValue:", NSString, NSString)(name, stringValue); + } + + static Object attributeWithName (NSString name, NSString URI, NSString stringValue) + { + return invokeObjcSelfClass!(Object, "attributeWithName:URI:stringValue:", NSString, NSString, NSString)(name, URI, stringValue); + } + + static Object namespaceWithName (NSString name, NSString stringValue) + { + return invokeObjcSelfClass!(Object, "namespaceWithName:stringValue:", NSString, NSString)(name, stringValue); + } + + static Object processingInstructionWithName (NSString name, NSString stringValue) + { + return invokeObjcSelfClass!(Object, "processingInstructionWithName:stringValue:", NSString, NSString)(name, stringValue); + } + + static Object commentWithStringValue (NSString stringValue) + { + return invokeObjcSelfClass!(Object, "commentWithStringValue:", NSString)(stringValue); + } + + static Object textWithStringValue (NSString stringValue) + { + return invokeObjcSelfClass!(Object, "textWithStringValue:", NSString)(stringValue); + } + + static Object DTDNodeWithXMLString (NSString string) + { + return invokeObjcSelfClass!(Object, "DTDNodeWithXMLString:", NSString)(string); + } + + uint kind () + { + return invokeObjcSelf!(uint, "kind"); + } + + void setName (NSString name) + { + return invokeObjcSelf!(void, "setName:", NSString)(name); + } + + NSString name () + { + return invokeObjcSelf!(NSString, "name"); + } + + void setObjectValue (Object value) + { + return invokeObjcSelf!(void, "setObjectValue:", Object)(value); + } + + Object objectValue () + { + return invokeObjcSelf!(Object, "objectValue"); + } + + void setStringValue (NSString string) + { + return invokeObjcSelf!(void, "setStringValue:", NSString)(string); + } + + void setStringValue (NSString string, bool resolve) + { + return invokeObjcSelf!(void, "setStringValue:resolvingEntities:", NSString, bool)(string, resolve); + } + + NSString stringValue () + { + return invokeObjcSelf!(NSString, "stringValue"); + } + + NSUInteger index () + { + return invokeObjcSelf!(NSUInteger, "index"); + } + + NSUInteger level () + { + return invokeObjcSelf!(NSUInteger, "level"); + } + + NSXMLDocument rootDocument () + { + return invokeObjcSelf!(NSXMLDocument, "rootDocument"); + } + + NSXMLNode parent () + { + id result = invokeObjcSelf!(id, "parent"return result is this.objcObject ? this : (result !is null ? new NSXMLNode(result) : null); } + + NSUInteger childCount () + { + return invokeObjcSelf!(NSUInteger, "childCount"); + } + + NSArray children () + { + return invokeObjcSelf!(NSArray, "children"); + } + + NSXMLNode childAtIndex (NSUInteger index) + { + id result = invokeObjcSelf!(id, "childAtIndex:", NSUInteger)(indexreturn result is this.objcObject ? this : (result !is null ? new NSXMLNode(result) : null); } + + NSXMLNode previousSibling () + { + id result = invokeObjcSelf!(id, "previousSibling"return result is this.objcObject ? this : (result !is null ? new NSXMLNode(result) : null); } + + NSXMLNode nextSibling () + { + id result = invokeObjcSelf!(id, "nextSibling"return result is this.objcObject ? this : (result !is null ? new NSXMLNode(result) : null); } + + NSXMLNode previousNode () + { + id result = invokeObjcSelf!(id, "previousNode"return result is this.objcObject ? this : (result !is null ? new NSXMLNode(result) : null); } + + NSXMLNode nextNode () + { + id result = invokeObjcSelf!(id, "nextNode"return result is this.objcObject ? this : (result !is null ? new NSXMLNode(result) : null); } + + void detach () + { + return invokeObjcSelf!(void, "detach"); + } + + NSString XPath () + { + return invokeObjcSelf!(NSString, "XPath"); + } + + NSString localName () + { + return invokeObjcSelf!(NSString, "localName"); + } + + NSString prefix () + { + return invokeObjcSelf!(NSString, "prefix"); + } + + void setURI (NSString URI) + { + return invokeObjcSelf!(void, "setURI:", NSString)(URI); + } + + NSString URI () + { + return invokeObjcSelf!(NSString, "URI"); + } + + static NSString localNameForName (NSString name) + { + return invokeObjcSelfClass!(NSString, "localNameForName:", NSString)(name); + } + + static NSString prefixForName (NSString name) + { + return invokeObjcSelfClass!(NSString, "prefixForName:", NSString)(name); + } + + static NSXMLNode predefinedNamespaceForPrefix (NSString name) + { + return invokeObjcSelfClass!(NSXMLNode, "predefinedNamespaceForPrefix:", NSString)(namereturn result is this.objcObject ? this : (result !is null ? new NSXMLNode(result) : null); } + + NSString description () + { + return invokeObjcSelf!(NSString, "description"); + } + + NSString XMLString () + { + return invokeObjcSelf!(NSString, "XMLString"); + } + + NSString XMLStringWithOptions (NSUInteger options) + { + return invokeObjcSelf!(NSString, "XMLStringWithOptions:", NSUInteger)(options); + } + + NSString canonicalXMLStringPreservingComments (bool comments) + { + return invokeObjcSelf!(NSString, "canonicalXMLStringPreservingComments:", bool)(comments); + } + + NSArray nodesForXPath (NSString xpath, NSError** error) + { + return invokeObjcSelf!(NSArray, "nodesForXPath:error:", NSString, NSError**)(xpath, error); + } + + NSArray objectsForXQuery (NSString xquery, NSDictionary constants, NSError** error) + { + return invokeObjcSelf!(NSArray, "objectsForXQuery:constants:error:", NSString, NSDictionary, NSError**)(xquery, constants, error); + } + + NSArray objectsForXQuery (NSString xquery, NSError** error) + { + return invokeObjcSelf!(NSArray, "objectsForXQuery:error:", NSString, NSError**)(xquery, error); + } + + Object copyWithZone (NSZone* zone) + { + return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLNodeOptions.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLNodeOptions.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,50 @@ +/** + * 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.NSXMLNodeOptions; + +import dstep.foundation.NSObjCRuntime; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +enum +{ + NSXMLNodeOptionsNone = 0, + NSXMLNodeIsCDATA = 1 << 0, + NSXMLNodeExpandEmptyElement = 1 << 1, + NSXMLNodeCompactEmptyElement = 1 << 2, + NSXMLNodeUseSingleQuotes = 1 << 3, + NSXMLNodeUseDoubleQuotes = 1 << 4, + NSXMLDocumentTidyHTML = 1 << 9, + NSXMLDocumentTidyXML = 1 << 10, + NSXMLDocumentValidate = 1 << 13, + NSXMLDocumentXInclude = 1 << 16, + NSXMLNodePrettyPrint = 1 << 17, + NSXMLDocumentIncludeContentTypeDeclaration = 1 << 18, + NSXMLNodePreserveNamespaceOrder = 1 << 20, + NSXMLNodePreserveAttributeOrder = 1 << 21, + NSXMLNodePreserveEntities = 1 << 22, + NSXMLNodePreservePrefixes = 1 << 23, + NSXMLNodePreserveCDATA = 1 << 24, + NSXMLNodePreserveWhitespace = 1 << 25, + NSXMLNodePreserveDTD = 1 << 26, + NSXMLNodePreserveCharacterReferences = 1 << 27, + NSXMLNodePreserveEmptyElements = (NSXMLNodeExpandEmptyElement | NSXMLNodeCompactEmptyElement), + NSXMLNodePreserveQuotes = (NSXMLNodeUseSingleQuotes | NSXMLNodeUseDoubleQuotes), + NSXMLNodePreserveAll = ( + NSXMLNodePreserveNamespaceOrder | + NSXMLNodePreserveAttributeOrder | + NSXMLNodePreserveEntities | + NSXMLNodePreservePrefixes | + NSXMLNodePreserveCDATA | + NSXMLNodePreserveEmptyElements | + NSXMLNodePreserveQuotes | + NSXMLNodePreserveWhitespace | + NSXMLNodePreserveDTD | + NSXMLNodePreserveCharacterReferences | + 0xFFF00000) +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLParser.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLParser.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,265 @@ +/** + * 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.NSXMLParser; + +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSXMLParser_bindings; + +alias NSInteger NSXMLParserError; + +const NSString NSXMLParserErrorDomain; + +enum +{ + NSXMLParserInternalError = 1, + NSXMLParserOutOfMemoryError = 2, + NSXMLParserDocumentStartError = 3, + NSXMLParserEmptyDocumentError = 4, + NSXMLParserPrematureDocumentEndError = 5, + NSXMLParserInvalidHexCharacterRefError = 6, + NSXMLParserInvalidDecimalCharacterRefError = 7, + NSXMLParserInvalidCharacterRefError = 8, + NSXMLParserInvalidCharacterError = 9, + NSXMLParserCharacterRefAtEOFError = 10, + NSXMLParserCharacterRefInPrologError = 11, + NSXMLParserCharacterRefInEpilogError = 12, + NSXMLParserCharacterRefInDTDError = 13, + NSXMLParserEntityRefAtEOFError = 14, + NSXMLParserEntityRefInPrologError = 15, + NSXMLParserEntityRefInEpilogError = 16, + NSXMLParserEntityRefInDTDError = 17, + NSXMLParserParsedEntityRefAtEOFError = 18, + NSXMLParserParsedEntityRefInPrologError = 19, + NSXMLParserParsedEntityRefInEpilogError = 20, + NSXMLParserParsedEntityRefInInternalSubsetError = 21, + NSXMLParserEntityReferenceWithoutNameError = 22, + NSXMLParserEntityReferenceMissingSemiError = 23, + NSXMLParserParsedEntityRefNoNameError = 24, + NSXMLParserParsedEntityRefMissingSemiError = 25, + NSXMLParserUndeclaredEntityError = 26, + NSXMLParserUnparsedEntityError = 28, + NSXMLParserEntityIsExternalError = 29, + NSXMLParserEntityIsParameterError = 30, + NSXMLParserUnknownEncodingError = 31, + NSXMLParserEncodingNotSupportedError = 32, + NSXMLParserStringNotStartedError = 33, + NSXMLParserStringNotClosedError = 34, + NSXMLParserNamespaceDeclarationError = 35, + NSXMLParserEntityNotStartedError = 36, + NSXMLParserEntityNotFinishedError = 37, + NSXMLParserLessThanSymbolInAttributeError = 38, + NSXMLParserAttributeNotStartedError = 39, + NSXMLParserAttributeNotFinishedError = 40, + NSXMLParserAttributeHasNoValueError = 41, + NSXMLParserAttributeRedefinedError = 42, + NSXMLParserLiteralNotStartedError = 43, + NSXMLParserLiteralNotFinishedError = 44, + NSXMLParserCommentNotFinishedError = 45, + NSXMLParserProcessingInstructionNotStartedError = 46, + NSXMLParserProcessingInstructionNotFinishedError = 47, + NSXMLParserNotationNotStartedError = 48, + NSXMLParserNotationNotFinishedError = 49, + NSXMLParserAttributeListNotStartedError = 50, + NSXMLParserAttributeListNotFinishedError = 51, + NSXMLParserMixedContentDeclNotStartedError = 52, + NSXMLParserMixedContentDeclNotFinishedError = 53, + NSXMLParserElementContentDeclNotStartedError = 54, + NSXMLParserElementContentDeclNotFinishedError = 55, + NSXMLParserXMLDeclNotStartedError = 56, + NSXMLParserXMLDeclNotFinishedError = 57, + NSXMLParserConditionalSectionNotStartedError = 58, + NSXMLParserConditionalSectionNotFinishedError = 59, + NSXMLParserExternalSubsetNotFinishedError = 60, + NSXMLParserDOCTYPEDeclNotFinishedError = 61, + NSXMLParserMisplacedCDATAEndStringError = 62, + NSXMLParserCDATANotFinishedError = 63, + NSXMLParserMisplacedXMLDeclarationError = 64, + NSXMLParserSpaceRequiredError = 65, + NSXMLParserSeparatorRequiredError = 66, + NSXMLParserNMTOKENRequiredError = 67, + NSXMLParserNAMERequiredError = 68, + NSXMLParserPCDATARequiredError = 69, + NSXMLParserURIRequiredError = 70, + NSXMLParserPublicIdentifierRequiredError = 71, + NSXMLParserLTRequiredError = 72, + NSXMLParserGTRequiredError = 73, + NSXMLParserLTSlashRequiredError = 74, + NSXMLParserEqualExpectedError = 75, + NSXMLParserTagNameMismatchError = 76, + NSXMLParserUnfinishedTagError = 77, + NSXMLParserStandaloneValueError = 78, + NSXMLParserInvalidEncodingNameError = 79, + NSXMLParserCommentContainsDoubleHyphenError = 80, + NSXMLParserInvalidEncodingError = 81, + NSXMLParserExternalStandaloneEntityError = 82, + NSXMLParserInvalidConditionalSectionError = 83, + NSXMLParserEntityValueRequiredError = 84, + NSXMLParserNotWellBalancedError = 85, + NSXMLParserExtraContentError = 86, + NSXMLParserInvalidCharacterInEntityError = 87, + NSXMLParserParsedEntityRefInInternalError = 88, + NSXMLParserEntityRefLoopError = 89, + NSXMLParserEntityBoundaryError = 90, + NSXMLParserInvalidURIError = 91, + NSXMLParserURIFragmentError = 92, + NSXMLParserNoDTDError = 94, + NSXMLParserDelegateAbortedParseError = 512 +} + +static this () +{ + NSXMLParserErrorDomain = new NSString(bindings.NSXMLParserErrorDomain); +} + +class NSXMLParser : NSObject +{ + mixin ObjcWrap; + mixin TNSXMLParserLocatorAdditions; + + Object initWithContentsOfURL (NSURL url) + { + return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); + } + + this (NSURL url) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object initWithData (NSData data) + { + return invokeObjcSelf!(Object, "initWithData:", NSData)(data); + } + + this (NSData data) + { + objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); + id result = Bridge.invokeObjcMethod!(id, "initWithData:", NSData)(objcObject, data); + + if (result) + objcObject = ret; + + dObject = this; + } + + Object delegate_ () + { + return invokeObjcSelf!(Object, "delegate"); + } + + void setDelegate (Object delegate_) + { + return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); + } + + void setShouldProcessNamespaces (bool shouldProcessNamespaces) + { + return invokeObjcSelf!(void, "setShouldProcessNamespaces:", bool)(shouldProcessNamespaces); + } + + void setShouldReportNamespacePrefixes (bool shouldReportNamespacePrefixes) + { + return invokeObjcSelf!(void, "setShouldReportNamespacePrefixes:", bool)(shouldReportNamespacePrefixes); + } + + void setShouldResolveExternalEntities (bool shouldResolveExternalEntities) + { + return invokeObjcSelf!(void, "setShouldResolveExternalEntities:", bool)(shouldResolveExternalEntities); + } + + bool shouldProcessNamespaces () + { + return invokeObjcSelf!(bool, "shouldProcessNamespaces"); + } + + bool shouldReportNamespacePrefixes () + { + return invokeObjcSelf!(bool, "shouldReportNamespacePrefixes"); + } + + bool shouldResolveExternalEntities () + { + return invokeObjcSelf!(bool, "shouldResolveExternalEntities"); + } + + bool parse () + { + return invokeObjcSelf!(bool, "parse"); + } + + void abortParsing () + { + return invokeObjcSelf!(void, "abortParsing"); + } + + NSError parserError () + { + return invokeObjcSelf!(NSError, "parserError"); + } +} + +template TNSXMLParserDelegateEventAdditions () +{ + void parserDidStartDocument (NSXMLParser parser); + void parserDidEndDocument (NSXMLParser parser); + void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID); + void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID, NSString notationName); + void parser (NSXMLParser parser, NSString attributeName, NSString elementName, NSString type, NSString defaultValue); + void parser (NSXMLParser parser, NSString elementName, NSString model); + void parser (NSXMLParser parser, NSString name, NSString value); + void parser (NSXMLParser parser, NSString name, NSString publicID, NSString systemID); + void parser (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName, NSDictionary attributeDict); + void parser (NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qName); + void parser (NSXMLParser parser, NSString prefix, NSString namespaceURI); + void parser (NSXMLParser parser, NSString prefix); + void parser (NSXMLParser parser, NSString string); + void parser (NSXMLParser parser, NSString whitespaceString); + void parser (NSXMLParser parser, NSString target, NSString data); + void parser (NSXMLParser parser, NSString comment); + void parser (NSXMLParser parser, NSData CDATABlock); + NSData parser (NSXMLParser parser, NSString name, NSString systemID); + void parser (NSXMLParser parser, NSError parseError); + void parser (NSXMLParser parser, NSError validationError); +} + +template TNSXMLParserLocatorAdditions () +{ + NSString publicID () + { + return invokeObjcSelf!(NSString, "publicID"); + } + + NSString systemID () + { + return invokeObjcSelf!(NSString, "systemID"); + } + + NSInteger lineNumber () + { + return invokeObjcSelf!(NSInteger, "lineNumber"); + } + + NSInteger columnNumber () + { + return invokeObjcSelf!(NSInteger, "columnNumber"); + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSXMLParser_bindings.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSXMLParser_bindings.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,20 @@ +module dstep.foundation.NSXMLParser_bindings; + +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + + +extern (C) +{ + extern + { + package const id NSXMLParserErrorDomain; + } +} + diff -r 4f583f7e242e -r 89f3c3ef1fd2 dstep/foundation/NSZone.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSZone.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,53 @@ +/** + * 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.NSZone; + +import dstep.corefoundation.CFBase; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +alias _NSZone NSZone; + +enum +{ + NSScannedOption = (1<<0), + NSCollectorDisabledOption = (1<<1) +} + +void NSSetZoneName (NSZone* zone, NSString name) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSSetZoneName, NSZone*, NSString)(zone, name); +} + +NSString NSZoneName (NSZone* zone) +{ + return Bridge.invokeObjcFunction!(NSString, bindings.NSZoneName, NSZone*)(zone); +} + +extern (C) +{ + NSZone* NSDefaultMallocZone (); + NSZone* NSCreateZone (NSUInteger startSize, NSUInteger granularity, bool canFree); + void NSRecycleZone (NSZone* zone); + NSZone* NSZoneFromPointer (void* ptr); + void* NSZoneMalloc (NSZone* zone, NSUInteger size); + void* NSZoneCalloc (NSZone* zone, NSUInteger numElems, NSUInteger byteSize); + void* NSZoneRealloc (NSZone* zone, void* ptr, NSUInteger size); + void NSZoneFree (NSZone* zone, void* ptr); + void* NSAllocateCollectable (NSUInteger size, NSUInteger options); + void* NSReallocateCollectable (void* ptr, NSUInteger size, NSUInteger options); + NSUInteger NSPageSize (); + NSUInteger NSLogPageSize (); + NSUInteger NSRoundUpToMultipleOfPageSize (NSUInteger bytes); + NSUInteger NSRoundDownToMultipleOfPageSize (NSUInteger bytes); + void* NSAllocateMemoryPages (NSUInteger bytes); + void NSDeallocateMemoryPages (void* ptr, NSUInteger bytes); + void NSCopyMemoryPages (void* source, void* dest, NSUInteger bytes); + NSUInteger NSRealMemoryAvailable (); +} \ No newline at end of file