objc2_foundation/generated/
NSTextCheckingResult.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8#[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
52pub type NSTextCheckingTypes = u64;
54
55pub const NSTextCheckingAllSystemTypes: NSTextCheckingTypes = 0xffffffff;
57pub const NSTextCheckingAllCustomTypes: NSTextCheckingTypes = 0xffffffff << 32;
59pub const NSTextCheckingAllTypes: NSTextCheckingTypes =
61 NSTextCheckingAllSystemTypes | NSTextCheckingAllCustomTypes;
62
63#[cfg(feature = "NSString")]
66pub type NSTextCheckingKey = NSString;
67
68extern_class!(
69 #[unsafe(super(NSObject))]
71 #[derive(Debug, PartialEq, Eq, Hash)]
72 pub struct NSTextCheckingResult;
73);
74
75#[cfg(feature = "NSObject")]
76extern_conformance!(
77 unsafe impl NSCoding for NSTextCheckingResult {}
78);
79
80#[cfg(feature = "NSObject")]
81extern_conformance!(
82 unsafe impl NSCopying for NSTextCheckingResult {}
83);
84
85#[cfg(feature = "NSObject")]
86unsafe impl CopyingHelper for NSTextCheckingResult {
87 type Result = Self;
88}
89
90extern_conformance!(
91 unsafe impl NSObjectProtocol for NSTextCheckingResult {}
92);
93
94#[cfg(feature = "NSObject")]
95extern_conformance!(
96 unsafe impl NSSecureCoding for NSTextCheckingResult {}
97);
98
99impl NSTextCheckingResult {
100 extern_methods!(
101 #[unsafe(method(resultType))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn resultType(&self) -> NSTextCheckingType;
104
105 #[cfg(feature = "NSRange")]
106 #[unsafe(method(range))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn range(&self) -> NSRange;
109 );
110}
111
112impl NSTextCheckingResult {
114 extern_methods!(
115 #[unsafe(method(init))]
116 #[unsafe(method_family = init)]
117 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
118
119 #[unsafe(method(new))]
120 #[unsafe(method_family = new)]
121 pub unsafe fn new() -> Retained<Self>;
122 );
123}
124
125impl NSTextCheckingResult {
127 extern_methods!(
128 #[cfg(feature = "NSOrthography")]
129 #[unsafe(method(orthography))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn orthography(&self) -> Option<Retained<NSOrthography>>;
132
133 #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
134 #[unsafe(method(grammarDetails))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn grammarDetails(
137 &self,
138 ) -> Option<Retained<NSArray<NSDictionary<NSString, AnyObject>>>>;
139
140 #[cfg(feature = "NSDate")]
141 #[unsafe(method(date))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn date(&self) -> Option<Retained<NSDate>>;
144
145 #[cfg(feature = "NSTimeZone")]
146 #[unsafe(method(timeZone))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
149
150 #[cfg(feature = "NSDate")]
151 #[unsafe(method(duration))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn duration(&self) -> NSTimeInterval;
154
155 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
156 #[unsafe(method(components))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn components(
159 &self,
160 ) -> Option<Retained<NSDictionary<NSTextCheckingKey, NSString>>>;
161
162 #[cfg(feature = "NSURL")]
163 #[unsafe(method(URL))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
166
167 #[cfg(feature = "NSString")]
168 #[unsafe(method(replacementString))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn replacementString(&self) -> Option<Retained<NSString>>;
171
172 #[cfg(all(feature = "NSArray", feature = "NSString"))]
173 #[unsafe(method(alternativeStrings))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn alternativeStrings(&self) -> Option<Retained<NSArray<NSString>>>;
176
177 #[cfg(feature = "NSRegularExpression")]
178 #[unsafe(method(regularExpression))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn regularExpression(&self) -> Option<Retained<NSRegularExpression>>;
181
182 #[cfg(feature = "NSString")]
183 #[unsafe(method(phoneNumber))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn phoneNumber(&self) -> Option<Retained<NSString>>;
186
187 #[unsafe(method(numberOfRanges))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn numberOfRanges(&self) -> NSUInteger;
190
191 #[cfg(feature = "NSRange")]
192 #[unsafe(method(rangeAtIndex:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn rangeAtIndex(&self, idx: NSUInteger) -> NSRange;
195
196 #[cfg(all(feature = "NSRange", feature = "NSString"))]
197 #[unsafe(method(rangeWithName:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn rangeWithName(&self, name: &NSString) -> NSRange;
200
201 #[unsafe(method(resultByAdjustingRangesWithOffset:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn resultByAdjustingRangesWithOffset(
204 &self,
205 offset: NSInteger,
206 ) -> Retained<NSTextCheckingResult>;
207
208 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
209 #[unsafe(method(addressComponents))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn addressComponents(
212 &self,
213 ) -> Option<Retained<NSDictionary<NSTextCheckingKey, NSString>>>;
214 );
215}
216
217extern "C" {
218 #[cfg(feature = "NSString")]
220 pub static NSTextCheckingNameKey: &'static NSTextCheckingKey;
221}
222
223extern "C" {
224 #[cfg(feature = "NSString")]
226 pub static NSTextCheckingJobTitleKey: &'static NSTextCheckingKey;
227}
228
229extern "C" {
230 #[cfg(feature = "NSString")]
232 pub static NSTextCheckingOrganizationKey: &'static NSTextCheckingKey;
233}
234
235extern "C" {
236 #[cfg(feature = "NSString")]
238 pub static NSTextCheckingStreetKey: &'static NSTextCheckingKey;
239}
240
241extern "C" {
242 #[cfg(feature = "NSString")]
244 pub static NSTextCheckingCityKey: &'static NSTextCheckingKey;
245}
246
247extern "C" {
248 #[cfg(feature = "NSString")]
250 pub static NSTextCheckingStateKey: &'static NSTextCheckingKey;
251}
252
253extern "C" {
254 #[cfg(feature = "NSString")]
256 pub static NSTextCheckingZIPKey: &'static NSTextCheckingKey;
257}
258
259extern "C" {
260 #[cfg(feature = "NSString")]
262 pub static NSTextCheckingCountryKey: &'static NSTextCheckingKey;
263}
264
265extern "C" {
266 #[cfg(feature = "NSString")]
268 pub static NSTextCheckingPhoneKey: &'static NSTextCheckingKey;
269}
270
271extern "C" {
272 #[cfg(feature = "NSString")]
274 pub static NSTextCheckingAirlineKey: &'static NSTextCheckingKey;
275}
276
277extern "C" {
278 #[cfg(feature = "NSString")]
280 pub static NSTextCheckingFlightKey: &'static NSTextCheckingKey;
281}
282
283impl NSTextCheckingResult {
285 extern_methods!(
286 #[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
287 #[unsafe(method(orthographyCheckingResultWithRange:orthography:))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn orthographyCheckingResultWithRange_orthography(
290 range: NSRange,
291 orthography: &NSOrthography,
292 ) -> Retained<NSTextCheckingResult>;
293
294 #[cfg(feature = "NSRange")]
295 #[unsafe(method(spellCheckingResultWithRange:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn spellCheckingResultWithRange(
298 range: NSRange,
299 ) -> Retained<NSTextCheckingResult>;
300
301 #[cfg(all(
302 feature = "NSArray",
303 feature = "NSDictionary",
304 feature = "NSRange",
305 feature = "NSString"
306 ))]
307 #[unsafe(method(grammarCheckingResultWithRange:details:))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn grammarCheckingResultWithRange_details(
310 range: NSRange,
311 details: &NSArray<NSDictionary<NSString, AnyObject>>,
312 ) -> Retained<NSTextCheckingResult>;
313
314 #[cfg(all(feature = "NSDate", feature = "NSRange"))]
315 #[unsafe(method(dateCheckingResultWithRange:date:))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn dateCheckingResultWithRange_date(
318 range: NSRange,
319 date: &NSDate,
320 ) -> Retained<NSTextCheckingResult>;
321
322 #[cfg(all(feature = "NSDate", feature = "NSRange", feature = "NSTimeZone"))]
323 #[unsafe(method(dateCheckingResultWithRange:date:timeZone:duration:))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn dateCheckingResultWithRange_date_timeZone_duration(
326 range: NSRange,
327 date: &NSDate,
328 time_zone: &NSTimeZone,
329 duration: NSTimeInterval,
330 ) -> Retained<NSTextCheckingResult>;
331
332 #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
333 #[unsafe(method(addressCheckingResultWithRange:components:))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn addressCheckingResultWithRange_components(
336 range: NSRange,
337 components: &NSDictionary<NSTextCheckingKey, NSString>,
338 ) -> Retained<NSTextCheckingResult>;
339
340 #[cfg(all(feature = "NSRange", feature = "NSURL"))]
341 #[unsafe(method(linkCheckingResultWithRange:URL:))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn linkCheckingResultWithRange_URL(
344 range: NSRange,
345 url: &NSURL,
346 ) -> Retained<NSTextCheckingResult>;
347
348 #[cfg(all(feature = "NSRange", feature = "NSString"))]
349 #[unsafe(method(quoteCheckingResultWithRange:replacementString:))]
350 #[unsafe(method_family = none)]
351 pub unsafe fn quoteCheckingResultWithRange_replacementString(
352 range: NSRange,
353 replacement_string: &NSString,
354 ) -> Retained<NSTextCheckingResult>;
355
356 #[cfg(all(feature = "NSRange", feature = "NSString"))]
357 #[unsafe(method(dashCheckingResultWithRange:replacementString:))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn dashCheckingResultWithRange_replacementString(
360 range: NSRange,
361 replacement_string: &NSString,
362 ) -> Retained<NSTextCheckingResult>;
363
364 #[cfg(all(feature = "NSRange", feature = "NSString"))]
365 #[unsafe(method(replacementCheckingResultWithRange:replacementString:))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn replacementCheckingResultWithRange_replacementString(
368 range: NSRange,
369 replacement_string: &NSString,
370 ) -> Retained<NSTextCheckingResult>;
371
372 #[cfg(all(feature = "NSRange", feature = "NSString"))]
373 #[unsafe(method(correctionCheckingResultWithRange:replacementString:))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn correctionCheckingResultWithRange_replacementString(
376 range: NSRange,
377 replacement_string: &NSString,
378 ) -> Retained<NSTextCheckingResult>;
379
380 #[cfg(all(feature = "NSArray", feature = "NSRange", feature = "NSString"))]
381 #[unsafe(method(correctionCheckingResultWithRange:replacementString:alternativeStrings:))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn correctionCheckingResultWithRange_replacementString_alternativeStrings(
384 range: NSRange,
385 replacement_string: &NSString,
386 alternative_strings: &NSArray<NSString>,
387 ) -> Retained<NSTextCheckingResult>;
388
389 #[cfg(all(feature = "NSRange", feature = "NSRegularExpression"))]
390 #[unsafe(method(regularExpressionCheckingResultWithRanges:count:regularExpression:))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn regularExpressionCheckingResultWithRanges_count_regularExpression(
393 ranges: NSRangePointer,
394 count: NSUInteger,
395 regular_expression: &NSRegularExpression,
396 ) -> Retained<NSTextCheckingResult>;
397
398 #[cfg(all(feature = "NSRange", feature = "NSString"))]
399 #[unsafe(method(phoneNumberCheckingResultWithRange:phoneNumber:))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn phoneNumberCheckingResultWithRange_phoneNumber(
402 range: NSRange,
403 phone_number: &NSString,
404 ) -> Retained<NSTextCheckingResult>;
405
406 #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
407 #[unsafe(method(transitInformationCheckingResultWithRange:components:))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn transitInformationCheckingResultWithRange_components(
410 range: NSRange,
411 components: &NSDictionary<NSTextCheckingKey, NSString>,
412 ) -> Retained<NSTextCheckingResult>;
413 );
414}