use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[deprecated = "Use MKLocalSearchCompleterResultType"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MKSearchCompletionFilterType(pub NSInteger);
impl MKSearchCompletionFilterType {
#[doc(alias = "MKSearchCompletionFilterTypeLocationsAndQueries")]
#[deprecated = "Use MKLocalSearchCompleterResultType"]
pub const LocationsAndQueries: Self = Self(0);
#[doc(alias = "MKSearchCompletionFilterTypeLocationsOnly")]
#[deprecated = "Use MKLocalSearchCompleterResultType"]
pub const LocationsOnly: Self = Self(1);
}
unsafe impl Encode for MKSearchCompletionFilterType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MKSearchCompletionFilterType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MKLocalSearchCompleterResultType(pub NSUInteger);
bitflags::bitflags! {
impl MKLocalSearchCompleterResultType: NSUInteger {
#[doc(alias = "MKLocalSearchCompleterResultTypeAddress")]
const Address = 1<<0;
#[doc(alias = "MKLocalSearchCompleterResultTypePointOfInterest")]
const PointOfInterest = 1<<1;
#[doc(alias = "MKLocalSearchCompleterResultTypeQuery")]
const Query = 1<<2;
#[doc(alias = "MKLocalSearchCompleterResultTypePhysicalFeature")]
const PhysicalFeature = 1<<3;
}
}
unsafe impl Encode for MKLocalSearchCompleterResultType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MKLocalSearchCompleterResultType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MKLocalSearchCompleter;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MKLocalSearchCompleter {}
);
impl MKLocalSearchCompleter {
extern_methods!(
#[unsafe(method(queryFragment))]
#[unsafe(method_family = none)]
pub unsafe fn queryFragment(&self) -> Retained<NSString>;
#[unsafe(method(setQueryFragment:))]
#[unsafe(method_family = none)]
pub unsafe fn setQueryFragment(&self, query_fragment: &NSString);
#[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
#[unsafe(method(region))]
#[unsafe(method_family = none)]
pub unsafe fn region(&self) -> MKCoordinateRegion;
#[cfg(all(feature = "MKGeometry", feature = "objc2-core-location"))]
#[unsafe(method(setRegion:))]
#[unsafe(method_family = none)]
pub unsafe fn setRegion(&self, region: MKCoordinateRegion);
#[cfg(feature = "MKTypes")]
#[unsafe(method(regionPriority))]
#[unsafe(method_family = none)]
pub unsafe fn regionPriority(&self) -> MKLocalSearchRegionPriority;
#[cfg(feature = "MKTypes")]
#[unsafe(method(setRegionPriority:))]
#[unsafe(method_family = none)]
pub unsafe fn setRegionPriority(&self, region_priority: MKLocalSearchRegionPriority);
#[deprecated = "Use resultTypes"]
#[unsafe(method(filterType))]
#[unsafe(method_family = none)]
pub unsafe fn filterType(&self) -> MKSearchCompletionFilterType;
#[deprecated = "Use resultTypes"]
#[unsafe(method(setFilterType:))]
#[unsafe(method_family = none)]
pub unsafe fn setFilterType(&self, filter_type: MKSearchCompletionFilterType);
#[unsafe(method(resultTypes))]
#[unsafe(method_family = none)]
pub unsafe fn resultTypes(&self) -> MKLocalSearchCompleterResultType;
#[unsafe(method(setResultTypes:))]
#[unsafe(method_family = none)]
pub unsafe fn setResultTypes(&self, result_types: MKLocalSearchCompleterResultType);
#[cfg(feature = "MKPointOfInterestFilter")]
#[unsafe(method(pointOfInterestFilter))]
#[unsafe(method_family = none)]
pub unsafe fn pointOfInterestFilter(&self) -> Option<Retained<MKPointOfInterestFilter>>;
#[cfg(feature = "MKPointOfInterestFilter")]
#[unsafe(method(setPointOfInterestFilter:))]
#[unsafe(method_family = none)]
pub unsafe fn setPointOfInterestFilter(
&self,
point_of_interest_filter: Option<&MKPointOfInterestFilter>,
);
#[cfg(feature = "MKAddressFilter")]
#[unsafe(method(addressFilter))]
#[unsafe(method_family = none)]
pub unsafe fn addressFilter(&self) -> Option<Retained<MKAddressFilter>>;
#[cfg(feature = "MKAddressFilter")]
#[unsafe(method(setAddressFilter:))]
#[unsafe(method_family = none)]
pub unsafe fn setAddressFilter(&self, address_filter: Option<&MKAddressFilter>);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn MKLocalSearchCompleterDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn MKLocalSearchCompleterDelegate>>,
);
#[unsafe(method(results))]
#[unsafe(method_family = none)]
pub unsafe fn results(&self) -> Retained<NSArray<MKLocalSearchCompletion>>;
#[unsafe(method(isSearching))]
#[unsafe(method_family = none)]
pub unsafe fn isSearching(&self) -> bool;
#[unsafe(method(cancel))]
#[unsafe(method_family = none)]
pub unsafe fn cancel(&self);
);
}
impl MKLocalSearchCompleter {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait MKLocalSearchCompleterDelegate: NSObjectProtocol {
#[optional]
#[unsafe(method(completerDidUpdateResults:))]
#[unsafe(method_family = none)]
unsafe fn completerDidUpdateResults(&self, completer: &MKLocalSearchCompleter);
#[optional]
#[unsafe(method(completer:didFailWithError:))]
#[unsafe(method_family = none)]
unsafe fn completer_didFailWithError(
&self,
completer: &MKLocalSearchCompleter,
error: &NSError,
);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MKLocalSearchCompletion;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MKLocalSearchCompletion {}
);
impl MKLocalSearchCompletion {
extern_methods!(
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[unsafe(method(titleHighlightRanges))]
#[unsafe(method_family = none)]
pub unsafe fn titleHighlightRanges(&self) -> Retained<NSArray<NSValue>>;
#[unsafe(method(subtitle))]
#[unsafe(method_family = none)]
pub unsafe fn subtitle(&self) -> Retained<NSString>;
#[unsafe(method(subtitleHighlightRanges))]
#[unsafe(method_family = none)]
pub unsafe fn subtitleHighlightRanges(&self) -> Retained<NSArray<NSValue>>;
);
}
impl MKLocalSearchCompletion {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
#[cfg(feature = "MKLocalSearchRequest")]
impl MKLocalSearchRequest {
extern_methods!(
#[unsafe(method(initWithCompletion:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCompletion(
this: Allocated<Self>,
completion: &MKLocalSearchCompletion,
) -> Retained<Self>;
);
}