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!(
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!(
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!(
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!(
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>;
}
);