diff dstep/foundation/NSValue.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 diff
--- a/dstep/foundation/NSValue.d	Mon Aug 03 15:31:48 2009 +0200
+++ b/dstep/foundation/NSValue.d	Sun Jan 03 22:06:11 2010 +0100
@@ -6,17 +6,460 @@
  */
 module dstep.foundation.NSValue;
 
+import dstep.foundation.NSCoder;
+import dstep.foundation.NSDecimal;
+import dstep.foundation.NSDecimalNumber;
 import dstep.foundation.NSDictionary;
+import dstep.foundation.NSGeometry;
+import dstep.foundation.NSObjCRuntime;
 import dstep.foundation.NSObject;
+import dstep.foundation.NSRange;
 import dstep.foundation.NSString;
+import dstep.foundation.NSZone;
 import dstep.objc.bridge.Bridge;
-import dstep.objc.objc : id;
+import dstep.applicationservices.coregraphics.CGGeometry;
+import dstep.objc.objc;
+
+private
+{
+	alias CGPoint NSPoint;
+	alias NSPoint* NSPointPointer;
+	alias NSPoint* NSPointArray;
+	alias CGSize NSSize;
+	alias NSSize* NSSizePointer;
+	alias NSSize* NSSizeArray;
+	alias CGRect NSRect;
+	alias NSRect* NSRectPointer;
+	alias NSRect* NSRectArray;
+	alias NSUInteger NSRectEdge;
+}
+
+const TNSNumberCreation = `
+
+	Object initWithChar (byte value)
+	{
+		return invokeObjcSelf!(Object, "initWithChar:", byte)(value);
+	}
+
+	this (byte value)
+	{
+		typeof(this).alloc.initWithChar(value);
+	}
+
+	Object initWithUnsignedChar (ubyte value)
+	{
+		return invokeObjcSelf!(Object, "initWithUnsignedChar:", ubyte)(value);
+	}
+
+	this (ubyte value)
+	{
+		typeof(this).alloc.initWithUnsignedChar(value);
+	}
+
+	Object initWithShort (short value)
+	{
+		return invokeObjcSelf!(Object, "initWithShort:", short)(value);
+	}
+
+	this (short value)
+	{
+		typeof(this).alloc.initWithShort(value);
+	}
+
+	Object initWithUnsignedShort (ushort value)
+	{
+		return invokeObjcSelf!(Object, "initWithUnsignedShort:", ushort)(value);
+	}
+
+	this (ushort value)
+	{
+		typeof(this).alloc.initWithUnsignedShort(value);
+	}
+
+	Object initWithInt (int value)
+	{
+		return invokeObjcSelf!(Object, "initWithInt:", int)(value);
+	}
+
+	this (int value)
+	{
+		typeof(this).alloc.initWithInt(value);
+	}
+
+	Object initWithUnsignedInt (uint value)
+	{
+		return invokeObjcSelf!(Object, "initWithUnsignedInt:", uint)(value);
+	}
+
+	this (uint value)
+	{
+		typeof(this).alloc.initWithUnsignedInt(value);
+	}
+
+	Object initWithLong (int value)
+	{
+		return invokeObjcSelf!(Object, "initWithLong:", int)(value);
+	}
+
+	this (int value)
+	{
+		typeof(this).alloc.initWithLong(value);
+	}
+
+	Object initWithUnsignedLong (uint value)
+	{
+		return invokeObjcSelf!(Object, "initWithUnsignedLong:", uint)(value);
+	}
+
+	this (uint value)
+	{
+		typeof(this).alloc.initWithUnsignedLong(value);
+	}
+
+	Object initWithLongLong (long value)
+	{
+		return invokeObjcSelf!(Object, "initWithLongLong:", long)(value);
+	}
+
+	this (long value)
+	{
+		typeof(this).alloc.initWithLongLong(value);
+	}
+
+	Object initWithUnsignedLongLong (ulong value)
+	{
+		return invokeObjcSelf!(Object, "initWithUnsignedLongLong:", ulong)(value);
+	}
+
+	this (ulong value)
+	{
+		typeof(this).alloc.initWithUnsignedLongLong(value);
+	}
+
+	Object initWithFloat (float value)
+	{
+		return invokeObjcSelf!(Object, "initWithFloat:", float)(value);
+	}
+
+	this (float value)
+	{
+		typeof(this).alloc.initWithFloat(value);
+	}
+
+	Object initWithDouble (double value)
+	{
+		return invokeObjcSelf!(Object, "initWithDouble:", double)(value);
+	}
+
+	this (double value)
+	{
+		typeof(this).alloc.initWithDouble(value);
+	}
+
+	Object initWithBool (bool value)
+	{
+		return invokeObjcSelf!(Object, "initWithBool:", bool)(value);
+	}
+
+	this (bool value)
+	{
+		typeof(this).alloc.initWithBool(value);
+	}
+
+	Object initWithInteger (NSInteger value)
+	{
+		return invokeObjcSelf!(Object, "initWithInteger:", NSInteger)(value);
+	}
+
+	this (NSInteger value)
+	{
+		typeof(this).alloc.initWithInteger(value);
+	}
+
+	Object initWithUnsignedInteger (NSUInteger value)
+	{
+		return invokeObjcSelf!(Object, "initWithUnsignedInteger:", NSUInteger)(value);
+	}
+
+	this (NSUInteger value)
+	{
+		typeof(this).alloc.initWithUnsignedInteger(value);
+	}
+
+	static NSNumber numberWithChar (byte value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithChar:", byte)(value);
+	}
+
+	static NSNumber numberWithUnsignedChar (ubyte value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedChar:", ubyte)(value);
+	}
+
+	static NSNumber numberWithShort (short value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithShort:", short)(value);
+	}
+
+	static NSNumber numberWithUnsignedShort (ushort value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedShort:", ushort)(value);
+	}
+
+	static NSNumber numberWithInt (int value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithInt:", int)(value);
+	}
+
+	static NSNumber numberWithUnsignedInt (uint value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInt:", uint)(value);
+	}
+
+	static NSNumber numberWithLong (int value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithLong:", int)(value);
+	}
+
+	static NSNumber numberWithUnsignedLong (uint value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLong:", uint)(value);
+	}
+
+	static NSNumber numberWithLongLong (long value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithLongLong:", long)(value);
+	}
+
+	static NSNumber numberWithUnsignedLongLong (ulong value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLongLong:", ulong)(value);
+	}
+
+	static NSNumber numberWithFloat (float value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithFloat:", float)(value);
+	}
+
+	static NSNumber numberWithDouble (double value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithDouble:", double)(value);
+	}
+
+	static NSNumber numberWithBool (bool value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithBool:", bool)(value);
+	}
+
+	static NSNumber numberWithInteger (NSInteger value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithInteger:", NSInteger)(value);
+	}
+
+	static NSNumber numberWithUnsignedInteger (NSUInteger value)
+	{
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInteger:", NSUInteger)(value);
+	}
+`;
+
+const TNSValueCreation = `
+
+	Object initWithBytes (void* value, char* type)
+	{
+		return invokeObjcSelf!(Object, "initWithBytes:objCType:", void*, char*)(value, type);
+	}
+
+	this (void* value, char* type)
+	{
+		typeof(this).alloc.initWithBytes(value, type);
+	}
+
+	static NSValue valueWithBytes (void* value, char* type)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithBytes:objCType:", void*, char*)(value, type);
+	}
+
+	static NSValue value (void* value, char* type)
+	{
+		return invokeObjcSuperClass!(NSValue, "value:withObjCType:", void*, char*)(value, type);
+	}
+`;
+
+const TNSValueExtensionMethods = `
+
+	static NSValue valueWithNonretainedObject (Object anObject)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithNonretainedObject:", Object)(anObject);
+	}
+
+	Object nonretainedObjectValue ()
+	{
+		return invokeObjcSelf!(Object, "nonretainedObjectValue");
+	}
+
+	static NSValue valueWithPointer (void* pointer)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithPointer:", void*)(pointer);
+	}
+
+	void* pointerValue ()
+	{
+		return invokeObjcSelf!(void*, "pointerValue");
+	}
+
+	bool isEqualToValue (NSValue value)
+	{
+		return invokeObjcSelf!(bool, "isEqualToValue:", NSValue)(value);
+	}
+`;
+
+class NSValue : NSObject, INSCopying, INSCoding
+{
+	mixin (ObjcWrap);
+	
+	this ()
+	{
+		super(typeof(this).alloc.init.objcObject);
+	}
+	
+	typeof(this) init ()
+	{
+		return invokeObjcSelf!(typeof(this), "init");
+	}
+
+	void getValue (void* value)
+	{
+		return invokeObjcSelf!(void, "getValue:", void*)(value);
+	}
+
+	char* objCType ()
+	{
+		return invokeObjcSelf!(char*, "objCType");
+	}
+
+	Object copyWithZone (NSZone* zone)
+	{
+		return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone);
+	}
+
+	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);
+	}
+	
+	// TNSValueGeometryExtensions
+	static NSValue valueWithPoint (dstep.applicationservices.coregraphics.CGGeometry.CGPoint point)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithPoint:", NSPoint)(point);
+	}
+	
+	static NSValue valueWithSize (NSSize size)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithSize:", NSSize)(size);
+	}
+	
+	static NSValue valueWithRect (NSRect rect)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithRect:", NSRect)(rect);
+	}
+	
+	NSPoint pointValue ()
+	{
+		return invokeObjcSelf!(NSPoint, "pointValue");
+	}
+	
+	NSSize sizeValue ()
+	{
+		return invokeObjcSelf!(NSSize, "sizeValue");
+	}
+	
+	NSRect rectValue ()
+	{
+		return invokeObjcSelf!(NSRect, "rectValue");
+	}
+	
+	// TNSValueCreation
+	Object initWithBytes (void* value, char* type)
+	{
+		return invokeObjcSelf!(Object, "initWithBytes:objCType:", void*, char*)(value, type);
+	}
+	
+	this (void* value, char* type)
+	{
+		typeof(this).alloc.initWithBytes(value, type);
+	}
+	
+	static NSValue valueWithBytes (void* value, char* type)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithBytes:objCType:", void*, char*)(value, type);
+	}
+	
+	static NSValue value (void* value, char* type)
+	{
+		return invokeObjcSuperClass!(NSValue, "value:withObjCType:", void*, char*)(value, type);
+	}
+	
+	// TNSValueRangeExtensions
+	static NSValue valueWithRange (NSRange range)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithRange:", NSRange)(range);
+	}
+	
+	NSRange rangeValue ()
+	{
+		return invokeObjcSelf!(NSRange, "rangeValue");
+	}
+	
+	// TNSValueExtensionMethods
+	static NSValue valueWithNonretainedObject (Object anObject)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithNonretainedObject:", Object)(anObject);
+	}
+	
+	Object nonretainedObjectValue ()
+	{
+		return invokeObjcSelf!(Object, "nonretainedObjectValue");
+	}
+	
+	static NSValue valueWithPointer (void* pointer)
+	{
+		return invokeObjcSuperClass!(NSValue, "valueWithPointer:", void*)(pointer);
+	}
+	
+	void* pointerValue ()
+	{
+		return invokeObjcSelf!(void*, "pointerValue");
+	}
+	
+	bool isEqualToValue (NSValue value)
+	{
+		return invokeObjcSelf!(bool, "isEqualToValue:", NSValue)(value);
+	}
+}
 
 class NSNumber : NSValue
 {
-	mixin ObjcWrap;
-	mixin TNSDecimalNumberExtensions;
-	mixin TNSNumberCreation;
+	mixin (ObjcWrap);
+
+	this ()
+	{
+		super(typeof(this).alloc.init.objcObject);
+	}
+	
+	typeof(this) init ()
+	{
+		return invokeObjcSelf!(typeof(this), "init");
+	}
 
 	byte charValue ()
 	{
@@ -112,425 +555,216 @@
 	{
 		return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale);
 	}
-}
-
-class NSValue : NSObject, INSCopying, INSCoding
-{
-	mixin ObjcWrap;
-	mixin TNSValueGeometryExtensions;
-	mixin TNSValueCreation;
-	mixin TNSValueRangeExtensions;
-	mixin TNSValueExtensionMethods;
-
-	void getValue (void* value)
+	
+	// TNSDecimalNumberExtensions
+	NSDecimal decimalValue ()
 	{
-		return invokeObjcSelf!(void, "getValue:", void*)(value);
-	}
-
-	char* objCType ()
-	{
-		return invokeObjcSelf!(char*, "objCType");
-	}
-
-	Object copyWithZone (NSZone* zone)
-	{
-		return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone);
+		return invokeObjcSelf!(NSDecimal, "decimalValue");
 	}
