objc2_foundation/generated/
NSTextCheckingResult.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingtype?language=objc)
9// NS_OPTIONS
10#[repr(transparent)]
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
12pub struct NSTextCheckingType(pub u64);
13bitflags::bitflags! {
14    impl NSTextCheckingType: u64 {
15        #[doc(alias = "NSTextCheckingTypeOrthography")]
16        const Orthography = 1<<0;
17        #[doc(alias = "NSTextCheckingTypeSpelling")]
18        const Spelling = 1<<1;
19        #[doc(alias = "NSTextCheckingTypeGrammar")]
20        const Grammar = 1<<2;
21        #[doc(alias = "NSTextCheckingTypeDate")]
22        const Date = 1<<3;
23        #[doc(alias = "NSTextCheckingTypeAddress")]
24        const Address = 1<<4;
25        #[doc(alias = "NSTextCheckingTypeLink")]
26        const Link = 1<<5;
27        #[doc(alias = "NSTextCheckingTypeQuote")]
28        const Quote = 1<<6;
29        #[doc(alias = "NSTextCheckingTypeDash")]
30        const Dash = 1<<7;
31        #[doc(alias = "NSTextCheckingTypeReplacement")]
32        const Replacement = 1<<8;
33        #[doc(alias = "NSTextCheckingTypeCorrection")]
34        const Correction = 1<<9;
35        #[doc(alias = "NSTextCheckingTypeRegularExpression")]
36        const RegularExpression = 1<<10;
37        #[doc(alias = "NSTextCheckingTypePhoneNumber")]
38        const PhoneNumber = 1<<11;
39        #[doc(alias = "NSTextCheckingTypeTransitInformation")]
40        const TransitInformation = 1<<12;
41    }
42}
43
44unsafe impl Encode for NSTextCheckingType {
45    const ENCODING: Encoding = u64::ENCODING;
46}
47
48unsafe impl RefEncode for NSTextCheckingType {
49    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
50}
51
52/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingtypes?language=objc)
53pub type NSTextCheckingTypes = u64;
54
55/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingallsystemtypes?language=objc)
56pub const NSTextCheckingAllSystemTypes: NSTextCheckingTypes = 0xffffffff;
57/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingallcustomtypes?language=objc)
58pub const NSTextCheckingAllCustomTypes: NSTextCheckingTypes = 0xffffffff << 32;
59/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingalltypes?language=objc)
60pub const NSTextCheckingAllTypes: NSTextCheckingTypes =
61    NSTextCheckingAllSystemTypes | NSTextCheckingAllCustomTypes;
62
63/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingkey?language=objc)
64// NS_TYPED_EXTENSIBLE_ENUM
65#[cfg(feature = "NSString")]
66pub type NSTextCheckingKey = NSString;
67
68extern_class!(
69    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingresult?language=objc)
70    #[unsafe(super(NSObject))]
71    #[derive(Debug, PartialEq, Eq, Hash)]
72    pub struct NSTextCheckingResult;
73);
74
75#[cfg(feature = "NSObject")]
76unsafe impl NSCoding for NSTextCheckingResult {}
77
78#[cfg(feature = "NSObject")]
79unsafe impl NSCopying for NSTextCheckingResult {}
80
81#[cfg(feature = "NSObject")]
82unsafe impl CopyingHelper for NSTextCheckingResult {
83    type Result = Self;
84}
85
86unsafe impl NSObjectProtocol for NSTextCheckingResult {}
87
88#[cfg(feature = "NSObject")]
89unsafe impl NSSecureCoding for NSTextCheckingResult {}
90
91impl NSTextCheckingResult {
92    extern_methods!(
93        #[unsafe(method(resultType))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn resultType(&self) -> NSTextCheckingType;
96
97        #[cfg(feature = "NSRange")]
98        #[unsafe(method(range))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn range(&self) -> NSRange;
101    );
102}
103
104/// Methods declared on superclass `NSObject`.
105impl NSTextCheckingResult {
106    extern_methods!(
107        #[unsafe(method(init))]
108        #[unsafe(method_family = init)]
109        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
110
111        #[unsafe(method(new))]
112        #[unsafe(method_family = new)]
113        pub unsafe fn new() -> Retained<Self>;
114    );
115}
116
117/// NSTextCheckingResultOptional.
118impl NSTextCheckingResult {
119    extern_methods!(
120        #[cfg(feature = "NSOrthography")]
121        #[unsafe(method(orthography))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn orthography(&self) -> Option<Retained<NSOrthography>>;
124
125        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
126        #[unsafe(method(grammarDetails))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn grammarDetails(
129            &self,
130        ) -> Option<Retained<NSArray<NSDictionary<NSString, AnyObject>>>>;
131
132        #[cfg(feature = "NSDate")]
133        #[unsafe(method(date))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn date(&self) -> Option<Retained<NSDate>>;
136
137        #[cfg(feature = "NSTimeZone")]
138        #[unsafe(method(timeZone))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
141
142        #[cfg(feature = "NSDate")]
143        #[unsafe(method(duration))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn duration(&self) -> NSTimeInterval;
146
147        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
148        #[unsafe(method(components))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn components(
151            &self,
152        ) -> Option<Retained<NSDictionary<NSTextCheckingKey, NSString>>>;
153
154        #[cfg(feature = "NSURL")]
155        #[unsafe(method(URL))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
158
159        #[cfg(feature = "NSString")]
160        #[unsafe(method(replacementString))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn replacementString(&self) -> Option<Retained<NSString>>;
163
164        #[cfg(all(feature = "NSArray", feature = "NSString"))]
165        #[unsafe(method(alternativeStrings))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn alternativeStrings(&self) -> Option<Retained<NSArray<NSString>>>;
168
169        #[cfg(feature = "NSRegularExpression")]
170        #[unsafe(method(regularExpression))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn regularExpression(&self) -> Option<Retained<NSRegularExpression>>;
173
174        #[cfg(feature = "NSString")]
175        #[unsafe(method(phoneNumber))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn phoneNumber(&self) -> Option<Retained<NSString>>;
178
179        #[unsafe(method(numberOfRanges))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn numberOfRanges(&self) -> NSUInteger;
182
183        #[cfg(feature = "NSRange")]
184        #[unsafe(method(rangeAtIndex:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn rangeAtIndex(&self, idx: NSUInteger) -> NSRange;
187
188        #[cfg(all(feature = "NSRange", feature = "NSString"))]
189        #[unsafe(method(rangeWithName:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn rangeWithName(&self, name: &NSString) -> NSRange;
192
193        #[unsafe(method(resultByAdjustingRangesWithOffset:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn resultByAdjustingRangesWithOffset(
196            &self,
197            offset: NSInteger,
198        ) -> Retained<NSTextCheckingResult>;
199
200        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
201        #[unsafe(method(addressComponents))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn addressComponents(
204            &self,
205        ) -> Option<Retained<NSDictionary<NSTextCheckingKey, NSString>>>;
206    );
207}
208
209extern "C" {
210    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingnamekey?language=objc)
211    #[cfg(feature = "NSString")]
212    pub static NSTextCheckingNameKey: &'static NSTextCheckingKey;
213}
214
215extern "C" {
216    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingjobtitlekey?language=objc)
217    #[cfg(feature = "NSString")]
218    pub static NSTextCheckingJobTitleKey: &'static NSTextCheckingKey;
219}
220
221extern "C" {
222    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingorganizationkey?language=objc)
223    #[cfg(feature = "NSString")]
224    pub static NSTextCheckingOrganizationKey: &'static NSTextCheckingKey;
225}
226
227extern "C" {
228    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingstreetkey?language=objc)
229    #[cfg(feature = "NSString")]
230    pub static NSTextCheckingStreetKey: &'static NSTextCheckingKey;
231}
232
233extern "C" {
234    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingcitykey?language=objc)
235    #[cfg(feature = "NSString")]
236    pub static NSTextCheckingCityKey: &'static NSTextCheckingKey;
237}
238
239extern "C" {
240    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingstatekey?language=objc)
241    #[cfg(feature = "NSString")]
242    pub static NSTextCheckingStateKey: &'static NSTextCheckingKey;
243}
244
245extern "C" {
246    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingzipkey?language=objc)
247    #[cfg(feature = "NSString")]
248    pub static NSTextCheckingZIPKey: &'static NSTextCheckingKey;
249}
250
251extern "C" {
252    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingcountrykey?language=objc)
253    #[cfg(feature = "NSString")]
254    pub static NSTextCheckingCountryKey: &'static NSTextCheckingKey;
255}
256
257extern "C" {
258    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingphonekey?language=objc)
259    #[cfg(feature = "NSString")]
260    pub static NSTextCheckingPhoneKey: &'static NSTextCheckingKey;
261}
262
263extern "C" {
264    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingairlinekey?language=objc)
265    #[cfg(feature = "NSString")]
266    pub static NSTextCheckingAirlineKey: &'static NSTextCheckingKey;
267}
268
269extern "C" {
270    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nstextcheckingflightkey?language=objc)
271    #[cfg(feature = "NSString")]
272    pub static NSTextCheckingFlightKey: &'static NSTextCheckingKey;
273}
274
275/// NSTextCheckingResultCreation.
276impl NSTextCheckingResult {
277    extern_methods!(
278        #[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
279        #[unsafe(method(orthographyCheckingResultWithRange:orthography:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn orthographyCheckingResultWithRange_orthography(
282            range: NSRange,
283            orthography: &NSOrthography,
284        ) -> Retained<NSTextCheckingResult>;
285
286        #[cfg(feature = "NSRange")]
287        #[unsafe(method(spellCheckingResultWithRange:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn spellCheckingResultWithRange(
290            range: NSRange,
291        ) -> Retained<NSTextCheckingResult>;
292
293        #[cfg(all(
294            feature = "NSArray",
295            feature = "NSDictionary",
296            feature = "NSRange",
297            feature = "NSString"
298        ))]
299        #[unsafe(method(grammarCheckingResultWithRange:details:))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn grammarCheckingResultWithRange_details(
302            range: NSRange,
303            details: &NSArray<NSDictionary<NSString, AnyObject>>,
304        ) -> Retained<NSTextCheckingResult>;
305
306        #[cfg(all(feature = "NSDate", feature = "NSRange"))]
307        #[unsafe(method(dateCheckingResultWithRange:date:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn dateCheckingResultWithRange_date(
310            range: NSRange,
311            date: &NSDate,
312        ) -> Retained<NSTextCheckingResult>;
313
314        #[cfg(all(feature = "NSDate", feature = "NSRange", feature = "NSTimeZone"))]
315        #[unsafe(method(dateCheckingResultWithRange:date:timeZone:duration:))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn dateCheckingResultWithRange_date_timeZone_duration(
318            range: NSRange,
319            date: &NSDate,
320            time_zone: &NSTimeZone,
321            duration: NSTimeInterval,
322        ) -> Retained<NSTextCheckingResult>;
323
324        #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
325        #[unsafe(method(addressCheckingResultWithRange:components:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn addressCheckingResultWithRange_components(
328            range: NSRange,
329            components: &NSDictionary<NSTextCheckingKey, NSString>,
330        ) -> Retained<NSTextCheckingResult>;
331
332        #[cfg(all(feature = "NSRange", feature = "NSURL"))]
333        #[unsafe(method(linkCheckingResultWithRange:URL:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn linkCheckingResultWithRange_URL(
336            range: NSRange,
337            url: &NSURL,
338        ) -> Retained<NSTextCheckingResult>;
339
340        #[cfg(all(feature = "NSRange", feature = "NSString"))]
341        #[unsafe(method(quoteCheckingResultWithRange:replacementString:))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn quoteCheckingResultWithRange_replacementString(
344            range: NSRange,
345            replacement_string: &NSString,
346        ) -> Retained<NSTextCheckingResult>;
347
348        #[cfg(all(feature = "NSRange", feature = "NSString"))]
349        #[unsafe(method(dashCheckingResultWithRange:replacementString:))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn dashCheckingResultWithRange_replacementString(
352            range: NSRange,
353            replacement_string: &NSString,
354        ) -> Retained<NSTextCheckingResult>;
355
356        #[cfg(all(feature = "NSRange", feature = "NSString"))]
357        #[unsafe(method(replacementCheckingResultWithRange:replacementString:))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn replacementCheckingResultWithRange_replacementString(
360            range: NSRange,
361            replacement_string: &NSString,
362        ) -> Retained<NSTextCheckingResult>;
363
364        #[cfg(all(feature = "NSRange", feature = "NSString"))]
365        #[unsafe(method(correctionCheckingResultWithRange:replacementString:))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn correctionCheckingResultWithRange_replacementString(
368            range: NSRange,
369            replacement_string: &NSString,
370        ) -> Retained<NSTextCheckingResult>;
371
372        #[cfg(all(feature = "NSArray", feature = "NSRange", feature = "NSString"))]
373        #[unsafe(method(correctionCheckingResultWithRange:replacementString:alternativeStrings:))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn correctionCheckingResultWithRange_replacementString_alternativeStrings(
376            range: NSRange,
377            replacement_string: &NSString,
378            alternative_strings: &NSArray<NSString>,
379        ) -> Retained<NSTextCheckingResult>;
380
381        #[cfg(all(feature = "NSRange", feature = "NSRegularExpression"))]
382        #[unsafe(method(regularExpressionCheckingResultWithRanges:count:regularExpression:))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn regularExpressionCheckingResultWithRanges_count_regularExpression(
385            ranges: NSRangePointer,
386            count: NSUInteger,
387            regular_expression: &NSRegularExpression,
388        ) -> Retained<NSTextCheckingResult>;
389
390        #[cfg(all(feature = "NSRange", feature = "NSString"))]
391        #[unsafe(method(phoneNumberCheckingResultWithRange:phoneNumber:))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn phoneNumberCheckingResultWithRange_phoneNumber(
394            range: NSRange,
395            phone_number: &NSString,
396        ) -> Retained<NSTextCheckingResult>;
397
398        #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
399        #[unsafe(method(transitInformationCheckingResultWithRange:components:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn transitInformationCheckingResultWithRange_components(
402            range: NSRange,
403            components: &NSDictionary<NSTextCheckingKey, NSString>,
404        ) -> Retained<NSTextCheckingResult>;
405    );
406}