comparison 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
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSFileWrapper;
8
9 import dstep.appkit.NSImage;
10 import dstep.foundation.NSCoder;
11 import dstep.foundation.NSData;
12 import dstep.foundation.NSDictionary;
13 import dstep.foundation.NSObject;
14 import dstep.foundation.NSString;
15 import dstep.objc.bridge.Bridge;
16 import dstep.objc.objc;
17
18 class NSFileWrapper : NSObject, INSCoding
19 {
20 mixin (ObjcWrap);
21
22 this (NSCoder aDecoder)
23 {
24 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
25 }
26
27 void encodeWithCoder (NSCoder aCoder)
28 {
29 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
30 }
31
32 typeof(this) initWithCoder (NSCoder aDecoder)
33 {
34 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
35 }
36
37 NSFileWrapper initDirectoryWithFileWrappers (NSDictionary docs)
38 {
39 id result = invokeObjcSelf!(id, "initDirectoryWithFileWrappers:", NSDictionary)(docs);
40 return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null);
41 }
42
43 this (NSDictionary docs)
44 {
45 super(NSFileWrapper.alloc.initDirectoryWithFileWrappers(docs).objcObject);
46 }
47
48 NSFileWrapper initRegularFileWithContents (NSData data)
49 {
50 id result = invokeObjcSelf!(id, "initRegularFileWithContents:", NSData)(data);
51 return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null);
52 }
53
54 this (NSData data)
55 {
56 super(NSFileWrapper.alloc.initRegularFileWithContents(data).objcObject);
57 }
58
59 NSFileWrapper initSymbolicLinkWithDestination (NSString path)
60 {
61 id result = invokeObjcSelf!(id, "initSymbolicLinkWithDestination:", NSString)(path);
62 return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null);
63 }
64
65 this (NSString path)
66 {
67 super(NSFileWrapper.alloc.initSymbolicLinkWithDestination(path).objcObject);
68 }
69
70 NSFileWrapper initWithPath (NSString path)
71 {
72 id result = invokeObjcSelf!(id, "initWithPath:", NSString)(path);
73 return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null);
74 }
75
76 this (NSString path)
77 {
78 super(NSFileWrapper.alloc.initWithPath(path).objcObject);
79 }
80
81 NSFileWrapper initWithSerializedRepresentation (NSData data)
82 {
83 id result = invokeObjcSelf!(id, "initWithSerializedRepresentation:", NSData)(data);
84 return result is this.objcObject ? this : (result !is null ? new NSFileWrapper(result) : null);
85 }
86
87 this (NSData data)
88 {
89 super(NSFileWrapper.alloc.initWithSerializedRepresentation(data).objcObject);
90 }
91
92 bool writeToFile (NSString path, bool atomicFlag, bool updateFilenamesFlag)
93 {
94 return invokeObjcSelf!(bool, "writeToFile:atomically:updateFilenames:", NSString, bool, bool)(path, atomicFlag, updateFilenamesFlag);
95 }
96
97 NSData serializedRepresentation ()
98 {
99 return invokeObjcSelf!(NSData, "serializedRepresentation");
100 }
101
102 void setFilename (NSString filename)
103 {
104 return invokeObjcSelf!(void, "setFilename:", NSString)(filename);
105 }
106
107 NSString filename ()
108 {
109 return invokeObjcSelf!(NSString, "filename");
110 }
111
112 void setPreferredFilename (NSString filename)
113 {
114 return invokeObjcSelf!(void, "setPreferredFilename:", NSString)(filename);
115 }
116
117 NSString preferredFilename ()
118 {
119 return invokeObjcSelf!(NSString, "preferredFilename");
120 }
121
122 void setFileAttributes (NSDictionary attributes)
123 {
124 return invokeObjcSelf!(void, "setFileAttributes:", NSDictionary)(attributes);
125 }
126
127 NSDictionary fileAttributes ()
128 {
129 return invokeObjcSelf!(NSDictionary, "fileAttributes");
130 }
131
132 bool isRegularFile ()
133 {
134 return invokeObjcSelf!(bool, "isRegularFile");
135 }
136
137 bool isDirectory ()
138 {
139 return invokeObjcSelf!(bool, "isDirectory");
140 }
141
142 bool isSymbolicLink ()
143 {
144 return invokeObjcSelf!(bool, "isSymbolicLink");
145 }
146
147 void setIcon (NSImage icon)
148 {
149 return invokeObjcSelf!(void, "setIcon:", NSImage)(icon);
150 }
151
152 NSImage icon ()
153 {
154 return invokeObjcSelf!(NSImage, "icon");
155 }
156
157 bool needsToBeUpdatedFromPath (NSString path)
158 {
159 return invokeObjcSelf!(bool, "needsToBeUpdatedFromPath:", NSString)(path);
160 }
161
162 bool updateFromPath (NSString path)
163 {
164 return invokeObjcSelf!(bool, "updateFromPath:", NSString)(path);
165 }
166
167 NSString addFileWrapper (NSFileWrapper doc)
168 {
169 return invokeObjcSelf!(NSString, "addFileWrapper:", NSFileWrapper)(doc);
170 }
171
172 void removeFileWrapper (NSFileWrapper doc)
173 {
174 return invokeObjcSelf!(void, "removeFileWrapper:", NSFileWrapper)(doc);
175 }
176
177 NSDictionary fileWrappers ()
178 {
179 return invokeObjcSelf!(NSDictionary, "fileWrappers");
180 }
181
182 NSString keyForFileWrapper (NSFileWrapper doc)
183 {
184 return invokeObjcSelf!(NSString, "keyForFileWrapper:", NSFileWrapper)(doc);
185 }
186
187 NSString addFileWithPath (NSString path)
188 {
189 return invokeObjcSelf!(NSString, "addFileWithPath:", NSString)(path);
190 }
191
192 NSString addRegularFileWithContents (NSData data, NSString filename)
193 {
194 return invokeObjcSelf!(NSString, "addRegularFileWithContents:preferredFilename:", NSData, NSString)(data, filename);
195 }
196
197 NSString addSymbolicLinkWithDestination (NSString path, NSString filename)
198 {
199 return invokeObjcSelf!(NSString, "addSymbolicLinkWithDestination:preferredFilename:", NSString, NSString)(path, filename);
200 }
201
202 NSData regularFileContents ()
203 {
204 return invokeObjcSelf!(NSData, "regularFileContents");
205 }
206
207 NSString symbolicLinkDestination ()
208 {
209 return invokeObjcSelf!(NSString, "symbolicLinkDestination");
210 }
211
212 }
213