objc2_foundation/generated/
NSScanner.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::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsscanner?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSScanner;
14);
15
16#[cfg(feature = "NSObject")]
17extern_conformance!(
18    unsafe impl NSCopying for NSScanner {}
19);
20
21#[cfg(feature = "NSObject")]
22unsafe impl CopyingHelper for NSScanner {
23    type Result = Self;
24}
25
26extern_conformance!(
27    unsafe impl NSObjectProtocol for NSScanner {}
28);
29
30impl NSScanner {
31    extern_methods!(
32        #[cfg(feature = "NSString")]
33        #[unsafe(method(string))]
34        #[unsafe(method_family = none)]
35        pub fn string(&self) -> Retained<NSString>;
36
37        #[unsafe(method(scanLocation))]
38        #[unsafe(method_family = none)]
39        pub fn scanLocation(&self) -> NSUInteger;
40
41        /// Setter for [`scanLocation`][Self::scanLocation].
42        #[unsafe(method(setScanLocation:))]
43        #[unsafe(method_family = none)]
44        pub fn setScanLocation(&self, scan_location: NSUInteger);
45
46        #[cfg(feature = "NSCharacterSet")]
47        #[unsafe(method(charactersToBeSkipped))]
48        #[unsafe(method_family = none)]
49        pub fn charactersToBeSkipped(&self) -> Option<Retained<NSCharacterSet>>;
50
51        #[cfg(feature = "NSCharacterSet")]
52        /// Setter for [`charactersToBeSkipped`][Self::charactersToBeSkipped].
53        ///
54        /// This is [copied][crate::NSCopying::copy] when set.
55        #[unsafe(method(setCharactersToBeSkipped:))]
56        #[unsafe(method_family = none)]
57        pub fn setCharactersToBeSkipped(&self, characters_to_be_skipped: Option<&NSCharacterSet>);
58
59        #[unsafe(method(caseSensitive))]
60        #[unsafe(method_family = none)]
61        pub fn caseSensitive(&self) -> bool;
62
63        /// Setter for [`caseSensitive`][Self::caseSensitive].
64        #[unsafe(method(setCaseSensitive:))]
65        #[unsafe(method_family = none)]
66        pub fn setCaseSensitive(&self, case_sensitive: bool);
67
68        #[unsafe(method(locale))]
69        #[unsafe(method_family = none)]
70        pub fn locale(&self) -> Option<Retained<AnyObject>>;
71
72        /// Setter for [`locale`][Self::locale].
73        ///
74        /// # Safety
75        ///
76        /// `locale` should be of the correct type.
77        #[unsafe(method(setLocale:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setLocale(&self, locale: Option<&AnyObject>);
80
81        #[cfg(feature = "NSString")]
82        #[unsafe(method(initWithString:))]
83        #[unsafe(method_family = init)]
84        pub fn initWithString(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
85    );
86}
87
88/// Methods declared on superclass `NSObject`.
89impl NSScanner {
90    extern_methods!(
91        #[unsafe(method(init))]
92        #[unsafe(method_family = init)]
93        pub fn init(this: Allocated<Self>) -> Retained<Self>;
94
95        #[unsafe(method(new))]
96        #[unsafe(method_family = new)]
97        pub fn new() -> Retained<Self>;
98    );
99}
100
101impl DefaultRetained for NSScanner {
102    #[inline]
103    fn default_retained() -> Retained<Self> {
104        Self::new()
105    }
106}
107
108/// NSExtendedScanner.
109impl NSScanner {
110    extern_methods!(
111        /// # Safety
112        ///
113        /// `result` must be a valid pointer or null.
114        #[unsafe(method(scanInt:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn scanInt(&self, result: *mut c_int) -> bool;
117
118        /// # Safety
119        ///
120        /// `result` must be a valid pointer or null.
121        #[unsafe(method(scanInteger:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn scanInteger(&self, result: *mut NSInteger) -> bool;
124
125        /// # Safety
126        ///
127        /// `result` must be a valid pointer or null.
128        #[unsafe(method(scanLongLong:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn scanLongLong(&self, result: *mut c_longlong) -> bool;
131
132        /// # Safety
133        ///
134        /// `result` must be a valid pointer or null.
135        #[unsafe(method(scanUnsignedLongLong:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn scanUnsignedLongLong(&self, result: *mut c_ulonglong) -> bool;
138
139        /// # Safety
140        ///
141        /// `result` must be a valid pointer or null.
142        #[unsafe(method(scanFloat:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn scanFloat(&self, result: *mut c_float) -> bool;
145
146        /// # Safety
147        ///
148        /// `result` must be a valid pointer or null.
149        #[unsafe(method(scanDouble:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn scanDouble(&self, result: *mut c_double) -> bool;
152
153        /// # Safety
154        ///
155        /// `result` must be a valid pointer or null.
156        #[unsafe(method(scanHexInt:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn scanHexInt(&self, result: *mut c_uint) -> bool;
159
160        /// # Safety
161        ///
162        /// `result` must be a valid pointer or null.
163        #[unsafe(method(scanHexLongLong:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn scanHexLongLong(&self, result: *mut c_ulonglong) -> bool;
166
167        /// # Safety
168        ///
169        /// `result` must be a valid pointer or null.
170        #[unsafe(method(scanHexFloat:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn scanHexFloat(&self, result: *mut c_float) -> bool;
173
174        /// # Safety
175        ///
176        /// `result` must be a valid pointer or null.
177        #[unsafe(method(scanHexDouble:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn scanHexDouble(&self, result: *mut c_double) -> bool;
180
181        #[cfg(feature = "NSString")]
182        #[unsafe(method(scanString:intoString:))]
183        #[unsafe(method_family = none)]
184        pub fn scanString_intoString(
185            &self,
186            string: &NSString,
187            result: Option<&mut Option<Retained<NSString>>>,
188        ) -> bool;
189
190        #[cfg(all(feature = "NSCharacterSet", feature = "NSString"))]
191        #[unsafe(method(scanCharactersFromSet:intoString:))]
192        #[unsafe(method_family = none)]
193        pub fn scanCharactersFromSet_intoString(
194            &self,
195            set: &NSCharacterSet,
196            result: Option<&mut Option<Retained<NSString>>>,
197        ) -> bool;
198
199        #[cfg(feature = "NSString")]
200        #[unsafe(method(scanUpToString:intoString:))]
201        #[unsafe(method_family = none)]
202        pub fn scanUpToString_intoString(
203            &self,
204            string: &NSString,
205            result: Option<&mut Option<Retained<NSString>>>,
206        ) -> bool;
207
208        #[cfg(all(feature = "NSCharacterSet", feature = "NSString"))]
209        #[unsafe(method(scanUpToCharactersFromSet:intoString:))]
210        #[unsafe(method_family = none)]
211        pub fn scanUpToCharactersFromSet_intoString(
212            &self,
213            set: &NSCharacterSet,
214            result: Option<&mut Option<Retained<NSString>>>,
215        ) -> bool;
216
217        #[unsafe(method(isAtEnd))]
218        #[unsafe(method_family = none)]
219        pub fn isAtEnd(&self) -> bool;
220
221        #[cfg(feature = "NSString")]
222        #[unsafe(method(scannerWithString:))]
223        #[unsafe(method_family = none)]
224        pub fn scannerWithString(string: &NSString) -> Retained<Self>;
225
226        #[cfg(feature = "NSString")]
227        #[unsafe(method(localizedScannerWithString:))]
228        #[unsafe(method_family = none)]
229        pub fn localizedScannerWithString(string: &NSString) -> Retained<AnyObject>;
230    );
231}