objc2_core_foundation/generated/
CFCharacterSet.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9
10use crate::*;
11
12/// This is the type of a reference to immutable CFCharacterSets.
13///
14/// This is toll-free bridged with `NSCharacterSet`.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfcharacterset?language=objc)
17#[doc(alias = "CFCharacterSetRef")]
18#[repr(C)]
19pub struct CFCharacterSet {
20    inner: [u8; 0],
21    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
22}
23
24cf_type!(
25    unsafe impl CFCharacterSet {}
26);
27#[cfg(feature = "objc2")]
28cf_objc2_type!(
29    unsafe impl RefEncode<"__CFCharacterSet"> for CFCharacterSet {}
30);
31
32/// This is the type of a reference to mutable CFMutableCharacterSets.
33///
34/// This is toll-free bridged with `NSMutableCharacterSet`.
35///
36/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfmutablecharacterset?language=objc)
37#[doc(alias = "CFMutableCharacterSetRef")]
38#[repr(C)]
39pub struct CFMutableCharacterSet {
40    inner: [u8; 0],
41    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
42}
43
44cf_type!(
45    unsafe impl CFMutableCharacterSet: CFCharacterSet {}
46);
47#[cfg(feature = "objc2")]
48cf_objc2_type!(
49    unsafe impl RefEncode<"__CFCharacterSet"> for CFMutableCharacterSet {}
50);
51
52/// Type of the predefined CFCharacterSet selector values.
53///
54/// See also [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfcharactersetpredefinedset?language=objc)
55// NS_ENUM
56#[repr(transparent)]
57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
58pub struct CFCharacterSetPredefinedSet(pub CFIndex);
59impl CFCharacterSetPredefinedSet {
60    #[doc(alias = "kCFCharacterSetControl")]
61    pub const Control: Self = Self(1);
62    #[doc(alias = "kCFCharacterSetWhitespace")]
63    pub const Whitespace: Self = Self(2);
64    #[doc(alias = "kCFCharacterSetWhitespaceAndNewline")]
65    pub const WhitespaceAndNewline: Self = Self(3);
66    #[doc(alias = "kCFCharacterSetDecimalDigit")]
67    pub const DecimalDigit: Self = Self(4);
68    #[doc(alias = "kCFCharacterSetLetter")]
69    pub const Letter: Self = Self(5);
70    #[doc(alias = "kCFCharacterSetLowercaseLetter")]
71    pub const LowercaseLetter: Self = Self(6);
72    #[doc(alias = "kCFCharacterSetUppercaseLetter")]
73    pub const UppercaseLetter: Self = Self(7);
74    #[doc(alias = "kCFCharacterSetNonBase")]
75    pub const NonBase: Self = Self(8);
76    #[doc(alias = "kCFCharacterSetDecomposable")]
77    pub const Decomposable: Self = Self(9);
78    #[doc(alias = "kCFCharacterSetAlphaNumeric")]
79    pub const AlphaNumeric: Self = Self(10);
80    #[doc(alias = "kCFCharacterSetPunctuation")]
81    pub const Punctuation: Self = Self(11);
82    #[doc(alias = "kCFCharacterSetCapitalizedLetter")]
83    pub const CapitalizedLetter: Self = Self(13);
84    #[doc(alias = "kCFCharacterSetSymbol")]
85    pub const Symbol: Self = Self(14);
86    #[doc(alias = "kCFCharacterSetNewline")]
87    pub const Newline: Self = Self(15);
88    #[doc(alias = "kCFCharacterSetIllegal")]
89    pub const Illegal: Self = Self(12);
90}
91
92#[cfg(feature = "objc2")]
93unsafe impl Encode for CFCharacterSetPredefinedSet {
94    const ENCODING: Encoding = CFIndex::ENCODING;
95}
96
97#[cfg(feature = "objc2")]
98unsafe impl RefEncode for CFCharacterSetPredefinedSet {
99    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
100}
101
102unsafe impl ConcreteType for CFCharacterSet {
103    /// Returns the type identifier of all CFCharacterSet instances.
104    #[doc(alias = "CFCharacterSetGetTypeID")]
105    #[inline]
106    fn type_id() -> CFTypeID {
107        extern "C-unwind" {
108            fn CFCharacterSetGetTypeID() -> CFTypeID;
109        }
110        unsafe { CFCharacterSetGetTypeID() }
111    }
112}
113
114impl CFCharacterSet {
115    /// Returns a predefined CFCharacterSet instance.
116    ///
117    /// Parameter `theSetIdentifier`: The CFCharacterSetPredefinedSet selector
118    /// which specifies the predefined character set.  If the
119    /// value is not in CFCharacterSetPredefinedSet, the behavior
120    /// is undefined.
121    ///
122    /// Returns: A reference to the predefined immutable CFCharacterSet.
123    /// This instance is owned by CF.
124    #[doc(alias = "CFCharacterSetGetPredefined")]
125    #[inline]
126    pub fn predefined(
127        the_set_identifier: CFCharacterSetPredefinedSet,
128    ) -> Option<CFRetained<CFCharacterSet>> {
129        extern "C-unwind" {
130            fn CFCharacterSetGetPredefined(
131                the_set_identifier: CFCharacterSetPredefinedSet,
132            ) -> Option<NonNull<CFCharacterSet>>;
133        }
134        let ret = unsafe { CFCharacterSetGetPredefined(the_set_identifier) };
135        ret.map(|ret| unsafe { CFRetained::retain(ret) })
136    }
137
138    /// Creates a new immutable character set with the values from the given range.
139    ///
140    /// Parameter `alloc`: The CFAllocator which should be used to allocate
141    /// memory for the array and its storage for values. This
142    /// parameter may be NULL in which case the current default
143    /// CFAllocator is used. If this reference is not a valid
144    /// CFAllocator, the behavior is undefined.
145    ///
146    /// Parameter `theRange`: The CFRange which should be used to specify the
147    /// Unicode range the character set is filled with.  It
148    /// accepts the range in 32-bit in the UTF-32 format.  The
149    /// valid character point range is from 0x00000 to 0x10FFFF.
150    /// If the range is outside of the valid Unicode character
151    /// point, the behavior is undefined.
152    ///
153    /// Returns: A reference to the new immutable CFCharacterSet.
154    ///
155    /// # Safety
156    ///
157    /// `alloc` might not allow `None`.
158    #[doc(alias = "CFCharacterSetCreateWithCharactersInRange")]
159    #[inline]
160    pub unsafe fn with_characters_in_range(
161        alloc: Option<&CFAllocator>,
162        the_range: CFRange,
163    ) -> Option<CFRetained<CFCharacterSet>> {
164        extern "C-unwind" {
165            fn CFCharacterSetCreateWithCharactersInRange(
166                alloc: Option<&CFAllocator>,
167                the_range: CFRange,
168            ) -> Option<NonNull<CFCharacterSet>>;
169        }
170        let ret = unsafe { CFCharacterSetCreateWithCharactersInRange(alloc, the_range) };
171        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
172    }
173
174    /// Creates a new immutable character set with the values in the given string.
175    ///
176    /// Parameter `alloc`: The CFAllocator which should be used to allocate
177    /// memory for the array and its storage for values. This
178    /// parameter may be NULL in which case the current default
179    /// CFAllocator is used. If this reference is not a valid
180    /// CFAllocator, the behavior is undefined.
181    ///
182    /// Parameter `theString`: The CFString which should be used to specify
183    /// the Unicode characters the character set is filled with.
184    /// If this parameter is not a valid CFString, the behavior
185    /// is undefined.
186    ///
187    /// Returns: A reference to the new immutable CFCharacterSet.
188    ///
189    /// # Safety
190    ///
191    /// - `alloc` might not allow `None`.
192    /// - `the_string` might not allow `None`.
193    #[doc(alias = "CFCharacterSetCreateWithCharactersInString")]
194    #[inline]
195    pub unsafe fn with_characters_in_string(
196        alloc: Option<&CFAllocator>,
197        the_string: Option<&CFString>,
198    ) -> Option<CFRetained<CFCharacterSet>> {
199        extern "C-unwind" {
200            fn CFCharacterSetCreateWithCharactersInString(
201                alloc: Option<&CFAllocator>,
202                the_string: Option<&CFString>,
203            ) -> Option<NonNull<CFCharacterSet>>;
204        }
205        let ret = unsafe { CFCharacterSetCreateWithCharactersInString(alloc, the_string) };
206        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
207    }
208
209    /// Creates a new immutable character set with the bitmap representtion in the given data.
210    ///
211    /// Parameter `alloc`: The CFAllocator which should be used to allocate
212    /// memory for the array and its storage for values. This
213    /// parameter may be NULL in which case the current default
214    /// CFAllocator is used. If this reference is not a valid
215    /// CFAllocator, the behavior is undefined.
216    ///
217    /// Parameter `theData`: The CFData which should be used to specify the
218    /// bitmap representation of the Unicode character points
219    /// the character set is filled with.  The bitmap
220    /// representation could contain all the Unicode character
221    /// range starting from BMP to Plane 16.  The first 8192 bytes
222    /// of the data represent the BMP range.  The BMP range 8192
223    /// bytes can be followed by zero to sixteen 8192 byte
224    /// bitmaps, each one with the plane index byte prepended.
225    /// For example, the bitmap representing the BMP and Plane 2
226    /// has the size of 16385 bytes (8192 bytes for BMP, 1 byte
227    /// index + 8192 bytes bitmap for Plane 2).  The plane index
228    /// byte, in this case, contains the integer value two.  If
229    /// this parameter is not a valid CFData or it contains a
230    /// Plane index byte outside of the valid Plane range
231    /// (1 to 16), the behavior is undefined.
232    ///
233    /// Returns: A reference to the new immutable CFCharacterSet.
234    ///
235    /// # Safety
236    ///
237    /// - `alloc` might not allow `None`.
238    /// - `the_data` might not allow `None`.
239    #[doc(alias = "CFCharacterSetCreateWithBitmapRepresentation")]
240    #[cfg(feature = "CFData")]
241    #[inline]
242    pub unsafe fn with_bitmap_representation(
243        alloc: Option<&CFAllocator>,
244        the_data: Option<&CFData>,
245    ) -> Option<CFRetained<CFCharacterSet>> {
246        extern "C-unwind" {
247            fn CFCharacterSetCreateWithBitmapRepresentation(
248                alloc: Option<&CFAllocator>,
249                the_data: Option<&CFData>,
250            ) -> Option<NonNull<CFCharacterSet>>;
251        }
252        let ret = unsafe { CFCharacterSetCreateWithBitmapRepresentation(alloc, the_data) };
253        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
254    }
255
256    /// Creates a new immutable character set that is the invert of the specified character set.
257    ///
258    /// Parameter `alloc`: The CFAllocator which should be used to allocate
259    /// memory for the array and its storage for values. This
260    /// parameter may be NULL in which case the current default
261    /// CFAllocator is used. If this reference is not a valid
262    /// CFAllocator, the behavior is undefined.
263    ///
264    /// Parameter `theSet`: The CFCharacterSet which is to be inverted.  If this
265    /// parameter is not a valid CFCharacterSet, the behavior is
266    /// undefined.
267    ///
268    /// Returns: A reference to the new immutable CFCharacterSet.
269    ///
270    /// # Safety
271    ///
272    /// - `alloc` might not allow `None`.
273    /// - `the_set` might not allow `None`.
274    #[doc(alias = "CFCharacterSetCreateInvertedSet")]
275    #[inline]
276    pub unsafe fn new_inverted_set(
277        alloc: Option<&CFAllocator>,
278        the_set: Option<&CFCharacterSet>,
279    ) -> Option<CFRetained<CFCharacterSet>> {
280        extern "C-unwind" {
281            fn CFCharacterSetCreateInvertedSet(
282                alloc: Option<&CFAllocator>,
283                the_set: Option<&CFCharacterSet>,
284            ) -> Option<NonNull<CFCharacterSet>>;
285        }
286        let ret = unsafe { CFCharacterSetCreateInvertedSet(alloc, the_set) };
287        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
288    }
289
290    /// Reports whether or not the character set is a superset of the character set specified as the second parameter.
291    ///
292    /// Parameter `theSet`: The character set to be checked for the membership of theOtherSet.
293    /// If this parameter is not a valid CFCharacterSet, the behavior is undefined.
294    ///
295    /// Parameter `theOtherset`: The character set to be checked whether or not it is a subset of theSet.
296    /// If this parameter is not a valid CFCharacterSet, the behavior is undefined.
297    ///
298    /// # Safety
299    ///
300    /// `the_otherset` might not allow `None`.
301    #[doc(alias = "CFCharacterSetIsSupersetOfSet")]
302    #[inline]
303    pub unsafe fn is_superset_of_set(&self, the_otherset: Option<&CFCharacterSet>) -> bool {
304        extern "C-unwind" {
305            fn CFCharacterSetIsSupersetOfSet(
306                the_set: &CFCharacterSet,
307                the_otherset: Option<&CFCharacterSet>,
308            ) -> Boolean;
309        }
310        let ret = unsafe { CFCharacterSetIsSupersetOfSet(self, the_otherset) };
311        ret != 0
312    }
313
314    /// Reports whether or not the character set contains at least one member character in the specified plane.
315    ///
316    /// Parameter `theSet`: The character set to be checked for the membership.  If this
317    /// parameter is not a valid CFCharacterSet, the behavior is undefined.
318    ///
319    /// Parameter `thePlane`: The plane number to be checked for the membership.
320    /// The valid value range is from 0 to 16.  If the value is outside of the valid
321    /// plane number range, the behavior is undefined.
322    #[doc(alias = "CFCharacterSetHasMemberInPlane")]
323    #[inline]
324    pub unsafe fn has_member_in_plane(&self, the_plane: CFIndex) -> bool {
325        extern "C-unwind" {
326            fn CFCharacterSetHasMemberInPlane(
327                the_set: &CFCharacterSet,
328                the_plane: CFIndex,
329            ) -> Boolean;
330        }
331        let ret = unsafe { CFCharacterSetHasMemberInPlane(self, the_plane) };
332        ret != 0
333    }
334}
335
336impl CFMutableCharacterSet {
337    /// Creates a new empty mutable character set.
338    ///
339    /// Parameter `alloc`: The CFAllocator which should be used to allocate
340    /// memory for the array and its storage for values. This
341    /// parameter may be NULL in which case the current default
342    /// CFAllocator is used. If this reference is not a valid
343    /// CFAllocator, the behavior is undefined.
344    ///
345    /// Returns: A reference to the new mutable CFCharacterSet.
346    ///
347    /// # Safety
348    ///
349    /// `alloc` might not allow `None`.
350    #[doc(alias = "CFCharacterSetCreateMutable")]
351    #[inline]
352    pub unsafe fn new(alloc: Option<&CFAllocator>) -> Option<CFRetained<CFMutableCharacterSet>> {
353        extern "C-unwind" {
354            fn CFCharacterSetCreateMutable(
355                alloc: Option<&CFAllocator>,
356            ) -> Option<NonNull<CFMutableCharacterSet>>;
357        }
358        let ret = unsafe { CFCharacterSetCreateMutable(alloc) };
359        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
360    }
361}
362
363impl CFCharacterSet {
364    /// Creates a new character set with the values from the given character set.  This function tries to compact the backing store where applicable.
365    ///
366    /// Parameter `alloc`: The CFAllocator which should be used to allocate
367    /// memory for the array and its storage for values. This
368    /// parameter may be NULL in which case the current default
369    /// CFAllocator is used. If this reference is not a valid
370    /// CFAllocator, the behavior is undefined.
371    ///
372    /// Parameter `theSet`: The CFCharacterSet which is to be copied.  If this
373    /// parameter is not a valid CFCharacterSet, the behavior is
374    /// undefined.
375    ///
376    /// Returns: A reference to the new CFCharacterSet.
377    ///
378    /// # Safety
379    ///
380    /// - `alloc` might not allow `None`.
381    /// - `the_set` might not allow `None`.
382    #[doc(alias = "CFCharacterSetCreateCopy")]
383    #[inline]
384    pub unsafe fn new_copy(
385        alloc: Option<&CFAllocator>,
386        the_set: Option<&CFCharacterSet>,
387    ) -> Option<CFRetained<CFCharacterSet>> {
388        extern "C-unwind" {
389            fn CFCharacterSetCreateCopy(
390                alloc: Option<&CFAllocator>,
391                the_set: Option<&CFCharacterSet>,
392            ) -> Option<NonNull<CFCharacterSet>>;
393        }
394        let ret = unsafe { CFCharacterSetCreateCopy(alloc, the_set) };
395        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
396    }
397}
398
399impl CFMutableCharacterSet {
400    /// Creates a new mutable character set with the values from the given character set.
401    ///
402    /// Parameter `alloc`: The CFAllocator which should be used to allocate
403    /// memory for the array and its storage for values. This
404    /// parameter may be NULL in which case the current default
405    /// CFAllocator is used. If this reference is not a valid
406    /// CFAllocator, the behavior is undefined.
407    ///
408    /// Parameter `theSet`: The CFCharacterSet which is to be copied.  If this
409    /// parameter is not a valid CFCharacterSet, the behavior is
410    /// undefined.
411    ///
412    /// Returns: A reference to the new mutable CFCharacterSet.
413    ///
414    /// # Safety
415    ///
416    /// - `alloc` might not allow `None`.
417    /// - `the_set` might not allow `None`.
418    #[doc(alias = "CFCharacterSetCreateMutableCopy")]
419    #[inline]
420    pub unsafe fn new_copy(
421        alloc: Option<&CFAllocator>,
422        the_set: Option<&CFCharacterSet>,
423    ) -> Option<CFRetained<CFMutableCharacterSet>> {
424        extern "C-unwind" {
425            fn CFCharacterSetCreateMutableCopy(
426                alloc: Option<&CFAllocator>,
427                the_set: Option<&CFCharacterSet>,
428            ) -> Option<NonNull<CFMutableCharacterSet>>;
429        }
430        let ret = unsafe { CFCharacterSetCreateMutableCopy(alloc, the_set) };
431        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
432    }
433}
434
435impl CFCharacterSet {
436    /// Reports whether or not the Unicode character is in the character set.
437    ///
438    /// Parameter `theSet`: The character set to be searched. If this parameter
439    /// is not a valid CFCharacterSet, the behavior is undefined.
440    ///
441    /// Parameter `theChar`: The Unicode character for which to test against the
442    /// character set.  Note that this function takes 16-bit Unicode
443    /// character value; hence, it does not support access to the
444    /// non-BMP planes.
445    ///
446    /// Returns: true, if the value is in the character set, otherwise false.
447    #[doc(alias = "CFCharacterSetIsCharacterMember")]
448    #[inline]
449    pub fn is_character_member(&self, the_char: UniChar) -> bool {
450        extern "C-unwind" {
451            fn CFCharacterSetIsCharacterMember(
452                the_set: &CFCharacterSet,
453                the_char: UniChar,
454            ) -> Boolean;
455        }
456        let ret = unsafe { CFCharacterSetIsCharacterMember(self, the_char) };
457        ret != 0
458    }
459
460    /// Reports whether or not the UTF-32 character is in the character set.
461    ///
462    /// Parameter `theSet`: The character set to be searched. If this parameter
463    /// is not a valid CFCharacterSet, the behavior is undefined.
464    ///
465    /// Parameter `theChar`: The UTF-32 character for which to test against the
466    /// character set.
467    ///
468    /// Returns: true, if the value is in the character set, otherwise false.
469    #[doc(alias = "CFCharacterSetIsLongCharacterMember")]
470    #[inline]
471    pub fn is_long_character_member(&self, the_char: UTF32Char) -> bool {
472        extern "C-unwind" {
473            fn CFCharacterSetIsLongCharacterMember(
474                the_set: &CFCharacterSet,
475                the_char: UTF32Char,
476            ) -> Boolean;
477        }
478        let ret = unsafe { CFCharacterSetIsLongCharacterMember(self, the_char) };
479        ret != 0
480    }
481
482    /// Creates a new immutable data with the bitmap representation from the given character set.
483    ///
484    /// Parameter `alloc`: The CFAllocator which should be used to allocate
485    /// memory for the array and its storage for values. This
486    /// parameter may be NULL in which case the current default
487    /// CFAllocator is used. If this reference is not a valid
488    /// CFAllocator, the behavior is undefined.
489    ///
490    /// Parameter `theSet`: The CFCharacterSet which is to be used create the
491    /// bitmap representation from.  Refer to the comments for
492    /// CFCharacterSetCreateWithBitmapRepresentation for the
493    /// detailed discussion of the bitmap representation format.
494    /// If this parameter is not a valid CFCharacterSet, the
495    /// behavior is undefined.
496    ///
497    /// Returns: A reference to the new immutable CFData.
498    ///
499    /// # Safety
500    ///
501    /// - `alloc` might not allow `None`.
502    /// - `the_set` might not allow `None`.
503    #[doc(alias = "CFCharacterSetCreateBitmapRepresentation")]
504    #[cfg(feature = "CFData")]
505    #[inline]
506    pub unsafe fn new_bitmap_representation(
507        alloc: Option<&CFAllocator>,
508        the_set: Option<&CFCharacterSet>,
509    ) -> Option<CFRetained<CFData>> {
510        extern "C-unwind" {
511            fn CFCharacterSetCreateBitmapRepresentation(
512                alloc: Option<&CFAllocator>,
513                the_set: Option<&CFCharacterSet>,
514            ) -> Option<NonNull<CFData>>;
515        }
516        let ret = unsafe { CFCharacterSetCreateBitmapRepresentation(alloc, the_set) };
517        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
518    }
519}
520
521impl CFMutableCharacterSet {
522    /// Adds the given range to the charaacter set.
523    ///
524    /// Parameter `theSet`: The character set to which the range is to be added.
525    /// If this parameter is not a valid mutable CFCharacterSet,
526    /// the behavior is undefined.
527    ///
528    /// Parameter `theRange`: The range to add to the character set.  It accepts
529    /// the range in 32-bit in the UTF-32 format.  The valid
530    /// character point range is from 0x00000 to 0x10FFFF.  If the
531    /// range is outside of the valid Unicode character point,
532    /// the behavior is undefined.
533    ///
534    /// # Safety
535    ///
536    /// `the_set` might not allow `None`.
537    #[doc(alias = "CFCharacterSetAddCharactersInRange")]
538    #[inline]
539    pub unsafe fn add_characters_in_range(
540        the_set: Option<&CFMutableCharacterSet>,
541        the_range: CFRange,
542    ) {
543        extern "C-unwind" {
544            fn CFCharacterSetAddCharactersInRange(
545                the_set: Option<&CFMutableCharacterSet>,
546                the_range: CFRange,
547            );
548        }
549        unsafe { CFCharacterSetAddCharactersInRange(the_set, the_range) }
550    }
551
552    /// Removes the given range from the charaacter set.
553    ///
554    /// Parameter `theSet`: The character set from which the range is to be
555    /// removed.  If this parameter is not a valid mutable
556    /// CFCharacterSet, the behavior is undefined.
557    ///
558    /// Parameter `theRange`: The range to remove from the character set.
559    /// It accepts the range in 32-bit in the UTF-32 format.
560    /// The valid character point range is from 0x00000 to 0x10FFFF.
561    /// If the range is outside of the valid Unicode character point,
562    /// the behavior is undefined.
563    ///
564    /// # Safety
565    ///
566    /// `the_set` might not allow `None`.
567    #[doc(alias = "CFCharacterSetRemoveCharactersInRange")]
568    #[inline]
569    pub unsafe fn remove_characters_in_range(
570        the_set: Option<&CFMutableCharacterSet>,
571        the_range: CFRange,
572    ) {
573        extern "C-unwind" {
574            fn CFCharacterSetRemoveCharactersInRange(
575                the_set: Option<&CFMutableCharacterSet>,
576                the_range: CFRange,
577            );
578        }
579        unsafe { CFCharacterSetRemoveCharactersInRange(the_set, the_range) }
580    }
581
582    /// Adds the characters in the given string to the charaacter set.
583    ///
584    /// Parameter `theSet`: The character set to which the characters in the
585    /// string are to be added.  If this parameter is not a
586    /// valid mutable CFCharacterSet, the behavior is undefined.
587    ///
588    /// Parameter `theString`: The string to add to the character set.
589    /// If this parameter is not a valid CFString, the behavior
590    /// is undefined.
591    ///
592    /// # Safety
593    ///
594    /// - `the_set` might not allow `None`.
595    /// - `the_string` might not allow `None`.
596    #[doc(alias = "CFCharacterSetAddCharactersInString")]
597    #[inline]
598    pub unsafe fn add_characters_in_string(
599        the_set: Option<&CFMutableCharacterSet>,
600        the_string: Option<&CFString>,
601    ) {
602        extern "C-unwind" {
603            fn CFCharacterSetAddCharactersInString(
604                the_set: Option<&CFMutableCharacterSet>,
605                the_string: Option<&CFString>,
606            );
607        }
608        unsafe { CFCharacterSetAddCharactersInString(the_set, the_string) }
609    }
610
611    /// Removes the characters in the given string from the charaacter set.
612    ///
613    /// Parameter `theSet`: The character set from which the characters in the
614    /// string are to be remove.  If this parameter is not a
615    /// valid mutable CFCharacterSet, the behavior is undefined.
616    ///
617    /// Parameter `theString`: The string to remove from the character set.
618    /// If this parameter is not a valid CFString, the behavior
619    /// is undefined.
620    ///
621    /// # Safety
622    ///
623    /// - `the_set` might not allow `None`.
624    /// - `the_string` might not allow `None`.
625    #[doc(alias = "CFCharacterSetRemoveCharactersInString")]
626    #[inline]
627    pub unsafe fn remove_characters_in_string(
628        the_set: Option<&CFMutableCharacterSet>,
629        the_string: Option<&CFString>,
630    ) {
631        extern "C-unwind" {
632            fn CFCharacterSetRemoveCharactersInString(
633                the_set: Option<&CFMutableCharacterSet>,
634                the_string: Option<&CFString>,
635            );
636        }
637        unsafe { CFCharacterSetRemoveCharactersInString(the_set, the_string) }
638    }
639
640    /// Forms the union with the given character set.
641    ///
642    /// Parameter `theSet`: The destination character set into which the
643    /// union of the two character sets is stored.  If this
644    /// parameter is not a valid mutable CFCharacterSet, the
645    /// behavior is undefined.
646    ///
647    /// Parameter `theOtherSet`: The character set with which the union is
648    /// formed.  If this parameter is not a valid CFCharacterSet,
649    /// the behavior is undefined.
650    ///
651    /// # Safety
652    ///
653    /// - `the_set` might not allow `None`.
654    /// - `the_other_set` might not allow `None`.
655    #[doc(alias = "CFCharacterSetUnion")]
656    #[inline]
657    pub unsafe fn union(
658        the_set: Option<&CFMutableCharacterSet>,
659        the_other_set: Option<&CFCharacterSet>,
660    ) {
661        extern "C-unwind" {
662            fn CFCharacterSetUnion(
663                the_set: Option<&CFMutableCharacterSet>,
664                the_other_set: Option<&CFCharacterSet>,
665            );
666        }
667        unsafe { CFCharacterSetUnion(the_set, the_other_set) }
668    }
669
670    /// Forms the intersection with the given character set.
671    ///
672    /// Parameter `theSet`: The destination character set into which the
673    /// intersection of the two character sets is stored.
674    /// If this parameter is not a valid mutable CFCharacterSet,
675    /// the behavior is undefined.
676    ///
677    /// Parameter `theOtherSet`: The character set with which the intersection
678    /// is formed.  If this parameter is not a valid CFCharacterSet,
679    /// the behavior is undefined.
680    ///
681    /// # Safety
682    ///
683    /// - `the_set` might not allow `None`.
684    /// - `the_other_set` might not allow `None`.
685    #[doc(alias = "CFCharacterSetIntersect")]
686    #[inline]
687    pub unsafe fn intersect(
688        the_set: Option<&CFMutableCharacterSet>,
689        the_other_set: Option<&CFCharacterSet>,
690    ) {
691        extern "C-unwind" {
692            fn CFCharacterSetIntersect(
693                the_set: Option<&CFMutableCharacterSet>,
694                the_other_set: Option<&CFCharacterSet>,
695            );
696        }
697        unsafe { CFCharacterSetIntersect(the_set, the_other_set) }
698    }
699
700    /// Inverts the content of the given character set.
701    ///
702    /// Parameter `theSet`: The character set to be inverted.
703    /// If this parameter is not a valid mutable CFCharacterSet,
704    /// the behavior is undefined.
705    ///
706    /// # Safety
707    ///
708    /// `the_set` might not allow `None`.
709    #[doc(alias = "CFCharacterSetInvert")]
710    #[inline]
711    pub unsafe fn invert(the_set: Option<&CFMutableCharacterSet>) {
712        extern "C-unwind" {
713            fn CFCharacterSetInvert(the_set: Option<&CFMutableCharacterSet>);
714        }
715        unsafe { CFCharacterSetInvert(the_set) }
716    }
717}
718
719#[deprecated = "renamed to `CFCharacterSet::predefined`"]
720#[inline]
721pub extern "C-unwind" fn CFCharacterSetGetPredefined(
722    the_set_identifier: CFCharacterSetPredefinedSet,
723) -> Option<CFRetained<CFCharacterSet>> {
724    extern "C-unwind" {
725        fn CFCharacterSetGetPredefined(
726            the_set_identifier: CFCharacterSetPredefinedSet,
727        ) -> Option<NonNull<CFCharacterSet>>;
728    }
729    let ret = unsafe { CFCharacterSetGetPredefined(the_set_identifier) };
730    ret.map(|ret| unsafe { CFRetained::retain(ret) })
731}
732
733#[deprecated = "renamed to `CFCharacterSet::with_characters_in_range`"]
734#[inline]
735pub unsafe extern "C-unwind" fn CFCharacterSetCreateWithCharactersInRange(
736    alloc: Option<&CFAllocator>,
737    the_range: CFRange,
738) -> Option<CFRetained<CFCharacterSet>> {
739    extern "C-unwind" {
740        fn CFCharacterSetCreateWithCharactersInRange(
741            alloc: Option<&CFAllocator>,
742            the_range: CFRange,
743        ) -> Option<NonNull<CFCharacterSet>>;
744    }
745    let ret = unsafe { CFCharacterSetCreateWithCharactersInRange(alloc, the_range) };
746    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
747}
748
749#[deprecated = "renamed to `CFCharacterSet::with_characters_in_string`"]
750#[inline]
751pub unsafe extern "C-unwind" fn CFCharacterSetCreateWithCharactersInString(
752    alloc: Option<&CFAllocator>,
753    the_string: Option<&CFString>,
754) -> Option<CFRetained<CFCharacterSet>> {
755    extern "C-unwind" {
756        fn CFCharacterSetCreateWithCharactersInString(
757            alloc: Option<&CFAllocator>,
758            the_string: Option<&CFString>,
759        ) -> Option<NonNull<CFCharacterSet>>;
760    }
761    let ret = unsafe { CFCharacterSetCreateWithCharactersInString(alloc, the_string) };
762    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
763}
764
765#[cfg(feature = "CFData")]
766#[deprecated = "renamed to `CFCharacterSet::with_bitmap_representation`"]
767#[inline]
768pub unsafe extern "C-unwind" fn CFCharacterSetCreateWithBitmapRepresentation(
769    alloc: Option<&CFAllocator>,
770    the_data: Option<&CFData>,
771) -> Option<CFRetained<CFCharacterSet>> {
772    extern "C-unwind" {
773        fn CFCharacterSetCreateWithBitmapRepresentation(
774            alloc: Option<&CFAllocator>,
775            the_data: Option<&CFData>,
776        ) -> Option<NonNull<CFCharacterSet>>;
777    }
778    let ret = unsafe { CFCharacterSetCreateWithBitmapRepresentation(alloc, the_data) };
779    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
780}
781
782#[deprecated = "renamed to `CFCharacterSet::new_inverted_set`"]
783#[inline]
784pub unsafe extern "C-unwind" fn CFCharacterSetCreateInvertedSet(
785    alloc: Option<&CFAllocator>,
786    the_set: Option<&CFCharacterSet>,
787) -> Option<CFRetained<CFCharacterSet>> {
788    extern "C-unwind" {
789        fn CFCharacterSetCreateInvertedSet(
790            alloc: Option<&CFAllocator>,
791            the_set: Option<&CFCharacterSet>,
792        ) -> Option<NonNull<CFCharacterSet>>;
793    }
794    let ret = unsafe { CFCharacterSetCreateInvertedSet(alloc, the_set) };
795    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
796}
797
798#[deprecated = "renamed to `CFCharacterSet::is_superset_of_set`"]
799#[inline]
800pub unsafe extern "C-unwind" fn CFCharacterSetIsSupersetOfSet(
801    the_set: &CFCharacterSet,
802    the_otherset: Option<&CFCharacterSet>,
803) -> bool {
804    extern "C-unwind" {
805        fn CFCharacterSetIsSupersetOfSet(
806            the_set: &CFCharacterSet,
807            the_otherset: Option<&CFCharacterSet>,
808        ) -> Boolean;
809    }
810    let ret = unsafe { CFCharacterSetIsSupersetOfSet(the_set, the_otherset) };
811    ret != 0
812}
813
814#[deprecated = "renamed to `CFCharacterSet::has_member_in_plane`"]
815#[inline]
816pub unsafe extern "C-unwind" fn CFCharacterSetHasMemberInPlane(
817    the_set: &CFCharacterSet,
818    the_plane: CFIndex,
819) -> bool {
820    extern "C-unwind" {
821        fn CFCharacterSetHasMemberInPlane(the_set: &CFCharacterSet, the_plane: CFIndex) -> Boolean;
822    }
823    let ret = unsafe { CFCharacterSetHasMemberInPlane(the_set, the_plane) };
824    ret != 0
825}
826
827#[deprecated = "renamed to `CFMutableCharacterSet::new`"]
828#[inline]
829pub unsafe extern "C-unwind" fn CFCharacterSetCreateMutable(
830    alloc: Option<&CFAllocator>,
831) -> Option<CFRetained<CFMutableCharacterSet>> {
832    extern "C-unwind" {
833        fn CFCharacterSetCreateMutable(
834            alloc: Option<&CFAllocator>,
835        ) -> Option<NonNull<CFMutableCharacterSet>>;
836    }
837    let ret = unsafe { CFCharacterSetCreateMutable(alloc) };
838    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
839}
840
841#[deprecated = "renamed to `CFCharacterSet::new_copy`"]
842#[inline]
843pub unsafe extern "C-unwind" fn CFCharacterSetCreateCopy(
844    alloc: Option<&CFAllocator>,
845    the_set: Option<&CFCharacterSet>,
846) -> Option<CFRetained<CFCharacterSet>> {
847    extern "C-unwind" {
848        fn CFCharacterSetCreateCopy(
849            alloc: Option<&CFAllocator>,
850            the_set: Option<&CFCharacterSet>,
851        ) -> Option<NonNull<CFCharacterSet>>;
852    }
853    let ret = unsafe { CFCharacterSetCreateCopy(alloc, the_set) };
854    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
855}
856
857#[deprecated = "renamed to `CFMutableCharacterSet::new_copy`"]
858#[inline]
859pub unsafe extern "C-unwind" fn CFCharacterSetCreateMutableCopy(
860    alloc: Option<&CFAllocator>,
861    the_set: Option<&CFCharacterSet>,
862) -> Option<CFRetained<CFMutableCharacterSet>> {
863    extern "C-unwind" {
864        fn CFCharacterSetCreateMutableCopy(
865            alloc: Option<&CFAllocator>,
866            the_set: Option<&CFCharacterSet>,
867        ) -> Option<NonNull<CFMutableCharacterSet>>;
868    }
869    let ret = unsafe { CFCharacterSetCreateMutableCopy(alloc, the_set) };
870    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
871}
872
873#[deprecated = "renamed to `CFCharacterSet::is_character_member`"]
874#[inline]
875pub extern "C-unwind" fn CFCharacterSetIsCharacterMember(
876    the_set: &CFCharacterSet,
877    the_char: UniChar,
878) -> bool {
879    extern "C-unwind" {
880        fn CFCharacterSetIsCharacterMember(the_set: &CFCharacterSet, the_char: UniChar) -> Boolean;
881    }
882    let ret = unsafe { CFCharacterSetIsCharacterMember(the_set, the_char) };
883    ret != 0
884}
885
886#[deprecated = "renamed to `CFCharacterSet::is_long_character_member`"]
887#[inline]
888pub extern "C-unwind" fn CFCharacterSetIsLongCharacterMember(
889    the_set: &CFCharacterSet,
890    the_char: UTF32Char,
891) -> bool {
892    extern "C-unwind" {
893        fn CFCharacterSetIsLongCharacterMember(
894            the_set: &CFCharacterSet,
895            the_char: UTF32Char,
896        ) -> Boolean;
897    }
898    let ret = unsafe { CFCharacterSetIsLongCharacterMember(the_set, the_char) };
899    ret != 0
900}
901
902#[cfg(feature = "CFData")]
903#[deprecated = "renamed to `CFCharacterSet::new_bitmap_representation`"]
904#[inline]
905pub unsafe extern "C-unwind" fn CFCharacterSetCreateBitmapRepresentation(
906    alloc: Option<&CFAllocator>,
907    the_set: Option<&CFCharacterSet>,
908) -> Option<CFRetained<CFData>> {
909    extern "C-unwind" {
910        fn CFCharacterSetCreateBitmapRepresentation(
911            alloc: Option<&CFAllocator>,
912            the_set: Option<&CFCharacterSet>,
913        ) -> Option<NonNull<CFData>>;
914    }
915    let ret = unsafe { CFCharacterSetCreateBitmapRepresentation(alloc, the_set) };
916    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
917}
918
919extern "C-unwind" {
920    #[deprecated = "renamed to `CFMutableCharacterSet::add_characters_in_range`"]
921    pub fn CFCharacterSetAddCharactersInRange(
922        the_set: Option<&CFMutableCharacterSet>,
923        the_range: CFRange,
924    );
925}
926
927extern "C-unwind" {
928    #[deprecated = "renamed to `CFMutableCharacterSet::remove_characters_in_range`"]
929    pub fn CFCharacterSetRemoveCharactersInRange(
930        the_set: Option<&CFMutableCharacterSet>,
931        the_range: CFRange,
932    );
933}
934
935extern "C-unwind" {
936    #[deprecated = "renamed to `CFMutableCharacterSet::add_characters_in_string`"]
937    pub fn CFCharacterSetAddCharactersInString(
938        the_set: Option<&CFMutableCharacterSet>,
939        the_string: Option<&CFString>,
940    );
941}
942
943extern "C-unwind" {
944    #[deprecated = "renamed to `CFMutableCharacterSet::remove_characters_in_string`"]
945    pub fn CFCharacterSetRemoveCharactersInString(
946        the_set: Option<&CFMutableCharacterSet>,
947        the_string: Option<&CFString>,
948    );
949}
950
951extern "C-unwind" {
952    #[deprecated = "renamed to `CFMutableCharacterSet::union`"]
953    pub fn CFCharacterSetUnion(
954        the_set: Option<&CFMutableCharacterSet>,
955        the_other_set: Option<&CFCharacterSet>,
956    );
957}
958
959extern "C-unwind" {
960    #[deprecated = "renamed to `CFMutableCharacterSet::intersect`"]
961    pub fn CFCharacterSetIntersect(
962        the_set: Option<&CFMutableCharacterSet>,
963        the_other_set: Option<&CFCharacterSet>,
964    );
965}
966
967extern "C-unwind" {
968    #[deprecated = "renamed to `CFMutableCharacterSet::invert`"]
969    pub fn CFCharacterSetInvert(the_set: Option<&CFMutableCharacterSet>);
970}