diff dwt/internal/cocoa/NSKeyedArchiver.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/NSKeyedArchiver.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * 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.NSKeyedArchiver;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSCoder;
+import dwt.internal.cocoa.NSData;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSMutableData;
+import dwt.internal.cocoa.NSPropertyListFormat;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSKeyedArchiver : NSCoder
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public static bool archiveRootObject (id rootObject, NSString path)
+    {
+        return OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_archiveRootObject_1toFile_1, rootObject !is null ? rootObject.id : null,
+                path !is null ? path.id : null) !is null;
+    }
+
+    public static NSData archivedDataWithRootObject (id rootObject)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_archivedDataWithRootObject_1, rootObject !is null ? rootObject.id : null);
+        return result !is null ? new NSData(result) : null;
+    }
+
+    public NSString classNameForClass_ (objc.Class cls)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_classNameForClass_1, cls);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public static NSString static_classNameForClass_ (objc.Class cls)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_classNameForClass_1, cls);
+        return result !is null ? new NSString(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 encodeBool (bool boolv, NSString key)
+    {
+        OS.objc_msgSend(this.id, OS.sel_encodeBool_1forKey_1, boolv, key !is null ? key.id : null);
+    }
+
+    public void encodeBytes (/*const*/ubyte* 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 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 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 encodeObject (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 finishEncoding ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_finishEncoding);
+    }
+
+    public id initForWritingWithMutableData (NSMutableData data)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initForWritingWithMutableData_1, data !is null ? data.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSPropertyListFormat outputFormat ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_outputFormat);
+    }
+
+    public static void static_setClassName_forClass_ (NSString codedName, objc.Class cls)
+    {
+        OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_setClassName_1forClass_1, codedName !is null ? codedName.id : null, cls);
+    }
+
+    public void setClassName_forClass_ (NSString codedName, objc.Class cls)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setClassName_1forClass_1, codedName !is null ? codedName.id : null, cls);
+    }
+
+    public void setDelegate (id delegatee)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null);
+    }
+
+    public void setOutputFormat (NSPropertyListFormat format)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setOutputFormat_1, format);
+    }
+
+}