diff dwt/internal/cocoa/NSKeyedUnarchiver.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/NSKeyedUnarchiver.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSKeyedUnarchiver.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,137 +1,42 @@
 /*******************************************************************************
- * 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.NSKeyedUnarchiver;
 
-import dwt.internal.cocoa.id;
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSCoder;
 import dwt.internal.cocoa.NSData;
-import dwt.internal.cocoa.NSInteger;
-import dwt.internal.cocoa.NSString;
 import dwt.internal.cocoa.OS;
 import objc = dwt.internal.objc.runtime;
 
-public class NSKeyedUnarchiver : NSCoder
-{
-
-    public this ()
-    {
-        super();
-    }
-
-    public this (objc.id id)
-    {
-        super(id);
-    }
-
-    public objc.Class classForClassName_ (NSString codedName)
-    {
-        return cast(objc.Class) OS.objc_msgSend(this.id_, OS.sel_classForClassName_1, codedName !is null ? codedName.id_ : null);
-    }
-
-    public static objc.Class static_classForClassName_ (NSString codedName)
-    {
-        return cast(objc.Class) OS.objc_msgSend(OS.class_NSKeyedUnarchiver, OS.sel_classForClassName_1, codedName !is null ? codedName.id_ : null);
-    }
+public class NSKeyedUnarchiver : NSCoder {
 
-    public bool containsValueForKey (NSString key)
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_containsValueForKey_1, key !is null ? key.id_ : null) !is null;
-    }
-
-    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 double decodeDoubleForKey (NSString key)
-    {
-        return cast(double) 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 this() {
+    super();
+}
 
-    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 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 id delegatee ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_delegate);
-        return result !is null ? new id(result) : null;
-    }
-
-    public void finishDecoding ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_finishDecoding);
-    }
+public this(objc.id id) {
+    super(id);
+}
 
-    public id initForReadingWithData (NSData data)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initForReadingWithData_1, data !is null ? data.id_ : null);
-        return result !is null ? new id(result) : null;
-    }
-
-    public void setClass_forClassName_ (objc.Class cls, NSString codedName)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setClass_1forClassName_1, cls, codedName !is null ? codedName.id_ : null);
-    }
-
-    public static void static_setClass_forClassName_ (objc.Class cls, NSString codedName)
-    {
-        OS.objc_msgSend(OS.class_NSKeyedUnarchiver, OS.sel_setClass_1forClassName_1, cls, codedName !is null ? codedName.id_ : null);
-    }
+public this(cocoa.id id) {
+    super(id);
+}
 
-    public void setDelegate (id delegatee)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id_ : null);
-    }
-
-    public static id unarchiveObjectWithData (NSData data)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSKeyedUnarchiver, OS.sel_unarchiveObjectWithData_1, data !is null ? data.id_ : null);
-        return result !is null ? new id(result) : null;
-    }
-
-    public static id unarchiveObjectWithFile (NSString path)
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSKeyedUnarchiver, OS.sel_unarchiveObjectWithFile_1, path !is null ? path.id_ : null);
-        return result !is null ? new id(result) : null;
-    }
+public static cocoa.id unarchiveObjectWithData(NSData data) {
+    objc.id result = OS.objc_msgSend(OS.class_NSKeyedUnarchiver, OS.sel_unarchiveObjectWithData_, data !is null ? data.id : null);
+    return result !is null ? new cocoa.id(result) : null;
+}
 
 }