Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSUnarchiver.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/NSUnarchiver.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,105 @@ +/******************************************************************************* + * 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.NSUnarchiver; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSCoder; +import dwt.internal.cocoa.NSData; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSZone; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSUnarchiver : NSCoder +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public static NSString static_classNameDecodedForArchiveClassName_ (NSString inArchiveName) + { + objc.id result = OS.objc_msgSend(OS.class_NSUnarchiver, OS.sel_classNameDecodedForArchiveClassName_1, + inArchiveName !is null ? inArchiveName.id : null); + return result !is null ? new NSString(result) : null; + } + + public NSString classNameDecodedForArchiveClassName_ (NSString inArchiveName) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_classNameDecodedForArchiveClassName_1, inArchiveName !is null ? inArchiveName.id : null); + return result !is null ? new NSString(result) : null; + } + + public void decodeClassName_asClassName_ (NSString inArchiveName, NSString trueName) + { + OS.objc_msgSend(this.id, OS.sel_decodeClassName_1asClassName_1, inArchiveName !is null ? inArchiveName.id : null, + trueName !is null ? trueName.id : null); + } + + public static void static_decodeClassName_asClassName_ (NSString inArchiveName, NSString trueName) + { + OS.objc_msgSend(OS.class_NSUnarchiver, OS.sel_decodeClassName_1asClassName_1, inArchiveName !is null ? inArchiveName.id : null, + trueName !is null ? trueName.id : null); + } + + 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 bool isAtEnd () + { + return OS.objc_msgSend(this.id, OS.sel_isAtEnd) !is null; + } + + public NSZone* objectZone () + { + return OS.objc_msgSend(this.id, OS.sel_objectZone); + } + + public void replaceObject (id object, id newObject) + { + OS.objc_msgSend(this.id, OS.sel_replaceObject_1withObject_1, object !is null ? object.id : null, newObject !is null ? newObject.id : null); + } + + public void setObjectZone (NSZone* 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 static id unarchiveObjectWithData (NSData data) + { + objc.id result = OS.objc_msgSend(OS.class_NSUnarchiver, 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_NSUnarchiver, OS.sel_unarchiveObjectWithFile_1, path !is null ? path.id : null); + return result !is null ? new id(result) : null; + } + +}