Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSKeyedArchiver.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/NSKeyedArchiver.d Tue Oct 21 15:20:04 2008 +0200 +++ b/dwt/internal/cocoa/NSKeyedArchiver.d Mon Dec 01 17:07:00 2008 +0100 @@ -1,150 +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.NSKeyedArchiver; -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.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 class NSKeyedArchiver : NSCoder { - 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 this() { + super(); +} - 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 this(objc.id id) { + super(id); +} - 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 cast(NSPropertyListFormat) OS.objc_msgSend(this.id_, OS.sel_outputFormat); - } +public this(cocoa.id id) { + super(id); +} - 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); - } +public static NSData archivedDataWithRootObject(cocoa.id rootObject) { + objc.id result = OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_archivedDataWithRootObject_, rootObject !is null ? rootObject.id : null); + return result !is null ? new NSData(result) : null; +} }