diff dwt/internal/cocoa/NSCoder.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSCoder.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSCoder.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,341 +1,40 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 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
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *     Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSCoder;
 
-import dwt.internal.cocoa.id;
-import dwt.internal.cocoa.NSData;
-import dwt.internal.cocoa.NSInteger;
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 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.NSZone;
 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 /*const*/ubyte* decodeBytesForKey (NSString key, NSUInteger* lengthp)
-    {
-        return cast(/*const*/ubyte*) OS.objc_msgSend(this.id_, OS.sel_decodeBytesForKey_1returnedLength_1, key !is null ? key.id_ : null, lengthp);
-    }
-
-    public void* decodeBytesWithReturnedLength (NSUInteger* lengthp)
-    {
-        return cast(void*) 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 cast(int) 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 cast(int) OS.objc_msgSend(this.id_, OS.sel_decodeIntForKey_1, key !is null ? key.id_ : null);
-    }
+public class NSCoder : NSObject {
 
-    public NSInteger decodeIntegerForKey (NSString key)
-    {
-        return cast(NSInteger) 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 this() {
+    super();
+}
 
-    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 this(objc.id id) {
+    super(id);
+}
 
-    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_ (/*const*/void* byteaddr, NSUInteger length)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_encodeBytes_1length_1, byteaddr, 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 (NSInteger 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 this(cocoa.id id) {
+    super(id);
+}
 
-    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 int systemVersion() {
+    return cast(int)/*64*/OS.objc_msgSend(this.id, OS.sel_systemVersion);
+}
 
-    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 NSZone* objectZone ()
-    {
-        return cast(NSZone*) 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 cast(uint) OS.objc_msgSend(this.id_, OS.sel_systemVersion);
-    }
-
-    public NSInteger versionForClassName (NSString className)
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_versionForClassName_1, className !is null ? className.id_ : null);
-    }
 }