Mercurial > projects > dstep
view dstep/foundation/NSAppleEventDescriptor.d @ 15:7ff919f595d5
Added the Foundation framework, again
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:31:48 +0200 |
parents | 89f3c3ef1fd2 |
children | 19885b43130e |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Aug 3, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.foundation.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"); } static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, void* bytes, NSUInteger byteCount) { return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(descriptorType, bytes, byteCount); } static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, NSData data) { return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:data:", uint, NSData)(descriptorType, data); } static NSAppleEventDescriptor descriptorWithBoolean (ubyte boolean) { return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithBoolean:", ubyte)(boolean); } static NSAppleEventDescriptor descriptorWithEnumCode (uint enumerator) { return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithEnumCode:", uint)(enumerator); } static NSAppleEventDescriptor descriptorWithInt32 (int signedInt) { return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithInt32:", int)(signedInt); } static NSAppleEventDescriptor descriptorWithTypeCode (uint typeCode) { return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithTypeCode:", uint)(typeCode); } static NSAppleEventDescriptor descriptorWithString (NSString string) { return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithString:", NSString)(string); } 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, transactionID); } static NSAppleEventDescriptor listDescriptor () { return invokeObjcSelfClass!(NSAppleEventDescriptor, "listDescriptor"); } static NSAppleEventDescriptor recordDescriptor () { return invokeObjcSelfClass!(NSAppleEventDescriptor, "recordDescriptor"); } 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)(keyword); return 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)(keyword); return 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)(index); return 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)(keyword); return 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)(descriptorType); return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); } Object copyWithZone (NSZone* zone) { return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); } }