diff dwt/internal/cocoa/NSCoder.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSCoder.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,340 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ * Port to the D Programming language:
+ *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *******************************************************************************/
+module dwt.internal.cocoa.NSCoder;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSData;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSPoint;
+import dwt.internal.cocoa.NSRect;
+import dwt.internal.cocoa.NSSize;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSCoder : NSObject
+{
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public bool allowsKeyedCoding ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_allowsKeyedCoding) !is null;
+    }
+
+    public bool containsValueForKey (NSString key)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_containsValueForKey_1, key !is null ? key.id : null) !is null;
+    }
+
+    public void decodeArrayOfObjCType (/*const*/char* itemType, NSUInteger count, void* array)
+    {
+        OS.objc_msgSend(this.id, OS.sel_decodeArrayOfObjCType_1count_1at_1, itemType, count, array);
+    }
+
+    public bool decodeBoolForKey (NSString key)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_decodeBoolForKey_1, key !is null ? key.id : null) !is null;
+    }
+
+    public byte* decodeBytesForKey (NSString key, NSUInteger lengthp)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_decodeBytesForKey_1returnedLength_1, key !is null ? key.id : null, lengthp);
+    }
+
+    public void* decodeBytesWithReturnedLength (NSUInteger lengthp)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_decodeBytesWithReturnedLength_1, lengthp);
+    }
+
+    public NSData decodeDataObject ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeDataObject);
+        return result !is null ? new NSData(result) : null;
+    }
+
+    public double decodeDoubleForKey (NSString key)
+    {
+        return OS.objc_msgSend_fpret(this.id, OS.sel_decodeDoubleForKey_1, key !is null ? key.id : null);
+    }
+
+    public float decodeFloatForKey (NSString key)
+    {
+        return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_decodeFloatForKey_1, key !is null ? key.id : null);
+    }
+
+    public int decodeInt32ForKey (NSString key)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_decodeInt32ForKey_1, key !is null ? key.id : null);
+    }
+
+    public long decodeInt64ForKey (NSString key)
+    {
+        return cast(long) OS.objc_msgSend(this.id, OS.sel_decodeInt64ForKey_1, key !is null ? key.id : null);
+    }
+
+    public int decodeIntForKey (NSString key)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_decodeIntForKey_1, key !is null ? key.id : null);
+    }
+
+    public int decodeIntegerForKey (NSString key)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_decodeIntegerForKey_1, key !is null ? key.id : null);
+    }
+
+    public id decodeNXObject ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeNXObject);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id decodeObject ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeObject);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id decodeObjectForKey (NSString key)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeObjectForKey_1, key !is null ? key.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSPoint decodePoint ()
+    {
+        NSPoint result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_decodePoint);
+        return result;
+    }
+
+    public NSPoint decodePointForKey (NSString key)
+    {
+        NSPoint result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_decodePointForKey_1, key !is null ? key.id : null);
+        return result;
+    }
+
+    public id decodePropertyList ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_decodePropertyList);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSRect decodeRect ()
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_decodeRect);
+        return result;
+    }
+
+    public NSRect decodeRectForKey (NSString key)
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_decodeRectForKey_1, key !is null ? key.id : null);
+        return result;
+    }
+
+    public NSSize decodeSize ()
+    {
+        NSSize result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_decodeSize);
+        return result;
+    }
+
+    public NSSize decodeSizeForKey (NSString key)
+    {
+        NSSize result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_decodeSizeForKey_1, key !is null ? key.id : null);
+        return result;
+    }
+
+    public void decodeValueOfObjCType (/*const*/char* type, void* data)
+    {
+        OS.objc_msgSend(this.id, OS.sel_decodeValueOfObjCType_1at_1, type, data);
+    }
+
+    public void decodeValuesOfObjCTypes (/*const*/char* decodeValuesOfObjCTypes)
+    {
+        OS.objc_msgSend(this.id, OS.sel_decodeValuesOfObjCTypes_1, decodeValuesOfObjCTypes);
+    }
+
+    public void encodeArrayOfObjCType (/*const*/char* type, NSUInteger count, void* array)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeArrayOfObjCType_1count_1at_1, type, count, array);
+    }
+
+    public void encodeBool (bool boolv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeBool_1forKey_1, boolv, key !is null ? key.id : null);
+    }
+
+    public void encodeBycopyObject (id anObject)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeBycopyObject_1, anObject !is null ? anObject.id : null);
+    }
+
+    public void encodeByrefObject (id anObject)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeByrefObject_1, anObject !is null ? anObject.id : null);
+    }
+
+    public void encodeBytes_length_ (void* byteaddr, NSUInteger length)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeBytes_1length_1, byteaddr.ptr, length);
+    }
+
+    public void encodeBytes_length_forKey_ (byte* bytesp, NSUInteger lenv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeBytes_1length_1forKey_1, bytesp, lenv, key !is null ? key.id : null);
+    }
+
+    public void encodeConditionalObject_ (id object)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeConditionalObject_1, object !is null ? object.id : null);
+    }
+
+    public void encodeConditionalObject_forKey_ (id objv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeConditionalObject_1forKey_1, objv !is null ? objv.id : null, key !is null ? key.id : null);
+    }
+
+    public void encodeDataObject (NSData data)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeDataObject_1, data !is null ? data.id : null);
+    }
+
+    public void encodeDouble (double realv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeDouble_1forKey_1, realv, key !is null ? key.id : null);
+    }
+
+    public void encodeFloat (float realv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeFloat_1forKey_1, realv, key !is null ? key.id : null);
+    }
+
+    public void encodeInt32 (int intv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeInt32_1forKey_1, intv, key !is null ? key.id : null);
+    }
+
+    public void encodeInt64 (long intv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeInt64_1forKey_1, intv, key !is null ? key.id : null);
+    }
+
+    public void encodeInt (int intv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeInt_1forKey_1, intv, key !is null ? key.id : null);
+    }
+
+    public void encodeInteger (int intv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeInteger_1forKey_1, intv, key !is null ? key.id : null);
+    }
+
+    public void encodeNXObject (id object)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeNXObject_1, object !is null ? object.id : null);
+    }
+
+    public void encodeObject_ (id object)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeObject_1, object !is null ? object.id : null);
+    }
+
+    public void encodeObject_forKey_ (id objv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeObject_1forKey_1, objv !is null ? objv.id : null, key !is null ? key.id : null);
+    }
+
+    public void encodePoint_ (NSPoint point)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodePoint_1, point);
+    }
+
+    public void encodePoint_forKey_ (NSPoint point, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodePoint_1forKey_1, point, key !is null ? key.id : null);
+    }
+
+    public void encodePropertyList (id aPropertyList)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodePropertyList_1, aPropertyList !is null ? aPropertyList.id : null);
+    }
+
+    public void encodeRect_ (NSRect rect)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeRect_1, rect);
+    }
+
+    public void encodeRect_forKey_ (NSRect rect, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeRect_1forKey_1, rect, key !is null ? key.id : null);
+    }
+
+    public void encodeRootObject (id rootObject)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeRootObject_1, rootObject !is null ? rootObject.id : null);
+    }
+
+    public void encodeSize_ (NSSize size)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeSize_1, size);
+    }
+
+    public void encodeSize_forKey_ (NSSize size, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeSize_1forKey_1, size, key !is null ? key.id : null);
+    }
+
+    public void encodeValueOfObjCType (/*const*/char* type, void* addr)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeValueOfObjCType_1at_1, type, addr);
+    }
+
+    public void encodeValuesOfObjCTypes (/*const*/char* encodeValuesOfObjCTypes)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeValuesOfObjCTypes_1, encodeValuesOfObjCTypes);
+    }
+
+    public objc.id objectZone ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_objectZone);
+    }
+
+    public void setObjectZone (objc.id zone)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setObjectZone_1, zone);
+    }
+
+    public uint systemVersion ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_systemVersion);
+    }
+
+    public NSInteger versionForClassName (NSString className)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_versionForClassName_1, className !is null ? className.id : null);
+    }
+}