Mercurial > projects > dstep
annotate dstep/foundation/NSTask.d @ 25:b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 06 Apr 2010 11:37:27 +0200 |
parents | 19885b43130e |
children |
rev | line source |
---|---|
14 | 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.NSTask; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.foundation.NSDictionary; | |
11 import dstep.foundation.NSObject; | |
12 import dstep.foundation.NSString; | |
13 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
14 import dstep.objc.objc; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
15 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
16 |
14 | 17 |
18 import bindings = dstep.foundation.NSTask_bindings; | |
19 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 private NSString NSTaskDidTerminateNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 NSString NSTaskDidTerminateNotification () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 if (NSTaskDidTerminateNotification_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 return NSTaskDidTerminateNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 return NSTaskDidTerminateNotification_ = new NSString(bindings.NSTaskDidTerminateNotification); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 } |
14 | 29 |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
30 const TNSTaskConveniences = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
32 static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
33 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
34 return invokeObjcSuperClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
35 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
36 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
37 void waitUntilExit () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
38 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
39 return invokeObjcSelf!(void, "waitUntilExit"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
40 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
41 `; |
14 | 42 |
43 class NSTask : NSObject | |
44 { | |
25
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
45 mixin ObjcWrap; |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
46 |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
47 this (id object) |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
48 { |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
49 super(object); |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
50 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
51 |
14 | 52 this () |
53 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
54 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
55 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
56 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
57 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
58 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
59 return invokeObjcSelf!(typeof(this), "init"); |
14 | 60 } |
61 | |
62 void setLaunchPath (NSString path) | |
63 { | |
64 return invokeObjcSelf!(void, "setLaunchPath:", NSString)(path); | |
65 } | |
66 | |
67 void setArguments (NSArray arguments) | |
68 { | |
69 return invokeObjcSelf!(void, "setArguments:", NSArray)(arguments); | |
70 } | |
71 | |
72 void setEnvironment (NSDictionary dict) | |
73 { | |
74 return invokeObjcSelf!(void, "setEnvironment:", NSDictionary)(dict); | |
75 } | |
76 | |
77 void setCurrentDirectoryPath (NSString path) | |
78 { | |
79 return invokeObjcSelf!(void, "setCurrentDirectoryPath:", NSString)(path); | |
80 } | |
81 | |
82 void setStandardInput (Object input) | |
83 { | |
84 return invokeObjcSelf!(void, "setStandardInput:", Object)(input); | |
85 } | |
86 | |
87 void setStandardOutput (Object output) | |
88 { | |
89 return invokeObjcSelf!(void, "setStandardOutput:", Object)(output); | |
90 } | |
91 | |
92 void setStandardError (Object error) | |
93 { | |
94 return invokeObjcSelf!(void, "setStandardError:", Object)(error); | |
95 } | |
96 | |
97 NSString launchPath () | |
98 { | |
99 return invokeObjcSelf!(NSString, "launchPath"); | |
100 } | |
101 | |
102 NSArray arguments () | |
103 { | |
104 return invokeObjcSelf!(NSArray, "arguments"); | |
105 } | |
106 | |
107 NSDictionary environment () | |
108 { | |
109 return invokeObjcSelf!(NSDictionary, "environment"); | |
110 } | |
111 | |
112 NSString currentDirectoryPath () | |
113 { | |
114 return invokeObjcSelf!(NSString, "currentDirectoryPath"); | |
115 } | |
116 | |
117 Object standardInput () | |
118 { | |
119 return invokeObjcSelf!(Object, "standardInput"); | |
120 } | |
121 | |
122 Object standardOutput () | |
123 { | |
124 return invokeObjcSelf!(Object, "standardOutput"); | |
125 } | |
126 | |
127 Object standardError () | |
128 { | |
129 return invokeObjcSelf!(Object, "standardError"); | |
130 } | |
131 | |
132 void launch () | |
133 { | |
134 return invokeObjcSelf!(void, "launch"); | |
135 } | |
136 | |
137 void interrupt () | |
138 { | |
139 return invokeObjcSelf!(void, "interrupt"); | |
140 } | |
141 | |
142 void terminate () | |
143 { | |
144 return invokeObjcSelf!(void, "terminate"); | |
145 } | |
146 | |
147 bool suspend () | |
148 { | |
149 return invokeObjcSelf!(bool, "suspend"); | |
150 } | |
151 | |
152 bool resume () | |
153 { | |
154 return invokeObjcSelf!(bool, "resume"); | |
155 } | |
156 | |
157 int processIdentifier () | |
158 { | |
159 return invokeObjcSelf!(int, "processIdentifier"); | |
160 } | |
161 | |
162 bool isRunning () | |
163 { | |
164 return invokeObjcSelf!(bool, "isRunning"); | |
165 } | |
166 | |
167 int terminationStatus () | |
168 { | |
169 return invokeObjcSelf!(int, "terminationStatus"); | |
170 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
171 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
172 // TNSTaskConveniences |
14 | 173 static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) |
174 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
175 return invokeObjcSuperClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); |
14 | 176 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
177 |
14 | 178 void waitUntilExit () |
179 { | |
180 return invokeObjcSelf!(void, "waitUntilExit"); | |
181 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
182 } |