Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSKeyedUnarchiver.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/NSKeyedUnarchiver.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,137 @@ +/******************************************************************************* + * 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.NSKeyedUnarchiver; + +import 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 OS.objc_msgSend(this.id, OS.sel_classForClassName_1, codedName !is null ? codedName.id : null); + } + + public static objc.Class static_classForClassName_ (NSString codedName) + { + return OS.objc_msgSend(OS.class_NSKeyedUnarchiver, OS.sel_classForClassName_1, codedName !is null ? codedName.id : 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 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 OS.objc_msgSend(this.id, OS.sel_decodeBytesForKey_1returnedLength_1, key !is null ? key.id : null, lengthp); + } + + 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 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 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 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; + } + +}