objc2_foundation/generated/
NSMetadata.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSObject))]
12 #[derive(Debug, PartialEq, Eq, Hash)]
13 pub struct NSMetadataQuery;
14);
15
16unsafe impl NSObjectProtocol for NSMetadataQuery {}
17
18impl NSMetadataQuery {
19 extern_methods!(
20 #[unsafe(method(delegate))]
21 #[unsafe(method_family = none)]
22 pub unsafe fn delegate(
23 &self,
24 ) -> Option<Retained<ProtocolObject<dyn NSMetadataQueryDelegate>>>;
25
26 #[unsafe(method(setDelegate:))]
28 #[unsafe(method_family = none)]
29 pub unsafe fn setDelegate(
30 &self,
31 delegate: Option<&ProtocolObject<dyn NSMetadataQueryDelegate>>,
32 );
33
34 #[cfg(feature = "NSPredicate")]
35 #[unsafe(method(predicate))]
36 #[unsafe(method_family = none)]
37 pub unsafe fn predicate(&self) -> Option<Retained<NSPredicate>>;
38
39 #[cfg(feature = "NSPredicate")]
40 #[unsafe(method(setPredicate:))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);
44
45 #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
46 #[unsafe(method(sortDescriptors))]
47 #[unsafe(method_family = none)]
48 pub unsafe fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;
49
50 #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
51 #[unsafe(method(setSortDescriptors:))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
55
56 #[cfg(all(feature = "NSArray", feature = "NSString"))]
57 #[unsafe(method(valueListAttributes))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn valueListAttributes(&self) -> Retained<NSArray<NSString>>;
60
61 #[cfg(all(feature = "NSArray", feature = "NSString"))]
62 #[unsafe(method(setValueListAttributes:))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn setValueListAttributes(&self, value_list_attributes: &NSArray<NSString>);
66
67 #[cfg(all(feature = "NSArray", feature = "NSString"))]
68 #[unsafe(method(groupingAttributes))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn groupingAttributes(&self) -> Option<Retained<NSArray<NSString>>>;
71
72 #[cfg(all(feature = "NSArray", feature = "NSString"))]
73 #[unsafe(method(setGroupingAttributes:))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn setGroupingAttributes(&self, grouping_attributes: Option<&NSArray<NSString>>);
77
78 #[cfg(feature = "NSDate")]
79 #[unsafe(method(notificationBatchingInterval))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn notificationBatchingInterval(&self) -> NSTimeInterval;
82
83 #[cfg(feature = "NSDate")]
84 #[unsafe(method(setNotificationBatchingInterval:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn setNotificationBatchingInterval(
88 &self,
89 notification_batching_interval: NSTimeInterval,
90 );
91
92 #[cfg(feature = "NSArray")]
93 #[unsafe(method(searchScopes))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn searchScopes(&self) -> Retained<NSArray>;
96
97 #[cfg(feature = "NSArray")]
98 #[unsafe(method(setSearchScopes:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn setSearchScopes(&self, search_scopes: &NSArray);
102
103 #[cfg(feature = "NSArray")]
104 #[unsafe(method(searchItems))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn searchItems(&self) -> Option<Retained<NSArray>>;
107
108 #[cfg(feature = "NSArray")]
109 #[unsafe(method(setSearchItems:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn setSearchItems(&self, search_items: Option<&NSArray>);
113
114 #[cfg(feature = "NSOperation")]
115 #[unsafe(method(operationQueue))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn operationQueue(&self) -> Option<Retained<NSOperationQueue>>;
118
119 #[cfg(feature = "NSOperation")]
120 #[unsafe(method(setOperationQueue:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn setOperationQueue(&self, operation_queue: Option<&NSOperationQueue>);
124
125 #[unsafe(method(startQuery))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn startQuery(&self) -> bool;
128
129 #[unsafe(method(stopQuery))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn stopQuery(&self);
132
133 #[unsafe(method(isStarted))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn isStarted(&self) -> bool;
136
137 #[unsafe(method(isGathering))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn isGathering(&self) -> bool;
140
141 #[unsafe(method(isStopped))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn isStopped(&self) -> bool;
144
145 #[unsafe(method(disableUpdates))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn disableUpdates(&self);
148
149 #[unsafe(method(enableUpdates))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn enableUpdates(&self);
152
153 #[unsafe(method(resultCount))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn resultCount(&self) -> NSUInteger;
156
157 #[unsafe(method(resultAtIndex:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;
160
161 #[cfg(feature = "block2")]
162 #[unsafe(method(enumerateResultsUsingBlock:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn enumerateResultsUsingBlock(
165 &self,
166 block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
167 );
168
169 #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
170 #[unsafe(method(enumerateResultsWithOptions:usingBlock:))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn enumerateResultsWithOptions_usingBlock(
173 &self,
174 opts: NSEnumerationOptions,
175 block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
176 );
177
178 #[cfg(feature = "NSArray")]
179 #[unsafe(method(results))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn results(&self) -> Retained<NSArray>;
182
183 #[unsafe(method(indexOfResult:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn indexOfResult(&self, result: &AnyObject) -> NSUInteger;
186
187 #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
188 #[unsafe(method(valueLists))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn valueLists(
191 &self,
192 ) -> Retained<NSDictionary<NSString, NSArray<NSMetadataQueryAttributeValueTuple>>>;
193
194 #[cfg(feature = "NSArray")]
195 #[unsafe(method(groupedResults))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn groupedResults(&self) -> Retained<NSArray<NSMetadataQueryResultGroup>>;
198
199 #[cfg(feature = "NSString")]
200 #[unsafe(method(valueOfAttribute:forResultAtIndex:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn valueOfAttribute_forResultAtIndex(
203 &self,
204 attr_name: &NSString,
205 idx: NSUInteger,
206 ) -> Option<Retained<AnyObject>>;
207 );
208}
209
210impl NSMetadataQuery {
212 extern_methods!(
213 #[unsafe(method(init))]
214 #[unsafe(method_family = init)]
215 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
216
217 #[unsafe(method(new))]
218 #[unsafe(method_family = new)]
219 pub unsafe fn new() -> Retained<Self>;
220 );
221}
222
223extern_protocol!(
224 pub unsafe trait NSMetadataQueryDelegate: NSObjectProtocol {
226 #[optional]
227 #[unsafe(method(metadataQuery:replacementObjectForResultObject:))]
228 #[unsafe(method_family = none)]
229 unsafe fn metadataQuery_replacementObjectForResultObject(
230 &self,
231 query: &NSMetadataQuery,
232 result: &NSMetadataItem,
233 ) -> Retained<AnyObject>;
234
235 #[cfg(feature = "NSString")]
236 #[optional]
237 #[unsafe(method(metadataQuery:replacementValueForAttribute:value:))]
238 #[unsafe(method_family = none)]
239 unsafe fn metadataQuery_replacementValueForAttribute_value(
240 &self,
241 query: &NSMetadataQuery,
242 attr_name: &NSString,
243 attr_value: &AnyObject,
244 ) -> Retained<AnyObject>;
245 }
246);
247
248extern "C" {
249 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
251 pub static NSMetadataQueryDidStartGatheringNotification: &'static NSNotificationName;
252}
253
254extern "C" {
255 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
257 pub static NSMetadataQueryGatheringProgressNotification: &'static NSNotificationName;
258}
259
260extern "C" {
261 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
263 pub static NSMetadataQueryDidFinishGatheringNotification: &'static NSNotificationName;
264}
265
266extern "C" {
267 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
269 pub static NSMetadataQueryDidUpdateNotification: &'static NSNotificationName;
270}
271
272extern "C" {
273 #[cfg(feature = "NSString")]
275 pub static NSMetadataQueryUpdateAddedItemsKey: &'static NSString;
276}
277
278extern "C" {
279 #[cfg(feature = "NSString")]
281 pub static NSMetadataQueryUpdateChangedItemsKey: &'static NSString;
282}
283
284extern "C" {
285 #[cfg(feature = "NSString")]
287 pub static NSMetadataQueryUpdateRemovedItemsKey: &'static NSString;
288}
289
290extern "C" {
291 #[cfg(feature = "NSString")]
293 pub static NSMetadataQueryResultContentRelevanceAttribute: &'static NSString;
294}
295
296extern "C" {
297 #[cfg(feature = "NSString")]
299 pub static NSMetadataQueryUserHomeScope: &'static NSString;
300}
301
302extern "C" {
303 #[cfg(feature = "NSString")]
305 pub static NSMetadataQueryLocalComputerScope: &'static NSString;
306}
307
308extern "C" {
309 #[cfg(feature = "NSString")]
311 pub static NSMetadataQueryNetworkScope: &'static NSString;
312}
313
314extern "C" {
315 #[cfg(feature = "NSString")]
317 pub static NSMetadataQueryIndexedLocalComputerScope: &'static NSString;
318}
319
320extern "C" {
321 #[cfg(feature = "NSString")]
323 pub static NSMetadataQueryIndexedNetworkScope: &'static NSString;
324}
325
326extern "C" {
327 #[cfg(feature = "NSString")]
329 pub static NSMetadataQueryUbiquitousDocumentsScope: &'static NSString;
330}
331
332extern "C" {
333 #[cfg(feature = "NSString")]
335 pub static NSMetadataQueryUbiquitousDataScope: &'static NSString;
336}
337
338extern "C" {
339 #[cfg(feature = "NSString")]
341 pub static NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope: &'static NSString;
342}
343
344extern_class!(
345 #[unsafe(super(NSObject))]
347 #[derive(Debug, PartialEq, Eq, Hash)]
348 pub struct NSMetadataItem;
349);
350
351unsafe impl NSObjectProtocol for NSMetadataItem {}
352
353impl NSMetadataItem {
354 extern_methods!(
355 #[cfg(feature = "NSURL")]
356 #[unsafe(method(initWithURL:))]
357 #[unsafe(method_family = init)]
358 pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;
359
360 #[cfg(feature = "NSString")]
361 #[unsafe(method(valueForAttribute:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn valueForAttribute(&self, key: &NSString) -> Option<Retained<AnyObject>>;
364
365 #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
366 #[unsafe(method(valuesForAttributes:))]
367 #[unsafe(method_family = none)]
368 pub unsafe fn valuesForAttributes(
369 &self,
370 keys: &NSArray<NSString>,
371 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
372
373 #[cfg(all(feature = "NSArray", feature = "NSString"))]
374 #[unsafe(method(attributes))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn attributes(&self) -> Retained<NSArray<NSString>>;
377 );
378}
379
380impl NSMetadataItem {
382 extern_methods!(
383 #[unsafe(method(init))]
384 #[unsafe(method_family = init)]
385 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
386
387 #[unsafe(method(new))]
388 #[unsafe(method_family = new)]
389 pub unsafe fn new() -> Retained<Self>;
390 );
391}
392
393extern_class!(
394 #[unsafe(super(NSObject))]
396 #[derive(Debug, PartialEq, Eq, Hash)]
397 pub struct NSMetadataQueryAttributeValueTuple;
398);
399
400unsafe impl NSObjectProtocol for NSMetadataQueryAttributeValueTuple {}
401
402impl NSMetadataQueryAttributeValueTuple {
403 extern_methods!(
404 #[cfg(feature = "NSString")]
405 #[unsafe(method(attribute))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn attribute(&self) -> Retained<NSString>;
408
409 #[unsafe(method(value))]
410 #[unsafe(method_family = none)]
411 pub unsafe fn value(&self) -> Option<Retained<AnyObject>>;
412
413 #[unsafe(method(count))]
414 #[unsafe(method_family = none)]
415 pub unsafe fn count(&self) -> NSUInteger;
416 );
417}
418
419impl NSMetadataQueryAttributeValueTuple {
421 extern_methods!(
422 #[unsafe(method(init))]
423 #[unsafe(method_family = init)]
424 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
425
426 #[unsafe(method(new))]
427 #[unsafe(method_family = new)]
428 pub unsafe fn new() -> Retained<Self>;
429 );
430}
431
432extern_class!(
433 #[unsafe(super(NSObject))]
435 #[derive(Debug, PartialEq, Eq, Hash)]
436 pub struct NSMetadataQueryResultGroup;
437);
438
439unsafe impl NSObjectProtocol for NSMetadataQueryResultGroup {}
440
441impl NSMetadataQueryResultGroup {
442 extern_methods!(
443 #[cfg(feature = "NSString")]
444 #[unsafe(method(attribute))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn attribute(&self) -> Retained<NSString>;
447
448 #[unsafe(method(value))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn value(&self) -> Retained<AnyObject>;
451
452 #[cfg(feature = "NSArray")]
453 #[unsafe(method(subgroups))]
454 #[unsafe(method_family = none)]
455 pub unsafe fn subgroups(&self) -> Option<Retained<NSArray<NSMetadataQueryResultGroup>>>;
456
457 #[unsafe(method(resultCount))]
458 #[unsafe(method_family = none)]
459 pub unsafe fn resultCount(&self) -> NSUInteger;
460
461 #[unsafe(method(resultAtIndex:))]
462 #[unsafe(method_family = none)]
463 pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;
464
465 #[cfg(feature = "NSArray")]
466 #[unsafe(method(results))]
467 #[unsafe(method_family = none)]
468 pub unsafe fn results(&self) -> Retained<NSArray>;
469 );
470}
471
472impl NSMetadataQueryResultGroup {
474 extern_methods!(
475 #[unsafe(method(init))]
476 #[unsafe(method_family = init)]
477 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
478
479 #[unsafe(method(new))]
480 #[unsafe(method_family = new)]
481 pub unsafe fn new() -> Retained<Self>;
482 );
483}