-
-	void encodeWithCoder (NSCoder aCoder)
-	{
-		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
-	}
-
-	Object initWithCoder (NSCoder aDecoder)
-	{
-		return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
-	}
-
-	this (NSCoder aDecoder)
-	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
-	}
-}
-
-template TNSNumberCreation ()
-{
+	
+	// TNSNumberCreation
 	Object initWithChar (byte value)
 	{
 		return invokeObjcSelf!(Object, "initWithChar:", byte)(value);
 	}
-
+	
 	this (byte value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithChar:", byte)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithChar(value);
 	}
-
+	
 	Object initWithUnsignedChar (ubyte value)
 	{
 		return invokeObjcSelf!(Object, "initWithUnsignedChar:", ubyte)(value);
 	}
-
+	
 	this (ubyte value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedChar:", ubyte)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithUnsignedChar(value);
 	}
-
+	
 	Object initWithShort (short value)
 	{
 		return invokeObjcSelf!(Object, "initWithShort:", short)(value);
 	}
-
+	
 	this (short value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithShort:", short)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithShort(value);
 	}
-
+	
 	Object initWithUnsignedShort (ushort value)
 	{
 		return invokeObjcSelf!(Object, "initWithUnsignedShort:", ushort)(value);
 	}
-
+	
 	this (ushort value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedShort:", ushort)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithUnsignedShort(value);
 	}
-
+	
 	Object initWithInt (int value)
 	{
 		return invokeObjcSelf!(Object, "initWithInt:", int)(value);
 	}
-
+	
 	this (int value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithInt:", int)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithInt(value);
 	}
-
+	
 	Object initWithUnsignedInt (uint value)
 	{
 		return invokeObjcSelf!(Object, "initWithUnsignedInt:", uint)(value);
 	}
-
+	
 	this (uint value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedInt:", uint)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithUnsignedInt(value);
 	}
-
+	
 	Object initWithLong (int value)
 	{
 		return invokeObjcSelf!(Object, "initWithLong:", int)(value);
 	}
-
-	this (int value)
-	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithLong:", int)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
-	}
-
+	
 	Object initWithUnsignedLong (uint value)
 	{
 		return invokeObjcSelf!(Object, "initWithUnsignedLong:", uint)(value);
 	}
