diff dwt/internal/cocoa/NSFileManager.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/NSFileManager.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * 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.NSFileManager;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSData;
+import dwt.internal.cocoa.NSDictionary;
+import dwt.internal.cocoa.NSDirectoryEnumerator;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSFileManager : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public NSDictionary attributesOfFileSystemForPath (NSString path, objc.id** error)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_attributesOfFileSystemForPath_1error_1, path !is null ? path.id : null, error);
+        return result !is null ? new NSDictionary(result) : null;
+    }
+
+    public NSDictionary attributesOfItemAtPath (NSString path, objc.id** error)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_attributesOfItemAtPath_1error_1, path !is null ? path.id : null, error);
+        return result !is null ? new NSDictionary(result) : null;
+    }
+
+    public bool changeCurrentDirectoryPath (NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_changeCurrentDirectoryPath_1, path !is null ? path.id : null) !is null;
+    }
+
+    public bool changeFileAttributes (NSDictionary attributes, NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_changeFileAttributes_1atPath_1, attributes !is null ? attributes.id : null,
+                path !is null ? path.id : null) !is null;
+    }
+
+    public NSArray componentsToDisplayForPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_componentsToDisplayForPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSData contentsAtPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_contentsAtPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSData(result) : null;
+    }
+
+    public bool contentsEqualAtPath (NSString path1, NSString path2)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_contentsEqualAtPath_1andPath_1, path1 !is null ? path1.id : null, path2 !is null ? path2.id : null) !is null;
+    }
+
+    public NSArray contentsOfDirectoryAtPath (NSString path, objc.id** error)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_contentsOfDirectoryAtPath_1error_1, path !is null ? path.id : null, error);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public bool copyItemAtPath (NSString srcPath, NSString dstPath, objc.id** error)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_copyItemAtPath_1toPath_1error_1, srcPath !is null ? srcPath.id : null,
+                dstPath !is null ? dstPath.id : null, error) !is null;
+    }
+
+    public bool copyPath (NSString src, NSString dest, id handler)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_copyPath_1toPath_1handler_1, src !is null ? src.id : null, dest !is null ? dest.id : null,
+                handler !is null ? handler.id : null) !is null;
+    }
+
+    public bool createDirectoryAtPath_attributes_ (NSString path, NSDictionary attributes)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_createDirectoryAtPath_1attributes_1, path !is null ? path.id : null,
+                attributes !is null ? attributes.id : null) !is null;
+    }
+
+    public bool createDirectoryAtPath_withIntermediateDirectories_attributes_error_ (NSString path, bool createIntermediates,
+            NSDictionary attributes, objc.id** error)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_createDirectoryAtPath_1withIntermediateDirectories_1attributes_1error_1,
+                path !is null ? path.id : null, createIntermediates, attributes !is null ? attributes.id : null, error) !is null;
+    }
+
+    public bool createFileAtPath (NSString path, NSData data, NSDictionary attr)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_createFileAtPath_1contents_1attributes_1, path !is null ? path.id : null,
+                data !is null ? data.id : null, attr !is null ? attr.id : null) !is null;
+    }
+
+    public bool createSymbolicLinkAtPath_pathContent_ (NSString path, NSString otherpath)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_createSymbolicLinkAtPath_1pathContent_1, path !is null ? path.id : null,
+                otherpath !is null ? otherpath.id : null) !is null;
+    }
+
+    public bool createSymbolicLinkAtPath_withDestinationPath_error_ (NSString path, NSString destPath, objc.id** error)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_createSymbolicLinkAtPath_1withDestinationPath_1error_1, path !is null ? path.id : null,
+                destPath !is null ? destPath.id : null, error) !is null;
+    }
+
+    public NSString currentDirectoryPath ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_currentDirectoryPath);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public static NSFileManager defaultManager ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSFileManager, OS.sel_defaultManager);
+        return result !is null ? new NSFileManager(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 NSString destinationOfSymbolicLinkAtPath (NSString path, objc.id** error)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_destinationOfSymbolicLinkAtPath_1error_1, path !is null ? path.id : null, error);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSArray directoryContentsAtPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_directoryContentsAtPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSString displayNameAtPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_displayNameAtPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSDirectoryEnumerator enumeratorAtPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_enumeratorAtPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSDirectoryEnumerator(result) : null;
+    }
+
+    public NSDictionary fileAttributesAtPath (NSString path, bool yorn)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_fileAttributesAtPath_1traverseLink_1, path !is null ? path.id : null, yorn);
+        return result !is null ? new NSDictionary(result) : null;
+    }
+
+    public bool fileExistsAtPath_ (NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_fileExistsAtPath_1, path !is null ? path.id : null) !is null;
+    }
+
+    public bool fileExistsAtPath_isDirectory_ (NSString path, bool* isDirectory)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_fileExistsAtPath_1isDirectory_1, path !is null ? path.id : null, isDirectory) !is null;
+    }
+
+    public NSDictionary fileSystemAttributesAtPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_fileSystemAttributesAtPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSDictionary(result) : null;
+    }
+
+    public /*const*/char* fileSystemRepresentationWithPath (NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_fileSystemRepresentationWithPath_1, path !is null ? path.id : null);
+    }
+
+    public bool isDeletableFileAtPath (NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isDeletableFileAtPath_1, path !is null ? path.id : null) !is null;
+    }
+
+    public bool isExecutableFileAtPath (NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isExecutableFileAtPath_1, path !is null ? path.id : null) !is null;
+    }
+
+    public bool isReadableFileAtPath (NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isReadableFileAtPath_1, path !is null ? path.id : null) !is null;
+    }
+
+    public bool isWritableFileAtPath (NSString path)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isWritableFileAtPath_1, path !is null ? path.id : null) !is null;
+    }
+
+    public bool linkItemAtPath (NSString srcPath, NSString dstPath, objc.id** error)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_linkItemAtPath_1toPath_1error_1, srcPath !is null ? srcPath.id : null,
+                dstPath !is null ? dstPath.id : null, error) !is null;
+    }
+
+    public bool linkPath (NSString src, NSString dest, id handler)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_linkPath_1toPath_1handler_1, src !is null ? src.id : null, dest !is null ? dest.id : null,
+                handler !is null ? handler.id : null) !is null;
+    }
+
+    public bool moveItemAtPath (NSString srcPath, NSString dstPath, objc.id** error)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_moveItemAtPath_1toPath_1error_1, srcPath !is null ? srcPath.id : null,
+                dstPath !is null ? dstPath.id : null, error) !is null;
+    }
+
+    public bool movePath (NSString src, NSString dest, id handler)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_movePath_1toPath_1handler_1, src !is null ? src.id : null, dest !is null ? dest.id : null,
+                handler !is null ? handler.id : null) !is null;
+    }
+
+    public NSString pathContentOfSymbolicLinkAtPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_pathContentOfSymbolicLinkAtPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public bool removeFileAtPath (NSString path, id handler)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_removeFileAtPath_1handler_1, path !is null ? path.id : null, handler !is null ? handler.id : null) !is null;
+    }
+
+    public bool removeItemAtPath (NSString path, objc.id** error)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_removeItemAtPath_1error_1, path !is null ? path.id : null, error) !is null;
+    }
+
+    public bool setAttributes (NSDictionary attributes, NSString path, objc.id** error)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setAttributes_1ofItemAtPath_1error_1, attributes !is null ? attributes.id : null,
+                path !is null ? path.id : null, error) !is null;
+    }
+
+    public void setDelegate (id delegatee)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null);
+    }
+
+    public NSString stringWithFileSystemRepresentation (/*const*/char* str, NSUInteger len)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_stringWithFileSystemRepresentation_1length_1, str, len);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSArray subpathsAtPath (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_subpathsAtPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSArray subpathsOfDirectoryAtPath (NSString path, objc.id** error)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_subpathsOfDirectoryAtPath_1error_1, path !is null ? path.id : null, error);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+}