1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMetadataQuery;

    unsafe impl ClassType for NSMetadataQuery {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSMetadataQuery {}

extern_methods!(
    unsafe impl NSMetadataQuery {
        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSMetadataQueryDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSMetadataQueryDelegate>>,
        );

        #[cfg(feature = "NSPredicate")]
        #[method_id(@__retain_semantics Other predicate)]
        pub unsafe fn predicate(&self) -> Option<Retained<NSPredicate>>;

        #[cfg(feature = "NSPredicate")]
        #[method(setPredicate:)]
        pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);

        #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
        #[method_id(@__retain_semantics Other sortDescriptors)]
        pub unsafe fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;

        #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
        #[method(setSortDescriptors:)]
        pub unsafe fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[method_id(@__retain_semantics Other valueListAttributes)]
        pub unsafe fn valueListAttributes(&self) -> Retained<NSArray<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[method(setValueListAttributes:)]
        pub unsafe fn setValueListAttributes(&self, value_list_attributes: &NSArray<NSString>);

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[method_id(@__retain_semantics Other groupingAttributes)]
        pub unsafe fn groupingAttributes(&self) -> Option<Retained<NSArray<NSString>>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[method(setGroupingAttributes:)]
        pub unsafe fn setGroupingAttributes(&self, grouping_attributes: Option<&NSArray<NSString>>);

        #[cfg(feature = "NSDate")]
        #[method(notificationBatchingInterval)]
        pub unsafe fn notificationBatchingInterval(&self) -> NSTimeInterval;

        #[cfg(feature = "NSDate")]
        #[method(setNotificationBatchingInterval:)]
        pub unsafe fn setNotificationBatchingInterval(
            &self,
            notification_batching_interval: NSTimeInterval,
        );

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other searchScopes)]
        pub unsafe fn searchScopes(&self) -> Retained<NSArray>;

        #[cfg(feature = "NSArray")]
        #[method(setSearchScopes:)]
        pub unsafe fn setSearchScopes(&self, search_scopes: &NSArray);

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other searchItems)]
        pub unsafe fn searchItems(&self) -> Option<Retained<NSArray>>;

        #[cfg(feature = "NSArray")]
        #[method(setSearchItems:)]
        pub unsafe fn setSearchItems(&self, search_items: Option<&NSArray>);

        #[cfg(feature = "NSOperation")]
        #[method_id(@__retain_semantics Other operationQueue)]
        pub unsafe fn operationQueue(&self) -> Option<Retained<NSOperationQueue>>;

        #[cfg(feature = "NSOperation")]
        #[method(setOperationQueue:)]
        pub unsafe fn setOperationQueue(&self, operation_queue: Option<&NSOperationQueue>);

        #[method(startQuery)]
        pub unsafe fn startQuery(&self) -> bool;

        #[method(stopQuery)]
        pub unsafe fn stopQuery(&self);

        #[method(isStarted)]
        pub unsafe fn isStarted(&self) -> bool;

        #[method(isGathering)]
        pub unsafe fn isGathering(&self) -> bool;

        #[method(isStopped)]
        pub unsafe fn isStopped(&self) -> bool;

        #[method(disableUpdates)]
        pub unsafe fn disableUpdates(&self);

        #[method(enableUpdates)]
        pub unsafe fn enableUpdates(&self);

        #[method(resultCount)]
        pub unsafe fn resultCount(&self) -> NSUInteger;

        #[method_id(@__retain_semantics Other resultAtIndex:)]
        pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;

        #[cfg(feature = "block2")]
        #[method(enumerateResultsUsingBlock:)]
        pub unsafe fn enumerateResultsUsingBlock(
            &self,
            block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[method(enumerateResultsWithOptions:usingBlock:)]
        pub unsafe fn enumerateResultsWithOptions_usingBlock(
            &self,
            opts: NSEnumerationOptions,
            block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other results)]
        pub unsafe fn results(&self) -> Retained<NSArray>;

        #[method(indexOfResult:)]
        pub unsafe fn indexOfResult(&self, result: &AnyObject) -> NSUInteger;

        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
        #[method_id(@__retain_semantics Other valueLists)]
        pub unsafe fn valueLists(
            &self,
        ) -> Retained<NSDictionary<NSString, NSArray<NSMetadataQueryAttributeValueTuple>>>;

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other groupedResults)]
        pub unsafe fn groupedResults(&self) -> Retained<NSArray<NSMetadataQueryResultGroup>>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other valueOfAttribute:forResultAtIndex:)]
        pub unsafe fn valueOfAttribute_forResultAtIndex(
            &self,
            attr_name: &NSString,
            idx: NSUInteger,
        ) -> Option<Retained<AnyObject>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSMetadataQuery {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_protocol!(
    pub unsafe trait NSMetadataQueryDelegate: NSObjectProtocol {
        #[optional]
        #[method_id(@__retain_semantics Other metadataQuery:replacementObjectForResultObject:)]
        unsafe fn metadataQuery_replacementObjectForResultObject(
            &self,
            query: &NSMetadataQuery,
            result: &NSMetadataItem,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[optional]
        #[method_id(@__retain_semantics Other metadataQuery:replacementValueForAttribute:value:)]
        unsafe fn metadataQuery_replacementValueForAttribute_value(
            &self,
            query: &NSMetadataQuery,
            attr_name: &NSString,
            attr_value: &AnyObject,
        ) -> Retained<AnyObject>;
    }

    unsafe impl ProtocolType for dyn NSMetadataQueryDelegate {}
);

extern "C" {
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryDidStartGatheringNotification: &'static NSNotificationName;
}

extern "C" {
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryGatheringProgressNotification: &'static NSNotificationName;
}

extern "C" {
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryDidFinishGatheringNotification: &'static NSNotificationName;
}

extern "C" {
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryDidUpdateNotification: &'static NSNotificationName;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryUpdateAddedItemsKey: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryUpdateChangedItemsKey: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryUpdateRemovedItemsKey: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryResultContentRelevanceAttribute: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryUserHomeScope: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryLocalComputerScope: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryNetworkScope: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryIndexedLocalComputerScope: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryIndexedNetworkScope: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryUbiquitousDocumentsScope: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryUbiquitousDataScope: &'static NSString;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope: &'static NSString;
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMetadataItem;

    unsafe impl ClassType for NSMetadataItem {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSMetadataItem {}

extern_methods!(
    unsafe impl NSMetadataItem {
        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Init initWithURL:)]
        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other valueForAttribute:)]
        pub unsafe fn valueForAttribute(&self, key: &NSString) -> Option<Retained<AnyObject>>;

        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
        #[method_id(@__retain_semantics Other valuesForAttributes:)]
        pub unsafe fn valuesForAttributes(
            &self,
            keys: &NSArray<NSString>,
        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[method_id(@__retain_semantics Other attributes)]
        pub unsafe fn attributes(&self) -> Retained<NSArray<NSString>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSMetadataItem {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMetadataQueryAttributeValueTuple;

    unsafe impl ClassType for NSMetadataQueryAttributeValueTuple {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSMetadataQueryAttributeValueTuple {}

extern_methods!(
    unsafe impl NSMetadataQueryAttributeValueTuple {
        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other attribute)]
        pub unsafe fn attribute(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other value)]
        pub unsafe fn value(&self) -> Option<Retained<AnyObject>>;

        #[method(count)]
        pub unsafe fn count(&self) -> NSUInteger;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSMetadataQueryAttributeValueTuple {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMetadataQueryResultGroup;

    unsafe impl ClassType for NSMetadataQueryResultGroup {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSMetadataQueryResultGroup {}

extern_methods!(
    unsafe impl NSMetadataQueryResultGroup {
        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other attribute)]
        pub unsafe fn attribute(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other value)]
        pub unsafe fn value(&self) -> Retained<AnyObject>;

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other subgroups)]
        pub unsafe fn subgroups(&self) -> Option<Retained<NSArray<NSMetadataQueryResultGroup>>>;

        #[method(resultCount)]
        pub unsafe fn resultCount(&self) -> NSUInteger;

        #[method_id(@__retain_semantics Other resultAtIndex:)]
        pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other results)]
        pub unsafe fn results(&self) -> Retained<NSArray>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSMetadataQueryResultGroup {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);