-
-	this (uint value)
-	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedLong:", uint)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
-	}
-
+	
 	Object initWithLongLong (long value)
 	{
 		return invokeObjcSelf!(Object, "initWithLongLong:", long)(value);
 	}
-
+	
 	this (long value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithLongLong:", long)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithLongLong(value);
 	}
-
+	
 	Object initWithUnsignedLongLong (ulong value)
 	{
 		return invokeObjcSelf!(Object, "initWithUnsignedLongLong:", ulong)(value);
 	}
-
+	
 	this (ulong value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedLongLong:", ulong)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithUnsignedLongLong(value);
 	}
-
+	
 	Object initWithFloat (float value)
 	{
 		return invokeObjcSelf!(Object, "initWithFloat:", float)(value);
 	}
-
+	
 	this (float value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithFloat:", float)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithFloat(value);
 	}
-
+	
 	Object initWithDouble (double value)
 	{
 		return invokeObjcSelf!(Object, "initWithDouble:", double)(value);
 	}
-
+	
 	this (double value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithDouble:", double)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithDouble(value);
 	}
-
+	
 	Object initWithBool (bool value)
 	{
 		return invokeObjcSelf!(Object, "initWithBool:", bool)(value);
 	}
-
+	
 	this (bool value)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithBool:", bool)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithBool(value);
 	}
