Mercurial > projects > dstep
annotate dstep/foundation/NSTask.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 89f3c3ef1fd2 |
children | b9de51448c6b |
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 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
45 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
46 |
14 | 47 this () |
48 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
49 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
50 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
51 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
52 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
53 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
54 return invokeObjcSelf!(typeof(this), "init"); |
14 | 55 } |
56 | |
57 void setLaunchPath (NSString path) | |
58 { | |
59 return invokeObjcSelf!(void, "setLaunchPath:", NSString)(path); | |
60 } | |
61 | |
62 void setArguments (NSArray arguments) | |
63 { | |
64 return invokeObjcSelf!(void, "setArguments:", NSArray)(arguments); | |
65 } | |
66 | |
67 void setEnvironment (NSDictionary dict) | |
68 { | |
69 return invokeObjcSelf!(void, "setEnvironment:", NSDictionary)(dict); | |
70 } | |
71 | |
72 void setCurrentDirectoryPath (NSString path) | |
73 { | |
74 return invokeObjcSelf!(void, "setCurrentDirectoryPath:", NSString)(path); | |
75 } | |
76 | |
77 void setStandardInput (Object input) | |
78 { | |
79 return invokeObjcSelf!(void, "setStandardInput:", Object)(input); | |
80 } | |
81 | |
82 void setStandardOutput (Object output) | |
83 { | |
84 return invokeObjcSelf!(void, "setStandardOutput:", Object)(output); | |
85 } | |
86 | |
87 void setStandardError (Object error) | |
88 { | |
89 return invokeObjcSelf!(void, "setStandardError:", Object)(error); | |
90 } | |
91 | |
92 NSString launchPath () | |
93 { | |
94 return invokeObjcSelf!(NSString, "launchPath"); | |
95 } | |
96 | |
97 NSArray arguments () | |
98 { | |
99 return invokeObjcSelf!(NSArray, "arguments"); | |
100 } | |
101 | |
102 NSDictionary environment () | |
103 { | |
104 return invokeObjcSelf!(NSDictionary, "environment"); | |
105 } | |
106 | |
107 NSString currentDirectoryPath () | |
108 { | |
109 return invokeObjcSelf!(NSString, "currentDirectoryPath"); | |
110 } | |
111 | |
112 Object standardInput () | |
113 { | |
114 return invokeObjcSelf!(Object, "standardInput"); | |
115 } | |
116 | |
117 Object standardOutput () | |
118 { | |
119 return invokeObjcSelf!(Object, "standardOutput"); | |
120 } | |
121 | |
122 Object standardError () | |
123 { | |
124 return invokeObjcSelf!(Object, "standardError"); | |
125 } | |
126 | |
127 void launch () | |
128 { | |
129 return invokeObjcSelf!(void, "launch"); | |
130 } | |
131 | |
132 void interrupt () | |
133 { | |
134 return invokeObjcSelf!(void, "interrupt"); | |
135 } | |
136 | |
137 void terminate () | |
138 { | |
139 return invokeObjcSelf!(void, "terminate"); | |
140 } | |
141 | |
142 bool suspend () | |
143 { | |
144 return invokeObjcSelf!(bool, "suspend"); | |
145 } | |
146 | |
147 bool resume () | |
148 { | |
149 return invokeObjcSelf!(bool, "resume"); | |
150 } | |
151 | |
152 int processIdentifier () | |
153 { | |
154 return invokeObjcSelf!(int, "processIdentifier"); | |
155 } | |
156 | |
157 bool isRunning () | |
158 { | |
159 return invokeObjcSelf!(bool, "isRunning"); | |
160 } | |
161 | |
162 int terminationStatus () | |
163 { | |
164 return invokeObjcSelf!(int, "terminationStatus"); | |
165 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
166 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
167 // TNSTaskConveniences |
14 | 168 static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) |
169 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
170 return invokeObjcSuperClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); |
14 | 171 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
172 |
14 | 173 void waitUntilExit () |
174 { | |
175 return invokeObjcSelf!(void, "waitUntilExit"); | |
176 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
177 } |