Mercurial > projects > dstep
diff dstep/foundation/NSAppleEventDescriptor.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 7ff919f595d5 |
line wrap: on
line diff
--- /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); + } +} +