-
+	
 	Object initWithInteger (NSInteger value)
 	{
 		return invokeObjcSelf!(Object, "initWithInteger:", NSInteger)(value);
 	}
-
-	this (NSInteger value)
-	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithInteger:", NSInteger)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
-	}
-
+	
 	Object initWithUnsignedInteger (NSUInteger value)
 	{
 		return invokeObjcSelf!(Object, "initWithUnsignedInteger:", NSUInteger)(value);
 	}
-
-	this (NSUInteger value)
-	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithUnsignedInteger:", NSUInteger)(objcObject, value);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
-	}
-
+	
 	static NSNumber numberWithChar (byte value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithChar:", byte)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithChar:", byte)(value);
 	}
-
+	
 	static NSNumber numberWithUnsignedChar (ubyte value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedChar:", ubyte)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedChar:", ubyte)(value);
 	}
-
+	
 	static NSNumber numberWithShort (short value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithShort:", short)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithShort:", short)(value);
 	}
-
+	
 	static NSNumber numberWithUnsignedShort (ushort value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedShort:", ushort)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedShort:", ushort)(value);
 	}
-
+	
 	static NSNumber numberWithInt (int value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithInt:", int)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithInt:", int)(value);
 	}
-
+	
 	static NSNumber numberWithUnsignedInt (uint value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedInt:", uint)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInt:", uint)(value);
 	}
