objc2_core_spotlight/generated/
CSUserQuery.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/csuserinteraction?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct CSUserInteraction(pub NSInteger);
15impl CSUserInteraction {
16    #[doc(alias = "CSUserInteractionSelect")]
17    pub const Select: Self = Self(0);
18    #[doc(alias = "CSUserInteractionDefault")]
19    pub const Default: Self = Self(CSUserInteraction::Select.0);
20    #[doc(alias = "CSUserInteractionFocus")]
21    pub const Focus: Self = Self(1);
22}
23
24unsafe impl Encode for CSUserInteraction {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for CSUserInteraction {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/csuserquerycontext?language=objc)
34    #[unsafe(super(CSSearchQueryContext, NSObject))]
35    #[derive(Debug, PartialEq, Eq, Hash)]
36    #[cfg(feature = "CSSearchQuery")]
37    pub struct CSUserQueryContext;
38);
39
40#[cfg(feature = "CSSearchQuery")]
41extern_conformance!(
42    unsafe impl NSCoding for CSUserQueryContext {}
43);
44
45#[cfg(feature = "CSSearchQuery")]
46extern_conformance!(
47    unsafe impl NSCopying for CSUserQueryContext {}
48);
49
50#[cfg(feature = "CSSearchQuery")]
51unsafe impl CopyingHelper for CSUserQueryContext {
52    type Result = Self;
53}
54
55#[cfg(feature = "CSSearchQuery")]
56extern_conformance!(
57    unsafe impl NSObjectProtocol for CSUserQueryContext {}
58);
59
60#[cfg(feature = "CSSearchQuery")]
61extern_conformance!(
62    unsafe impl NSSecureCoding for CSUserQueryContext {}
63);
64
65#[cfg(feature = "CSSearchQuery")]
66impl CSUserQueryContext {
67    extern_methods!(
68        #[unsafe(method(userQueryContext))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn userQueryContext() -> Retained<CSUserQueryContext>;
71
72        #[cfg(feature = "CSSuggestion")]
73        #[unsafe(method(userQueryContextWithCurrentSuggestion:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn userQueryContextWithCurrentSuggestion(
76            current_suggestion: Option<&CSSuggestion>,
77        ) -> Retained<CSUserQueryContext>;
78
79        #[unsafe(method(enableRankedResults))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn enableRankedResults(&self) -> bool;
82
83        /// Setter for [`enableRankedResults`][Self::enableRankedResults].
84        #[unsafe(method(setEnableRankedResults:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setEnableRankedResults(&self, enable_ranked_results: bool);
87
88        #[unsafe(method(disableSemanticSearch))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn disableSemanticSearch(&self) -> bool;
91
92        /// Setter for [`disableSemanticSearch`][Self::disableSemanticSearch].
93        #[unsafe(method(setDisableSemanticSearch:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setDisableSemanticSearch(&self, disable_semantic_search: bool);
96
97        #[unsafe(method(maxResultCount))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn maxResultCount(&self) -> NSInteger;
100
101        /// Setter for [`maxResultCount`][Self::maxResultCount].
102        #[unsafe(method(setMaxResultCount:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setMaxResultCount(&self, max_result_count: NSInteger);
105
106        #[unsafe(method(maxSuggestionCount))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn maxSuggestionCount(&self) -> NSInteger;
109
110        /// Setter for [`maxSuggestionCount`][Self::maxSuggestionCount].
111        #[unsafe(method(setMaxSuggestionCount:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setMaxSuggestionCount(&self, max_suggestion_count: NSInteger);
114
115        #[unsafe(method(maxRankedResultCount))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn maxRankedResultCount(&self) -> NSInteger;
118
119        /// Setter for [`maxRankedResultCount`][Self::maxRankedResultCount].
120        #[unsafe(method(setMaxRankedResultCount:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setMaxRankedResultCount(&self, max_ranked_result_count: NSInteger);
123    );
124}
125
126/// Methods declared on superclass `NSObject`.
127#[cfg(feature = "CSSearchQuery")]
128impl CSUserQueryContext {
129    extern_methods!(
130        #[unsafe(method(init))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
133
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub unsafe fn new() -> Retained<Self>;
137    );
138}
139
140extern_class!(
141    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/csuserquery?language=objc)
142    #[unsafe(super(CSSearchQuery, NSObject))]
143    #[derive(Debug, PartialEq, Eq, Hash)]
144    #[cfg(feature = "CSSearchQuery")]
145    pub struct CSUserQuery;
146);
147
148#[cfg(feature = "CSSearchQuery")]
149extern_conformance!(
150    unsafe impl NSObjectProtocol for CSUserQuery {}
151);
152
153#[cfg(feature = "CSSearchQuery")]
154impl CSUserQuery {
155    extern_methods!(
156        #[unsafe(method(prepare))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn prepare();
159
160        #[unsafe(method(prepareProtectionClasses:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn prepareProtectionClasses(protection_classes: &NSArray<NSFileProtectionType>);
163
164        #[unsafe(method(initWithUserQueryString:userQueryContext:))]
165        #[unsafe(method_family = init)]
166        pub unsafe fn initWithUserQueryString_userQueryContext(
167            this: Allocated<Self>,
168            user_query_string: Option<&NSString>,
169            user_query_context: Option<&CSUserQueryContext>,
170        ) -> Retained<Self>;
171
172        #[unsafe(method(foundSuggestionCount))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn foundSuggestionCount(&self) -> NSInteger;
175
176        #[cfg(all(feature = "CSSuggestion", feature = "block2"))]
177        /// # Safety
178        ///
179        /// The returned block's argument must be a valid pointer.
180        #[unsafe(method(foundSuggestionsHandler))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn foundSuggestionsHandler(
183            &self,
184        ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSArray<CSSuggestion>>)>;
185
186        #[cfg(all(feature = "CSSuggestion", feature = "block2"))]
187        /// Setter for [`foundSuggestionsHandler`][Self::foundSuggestionsHandler].
188        ///
189        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
190        #[unsafe(method(setFoundSuggestionsHandler:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setFoundSuggestionsHandler(
193            &self,
194            found_suggestions_handler: Option<
195                &block2::DynBlock<dyn Fn(NonNull<NSArray<CSSuggestion>>)>,
196            >,
197        );
198
199        #[cfg(feature = "CSSearchableItem")]
200        #[unsafe(method(userEngagedWithItem:visibleItems:userInteractionType:))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn userEngagedWithItem_visibleItems_userInteractionType(
203            &self,
204            item: &CSSearchableItem,
205            visible_items: &NSArray<CSSearchableItem>,
206            user_interaction_type: CSUserInteraction,
207        );
208
209        #[cfg(feature = "CSSuggestion")]
210        #[unsafe(method(userEngagedWithSuggestion:visibleSuggestions:userInteractionType:))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn userEngagedWithSuggestion_visibleSuggestions_userInteractionType(
213            &self,
214            suggestion: &CSSuggestion,
215            visible_suggestions: &NSArray<CSSuggestion>,
216            user_interaction_type: CSUserInteraction,
217        );
218
219        #[unsafe(method(start))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn start(&self);
222
223        #[unsafe(method(cancel))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn cancel(&self);
226    );
227}
228
229/// Methods declared on superclass `CSSearchQuery`.
230#[cfg(feature = "CSSearchQuery")]
231impl CSUserQuery {
232    extern_methods!(
233        #[unsafe(method(init))]
234        #[unsafe(method_family = init)]
235        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
236
237        #[unsafe(method(initWithQueryString:queryContext:))]
238        #[unsafe(method_family = init)]
239        pub unsafe fn initWithQueryString_queryContext(
240            this: Allocated<Self>,
241            query_string: &NSString,
242            query_context: Option<&CSSearchQueryContext>,
243        ) -> Retained<Self>;
244
245        #[deprecated = "Use initWithQueryString:queryContext instead"]
246        #[unsafe(method(initWithQueryString:attributes:))]
247        #[unsafe(method_family = init)]
248        pub unsafe fn initWithQueryString_attributes(
249            this: Allocated<Self>,
250            query_string: &NSString,
251            attributes: Option<&NSArray<NSString>>,
252        ) -> Retained<Self>;
253    );
254}
255
256/// Methods declared on superclass `NSObject`.
257#[cfg(feature = "CSSearchQuery")]
258impl CSUserQuery {
259    extern_methods!(
260        #[unsafe(method(new))]
261        #[unsafe(method_family = new)]
262        pub unsafe fn new() -> Retained<Self>;
263    );
264}