Mercurial > projects > dstep
view dstep/foundation/NSTask.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 |
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.NSTask; import dstep.foundation.NSArray; import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; import dstep.objc.objc : id; import bindings = dstep.foundation.NSTask_bindings; const NSString NSTaskDidTerminateNotification; static this () { NSTaskDidTerminateNotification = new NSString(bindings.NSTaskDidTerminateNotification); } class NSTask : NSObject { mixin ObjcWrap; mixin TNSTaskConveniences; Object init () { return invokeObjcSelf!(Object, "init"); } this () { objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); if (result) objcObject = ret; dObject = this; } void setLaunchPath (NSString path) { return invokeObjcSelf!(void, "setLaunchPath:", NSString)(path); } void setArguments (NSArray arguments) { return invokeObjcSelf!(void, "setArguments:", NSArray)(arguments); } void setEnvironment (NSDictionary dict) { return invokeObjcSelf!(void, "setEnvironment:", NSDictionary)(dict); } void setCurrentDirectoryPath (NSString path) { return invokeObjcSelf!(void, "setCurrentDirectoryPath:", NSString)(path); } void setStandardInput (Object input) { return invokeObjcSelf!(void, "setStandardInput:", Object)(input); } void setStandardOutput (Object output) { return invokeObjcSelf!(void, "setStandardOutput:", Object)(output); } void setStandardError (Object error) { return invokeObjcSelf!(void, "setStandardError:", Object)(error); } NSString launchPath () { return invokeObjcSelf!(NSString, "launchPath"); } NSArray arguments () { return invokeObjcSelf!(NSArray, "arguments"); } NSDictionary environment () { return invokeObjcSelf!(NSDictionary, "environment"); } NSString currentDirectoryPath () { return invokeObjcSelf!(NSString, "currentDirectoryPath"); } Object standardInput () { return invokeObjcSelf!(Object, "standardInput"); } Object standardOutput () { return invokeObjcSelf!(Object, "standardOutput"); } Object standardError () { return invokeObjcSelf!(Object, "standardError"); } void launch () { return invokeObjcSelf!(void, "launch"); } void interrupt () { return invokeObjcSelf!(void, "interrupt"); } void terminate () { return invokeObjcSelf!(void, "terminate"); } bool suspend () { return invokeObjcSelf!(bool, "suspend"); } bool resume () { return invokeObjcSelf!(bool, "resume"); } int processIdentifier () { return invokeObjcSelf!(int, "processIdentifier"); } bool isRunning () { return invokeObjcSelf!(bool, "isRunning"); } int terminationStatus () { return invokeObjcSelf!(int, "terminationStatus"); } } template TNSTaskConveniences () { static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) { return invokeObjcSelfClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); } void waitUntilExit () { return invokeObjcSelf!(void, "waitUntilExit"); } }