view dstep/appkit/NSFileWrapper.d @ 22:f8a3b67adfcb

Removed duplicated methods
author Jacob Carlborg <doob@me.com>
date Tue, 09 Feb 2010 18:02:03 +0100
parents 19885b43130e
children b9de51448c6b
line wrap: on
line source

/**
 * 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);
	}

	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);
	}

	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");
	}

}