view dstep/quartzcore/CIVector.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
children b9de51448c6b
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Sep 24, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.quartzcore.CIVector;

import dstep.applicationservices.ApplicationServices;
import dstep.foundation.NSCoder;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.foundation.NSZone;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

class CIVector : NSObject, INSCopying, INSCoding
{
	mixin (ObjcWrap);
	
	this (NSCoder aDecoder)
	{
		super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
	}
	
	void encodeWithCoder (NSCoder aCoder)
	{
		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
	}
	
	typeof(this) initWithCoder (NSCoder aDecoder)
	{
		return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
	}
	
	typeof(this) copyWithZone (NSZone* zone)
	{
		return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
	}

	static CIVector vectorWithValues (CGFloat* values, uint count)
	{
		return invokeObjcSelfClass!(CIVector, "vectorWithValues:count:", CGFloat*, uint)(values, count);
	}

	static CIVector vectorWithX (CGFloat x)
	{
		return invokeObjcSelfClass!(CIVector, "vectorWithX:", CGFloat)(x);
	}

	static CIVector vectorWithX (CGFloat x, CGFloat y)
	{
		return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:", CGFloat, CGFloat)(x, y);
	}

	static CIVector vectorWithX (CGFloat x, CGFloat y, CGFloat z)
	{
		return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:Z:", CGFloat, CGFloat, CGFloat)(x, y, z);
	}

	static CIVector vectorWithX (CGFloat x, CGFloat y, CGFloat z, CGFloat w)
	{
		return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:Z:W:", CGFloat, CGFloat, CGFloat, CGFloat)(x, y, z, w);
	}

	static CIVector vectorWithString (NSString representation)
	{
		return invokeObjcSelfClass!(CIVector, "vectorWithString:", NSString)(representation);
	}

	CIVector initWithValues (CGFloat* values, uint count)
	{
		id result = invokeObjcSelf!(id, "initWithValues:count:", CGFloat*, uint)(values, count);
		return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null);
	}

	this (CGFloat* values, uint count)
	{
		super(CIVector.alloc.initWithValues(values, count).objcObject);
	}

	CIVector initWithX (CGFloat x)
	{
		id result = invokeObjcSelf!(id, "initWithX:", CGFloat)(x);
		return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null);
	}

	this (CGFloat x)
	{
		super(CIVector.alloc.initWithX(x).objcObject);
	}

	CIVector initWithX (CGFloat x, CGFloat y)
	{
		id result = invokeObjcSelf!(id, "initWithX:Y:", CGFloat, CGFloat)(x, y);
		return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null);
	}

	this (CGFloat x, CGFloat y)
	{
		super(CIVector.alloc.initWithX(x, y).objcObject);
	}

	CIVector initWithX (CGFloat x, CGFloat y, CGFloat z)
	{
		id result = invokeObjcSelf!(id, "initWithX:Y:Z:", CGFloat, CGFloat, CGFloat)(x, y, z);
		return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null);
	}

	this (CGFloat x, CGFloat y, CGFloat z)
	{
		super(CIVector.alloc.initWithX(x, y, z).objcObject);
	}

	CIVector initWithX (CGFloat x, CGFloat y, CGFloat z, CGFloat w)
	{
		id result = invokeObjcSelf!(id, "initWithX:Y:Z:W:", CGFloat, CGFloat, CGFloat, CGFloat)(x, y, z, w);
		return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null);
	}

	this (CGFloat x, CGFloat y, CGFloat z, CGFloat w)
	{
		super(CIVector.alloc.initWithX(x, y, z, w).objcObject);
	}

	CIVector initWithString (NSString representation)
	{
		id result = invokeObjcSelf!(id, "initWithString:", NSString)(representation);
		return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null);
	}

	this (NSString representation)
	{
		super(CIVector.alloc.initWithString(representation).objcObject);
	}

	CGFloat valueAtIndex (uint index)
	{
		return invokeObjcSelf!(CGFloat, "valueAtIndex:", uint)(index);
	}

	uint count ()
	{
		return invokeObjcSelf!(uint, "count");
	}

	CGFloat X ()
	{
		return invokeObjcSelf!(CGFloat, "X");
	}

	CGFloat Y ()
	{
		return invokeObjcSelf!(CGFloat, "Y");
	}

	CGFloat Z ()
	{
		return invokeObjcSelf!(CGFloat, "Z");
	}

	CGFloat W ()
	{
		return invokeObjcSelf!(CGFloat, "W");
	}

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

}