Mercurial > projects > dstep
diff dstep/foundation/NSScriptClassDescription.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/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 (); +} +