use crate::common::*;
use crate::Foundation::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMetadataQuery;
unsafe impl ClassType for NSMetadataQuery {
type Super = NSObject;
}
);
extern_methods!(
unsafe impl NSMetadataQuery {
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Id<NSMetadataQueryDelegate, Shared>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&NSMetadataQueryDelegate>);
#[method_id(@__retain_semantics Other predicate)]
pub unsafe fn predicate(&self) -> Option<Id<NSPredicate, Shared>>;
#[method(setPredicate:)]
pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);
#[method_id(@__retain_semantics Other sortDescriptors)]
pub unsafe fn sortDescriptors(&self) -> Id<NSArray<NSSortDescriptor>, Shared>;
#[method(setSortDescriptors:)]
pub unsafe fn setSortDescriptors(&self, sortDescriptors: &NSArray<NSSortDescriptor>);
#[method_id(@__retain_semantics Other valueListAttributes)]
pub unsafe fn valueListAttributes(&self) -> Id<NSArray<NSString>, Shared>;
#[method(setValueListAttributes:)]
pub unsafe fn setValueListAttributes(&self, valueListAttributes: &NSArray<NSString>);
#[method_id(@__retain_semantics Other groupingAttributes)]
pub unsafe fn groupingAttributes(&self) -> Option<Id<NSArray<NSString>, Shared>>;
#[method(setGroupingAttributes:)]
pub unsafe fn setGroupingAttributes(&self, groupingAttributes: Option<&NSArray<NSString>>);
#[method(notificationBatchingInterval)]
pub unsafe fn notificationBatchingInterval(&self) -> NSTimeInterval;
#[method(setNotificationBatchingInterval:)]
pub unsafe fn setNotificationBatchingInterval(
&self,
notificationBatchingInterval: NSTimeInterval,
);
#[method_id(@__retain_semantics Other searchScopes)]
pub unsafe fn searchScopes(&self) -> Id<NSArray, Shared>;
#[method(setSearchScopes:)]
pub unsafe fn setSearchScopes(&self, searchScopes: &NSArray);
#[method_id(@__retain_semantics Other searchItems)]
pub unsafe fn searchItems(&self) -> Option<Id<NSArray, Shared>>;
#[method(setSearchItems:)]
pub unsafe fn setSearchItems(&self, searchItems: Option<&NSArray>);
#[method_id(@__retain_semantics Other operationQueue)]
pub unsafe fn operationQueue(&self) -> Option<Id<NSOperationQueue, Shared>>;
#[method(setOperationQueue:)]
pub unsafe fn setOperationQueue(&self, operationQueue: 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<Object, Shared>;
#[method(enumerateResultsUsingBlock:)]
pub unsafe fn enumerateResultsUsingBlock(
&self,
block: &Block<(NonNull<Object>, NSUInteger, NonNull<Bool>), ()>,
);
#[method(enumerateResultsWithOptions:usingBlock:)]
pub unsafe fn enumerateResultsWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &Block<(NonNull<Object>, NSUInteger, NonNull<Bool>), ()>,
);
#[method_id(@__retain_semantics Other results)]
pub unsafe fn results(&self) -> Id<NSArray, Shared>;
#[method(indexOfResult:)]
pub unsafe fn indexOfResult(&self, result: &Object) -> NSUInteger;
#[method_id(@__retain_semantics Other valueLists)]
pub unsafe fn valueLists(
&self,
) -> Id<NSDictionary<NSString, NSArray<NSMetadataQueryAttributeValueTuple>>, Shared>;
#[method_id(@__retain_semantics Other groupedResults)]
pub unsafe fn groupedResults(&self) -> Id<NSArray<NSMetadataQueryResultGroup>, Shared>;
#[method_id(@__retain_semantics Other valueOfAttribute:forResultAtIndex:)]
pub unsafe fn valueOfAttribute_forResultAtIndex(
&self,
attrName: &NSString,
idx: NSUInteger,
) -> Option<Id<Object, Shared>>;
}
);
extern_protocol!(
pub struct NSMetadataQueryDelegate;
unsafe impl ProtocolType for NSMetadataQueryDelegate {
#[optional]
#[method_id(@__retain_semantics Other metadataQuery:replacementObjectForResultObject:)]
pub unsafe fn metadataQuery_replacementObjectForResultObject(
&self,
query: &NSMetadataQuery,
result: &NSMetadataItem,
) -> Id<Object, Shared>;
#[optional]
#[method_id(@__retain_semantics Other metadataQuery:replacementValueForAttribute:value:)]
pub unsafe fn metadataQuery_replacementValueForAttribute_value(
&self,
query: &NSMetadataQuery,
attrName: &NSString,
attrValue: &Object,
) -> Id<Object, Shared>;
}
);
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)]
pub struct NSMetadataItem;
unsafe impl ClassType for NSMetadataItem {
type Super = NSObject;
}
);
extern_methods!(
unsafe impl NSMetadataItem {
#[method_id(@__retain_semantics Init initWithURL:)]
pub unsafe fn initWithURL(
this: Option<Allocated<Self>>,
url: &NSURL,
) -> Option<Id<Self, Shared>>;
#[method_id(@__retain_semantics Other valueForAttribute:)]
pub unsafe fn valueForAttribute(&self, key: &NSString) -> Option<Id<Object, Shared>>;
#[method_id(@__retain_semantics Other valuesForAttributes:)]
pub unsafe fn valuesForAttributes(
&self,
keys: &NSArray<NSString>,
) -> Option<Id<NSDictionary<NSString, Object>, Shared>>;
#[method_id(@__retain_semantics Other attributes)]
pub unsafe fn attributes(&self) -> Id<NSArray<NSString>, Shared>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMetadataQueryAttributeValueTuple;
unsafe impl ClassType for NSMetadataQueryAttributeValueTuple {
type Super = NSObject;
}
);
extern_methods!(
unsafe impl NSMetadataQueryAttributeValueTuple {
#[method_id(@__retain_semantics Other attribute)]
pub unsafe fn attribute(&self) -> Id<NSString, Shared>;
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Option<Id<Object, Shared>>;
#[method(count)]
pub unsafe fn count(&self) -> NSUInteger;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMetadataQueryResultGroup;
unsafe impl ClassType for NSMetadataQueryResultGroup {
type Super = NSObject;
}
);
extern_methods!(
unsafe impl NSMetadataQueryResultGroup {
#[method_id(@__retain_semantics Other attribute)]
pub unsafe fn attribute(&self) -> Id<NSString, Shared>;
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Id<Object, Shared>;
#[method_id(@__retain_semantics Other subgroups)]
pub unsafe fn subgroups(&self) -> Option<Id<NSArray<NSMetadataQueryResultGroup>, Shared>>;
#[method(resultCount)]
pub unsafe fn resultCount(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other resultAtIndex:)]
pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Id<Object, Shared>;
#[method_id(@__retain_semantics Other results)]
pub unsafe fn results(&self) -> Id<NSArray, Shared>;
}
);