view dstep/foundation/NSScriptCommand.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 7ff919f595d5
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.NSScriptCommand;

import dstep.foundation.NSAppleEventDescriptor;
import dstep.foundation.NSCoder;
import dstep.foundation.NSDictionary;
import dstep.foundation.NSObject;
import dstep.foundation.NSScriptCommandDescription;
import dstep.foundation.NSScriptObjectSpecifiers;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

enum
{
	NSNoScriptError = 0,
	NSReceiverEvaluationScriptError,
	NSKeySpecifierEvaluationScriptError,
	NSArgumentEvaluationScriptError,
	NSReceiversCantHandleCommandScriptError,
	NSRequiredArgumentsMissingScriptError,
	NSArgumentsWrongScriptError,
	NSUnknownKeyScriptError,
	NSInternalScriptError,
	NSOperationNotSupportedForKeyScriptError,
	NSCannotCreateScriptCommandError
}

class NSScriptCommand : NSObject, INSCoding
{
	mixin (ObjcWrap);
	
	this ()
	{
		super(typeof(this).alloc.init.objcObject);
	}
	
	typeof(this) init ()
	{
		return invokeObjcSelf!(typeof(this), "init");
	}

	Object initWithCommandDescription (NSScriptCommandDescription commandDef)
	{
		return invokeObjcSelf!(Object, "initWithCommandDescription:", NSScriptCommandDescription)(commandDef);
	}

	this (NSScriptCommandDescription commandDef)
	{
		typeof(this).alloc.initWithCommandDescription(commandDef);
	}

	NSScriptCommandDescription commandDescription ()
	{
		return invokeObjcSelf!(NSScriptCommandDescription, "commandDescription");
	}

	void setDirectParameter (Object directParameter)
	{
		return invokeObjcSelf!(void, "setDirectParameter:", Object)(directParameter);
	}

	Object directParameter ()
	{
		return invokeObjcSelf!(Object, "directParameter");
	}

	void setReceiversSpecifier (NSScriptObjectSpecifier receiversRef)
	{
		return invokeObjcSelf!(void, "setReceiversSpecifier:", NSScriptObjectSpecifier)(receiversRef);
	}

	NSScriptObjectSpecifier receiversSpecifier ()
	{
		return invokeObjcSelf!(NSScriptObjectSpecifier, "receiversSpecifier");
	}

	Object evaluatedReceivers ()
	{
		return invokeObjcSelf!(Object, "evaluatedReceivers");
	}

	void setArguments (NSDictionary args)
	{
		return invokeObjcSelf!(void, "setArguments:", NSDictionary)(args);
	}

	NSDictionary arguments ()
	{
		return invokeObjcSelf!(NSDictionary, "arguments");
	}

	NSDictionary evaluatedArguments ()
	{
		return invokeObjcSelf!(NSDictionary, "evaluatedArguments");
	}

	bool isWellFormed ()
	{
		return invokeObjcSelf!(bool, "isWellFormed");
	}

	Object performDefaultImplementation ()
	{
		return invokeObjcSelf!(Object, "performDefaultImplementation");
	}

	Object executeCommand ()
	{
		return invokeObjcSelf!(Object, "executeCommand");
	}

	void setScriptErrorNumber (int errorNumber)
	{
		return invokeObjcSelf!(void, "setScriptErrorNumber:", int)(errorNumber);
	}

	void setScriptErrorOffendingObjectDescriptor (NSAppleEventDescriptor errorOffendingObjectDescriptor)
	{
		return invokeObjcSelf!(void, "setScriptErrorOffendingObjectDescriptor:", NSAppleEventDescriptor)(errorOffendingObjectDescriptor);
	}

	void setScriptErrorExpectedTypeDescriptor (NSAppleEventDescriptor errorExpectedTypeDescriptor)
	{
		return invokeObjcSelf!(void, "setScriptErrorExpectedTypeDescriptor:", NSAppleEventDescriptor)(errorExpectedTypeDescriptor);
	}

	void setScriptErrorString (NSString errorString)
	{
		return invokeObjcSelf!(void, "setScriptErrorString:", NSString)(errorString);
	}

	int scriptErrorNumber ()
	{
		return invokeObjcSelf!(int, "scriptErrorNumber");
	}

	NSAppleEventDescriptor scriptErrorOffendingObjectDescriptor ()
	{
		return invokeObjcSelf!(NSAppleEventDescriptor, "scriptErrorOffendingObjectDescriptor");
	}

	NSAppleEventDescriptor scriptErrorExpectedTypeDescriptor ()
	{
		return invokeObjcSelf!(NSAppleEventDescriptor, "scriptErrorExpectedTypeDescriptor");
	}

	NSString scriptErrorString ()
	{
		return invokeObjcSelf!(NSString, "scriptErrorString");
	}

	static NSScriptCommand currentCommand ()
	{
		return invokeObjcSuperClass!(NSScriptCommand, "currentCommand");
	}

	NSAppleEventDescriptor appleEvent ()
	{
		return invokeObjcSelf!(NSAppleEventDescriptor, "appleEvent");
	}

	void suspendExecution ()
	{
		return invokeObjcSelf!(void, "suspendExecution");
	}

	void resumeExecutionWithResult (Object result)
	{
		return invokeObjcSelf!(void, "resumeExecutionWithResult:", Object)(result);
	}

	void encodeWithCoder (NSCoder aCoder)
	{
		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
	}

	Object initWithCoder (NSCoder aDecoder)
	{
		return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
	}

	this (NSCoder aDecoder)
	{
		typeof(this).alloc.initWithCoder(aDecoder);
	}
}