Mercurial > projects > dstep
diff dstep/appkit/NSFileWrapper.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | f8a3b67adfcb |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSFileWrapper.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,213 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSFileWrapper; + +import dstep.appkit.NSImage; +import dstep.foundation.NSCoder; +import dstep.foundation.NSData; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSFileWrapper : NSObject, INSCoding +{ + mixin (ObjcWrap); + + this (NSCoder aDecoder) + { + super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); + } + + void encodeWithCoder (NSCoder aCoder) + { + return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); + } + + typeof(this) initWithCoder (NSCoder aDecoder) + { + return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); + } + + NSFileWrapper initDirectoryWithFileWrappers (NSDictionary docs) + { + id result = invokeObjcSelf!(id, "initDirectoryWithFileWrappers:", NSDictionary)(docs); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSDictionary docs) + { + super(NSFileWrapper.alloc.initDirectoryWithFileWrappers(docs).objcObject); + } + + NSFileWrapper initRegularFileWithContents (NSData data) + { + id result = invokeObjcSelf!(id, "initRegularFileWithContents:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSData data) + { + super(NSFileWrapper.alloc.initRegularFileWithContents(data).objcObject); + } + + NSFileWrapper initSymbolicLinkWithDestination (NSString path) + { + id result = invokeObjcSelf!(id, "initSymbolicLinkWithDestination:", NSString)(path); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSString path) + { + super(NSFileWrapper.alloc.initSymbolicLinkWithDestination(path).objcObject); + } + + NSFileWrapper initWithPath (NSString path) + { + id result = invokeObjcSelf!(id, "initWithPath:", NSString)(path); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSString path) + { + super(NSFileWrapper.alloc.initWithPath(path).objcObject); + } + + NSFileWrapper initWithSerializedRepresentation (NSData data) + { + id result = invokeObjcSelf!(id, "initWithSerializedRepresentation:", NSData)(data); + return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null); + } + + this (NSData data) + { + super(NSFileWrapper.alloc.initWithSerializedRepresentation(data).objcObject); + } + + bool writeToFile (NSString path, bool atomicFlag, bool updateFilenamesFlag) + { + return invokeObjcSelf!(bool, "writeToFile:atomically:updateFilenames:", NSString, bool, bool)(path, atomicFlag, updateFilenamesFlag); + } + + NSData serializedRepresentation () + { + return invokeObjcSelf!(NSData, "serializedRepresentation"); + } + + void setFilename (NSString filename) + { + return invokeObjcSelf!(void, "setFilename:", NSString)(filename); + } + + NSString filename () + { + return invokeObjcSelf!(NSString, "filename"); + } + + void setPreferredFilename (NSString filename) + { + return invokeObjcSelf!(void, "setPreferredFilename:", NSString)(filename); + } + + NSString preferredFilename () + { + return invokeObjcSelf!(NSString, "preferredFilename"); + } + + void setFileAttributes (NSDictionary attributes) + { + return invokeObjcSelf!(void, "setFileAttributes:", NSDictionary)(attributes); + } + + NSDictionary fileAttributes () + { + return invokeObjcSelf!(NSDictionary, "fileAttributes"); + } + + bool isRegularFile () + { + return invokeObjcSelf!(bool, "isRegularFile"); + } + + bool isDirectory () + { + return invokeObjcSelf!(bool, "isDirectory"); + } + + bool isSymbolicLink () + { + return invokeObjcSelf!(bool, "isSymbolicLink"); + } + + void setIcon (NSImage icon) + { + return invokeObjcSelf!(void, "setIcon:", NSImage)(icon); + } + + NSImage icon () + { + return invokeObjcSelf!(NSImage, "icon"); + } + + bool needsToBeUpdatedFromPath (NSString path) + { + return invokeObjcSelf!(bool, "needsToBeUpdatedFromPath:", NSString)(path); + } + + bool updateFromPath (NSString path) + { + return invokeObjcSelf!(bool, "updateFromPath:", NSString)(path); + } + + NSString addFileWrapper (NSFileWrapper doc) + { + return invokeObjcSelf!(NSString, "addFileWrapper:", NSFileWrapper)(doc); + } + + void removeFileWrapper (NSFileWrapper doc) + { + return invokeObjcSelf!(void, "removeFileWrapper:", NSFileWrapper)(doc); + } + + NSDictionary fileWrappers () + { + return invokeObjcSelf!(NSDictionary, "fileWrappers"); + } + + NSString keyForFileWrapper (NSFileWrapper doc) + { + return invokeObjcSelf!(NSString, "keyForFileWrapper:", NSFileWrapper)(doc); + } + + NSString addFileWithPath (NSString path) + { + return invokeObjcSelf!(NSString, "addFileWithPath:", NSString)(path); + } + + NSString addRegularFileWithContents (NSData data, NSString filename) + { + return invokeObjcSelf!(NSString, "addRegularFileWithContents:preferredFilename:", NSData, NSString)(data, filename); + } + + NSString addSymbolicLinkWithDestination (NSString path, NSString filename) + { + return invokeObjcSelf!(NSString, "addSymbolicLinkWithDestination:preferredFilename:", NSString, NSString)(path, filename); + } + + NSData regularFileContents () + { + return invokeObjcSelf!(NSData, "regularFileContents"); + } + + NSString symbolicLinkDestination () + { + return invokeObjcSelf!(NSString, "symbolicLinkDestination"); + } + +} +