comparison dstep/foundation/NSScriptCommandDescription.d @ 14:89f3c3ef1fd2

Added the Foundation framework
author Jacob Carlborg <doob@me.com>
date Mon, 03 Aug 2009 15:23:15 +0200
parents
children 19885b43130e
comparison
equal deleted inserted replaced
13:4f583f7e242e 14:89f3c3ef1fd2
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Aug 3, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.foundation.NSScriptCommandDescription;
8
9 import dstep.foundation.NSArray;
10 import dstep.foundation.NSDictionary;
11 import dstep.foundation.NSObject;
12 import dstep.foundation.NSScriptCommand;
13 import dstep.foundation.NSString;
14 import dstep.objc.bridge.Bridge;
15 import dstep.objc.objc : id;
16
17 class NSScriptCommandDescription : NSObject, INSCoding
18 {
19 mixin ObjcWrap;
20
21 Object initWithSuiteName (NSString suiteName, NSString commandName, NSDictionary commandDeclaration)
22 {
23 return invokeObjcSelf!(Object, "initWithSuiteName:commandName:dictionary:", NSString, NSString, NSDictionary)(suiteName, commandName, commandDeclaration);
24 }
25
26 this (NSString suiteName, NSString commandName, NSDictionary commandDeclaration)
27 {
28 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
29 id result = Bridge.invokeObjcMethod!(id, "initWithSuiteName:commandName:dictionary:", NSString, NSString, NSDictionary)(objcObject, suiteName, commandName, commandDeclaration);
30
31 if (result)
32 objcObject = ret;
33
34 dObject = this;
35 }
36
37 NSString suiteName ()
38 {
39 return invokeObjcSelf!(NSString, "suiteName");
40 }
41
42 NSString commandName ()
43 {
44 return invokeObjcSelf!(NSString, "commandName");
45 }
46
47 uint appleEventClassCode ()
48 {
49 return invokeObjcSelf!(uint, "appleEventClassCode");
50 }
51
52 uint appleEventCode ()
53 {
54 return invokeObjcSelf!(uint, "appleEventCode");
55 }
56
57 NSString commandClassName ()
58 {
59 return invokeObjcSelf!(NSString, "commandClassName");
60 }
61
62 NSString returnType ()
63 {
64 return invokeObjcSelf!(NSString, "returnType");
65 }
66
67 uint appleEventCodeForReturnType ()
68 {
69 return invokeObjcSelf!(uint, "appleEventCodeForReturnType");
70 }
71
72 NSArray argumentNames ()
73 {
74 return invokeObjcSelf!(NSArray, "argumentNames");
75 }
76
77 NSString typeForArgumentWithName (NSString argumentName)
78 {
79 return invokeObjcSelf!(NSString, "typeForArgumentWithName:", NSString)(argumentName);
80 }
81
82 uint appleEventCodeForArgumentWithName (NSString argumentName)
83 {
84 return invokeObjcSelf!(uint, "appleEventCodeForArgumentWithName:", NSString)(argumentName);
85 }
86
87 bool isOptionalArgumentWithName (NSString argumentName)
88 {
89 return invokeObjcSelf!(bool, "isOptionalArgumentWithName:", NSString)(argumentName);
90 }
91
92 NSScriptCommand createCommandInstance ()
93 {
94 return invokeObjcSelf!(NSScriptCommand, "createCommandInstance");
95 }
96
97 NSScriptCommand createCommandInstanceWithZone (NSZone* zone)
98 {
99 return invokeObjcSelf!(NSScriptCommand, "createCommandInstanceWithZone:", NSZone*)(zone);
100 }
101
102 void encodeWithCoder (NSCoder aCoder)
103 {
104 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
105 }
106
107 Object initWithCoder (NSCoder aDecoder)
108 {
109 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
110 }
111
112 this (NSCoder aDecoder)
113 {
114 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
115 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder);
116
117 if (result)
118 objcObject = ret;
119
120 dObject = this;
121 }
122 }
123