comparison dstep/foundation/NSMetadata.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 89f3c3ef1fd2
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
7 module dstep.foundation.NSMetadata; 7 module dstep.foundation.NSMetadata;
8 8
9 import dstep.foundation.NSArray; 9 import dstep.foundation.NSArray;
10 import dstep.foundation.NSDate; 10 import dstep.foundation.NSDate;
11 import dstep.foundation.NSDictionary; 11 import dstep.foundation.NSDictionary;
12 import dstep.foundation.NSMetadataItem; 12 import dstep.foundation.NSObjCRuntime;
13 import dstep.foundation.NSMetadataQueryAttributeValueTuple;
14 import dstep.foundation.NSMetadataQueryResultGroup;
15 import dstep.foundation.NSObject; 13 import dstep.foundation.NSObject;
16 import dstep.foundation.NSPredicate; 14 import dstep.foundation.NSPredicate;
17 import dstep.foundation.NSString; 15 import dstep.foundation.NSString;
18 import dstep.objc.bridge.Bridge; 16 import dstep.objc.bridge.Bridge;
19 import dstep.objc.objc : id; 17 import dstep.objc.objc;
18
19
20 20
21 import bindings = dstep.foundation.NSMetadata_bindings; 21 import bindings = dstep.foundation.NSMetadata_bindings;
22 22
23 const NSString NSMetadataQueryDidStartGatheringNotification; 23 private
24 const NSString NSMetadataQueryGatheringProgressNotification; 24 {
25 const NSString NSMetadataQueryDidFinishGatheringNotification; 25 NSString NSMetadataQueryDidStartGatheringNotification_;
26 const NSString NSMetadataQueryDidUpdateNotification; 26 NSString NSMetadataQueryGatheringProgressNotification_;
27 const NSString NSMetadataQueryResultContentRelevanceAttribute; 27 NSString NSMetadataQueryDidFinishGatheringNotification_;
28 const NSString NSMetadataQueryUserHomeScope; 28 NSString NSMetadataQueryDidUpdateNotification_;
29 const NSString NSMetadataQueryLocalComputerScope; 29 NSString NSMetadataQueryResultContentRelevanceAttribute_;
30 const NSString NSMetadataQueryNetworkScope; 30 NSString NSMetadataQueryUserHomeScope_;
31 31 NSString NSMetadataQueryLocalComputerScope_;
32 static this () 32 NSString NSMetadataQueryNetworkScope_;
33 { 33 }
34 NSMetadataQueryDidStartGatheringNotification = new NSString(bindings.NSMetadataQueryDidStartGatheringNotification); 34
35 NSMetadataQueryGatheringProgressNotification = new NSString(bindings.NSMetadataQueryGatheringProgressNotification); 35 NSString NSMetadataQueryDidStartGatheringNotification ()
36 NSMetadataQueryDidFinishGatheringNotification = new NSString(bindings.NSMetadataQueryDidFinishGatheringNotification); 36 {
37 NSMetadataQueryDidUpdateNotification = new NSString(bindings.NSMetadataQueryDidUpdateNotification); 37 if (NSMetadataQueryDidStartGatheringNotification_)
38 NSMetadataQueryResultContentRelevanceAttribute = new NSString(bindings.NSMetadataQueryResultContentRelevanceAttribute); 38 return NSMetadataQueryDidStartGatheringNotification_;
39 NSMetadataQueryUserHomeScope = new NSString(bindings.NSMetadataQueryUserHomeScope); 39
40 NSMetadataQueryLocalComputerScope = new NSString(bindings.NSMetadataQueryLocalComputerScope); 40 return NSMetadataQueryDidStartGatheringNotification_ = new NSString(bindings.NSMetadataQueryDidStartGatheringNotification);
41 NSMetadataQueryNetworkScope = new NSString(bindings.NSMetadataQueryNetworkScope); 41 }
42 } 42
43 NSString NSMetadataQueryGatheringProgressNotification ()
44 {
45 if (NSMetadataQueryGatheringProgressNotification_)
46 return NSMetadataQueryGatheringProgressNotification_;
47
48 return NSMetadataQueryGatheringProgressNotification_ = new NSString(bindings.NSMetadataQueryGatheringProgressNotification);
49 }
50
51 NSString NSMetadataQueryDidFinishGatheringNotification ()
52 {
53 if (NSMetadataQueryDidFinishGatheringNotification_)
54 return NSMetadataQueryDidFinishGatheringNotification_;
55
56 return NSMetadataQueryDidFinishGatheringNotification_ = new NSString(bindings.NSMetadataQueryDidFinishGatheringNotification);
57 }
58
59 NSString NSMetadataQueryDidUpdateNotification ()
60 {
61 if (NSMetadataQueryDidUpdateNotification_)
62 return NSMetadataQueryDidUpdateNotification_;
63
64 return NSMetadataQueryDidUpdateNotification_ = new NSString(bindings.NSMetadataQueryDidUpdateNotification);
65 }
66
67 NSString NSMetadataQueryResultContentRelevanceAttribute ()
68 {
69 if (NSMetadataQueryResultContentRelevanceAttribute_)
70 return NSMetadataQueryResultContentRelevanceAttribute_;
71
72 return NSMetadataQueryResultContentRelevanceAttribute_ = new NSString(bindings.NSMetadataQueryResultContentRelevanceAttribute);
73 }
74
75 NSString NSMetadataQueryUserHomeScope ()
76 {
77 if (NSMetadataQueryUserHomeScope_)
78 return NSMetadataQueryUserHomeScope_;
79
80 return NSMetadataQueryUserHomeScope_ = new NSString(bindings.NSMetadataQueryUserHomeScope);
81 }
82
83 NSString NSMetadataQueryLocalComputerScope ()
84 {
85 if (NSMetadataQueryLocalComputerScope_)
86 return NSMetadataQueryLocalComputerScope_;
87
88 return NSMetadataQueryLocalComputerScope_ = new NSString(bindings.NSMetadataQueryLocalComputerScope);
89 }
90
91 NSString NSMetadataQueryNetworkScope ()
92 {
93 if (NSMetadataQueryNetworkScope_)
94 return NSMetadataQueryNetworkScope_;
95
96 return NSMetadataQueryNetworkScope_ = new NSString(bindings.NSMetadataQueryNetworkScope);
97 }
98
99 const TNSMetadataQueryDelegate = `
100
101 Object metadataQuery (NSMetadataQuery query, NSMetadataItem result)
102 {
103 return invokeObjcSelf!(Object, "metadataQuery:replacementObjectForResultObject:", NSMetadataQuery, NSMetadataItem)(query, result);
104 }
105
106 Object metadataQuery (NSMetadataQuery query, NSString attrName, Object attrValue)
107 {
108 return invokeObjcSelf!(Object, "metadataQuery:replacementValueForAttribute:value:", NSMetadataQuery, NSString, Object)(query, attrName, attrValue);
109 }
110
111 //mixin ObjcBindMethod!(metadataQuery, "metadataQuery:replacementObjectForResultObject:");
112 //mixin ObjcBindMethod!(metadataQuery, "metadataQuery:replacementValueForAttribute:value:");
113 `;
43 114
44 class NSMetadataQueryResultGroup : NSObject 115 class NSMetadataQueryResultGroup : NSObject
45 { 116 {
46 mixin ObjcWrap; 117 mixin (ObjcWrap);
118
119 this ()
120 {
121 super(typeof(this).alloc.init.objcObject);
122 }
123
124 typeof(this) init ()
125 {
126 return invokeObjcSelf!(typeof(this), "init");
127 }
47 128
48 NSString attribute () 129 NSString attribute ()
49 { 130 {
50 return invokeObjcSelf!(NSString, "attribute"); 131 return invokeObjcSelf!(NSString, "attribute");
51 } 132 }
76 } 157 }
77 } 158 }
78 159
79 class NSMetadataItem : NSObject 160 class NSMetadataItem : NSObject
80 { 161 {
81 mixin ObjcWrap; 162 mixin (ObjcWrap);
163
164 this ()
165 {
166 super(typeof(this).alloc.init.objcObject);
167 }
168
169 typeof(this) init ()
170 {
171 return invokeObjcSelf!(typeof(this), "init");
172 }
82 173
83 Object valueForAttribute (NSString key) 174 Object valueForAttribute (NSString key)
84 { 175 {
85 return invokeObjcSelf!(Object, "valueForAttribute:", NSString)(key); 176 return invokeObjcSelf!(Object, "valueForAttribute:", NSString)(key);
86 } 177 }
96 } 187 }
97 } 188 }
98 189
99 class NSMetadataQuery : NSObject 190 class NSMetadataQuery : NSObject
100 { 191 {
101 mixin ObjcWrap; 192 mixin (ObjcWrap);
102 193
103 Object init ()
104 {
105 return invokeObjcSelf!(Object, "init");
106 }
107
108 this () 194 this ()
109 { 195 {
110 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 196 super(typeof(this).alloc.init.objcObject);
111 id result = Bridge.invokeObjcMethod!(id, "init")(objcObject); 197 }
112 198
113 if (result) 199 typeof(this) init ()
114 objcObject = ret; 200 {
115 201 return invokeObjcSelf!(typeof(this), "init");
116 dObject = this;
117 } 202 }
118 203
119 Object delegate_ () 204 Object delegate_ ()
120 { 205 {
121 return invokeObjcSelf!(Object, "delegate"); 206 return invokeObjcSelf!(Object, "delegate");
257 } 342 }
258 } 343 }
259 344
260 class NSMetadataQueryAttributeValueTuple : NSObject 345 class NSMetadataQueryAttributeValueTuple : NSObject
261 { 346 {
262 mixin ObjcWrap; 347 mixin (ObjcWrap);
348
349 this ()
350 {
351 super(typeof(this).alloc.init.objcObject);
352 }
353
354 typeof(this) init ()
355 {
356 return invokeObjcSelf!(typeof(this), "init");
357 }
263 358
264 NSString attribute () 359 NSString attribute ()
265 { 360 {
266 return invokeObjcSelf!(NSString, "attribute"); 361 return invokeObjcSelf!(NSString, "attribute");
267 } 362 }
274 NSUInteger count () 369 NSUInteger count ()
275 { 370 {
276 return invokeObjcSelf!(NSUInteger, "count"); 371 return invokeObjcSelf!(NSUInteger, "count");
277 } 372 }
278 } 373 }
279
280 template TNSMetadataQueryDelegate ()
281 {
282 Object metadataQuery (NSMetadataQuery query, NSMetadataItem result);
283 Object metadataQuery (NSMetadataQuery query, NSString attrName, Object attrValue);
284 }
285