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))]
26 #[unsafe(method_family = none)]
27 pub unsafe fn delegate(
28 &self,
29 ) -> Option<Retained<ProtocolObject<dyn NSMetadataQueryDelegate>>>;
30
31 #[unsafe(method(setDelegate:))]
37 #[unsafe(method_family = none)]
38 pub unsafe fn setDelegate(
39 &self,
40 delegate: Option<&ProtocolObject<dyn NSMetadataQueryDelegate>>,
41 );
42
43 #[cfg(feature = "NSPredicate")]
44 #[unsafe(method(predicate))]
45 #[unsafe(method_family = none)]
46 pub fn predicate(&self) -> Option<Retained<NSPredicate>>;
47
48 #[cfg(feature = "NSPredicate")]
49 #[unsafe(method(setPredicate:))]
53 #[unsafe(method_family = none)]
54 pub fn setPredicate(&self, predicate: Option<&NSPredicate>);
55
56 #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
57 #[unsafe(method(sortDescriptors))]
58 #[unsafe(method_family = none)]
59 pub fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;
60
61 #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
62 #[unsafe(method(setSortDescriptors:))]
66 #[unsafe(method_family = none)]
67 pub fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
68
69 #[cfg(all(feature = "NSArray", feature = "NSString"))]
70 #[unsafe(method(valueListAttributes))]
71 #[unsafe(method_family = none)]
72 pub fn valueListAttributes(&self) -> Retained<NSArray<NSString>>;
73
74 #[cfg(all(feature = "NSArray", feature = "NSString"))]
75 #[unsafe(method(setValueListAttributes:))]
79 #[unsafe(method_family = none)]
80 pub fn setValueListAttributes(&self, value_list_attributes: &NSArray<NSString>);
81
82 #[cfg(all(feature = "NSArray", feature = "NSString"))]
83 #[unsafe(method(groupingAttributes))]
84 #[unsafe(method_family = none)]
85 pub fn groupingAttributes(&self) -> Option<Retained<NSArray<NSString>>>;
86
87 #[cfg(all(feature = "NSArray", feature = "NSString"))]
88 #[unsafe(method(setGroupingAttributes:))]
92 #[unsafe(method_family = none)]
93 pub fn setGroupingAttributes(&self, grouping_attributes: Option<&NSArray<NSString>>);
94
95 #[cfg(feature = "NSDate")]
96 #[unsafe(method(notificationBatchingInterval))]
97 #[unsafe(method_family = none)]
98 pub fn notificationBatchingInterval(&self) -> NSTimeInterval;
99
100 #[cfg(feature = "NSDate")]
101 #[unsafe(method(setNotificationBatchingInterval:))]
103 #[unsafe(method_family = none)]
104 pub fn setNotificationBatchingInterval(
105 &self,
106 notification_batching_interval: NSTimeInterval,
107 );
108
109 #[cfg(feature = "NSArray")]
110 #[unsafe(method(searchScopes))]
111 #[unsafe(method_family = none)]
112 pub fn searchScopes(&self) -> Retained<NSArray>;
113
114 #[cfg(feature = "NSArray")]
115 #[unsafe(method(setSearchScopes:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn setSearchScopes(&self, search_scopes: &NSArray);
125
126 #[cfg(feature = "NSArray")]
127 #[unsafe(method(searchItems))]
128 #[unsafe(method_family = none)]
129 pub fn searchItems(&self) -> Option<Retained<NSArray>>;
130
131 #[cfg(feature = "NSArray")]
132 #[unsafe(method(setSearchItems:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn setSearchItems(&self, search_items: Option<&NSArray>);
142
143 #[cfg(feature = "NSOperation")]
144 #[unsafe(method(operationQueue))]
145 #[unsafe(method_family = none)]
146 pub fn operationQueue(&self) -> Option<Retained<NSOperationQueue>>;
147
148 #[cfg(feature = "NSOperation")]
149 #[unsafe(method(setOperationQueue:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn setOperationQueue(&self, operation_queue: Option<&NSOperationQueue>);
157
158 #[unsafe(method(startQuery))]
159 #[unsafe(method_family = none)]
160 pub fn startQuery(&self) -> bool;
161
162 #[unsafe(method(stopQuery))]
163 #[unsafe(method_family = none)]
164 pub fn stopQuery(&self);
165
166 #[unsafe(method(isStarted))]
167 #[unsafe(method_family = none)]
168 pub fn isStarted(&self) -> bool;
169
170 #[unsafe(method(isGathering))]
171 #[unsafe(method_family = none)]
172 pub fn isGathering(&self) -> bool;
173
174 #[unsafe(method(isStopped))]
175 #[unsafe(method_family = none)]
176 pub fn isStopped(&self) -> bool;
177
178 #[unsafe(method(disableUpdates))]
179 #[unsafe(method_family = none)]
180 pub fn disableUpdates(&self);
181
182 #[unsafe(method(enableUpdates))]
183 #[unsafe(method_family = none)]
184 pub fn enableUpdates(&self);
185
186 #[unsafe(method(resultCount))]
187 #[unsafe(method_family = none)]
188 pub fn resultCount(&self) -> NSUInteger;
189
190 #[unsafe(method(resultAtIndex:))]
191 #[unsafe(method_family = none)]
192 pub fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;
193
194 #[cfg(feature = "block2")]
195 #[unsafe(method(enumerateResultsUsingBlock:))]
196 #[unsafe(method_family = none)]
197 pub fn enumerateResultsUsingBlock(
198 &self,
199 block: &block2::DynBlock<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
200 );
201
202 #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
203 #[unsafe(method(enumerateResultsWithOptions:usingBlock:))]
204 #[unsafe(method_family = none)]
205 pub fn enumerateResultsWithOptions_usingBlock(
206 &self,
207 opts: NSEnumerationOptions,
208 block: &block2::DynBlock<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
209 );
210
211 #[cfg(feature = "NSArray")]
212 #[unsafe(method(results))]
213 #[unsafe(method_family = none)]
214 pub fn results(&self) -> Retained<NSArray>;
215
216 #[unsafe(method(indexOfResult:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn indexOfResult(&self, result: &AnyObject) -> NSUInteger;
222
223 #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
224 #[unsafe(method(valueLists))]
225 #[unsafe(method_family = none)]
226 pub fn valueLists(
227 &self,
228 ) -> Retained<NSDictionary<NSString, NSArray<NSMetadataQueryAttributeValueTuple>>>;
229
230 #[cfg(feature = "NSArray")]
231 #[unsafe(method(groupedResults))]
232 #[unsafe(method_family = none)]
233 pub fn groupedResults(&self) -> Retained<NSArray<NSMetadataQueryResultGroup>>;
234
235 #[cfg(feature = "NSString")]
236 #[unsafe(method(valueOfAttribute:forResultAtIndex:))]
237 #[unsafe(method_family = none)]
238 pub fn valueOfAttribute_forResultAtIndex(
239 &self,
240 attr_name: &NSString,
241 idx: NSUInteger,
242 ) -> Option<Retained<AnyObject>>;
243 );
244}
245
246impl NSMetadataQuery {
248 extern_methods!(
249 #[unsafe(method(init))]
250 #[unsafe(method_family = init)]
251 pub fn init(this: Allocated<Self>) -> Retained<Self>;
252
253 #[unsafe(method(new))]
254 #[unsafe(method_family = new)]
255 pub fn new() -> Retained<Self>;
256 );
257}
258
259impl DefaultRetained for NSMetadataQuery {
260 #[inline]
261 fn default_retained() -> Retained<Self> {
262 Self::new()
263 }
264}
265
266extern_protocol!(
267 pub unsafe trait NSMetadataQueryDelegate: NSObjectProtocol {
269 #[optional]
270 #[unsafe(method(metadataQuery:replacementObjectForResultObject:))]
271 #[unsafe(method_family = none)]
272 fn metadataQuery_replacementObjectForResultObject(
273 &self,
274 query: &NSMetadataQuery,
275 result: &NSMetadataItem,
276 ) -> Retained<AnyObject>;
277
278 #[cfg(feature = "NSString")]
279 #[optional]
283 #[unsafe(method(metadataQuery:replacementValueForAttribute:value:))]
284 #[unsafe(method_family = none)]
285 unsafe fn metadataQuery_replacementValueForAttribute_value(
286 &self,
287 query: &NSMetadataQuery,
288 attr_name: &NSString,
289 attr_value: &AnyObject,
290 ) -> Retained<AnyObject>;
291 }
292);
293
294extern "C" {
295 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
297 pub static NSMetadataQueryDidStartGatheringNotification: &'static NSNotificationName;
298}
299
300extern "C" {
301 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
303 pub static NSMetadataQueryGatheringProgressNotification: &'static NSNotificationName;
304}
305
306extern "C" {
307 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
309 pub static NSMetadataQueryDidFinishGatheringNotification: &'static NSNotificationName;
310}
311
312extern "C" {
313 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
315 pub static NSMetadataQueryDidUpdateNotification: &'static NSNotificationName;
316}
317
318extern "C" {
319 #[cfg(feature = "NSString")]
321 pub static NSMetadataQueryUpdateAddedItemsKey: &'static NSString;
322}
323
324extern "C" {
325 #[cfg(feature = "NSString")]
327 pub static NSMetadataQueryUpdateChangedItemsKey: &'static NSString;
328}
329
330extern "C" {
331 #[cfg(feature = "NSString")]
333 pub static NSMetadataQueryUpdateRemovedItemsKey: &'static NSString;
334}
335
336extern "C" {
337 #[cfg(feature = "NSString")]
339 pub static NSMetadataQueryResultContentRelevanceAttribute: &'static NSString;
340}
341
342extern "C" {
343 #[cfg(feature = "NSString")]
345 pub static NSMetadataQueryUserHomeScope: &'static NSString;
346}
347
348extern "C" {
349 #[cfg(feature = "NSString")]
351 pub static NSMetadataQueryLocalComputerScope: &'static NSString;
352}
353
354extern "C" {
355 #[cfg(feature = "NSString")]
357 pub static NSMetadataQueryNetworkScope: &'static NSString;
358}
359
360extern "C" {
361 #[cfg(feature = "NSString")]
363 pub static NSMetadataQueryIndexedLocalComputerScope: &'static NSString;
364}
365
366extern "C" {
367 #[cfg(feature = "NSString")]
369 pub static NSMetadataQueryIndexedNetworkScope: &'static NSString;
370}
371
372extern "C" {
373 #[cfg(feature = "NSString")]
375 pub static NSMetadataQueryUbiquitousDocumentsScope: &'static NSString;
376}
377
378extern "C" {
379 #[cfg(feature = "NSString")]
381 pub static NSMetadataQueryUbiquitousDataScope: &'static NSString;
382}
383
384extern "C" {
385 #[cfg(feature = "NSString")]
387 pub static NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope: &'static NSString;
388}
389
390extern_class!(
391 #[unsafe(super(NSObject))]
393 #[derive(Debug, PartialEq, Eq, Hash)]
394 pub struct NSMetadataItem;
395);
396
397extern_conformance!(
398 unsafe impl NSObjectProtocol for NSMetadataItem {}
399);
400
401impl NSMetadataItem {
402 extern_methods!(
403 #[cfg(feature = "NSURL")]
404 #[unsafe(method(initWithURL:))]
405 #[unsafe(method_family = init)]
406 pub fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;
407
408 #[cfg(feature = "NSString")]
409 #[unsafe(method(valueForAttribute:))]
410 #[unsafe(method_family = none)]
411 pub fn valueForAttribute(&self, key: &NSString) -> Option<Retained<AnyObject>>;
412
413 #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
414 #[unsafe(method(valuesForAttributes:))]
415 #[unsafe(method_family = none)]
416 pub fn valuesForAttributes(
417 &self,
418 keys: &NSArray<NSString>,
419 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
420
421 #[cfg(all(feature = "NSArray", feature = "NSString"))]
422 #[unsafe(method(attributes))]
423 #[unsafe(method_family = none)]
424 pub fn attributes(&self) -> Retained<NSArray<NSString>>;
425 );
426}
427
428impl NSMetadataItem {
430 extern_methods!(
431 #[unsafe(method(init))]
432 #[unsafe(method_family = init)]
433 pub fn init(this: Allocated<Self>) -> Retained<Self>;
434
435 #[unsafe(method(new))]
436 #[unsafe(method_family = new)]
437 pub fn new() -> Retained<Self>;
438 );
439}
440
441impl DefaultRetained for NSMetadataItem {
442 #[inline]
443 fn default_retained() -> Retained<Self> {
444 Self::new()
445 }
446}
447
448extern_class!(
449 #[unsafe(super(NSObject))]
451 #[derive(Debug, PartialEq, Eq, Hash)]
452 pub struct NSMetadataQueryAttributeValueTuple;
453);
454
455extern_conformance!(
456 unsafe impl NSObjectProtocol for NSMetadataQueryAttributeValueTuple {}
457);
458
459impl NSMetadataQueryAttributeValueTuple {
460 extern_methods!(
461 #[cfg(feature = "NSString")]
462 #[unsafe(method(attribute))]
463 #[unsafe(method_family = none)]
464 pub fn attribute(&self) -> Retained<NSString>;
465
466 #[unsafe(method(value))]
467 #[unsafe(method_family = none)]
468 pub fn value(&self) -> Option<Retained<AnyObject>>;
469
470 #[unsafe(method(count))]
471 #[unsafe(method_family = none)]
472 pub fn count(&self) -> NSUInteger;
473 );
474}
475
476impl NSMetadataQueryAttributeValueTuple {
478 extern_methods!(
479 #[unsafe(method(init))]
480 #[unsafe(method_family = init)]
481 pub fn init(this: Allocated<Self>) -> Retained<Self>;
482
483 #[unsafe(method(new))]
484 #[unsafe(method_family = new)]
485 pub fn new() -> Retained<Self>;
486 );
487}
488
489impl DefaultRetained for NSMetadataQueryAttributeValueTuple {
490 #[inline]
491 fn default_retained() -> Retained<Self> {
492 Self::new()
493 }
494}
495
496extern_class!(
497 #[unsafe(super(NSObject))]
499 #[derive(Debug, PartialEq, Eq, Hash)]
500 pub struct NSMetadataQueryResultGroup;
501);
502
503extern_conformance!(
504 unsafe impl NSObjectProtocol for NSMetadataQueryResultGroup {}
505);
506
507impl NSMetadataQueryResultGroup {
508 extern_methods!(
509 #[cfg(feature = "NSString")]
510 #[unsafe(method(attribute))]
511 #[unsafe(method_family = none)]
512 pub fn attribute(&self) -> Retained<NSString>;
513
514 #[unsafe(method(value))]
515 #[unsafe(method_family = none)]
516 pub fn value(&self) -> Retained<AnyObject>;
517
518 #[cfg(feature = "NSArray")]
519 #[unsafe(method(subgroups))]
520 #[unsafe(method_family = none)]
521 pub fn subgroups(&self) -> Option<Retained<NSArray<NSMetadataQueryResultGroup>>>;
522
523 #[unsafe(method(resultCount))]
524 #[unsafe(method_family = none)]
525 pub fn resultCount(&self) -> NSUInteger;
526
527 #[unsafe(method(resultAtIndex:))]
528 #[unsafe(method_family = none)]
529 pub fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;
530
531 #[cfg(feature = "NSArray")]
532 #[unsafe(method(results))]
533 #[unsafe(method_family = none)]
534 pub fn results(&self) -> Retained<NSArray>;
535 );
536}
537
538impl NSMetadataQueryResultGroup {
540 extern_methods!(
541 #[unsafe(method(init))]
542 #[unsafe(method_family = init)]
543 pub fn init(this: Allocated<Self>) -> Retained<Self>;
544
545 #[unsafe(method(new))]
546 #[unsafe(method_family = new)]
547 pub fn new() -> Retained<Self>;
548 );
549}
550
551impl DefaultRetained for NSMetadataQueryResultGroup {
552 #[inline]
553 fn default_retained() -> Retained<Self> {
554 Self::new()
555 }
556}