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

import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;



import bindings = dstep.foundation.NSScriptKeyValueCoding_bindings;

private NSString NSOperationNotSupportedForKeyException_;

NSString NSOperationNotSupportedForKeyException ()
{
	if (NSOperationNotSupportedForKeyException_)
		return NSOperationNotSupportedForKeyException_;
	
	return NSOperationNotSupportedForKeyException_ = new NSString(bindings.NSOperationNotSupportedForKeyException);
}

const TNSScriptKeyValueCoding = `

	Object valueAtIndex (NSUInteger index, NSString key)
	{
		return invokeObjcSelf!(Object, "valueAtIndex:inPropertyWithKey:", NSUInteger, NSString)(index, key);
	}
	
	Object valueWithName (NSString name, NSString key)
	{
		return invokeObjcSelf!(Object, "valueWithName:inPropertyWithKey:", NSString, NSString)(name, key);
	}
	
	Object valueWithUniqueID (Object uniqueID, NSString key)
	{
		return invokeObjcSelf!(Object, "valueWithUniqueID:inPropertyWithKey:", Object, NSString)(uniqueID, key);
	}
	
	void insertValue (Object value, NSUInteger index, NSString key)
	{
		return invokeObjcSelf!(void, "insertValue:atIndex:inPropertyWithKey:", Object, NSUInteger, NSString)(value, index, key);
	}
	
	void removeValueAtIndex (NSUInteger index, NSString key)
	{
		return invokeObjcSelf!(void, "removeValueAtIndex:fromPropertyWithKey:", NSUInteger, NSString)(index, key);
	}
	
	void replaceValueAtIndex (NSUInteger index, NSString key, Object value)
	{
		return invokeObjcSelf!(void, "replaceValueAtIndex:inPropertyWithKey:withValue:", NSUInteger, NSString, Object)(index, key, value);
	}
	
	void insertValue (Object value, NSString key)
	{
		return invokeObjcSelf!(void, "insertValue:inPropertyWithKey:", Object, NSString)(value, key);
	}
	
	Object coerceValue (Object value, NSString key)
	{
		return invokeObjcSelf!(Object, "coerceValue:forKey:", Object, NSString)(value, key);
	}
	
	//mixin ObjcBindMethod!(valueAtIndex, "valueAtIndex:inPropertyWithKey:");
	//mixin ObjcBindMethod!(valueWithName, "valueWithName:inPropertyWithKey:");
	//mixin ObjcBindMethod!(valueWithUniqueID, "valueWithUniqueID:inPropertyWithKey:");
	//mixin ObjcBindMethod!(insertValue, "insertValue:atIndex:inPropertyWithKey:");
	//mixin ObjcBindMethod!(removeValueAtIndex, "removeValueAtIndex:fromPropertyWithKey:");
	//mixin ObjcBindMethod!(replaceValueAtIndex, "replaceValueAtIndex:inPropertyWithKey:withValue:");
	//mixin ObjcBindMethod!(insertValue, "insertValue:inPropertyWithKey:");
	//mixin ObjcBindMethod!(coerceValue, "coerceValue:forKey:");
`;