Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSFileWrapper.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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSFileWrapper; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSData; | |
18 import dwt.internal.cocoa.NSDictionary; | |
19 import dwt.internal.cocoa.NSFileWrapper; | |
20 import dwt.internal.cocoa.NSImage; | |
21 import dwt.internal.cocoa.NSObject; | |
22 import dwt.internal.cocoa.NSString; | |
23 import dwt.internal.cocoa.OS; | |
24 import objc = dwt.internal.objc.runtime; | |
25 | |
26 public class NSFileWrapper : NSObject | |
27 { | |
28 | |
29 public this () | |
30 { | |
31 super(); | |
32 } | |
33 | |
34 public this (objc.id id) | |
35 { | |
36 super(id); | |
37 } | |
38 | |
39 public NSString addFileWithPath (NSString path) | |
40 { | |
41 objc.id result = OS.objc_msgSend(this.id, OS.sel_addFileWithPath_1, path !is null ? path.id : null); | |
42 return result !is null ? new NSString(result) : null; | |
43 } | |
44 | |
45 public NSString addFileWrapper (NSFileWrapper doc) | |
46 { | |
47 objc.id result = OS.objc_msgSend(this.id, OS.sel_addFileWrapper_1, doc !is null ? doc.id : null); | |
48 return result !is null ? new NSString(result) : null; | |
49 } | |
50 | |
51 public NSString addRegularFileWithContents (NSData data, NSString filename) | |
52 { | |
53 objc.id result = OS.objc_msgSend(this.id, OS.sel_addRegularFileWithContents_1preferredFilename_1, data !is null ? data.id : null, | |
54 filename !is null ? filename.id : null); | |
55 return result !is null ? new NSString(result) : null; | |
56 } | |
57 | |
58 public NSString addSymbolicLinkWithDestination (NSString path, NSString filename) | |
59 { | |
60 objc.id result = OS.objc_msgSend(this.id, OS.sel_addSymbolicLinkWithDestination_1preferredFilename_1, path !is null ? path.id : null, | |
61 filename !is null ? filename.id : null); | |
62 return result !is null ? new NSString(result) : null; | |
63 } | |
64 | |
65 public NSDictionary fileAttributes () | |
66 { | |
67 objc.id result = OS.objc_msgSend(this.id, OS.sel_fileAttributes); | |
68 return result !is null ? new NSDictionary(result) : null; | |
69 } | |
70 | |
71 public NSDictionary fileWrappers () | |
72 { | |
73 objc.id result = OS.objc_msgSend(this.id, OS.sel_fileWrappers); | |
74 return result !is null ? new NSDictionary(result) : null; | |
75 } | |
76 | |
77 public NSString filename () | |
78 { | |
79 objc.id result = OS.objc_msgSend(this.id, OS.sel_filename); | |
80 return result !is null ? new NSString(result) : null; | |
81 } | |
82 | |
83 public NSImage icon () | |
84 { | |
85 objc.id result = OS.objc_msgSend(this.id, OS.sel_icon); | |
86 return result !is null ? new NSImage(result) : null; | |
87 } | |
88 | |
89 public id initDirectoryWithFileWrappers (NSDictionary docs) | |
90 { | |
91 objc.id result = OS.objc_msgSend(this.id, OS.sel_initDirectoryWithFileWrappers_1, docs !is null ? docs.id : null); | |
92 return result !is null ? new id(result) : null; | |
93 } | |
94 | |
95 public id initRegularFileWithContents (NSData data) | |
96 { | |
97 objc.id result = OS.objc_msgSend(this.id, OS.sel_initRegularFileWithContents_1, data !is null ? data.id : null); | |
98 return result !is null ? new id(result) : null; | |
99 } | |
100 | |
101 public id initSymbolicLinkWithDestination (NSString path) | |
102 { | |
103 objc.id result = OS.objc_msgSend(this.id, OS.sel_initSymbolicLinkWithDestination_1, path !is null ? path.id : null); | |
104 return result !is null ? new id(result) : null; | |
105 } | |
106 | |
107 public id initWithPath (NSString path) | |
108 { | |
109 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithPath_1, path !is null ? path.id : null); | |
110 return result !is null ? new id(result) : null; | |
111 } | |
112 | |
113 public id initWithSerializedRepresentation (NSData data) | |
114 { | |
115 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSerializedRepresentation_1, data !is null ? data.id : null); | |
116 return result !is null ? new id(result) : null; | |
117 } | |
118 | |
119 public bool isDirectory () | |
120 { | |
121 return OS.objc_msgSend(this.id, OS.sel_isDirectory) !is null; | |
122 } | |
123 | |
124 public bool isRegularFile () | |
125 { | |
126 return OS.objc_msgSend(this.id, OS.sel_isRegularFile) !is null; | |
127 } | |
128 | |
129 public bool isSymbolicLink () | |
130 { | |
131 return OS.objc_msgSend(this.id, OS.sel_isSymbolicLink) !is null; | |
132 } | |
133 | |
134 public NSString keyForFileWrapper (NSFileWrapper doc) | |
135 { | |
136 objc.id result = OS.objc_msgSend(this.id, OS.sel_keyForFileWrapper_1, doc !is null ? doc.id : null); | |
137 return result !is null ? new NSString(result) : null; | |
138 } | |
139 | |
140 public bool needsToBeUpdatedFromPath (NSString path) | |
141 { | |
142 return OS.objc_msgSend(this.id, OS.sel_needsToBeUpdatedFromPath_1, path !is null ? path.id : null) !is null; | |
143 } | |
144 | |
145 public NSString preferredFilename () | |
146 { | |
147 objc.id result = OS.objc_msgSend(this.id, OS.sel_preferredFilename); | |
148 return result !is null ? new NSString(result) : null; | |
149 } | |
150 | |
151 public NSData regularFileContents () | |
152 { | |
153 objc.id result = OS.objc_msgSend(this.id, OS.sel_regularFileContents); | |
154 return result !is null ? new NSData(result) : null; | |
155 } | |
156 | |
157 public void removeFileWrapper (NSFileWrapper doc) | |
158 { | |
159 OS.objc_msgSend(this.id, OS.sel_removeFileWrapper_1, doc !is null ? doc.id : null); | |
160 } | |
161 | |
162 public NSData serializedRepresentation () | |
163 { | |
164 objc.id result = OS.objc_msgSend(this.id, OS.sel_serializedRepresentation); | |
165 return result !is null ? new NSData(result) : null; | |
166 } | |
167 | |
168 public void setFileAttributes (NSDictionary attributes) | |
169 { | |
170 OS.objc_msgSend(this.id, OS.sel_setFileAttributes_1, attributes !is null ? attributes.id : null); | |
171 } | |
172 | |
173 public void setFilename (NSString filename) | |
174 { | |
175 OS.objc_msgSend(this.id, OS.sel_setFilename_1, filename !is null ? filename.id : null); | |
176 } | |
177 | |
178 public void setIcon (NSImage icon) | |
179 { | |
180 OS.objc_msgSend(this.id, OS.sel_setIcon_1, icon !is null ? icon.id : null); | |
181 } | |
182 | |
183 public void setPreferredFilename (NSString filename) | |
184 { | |
185 OS.objc_msgSend(this.id, OS.sel_setPreferredFilename_1, filename !is null ? filename.id : null); | |
186 } | |
187 | |
188 public NSString symbolicLinkDestination () | |
189 { | |
190 objc.id result = OS.objc_msgSend(this.id, OS.sel_symbolicLinkDestination); | |
191 return result !is null ? new NSString(result) : null; | |
192 } | |
193 | |
194 public bool updateFromPath (NSString path) | |
195 { | |
196 return OS.objc_msgSend(this.id, OS.sel_updateFromPath_1, path !is null ? path.id : null) !is null; | |
197 } | |
198 | |
199 public bool writeToFile (NSString path, bool atomicFlag, bool updateFilenamesFlag) | |
200 { | |
201 return OS.objc_msgSend(this.id, OS.sel_writeToFile_1atomically_1updateFilenames_1, path !is null ? path.id : null, atomicFlag, | |
202 updateFilenamesFlag) !is null; | |
203 } | |
204 | |
205 } |