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