-
+	
 	static NSNumber numberWithLong (int value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithLong:", int)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithLong:", int)(value);
 	}
-
+	
 	static NSNumber numberWithUnsignedLong (uint value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedLong:", uint)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLong:", uint)(value);
 	}
-
+	
 	static NSNumber numberWithLongLong (long value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithLongLong:", long)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithLongLong:", long)(value);
 	}
-
+	
 	static NSNumber numberWithUnsignedLongLong (ulong value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedLongLong:", ulong)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedLongLong:", ulong)(value);
 	}
-
+	
 	static NSNumber numberWithFloat (float value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithFloat:", float)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithFloat:", float)(value);
 	}
-
+	
 	static NSNumber numberWithDouble (double value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithDouble:", double)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithDouble:", double)(value);
 	}
-
+	
 	static NSNumber numberWithBool (bool value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithBool:", bool)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithBool:", bool)(value);
 	}
-
+	
 	static NSNumber numberWithInteger (NSInteger value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithInteger:", NSInteger)(value);
+		return invokeObjcSuperClass!(NSNumber, "numberWithInteger:", NSInteger)(value);
 	}
-
+	
 	static NSNumber numberWithUnsignedInteger (NSUInteger value)
 	{
-		return invokeObjcSelfClass!(NSNumber, "numberWithUnsignedInteger:", NSUInteger)(value);
-	}
-}
-
-template TNSValueCreation ()
-{
-	Object initWithBytes (void* value, char* type)
-	{
-		return invokeObjcSelf!(Object, "initWithBytes:objCType:", void*, char*)(value, type);
-	}
-
-	this (void* value, char* type)
-	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithBytes:objCType:", void*, char*)(objcObject, value, type);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
-	}
-
-	static NSValue valueWithBytes (void* value, char* type)
-	{
-		return invokeObjcSelfClass!(NSValue, "valueWithBytes:objCType:", void*, char*)(value, type);
-	}
-
-	static NSValue value (void* value, char* type)
-	{
-		return invokeObjcSelfClass!(NSValue, "value:withObjCType:", void*, char*)(value, type);
+		return invokeObjcSuperClass!(NSNumber, "numberWithUnsignedInteger:", NSUInteger)(value);
 	}
-}
-
-template TNSValueExtensionMethods ()
-{
-	static NSValue valueWithNonretainedObject (Object anObject)
-	{
-		return invokeObjcSelfClass!(NSValue, "valueWithNonretainedObject:", Object)(anObject);
-	}
-
-	Object nonretainedObjectValue ()
-	{
-		return invokeObjcSelf!(Object, "nonretainedObjectValue");
-	}
-
-	static NSValue valueWithPointer (void* pointer)
-	{
-		return invokeObjcSelfClass!(NSValue, "valueWithPointer:", void*)(pointer);
-	}
-
-	void* pointerValue ()
-	{
-		return invokeObjcSelf!(void*, "pointerValue");
-	}
-
-	bool isEqualToValue (NSValue value)
-	{
-		return invokeObjcSelf!(bool, "isEqualToValue:", NSValue)(value);
-	}
-}
-
+}
\ No newline at end of file