use crate::common::*;
use crate::Foundation::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "Foundation_NSMetadataQuery")]
pub struct NSMetadataQuery;
#[cfg(feature = "Foundation_NSMetadataQuery")]
unsafe impl ClassType for NSMetadataQuery {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Foundation_NSMetadataQuery")]
unsafe impl NSObjectProtocol for NSMetadataQuery {}
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataQuery")]
unsafe impl NSMetadataQuery {
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSMetadataQueryDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSMetadataQueryDelegate>>,
);
#[cfg(feature = "Foundation_NSPredicate")]
#[method_id(@__retain_semantics Other predicate)]
pub unsafe fn predicate(&self) -> Option<Id<NSPredicate>>;
#[cfg(feature = "Foundation_NSPredicate")]
#[method(setPredicate:)]
pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);
#[cfg(all(
feature = "Foundation_NSArray",
feature = "Foundation_NSSortDescriptor"
))]
#[method_id(@__retain_semantics Other sortDescriptors)]
pub unsafe fn sortDescriptors(&self) -> Id<NSArray<NSSortDescriptor>>;
#[cfg(all(
feature = "Foundation_NSArray",
feature = "Foundation_NSSortDescriptor"
))]
#[method(setSortDescriptors:)]
pub unsafe fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
#[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
#[method_id(@__retain_semantics Other valueListAttributes)]
pub unsafe fn valueListAttributes(&self) -> Id<NSArray<NSString>>;
#[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
#[method(setValueListAttributes:)]
pub unsafe fn setValueListAttributes(&self, value_list_attributes: &NSArray<NSString>);
#[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
#[method_id(@__retain_semantics Other groupingAttributes)]
pub unsafe fn groupingAttributes(&self) -> Option<Id<NSArray<NSString>>>;
#[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
#[method(setGroupingAttributes:)]
pub unsafe fn setGroupingAttributes(&self, grouping_attributes: Option<&NSArray<NSString>>);
#[method(notificationBatchingInterval)]
pub unsafe fn notificationBatchingInterval(&self) -> NSTimeInterval;
#[method(setNotificationBatchingInterval:)]
pub unsafe fn setNotificationBatchingInterval(
&self,
notification_batching_interval: NSTimeInterval,
);
#[cfg(feature = "Foundation_NSArray")]
#[method_id(@__retain_semantics Other searchScopes)]
pub unsafe fn searchScopes(&self) -> Id<NSArray>;
#[cfg(feature = "Foundation_NSArray")]
#[method(setSearchScopes:)]
pub unsafe fn setSearchScopes(&self, search_scopes: &NSArray);
#[cfg(feature = "Foundation_NSArray")]
#[method_id(@__retain_semantics Other searchItems)]
pub unsafe fn searchItems(&self) -> Option<Id<NSArray>>;
#[cfg(feature = "Foundation_NSArray")]
#[method(setSearchItems:)]
pub unsafe fn setSearchItems(&self, search_items: Option<&NSArray>);
#[cfg(feature = "Foundation_NSOperationQueue")]
#[method_id(@__retain_semantics Other operationQueue)]
pub unsafe fn operationQueue(&self) -> Option<Id<NSOperationQueue>>;
#[cfg(feature = "Foundation_NSOperationQueue")]
#[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) -> Id<AnyObject>;
#[method(enumerateResultsUsingBlock:)]
pub unsafe fn enumerateResultsUsingBlock(
&self,
block: &Block<(NonNull<AnyObject>, NSUInteger, NonNull<Bool>), ()>,
);
#[method(enumerateResultsWithOptions:usingBlock:)]
pub unsafe fn enumerateResultsWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &Block<(NonNull<AnyObject>, NSUInteger, NonNull<Bool>), ()>,
);
#[cfg(feature = "Foundation_NSArray")]
#[method_id(@__retain_semantics Other results)]
pub unsafe fn results(&self) -> Id<NSArray>;
#[method(indexOfResult:)]
pub unsafe fn indexOfResult(&self, result: &AnyObject) -> NSUInteger;
#[cfg(all(
feature = "Foundation_NSArray",
feature = "Foundation_NSDictionary",
feature = "Foundation_NSMetadataQueryAttributeValueTuple",
feature = "Foundation_NSString"
))]
#[method_id(@__retain_semantics Other valueLists)]
pub unsafe fn valueLists(
&self,
) -> Id<NSDictionary<NSString, NSArray<NSMetadataQueryAttributeValueTuple>>>;
#[cfg(all(
feature = "Foundation_NSArray",
feature = "Foundation_NSMetadataQueryResultGroup"
))]
#[method_id(@__retain_semantics Other groupedResults)]
pub unsafe fn groupedResults(&self) -> Id<NSArray<NSMetadataQueryResultGroup>>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other valueOfAttribute:forResultAtIndex:)]
pub unsafe fn valueOfAttribute_forResultAtIndex(
&self,
attr_name: &NSString,
idx: NSUInteger,
) -> Option<Id<AnyObject>>;
}
);
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataQuery")]
unsafe impl NSMetadataQuery {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_protocol!(
pub unsafe trait NSMetadataQueryDelegate: NSObjectProtocol {
#[cfg(all(
feature = "Foundation_NSMetadataItem",
feature = "Foundation_NSMetadataQuery"
))]
#[optional]
#[method_id(@__retain_semantics Other metadataQuery:replacementObjectForResultObject:)]
unsafe fn metadataQuery_replacementObjectForResultObject(
&self,
query: &NSMetadataQuery,
result: &NSMetadataItem,
) -> Id<AnyObject>;
#[cfg(all(
feature = "Foundation_NSMetadataQuery",
feature = "Foundation_NSString"
))]
#[optional]
#[method_id(@__retain_semantics Other metadataQuery:replacementValueForAttribute:value:)]
unsafe fn metadataQuery_replacementValueForAttribute_value(
&self,
query: &NSMetadataQuery,
attr_name: &NSString,
attr_value: &AnyObject,
) -> Id<AnyObject>;
}
unsafe impl ProtocolType for dyn NSMetadataQueryDelegate {}
);
extern_static!(NSMetadataQueryDidStartGatheringNotification: &'static NSNotificationName);
extern_static!(NSMetadataQueryGatheringProgressNotification: &'static NSNotificationName);
extern_static!(NSMetadataQueryDidFinishGatheringNotification: &'static NSNotificationName);
extern_static!(NSMetadataQueryDidUpdateNotification: &'static NSNotificationName);
extern_static!(NSMetadataQueryUpdateAddedItemsKey: &'static NSString);
extern_static!(NSMetadataQueryUpdateChangedItemsKey: &'static NSString);
extern_static!(NSMetadataQueryUpdateRemovedItemsKey: &'static NSString);
extern_static!(NSMetadataQueryResultContentRelevanceAttribute: &'static NSString);
extern_static!(NSMetadataQueryUserHomeScope: &'static NSString);
extern_static!(NSMetadataQueryLocalComputerScope: &'static NSString);
extern_static!(NSMetadataQueryNetworkScope: &'static NSString);
extern_static!(NSMetadataQueryIndexedLocalComputerScope: &'static NSString);
extern_static!(NSMetadataQueryIndexedNetworkScope: &'static NSString);
extern_static!(NSMetadataQueryUbiquitousDocumentsScope: &'static NSString);
extern_static!(NSMetadataQueryUbiquitousDataScope: &'static NSString);
extern_static!(NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope: &'static NSString);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "Foundation_NSMetadataItem")]
pub struct NSMetadataItem;
#[cfg(feature = "Foundation_NSMetadataItem")]
unsafe impl ClassType for NSMetadataItem {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Foundation_NSMetadataItem")]
unsafe impl NSObjectProtocol for NSMetadataItem {}
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataItem")]
unsafe impl NSMetadataItem {
#[cfg(feature = "Foundation_NSURL")]
#[method_id(@__retain_semantics Init initWithURL:)]
pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Id<Self>>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other valueForAttribute:)]
pub unsafe fn valueForAttribute(&self, key: &NSString) -> Option<Id<AnyObject>>;
#[cfg(all(
feature = "Foundation_NSArray",
feature = "Foundation_NSDictionary",
feature = "Foundation_NSString"
))]
#[method_id(@__retain_semantics Other valuesForAttributes:)]
pub unsafe fn valuesForAttributes(
&self,
keys: &NSArray<NSString>,
) -> Option<Id<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
#[method_id(@__retain_semantics Other attributes)]
pub unsafe fn attributes(&self) -> Id<NSArray<NSString>>;
}
);
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataItem")]
unsafe impl NSMetadataItem {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "Foundation_NSMetadataQueryAttributeValueTuple")]
pub struct NSMetadataQueryAttributeValueTuple;
#[cfg(feature = "Foundation_NSMetadataQueryAttributeValueTuple")]
unsafe impl ClassType for NSMetadataQueryAttributeValueTuple {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Foundation_NSMetadataQueryAttributeValueTuple")]
unsafe impl NSObjectProtocol for NSMetadataQueryAttributeValueTuple {}
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataQueryAttributeValueTuple")]
unsafe impl NSMetadataQueryAttributeValueTuple {
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other attribute)]
pub unsafe fn attribute(&self) -> Id<NSString>;
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Option<Id<AnyObject>>;
#[method(count)]
pub unsafe fn count(&self) -> NSUInteger;
}
);
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataQueryAttributeValueTuple")]
unsafe impl NSMetadataQueryAttributeValueTuple {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "Foundation_NSMetadataQueryResultGroup")]
pub struct NSMetadataQueryResultGroup;
#[cfg(feature = "Foundation_NSMetadataQueryResultGroup")]
unsafe impl ClassType for NSMetadataQueryResultGroup {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Foundation_NSMetadataQueryResultGroup")]
unsafe impl NSObjectProtocol for NSMetadataQueryResultGroup {}
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataQueryResultGroup")]
unsafe impl NSMetadataQueryResultGroup {
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other attribute)]
pub unsafe fn attribute(&self) -> Id<NSString>;
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Id<AnyObject>;
#[cfg(feature = "Foundation_NSArray")]
#[method_id(@__retain_semantics Other subgroups)]
pub unsafe fn subgroups(&self) -> Option<Id<NSArray<NSMetadataQueryResultGroup>>>;
#[method(resultCount)]
pub unsafe fn resultCount(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other resultAtIndex:)]
pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Id<AnyObject>;
#[cfg(feature = "Foundation_NSArray")]
#[method_id(@__retain_semantics Other results)]
pub unsafe fn results(&self) -> Id<NSArray>;
}
);
extern_methods!(
#[cfg(feature = "Foundation_NSMetadataQueryResultGroup")]
unsafe impl NSMetadataQueryResultGroup {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);