Mercurial > projects > dstep
view 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 |
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; import bindings = dstep.foundation.NSTask_bindings; private NSString NSTaskDidTerminateNotification_; NSString NSTaskDidTerminateNotification () { if (NSTaskDidTerminateNotification_) return NSTaskDidTerminateNotification_; return NSTaskDidTerminateNotification_ = new NSString(bindings.NSTaskDidTerminateNotification); } const TNSTaskConveniences = ` static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) { return invokeObjcSuperClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); } void waitUntilExit () { return invokeObjcSelf!(void, "waitUntilExit"); } `; class NSTask : NSObject { mixin (ObjcWrap); this () { super(typeof(this).alloc.init.objcObject); } typeof(this) init () { return invokeObjcSelf!(typeof(this), "init"); } 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"); } // TNSTaskConveniences static NSTask launchedTaskWithLaunchPath (NSString path, NSArray arguments) { return invokeObjcSuperClass!(NSTask, "launchedTaskWithLaunchPath:arguments:", NSString, NSArray)(path, arguments); } void waitUntilExit () { return invokeObjcSelf!(void, "waitUntilExit"); } }