1use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7
8use crate::*;
9
10pub const kCFStringEncodingInvalidId: c_uint = 0xffffffff;
12pub type CFStringEncoding = u32;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct CFStringBuiltInEncodings(pub CFStringEncoding);
20impl CFStringBuiltInEncodings {
21 #[doc(alias = "kCFStringEncodingMacRoman")]
22 pub const EncodingMacRoman: Self = Self(0);
23 #[doc(alias = "kCFStringEncodingWindowsLatin1")]
24 pub const EncodingWindowsLatin1: Self = Self(0x0500);
25 #[doc(alias = "kCFStringEncodingISOLatin1")]
26 pub const EncodingISOLatin1: Self = Self(0x0201);
27 #[doc(alias = "kCFStringEncodingNextStepLatin")]
28 pub const EncodingNextStepLatin: Self = Self(0x0B01);
29 #[doc(alias = "kCFStringEncodingASCII")]
30 pub const EncodingASCII: Self = Self(0x0600);
31 #[doc(alias = "kCFStringEncodingUnicode")]
32 pub const EncodingUnicode: Self = Self(0x0100);
33 #[doc(alias = "kCFStringEncodingUTF8")]
34 pub const EncodingUTF8: Self = Self(0x08000100);
35 #[doc(alias = "kCFStringEncodingNonLossyASCII")]
36 pub const EncodingNonLossyASCII: Self = Self(0x0BFF);
37 #[doc(alias = "kCFStringEncodingUTF16")]
38 pub const EncodingUTF16: Self = Self(0x0100);
39 #[doc(alias = "kCFStringEncodingUTF16BE")]
40 pub const EncodingUTF16BE: Self = Self(0x10000100);
41 #[doc(alias = "kCFStringEncodingUTF16LE")]
42 pub const EncodingUTF16LE: Self = Self(0x14000100);
43 #[doc(alias = "kCFStringEncodingUTF32")]
44 pub const EncodingUTF32: Self = Self(0x0c000100);
45 #[doc(alias = "kCFStringEncodingUTF32BE")]
46 pub const EncodingUTF32BE: Self = Self(0x18000100);
47 #[doc(alias = "kCFStringEncodingUTF32LE")]
48 pub const EncodingUTF32LE: Self = Self(0x1c000100);
49}
50
51#[cfg(feature = "objc2")]
52unsafe impl Encode for CFStringBuiltInEncodings {
53 const ENCODING: Encoding = CFStringEncoding::ENCODING;
54}
55
56#[cfg(feature = "objc2")]
57unsafe impl RefEncode for CFStringBuiltInEncodings {
58 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61unsafe impl ConcreteType for CFString {
62 #[doc(alias = "CFStringGetTypeID")]
63 #[inline]
64 fn type_id() -> CFTypeID {
65 extern "C-unwind" {
66 fn CFStringGetTypeID() -> CFTypeID;
67 }
68 unsafe { CFStringGetTypeID() }
69 }
70}
71
72impl CFString {
73 #[doc(alias = "CFStringCreateWithPascalString")]
80 #[inline]
81 pub unsafe fn with_pascal_string(
82 alloc: Option<&CFAllocator>,
83 p_str: ConstStr255Param,
84 encoding: CFStringEncoding,
85 ) -> Option<CFRetained<CFString>> {
86 extern "C-unwind" {
87 fn CFStringCreateWithPascalString(
88 alloc: Option<&CFAllocator>,
89 p_str: ConstStr255Param,
90 encoding: CFStringEncoding,
91 ) -> Option<NonNull<CFString>>;
92 }
93 let ret = unsafe { CFStringCreateWithPascalString(alloc, p_str, encoding) };
94 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
95 }
96
97 #[doc(alias = "CFStringCreateWithCString")]
102 #[inline]
103 pub unsafe fn with_c_string(
104 alloc: Option<&CFAllocator>,
105 c_str: *const c_char,
106 encoding: CFStringEncoding,
107 ) -> Option<CFRetained<CFString>> {
108 extern "C-unwind" {
109 fn CFStringCreateWithCString(
110 alloc: Option<&CFAllocator>,
111 c_str: *const c_char,
112 encoding: CFStringEncoding,
113 ) -> Option<NonNull<CFString>>;
114 }
115 let ret = unsafe { CFStringCreateWithCString(alloc, c_str, encoding) };
116 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
117 }
118
119 #[doc(alias = "CFStringCreateWithBytes")]
124 #[inline]
125 pub unsafe fn with_bytes(
126 alloc: Option<&CFAllocator>,
127 bytes: *const u8,
128 num_bytes: CFIndex,
129 encoding: CFStringEncoding,
130 is_external_representation: bool,
131 ) -> Option<CFRetained<CFString>> {
132 extern "C-unwind" {
133 fn CFStringCreateWithBytes(
134 alloc: Option<&CFAllocator>,
135 bytes: *const u8,
136 num_bytes: CFIndex,
137 encoding: CFStringEncoding,
138 is_external_representation: Boolean,
139 ) -> Option<NonNull<CFString>>;
140 }
141 let ret = unsafe {
142 CFStringCreateWithBytes(
143 alloc,
144 bytes,
145 num_bytes,
146 encoding,
147 is_external_representation as _,
148 )
149 };
150 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
151 }
152
153 #[doc(alias = "CFStringCreateWithCharacters")]
158 #[inline]
159 pub unsafe fn with_characters(
160 alloc: Option<&CFAllocator>,
161 chars: *const UniChar,
162 num_chars: CFIndex,
163 ) -> Option<CFRetained<CFString>> {
164 extern "C-unwind" {
165 fn CFStringCreateWithCharacters(
166 alloc: Option<&CFAllocator>,
167 chars: *const UniChar,
168 num_chars: CFIndex,
169 ) -> Option<NonNull<CFString>>;
170 }
171 let ret = unsafe { CFStringCreateWithCharacters(alloc, chars, num_chars) };
172 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
173 }
174
175 #[doc(alias = "CFStringCreateWithPascalStringNoCopy")]
181 #[inline]
182 pub unsafe fn with_pascal_string_no_copy(
183 alloc: Option<&CFAllocator>,
184 p_str: ConstStr255Param,
185 encoding: CFStringEncoding,
186 contents_deallocator: Option<&CFAllocator>,
187 ) -> Option<CFRetained<CFString>> {
188 extern "C-unwind" {
189 fn CFStringCreateWithPascalStringNoCopy(
190 alloc: Option<&CFAllocator>,
191 p_str: ConstStr255Param,
192 encoding: CFStringEncoding,
193 contents_deallocator: Option<&CFAllocator>,
194 ) -> Option<NonNull<CFString>>;
195 }
196 let ret = unsafe {
197 CFStringCreateWithPascalStringNoCopy(alloc, p_str, encoding, contents_deallocator)
198 };
199 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
200 }
201
202 #[doc(alias = "CFStringCreateWithCStringNoCopy")]
208 #[inline]
209 pub unsafe fn with_c_string_no_copy(
210 alloc: Option<&CFAllocator>,
211 c_str: *const c_char,
212 encoding: CFStringEncoding,
213 contents_deallocator: Option<&CFAllocator>,
214 ) -> Option<CFRetained<CFString>> {
215 extern "C-unwind" {
216 fn CFStringCreateWithCStringNoCopy(
217 alloc: Option<&CFAllocator>,
218 c_str: *const c_char,
219 encoding: CFStringEncoding,
220 contents_deallocator: Option<&CFAllocator>,
221 ) -> Option<NonNull<CFString>>;
222 }
223 let ret = unsafe {
224 CFStringCreateWithCStringNoCopy(alloc, c_str, encoding, contents_deallocator)
225 };
226 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
227 }
228
229 #[doc(alias = "CFStringCreateWithBytesNoCopy")]
235 #[inline]
236 pub unsafe fn with_bytes_no_copy(
237 alloc: Option<&CFAllocator>,
238 bytes: *const u8,
239 num_bytes: CFIndex,
240 encoding: CFStringEncoding,
241 is_external_representation: bool,
242 contents_deallocator: Option<&CFAllocator>,
243 ) -> Option<CFRetained<CFString>> {
244 extern "C-unwind" {
245 fn CFStringCreateWithBytesNoCopy(
246 alloc: Option<&CFAllocator>,
247 bytes: *const u8,
248 num_bytes: CFIndex,
249 encoding: CFStringEncoding,
250 is_external_representation: Boolean,
251 contents_deallocator: Option<&CFAllocator>,
252 ) -> Option<NonNull<CFString>>;
253 }
254 let ret = unsafe {
255 CFStringCreateWithBytesNoCopy(
256 alloc,
257 bytes,
258 num_bytes,
259 encoding,
260 is_external_representation as _,
261 contents_deallocator,
262 )
263 };
264 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
265 }
266
267 #[doc(alias = "CFStringCreateWithCharactersNoCopy")]
273 #[inline]
274 pub unsafe fn with_characters_no_copy(
275 alloc: Option<&CFAllocator>,
276 chars: *const UniChar,
277 num_chars: CFIndex,
278 contents_deallocator: Option<&CFAllocator>,
279 ) -> Option<CFRetained<CFString>> {
280 extern "C-unwind" {
281 fn CFStringCreateWithCharactersNoCopy(
282 alloc: Option<&CFAllocator>,
283 chars: *const UniChar,
284 num_chars: CFIndex,
285 contents_deallocator: Option<&CFAllocator>,
286 ) -> Option<NonNull<CFString>>;
287 }
288 let ret = unsafe {
289 CFStringCreateWithCharactersNoCopy(alloc, chars, num_chars, contents_deallocator)
290 };
291 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
292 }
293
294 #[doc(alias = "CFStringCreateWithSubstring")]
299 #[inline]
300 pub unsafe fn with_substring(
301 alloc: Option<&CFAllocator>,
302 str: Option<&CFString>,
303 range: CFRange,
304 ) -> Option<CFRetained<CFString>> {
305 extern "C-unwind" {
306 fn CFStringCreateWithSubstring(
307 alloc: Option<&CFAllocator>,
308 str: Option<&CFString>,
309 range: CFRange,
310 ) -> Option<NonNull<CFString>>;
311 }
312 let ret = unsafe { CFStringCreateWithSubstring(alloc, str, range) };
313 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
314 }
315
316 #[doc(alias = "CFStringCreateCopy")]
317 #[inline]
318 pub fn new_copy(
319 alloc: Option<&CFAllocator>,
320 the_string: Option<&CFString>,
321 ) -> Option<CFRetained<CFString>> {
322 extern "C-unwind" {
323 fn CFStringCreateCopy(
324 alloc: Option<&CFAllocator>,
325 the_string: Option<&CFString>,
326 ) -> Option<NonNull<CFString>>;
327 }
328 let ret = unsafe { CFStringCreateCopy(alloc, the_string) };
329 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
330 }
331}
332
333impl CFMutableString {
334 #[doc(alias = "CFStringCreateMutable")]
335 #[inline]
336 pub fn new(
337 alloc: Option<&CFAllocator>,
338 max_length: CFIndex,
339 ) -> Option<CFRetained<CFMutableString>> {
340 extern "C-unwind" {
341 fn CFStringCreateMutable(
342 alloc: Option<&CFAllocator>,
343 max_length: CFIndex,
344 ) -> Option<NonNull<CFMutableString>>;
345 }
346 let ret = unsafe { CFStringCreateMutable(alloc, max_length) };
347 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
348 }
349
350 #[doc(alias = "CFStringCreateMutableCopy")]
351 #[inline]
352 pub fn new_copy(
353 alloc: Option<&CFAllocator>,
354 max_length: CFIndex,
355 the_string: Option<&CFString>,
356 ) -> Option<CFRetained<CFMutableString>> {
357 extern "C-unwind" {
358 fn CFStringCreateMutableCopy(
359 alloc: Option<&CFAllocator>,
360 max_length: CFIndex,
361 the_string: Option<&CFString>,
362 ) -> Option<NonNull<CFMutableString>>;
363 }
364 let ret = unsafe { CFStringCreateMutableCopy(alloc, max_length, the_string) };
365 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
366 }
367
368 #[doc(alias = "CFStringCreateMutableWithExternalCharactersNoCopy")]
374 #[inline]
375 pub unsafe fn with_external_characters_no_copy(
376 alloc: Option<&CFAllocator>,
377 chars: *mut UniChar,
378 num_chars: CFIndex,
379 capacity: CFIndex,
380 external_characters_allocator: Option<&CFAllocator>,
381 ) -> Option<CFRetained<CFMutableString>> {
382 extern "C-unwind" {
383 fn CFStringCreateMutableWithExternalCharactersNoCopy(
384 alloc: Option<&CFAllocator>,
385 chars: *mut UniChar,
386 num_chars: CFIndex,
387 capacity: CFIndex,
388 external_characters_allocator: Option<&CFAllocator>,
389 ) -> Option<NonNull<CFMutableString>>;
390 }
391 let ret = unsafe {
392 CFStringCreateMutableWithExternalCharactersNoCopy(
393 alloc,
394 chars,
395 num_chars,
396 capacity,
397 external_characters_allocator,
398 )
399 };
400 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
401 }
402}
403
404impl CFString {
405 #[doc(alias = "CFStringGetLength")]
407 #[inline]
408 pub fn length(&self) -> CFIndex {
409 extern "C-unwind" {
410 fn CFStringGetLength(the_string: &CFString) -> CFIndex;
411 }
412 unsafe { CFStringGetLength(self) }
413 }
414
415 #[doc(alias = "CFStringGetCharacterAtIndex")]
416 #[inline]
417 pub unsafe fn character_at_index(&self, idx: CFIndex) -> UniChar {
418 extern "C-unwind" {
419 fn CFStringGetCharacterAtIndex(the_string: &CFString, idx: CFIndex) -> UniChar;
420 }
421 unsafe { CFStringGetCharacterAtIndex(self, idx) }
422 }
423
424 #[doc(alias = "CFStringGetCharacters")]
428 #[inline]
429 pub unsafe fn characters(&self, range: CFRange, buffer: *mut UniChar) {
430 extern "C-unwind" {
431 fn CFStringGetCharacters(the_string: &CFString, range: CFRange, buffer: *mut UniChar);
432 }
433 unsafe { CFStringGetCharacters(self, range, buffer) }
434 }
435
436 #[doc(alias = "CFStringGetPascalString")]
440 #[inline]
441 pub unsafe fn pascal_string(
442 &self,
443 buffer: StringPtr,
444 buffer_size: CFIndex,
445 encoding: CFStringEncoding,
446 ) -> bool {
447 extern "C-unwind" {
448 fn CFStringGetPascalString(
449 the_string: &CFString,
450 buffer: StringPtr,
451 buffer_size: CFIndex,
452 encoding: CFStringEncoding,
453 ) -> Boolean;
454 }
455 let ret = unsafe { CFStringGetPascalString(self, buffer, buffer_size, encoding) };
456 ret != 0
457 }
458
459 #[doc(alias = "CFStringGetCString")]
463 #[inline]
464 pub unsafe fn c_string(
465 &self,
466 buffer: *mut c_char,
467 buffer_size: CFIndex,
468 encoding: CFStringEncoding,
469 ) -> bool {
470 extern "C-unwind" {
471 fn CFStringGetCString(
472 the_string: &CFString,
473 buffer: *mut c_char,
474 buffer_size: CFIndex,
475 encoding: CFStringEncoding,
476 ) -> Boolean;
477 }
478 let ret = unsafe { CFStringGetCString(self, buffer, buffer_size, encoding) };
479 ret != 0
480 }
481
482 #[doc(alias = "CFStringGetPascalStringPtr")]
483 #[inline]
484 pub fn pascal_string_ptr(&self, encoding: CFStringEncoding) -> ConstStringPtr {
485 extern "C-unwind" {
486 fn CFStringGetPascalStringPtr(
487 the_string: &CFString,
488 encoding: CFStringEncoding,
489 ) -> ConstStringPtr;
490 }
491 unsafe { CFStringGetPascalStringPtr(self, encoding) }
492 }
493
494 #[doc(alias = "CFStringGetCStringPtr")]
495 #[inline]
496 pub fn c_string_ptr(&self, encoding: CFStringEncoding) -> *const c_char {
497 extern "C-unwind" {
498 fn CFStringGetCStringPtr(
499 the_string: &CFString,
500 encoding: CFStringEncoding,
501 ) -> *const c_char;
502 }
503 unsafe { CFStringGetCStringPtr(self, encoding) }
504 }
505
506 #[doc(alias = "CFStringGetCharactersPtr")]
507 #[inline]
508 pub fn characters_ptr(&self) -> *const UniChar {
509 extern "C-unwind" {
510 fn CFStringGetCharactersPtr(the_string: &CFString) -> *const UniChar;
511 }
512 unsafe { CFStringGetCharactersPtr(self) }
513 }
514
515 #[doc(alias = "CFStringGetBytes")]
520 #[inline]
521 pub unsafe fn bytes(
522 &self,
523 range: CFRange,
524 encoding: CFStringEncoding,
525 loss_byte: u8,
526 is_external_representation: bool,
527 buffer: *mut u8,
528 max_buf_len: CFIndex,
529 used_buf_len: *mut CFIndex,
530 ) -> CFIndex {
531 extern "C-unwind" {
532 fn CFStringGetBytes(
533 the_string: &CFString,
534 range: CFRange,
535 encoding: CFStringEncoding,
536 loss_byte: u8,
537 is_external_representation: Boolean,
538 buffer: *mut u8,
539 max_buf_len: CFIndex,
540 used_buf_len: *mut CFIndex,
541 ) -> CFIndex;
542 }
543 unsafe {
544 CFStringGetBytes(
545 self,
546 range,
547 encoding,
548 loss_byte,
549 is_external_representation as _,
550 buffer,
551 max_buf_len,
552 used_buf_len,
553 )
554 }
555 }
556
557 #[doc(alias = "CFStringCreateFromExternalRepresentation")]
558 #[cfg(feature = "CFData")]
559 #[inline]
560 pub fn from_external_representation(
561 alloc: Option<&CFAllocator>,
562 data: Option<&CFData>,
563 encoding: CFStringEncoding,
564 ) -> Option<CFRetained<CFString>> {
565 extern "C-unwind" {
566 fn CFStringCreateFromExternalRepresentation(
567 alloc: Option<&CFAllocator>,
568 data: Option<&CFData>,
569 encoding: CFStringEncoding,
570 ) -> Option<NonNull<CFString>>;
571 }
572 let ret = unsafe { CFStringCreateFromExternalRepresentation(alloc, data, encoding) };
573 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
574 }
575
576 #[doc(alias = "CFStringCreateExternalRepresentation")]
577 #[cfg(feature = "CFData")]
578 #[inline]
579 pub fn new_external_representation(
580 alloc: Option<&CFAllocator>,
581 the_string: Option<&CFString>,
582 encoding: CFStringEncoding,
583 loss_byte: u8,
584 ) -> Option<CFRetained<CFData>> {
585 extern "C-unwind" {
586 fn CFStringCreateExternalRepresentation(
587 alloc: Option<&CFAllocator>,
588 the_string: Option<&CFString>,
589 encoding: CFStringEncoding,
590 loss_byte: u8,
591 ) -> Option<NonNull<CFData>>;
592 }
593 let ret =
594 unsafe { CFStringCreateExternalRepresentation(alloc, the_string, encoding, loss_byte) };
595 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
596 }
597
598 #[doc(alias = "CFStringGetSmallestEncoding")]
599 #[inline]
600 pub fn smallest_encoding(&self) -> CFStringEncoding {
601 extern "C-unwind" {
602 fn CFStringGetSmallestEncoding(the_string: &CFString) -> CFStringEncoding;
603 }
604 unsafe { CFStringGetSmallestEncoding(self) }
605 }
606
607 #[doc(alias = "CFStringGetFastestEncoding")]
608 #[inline]
609 pub fn fastest_encoding(&self) -> CFStringEncoding {
610 extern "C-unwind" {
611 fn CFStringGetFastestEncoding(the_string: &CFString) -> CFStringEncoding;
612 }
613 unsafe { CFStringGetFastestEncoding(self) }
614 }
615
616 #[doc(alias = "CFStringGetSystemEncoding")]
617 #[inline]
618 pub fn system_encoding() -> CFStringEncoding {
619 extern "C-unwind" {
620 fn CFStringGetSystemEncoding() -> CFStringEncoding;
621 }
622 unsafe { CFStringGetSystemEncoding() }
623 }
624
625 #[doc(alias = "CFStringGetMaximumSizeForEncoding")]
626 #[inline]
627 pub fn maximum_size_for_encoding(length: CFIndex, encoding: CFStringEncoding) -> CFIndex {
628 extern "C-unwind" {
629 fn CFStringGetMaximumSizeForEncoding(
630 length: CFIndex,
631 encoding: CFStringEncoding,
632 ) -> CFIndex;
633 }
634 unsafe { CFStringGetMaximumSizeForEncoding(length, encoding) }
635 }
636
637 #[doc(alias = "CFStringGetFileSystemRepresentation")]
643 #[inline]
644 pub unsafe fn file_system_representation(
645 &self,
646 buffer: *mut c_char,
647 max_buf_len: CFIndex,
648 ) -> bool {
649 extern "C-unwind" {
650 fn CFStringGetFileSystemRepresentation(
651 string: &CFString,
652 buffer: *mut c_char,
653 max_buf_len: CFIndex,
654 ) -> Boolean;
655 }
656 let ret = unsafe { CFStringGetFileSystemRepresentation(self, buffer, max_buf_len) };
657 ret != 0
658 }
659
660 #[doc(alias = "CFStringGetMaximumSizeOfFileSystemRepresentation")]
661 #[inline]
662 pub fn maximum_size_of_file_system_representation(&self) -> CFIndex {
663 extern "C-unwind" {
664 fn CFStringGetMaximumSizeOfFileSystemRepresentation(string: &CFString) -> CFIndex;
665 }
666 unsafe { CFStringGetMaximumSizeOfFileSystemRepresentation(self) }
667 }
668
669 #[doc(alias = "CFStringCreateWithFileSystemRepresentation")]
674 #[inline]
675 pub unsafe fn with_file_system_representation(
676 alloc: Option<&CFAllocator>,
677 buffer: *const c_char,
678 ) -> Option<CFRetained<CFString>> {
679 extern "C-unwind" {
680 fn CFStringCreateWithFileSystemRepresentation(
681 alloc: Option<&CFAllocator>,
682 buffer: *const c_char,
683 ) -> Option<NonNull<CFString>>;
684 }
685 let ret = unsafe { CFStringCreateWithFileSystemRepresentation(alloc, buffer) };
686 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
687 }
688}
689
690#[repr(transparent)]
693#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
694pub struct CFStringCompareFlags(pub CFOptionFlags);
695bitflags::bitflags! {
696 impl CFStringCompareFlags: CFOptionFlags {
697 #[doc(alias = "kCFCompareCaseInsensitive")]
698 const CompareCaseInsensitive = 1;
699 #[doc(alias = "kCFCompareBackwards")]
700 const CompareBackwards = 4;
701 #[doc(alias = "kCFCompareAnchored")]
702 const CompareAnchored = 8;
703 #[doc(alias = "kCFCompareNonliteral")]
704 const CompareNonliteral = 16;
705 #[doc(alias = "kCFCompareLocalized")]
706 const CompareLocalized = 32;
707 #[doc(alias = "kCFCompareNumerically")]
708 const CompareNumerically = 64;
709 #[doc(alias = "kCFCompareDiacriticInsensitive")]
710 const CompareDiacriticInsensitive = 128;
711 #[doc(alias = "kCFCompareWidthInsensitive")]
712 const CompareWidthInsensitive = 256;
713 #[doc(alias = "kCFCompareForcedOrdering")]
714 const CompareForcedOrdering = 512;
715 }
716}
717
718#[cfg(feature = "objc2")]
719unsafe impl Encode for CFStringCompareFlags {
720 const ENCODING: Encoding = CFOptionFlags::ENCODING;
721}
722
723#[cfg(feature = "objc2")]
724unsafe impl RefEncode for CFStringCompareFlags {
725 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
726}
727
728impl CFString {
729 #[doc(alias = "CFStringCompareWithOptionsAndLocale")]
734 #[cfg(feature = "CFLocale")]
735 #[inline]
736 pub unsafe fn compare_with_options_and_locale(
737 &self,
738 the_string2: Option<&CFString>,
739 range_to_compare: CFRange,
740 compare_options: CFStringCompareFlags,
741 locale: Option<&CFLocale>,
742 ) -> CFComparisonResult {
743 extern "C-unwind" {
744 fn CFStringCompareWithOptionsAndLocale(
745 the_string1: &CFString,
746 the_string2: Option<&CFString>,
747 range_to_compare: CFRange,
748 compare_options: CFStringCompareFlags,
749 locale: Option<&CFLocale>,
750 ) -> CFComparisonResult;
751 }
752 unsafe {
753 CFStringCompareWithOptionsAndLocale(
754 self,
755 the_string2,
756 range_to_compare,
757 compare_options,
758 locale,
759 )
760 }
761 }
762
763 #[doc(alias = "CFStringCompareWithOptions")]
767 #[inline]
768 pub unsafe fn compare_with_options(
769 &self,
770 the_string2: Option<&CFString>,
771 range_to_compare: CFRange,
772 compare_options: CFStringCompareFlags,
773 ) -> CFComparisonResult {
774 extern "C-unwind" {
775 fn CFStringCompareWithOptions(
776 the_string1: &CFString,
777 the_string2: Option<&CFString>,
778 range_to_compare: CFRange,
779 compare_options: CFStringCompareFlags,
780 ) -> CFComparisonResult;
781 }
782 unsafe { CFStringCompareWithOptions(self, the_string2, range_to_compare, compare_options) }
783 }
784
785 #[doc(alias = "CFStringCompare")]
786 #[inline]
787 pub fn compare(
788 &self,
789 the_string2: Option<&CFString>,
790 compare_options: CFStringCompareFlags,
791 ) -> CFComparisonResult {
792 extern "C-unwind" {
793 fn CFStringCompare(
794 the_string1: &CFString,
795 the_string2: Option<&CFString>,
796 compare_options: CFStringCompareFlags,
797 ) -> CFComparisonResult;
798 }
799 unsafe { CFStringCompare(self, the_string2, compare_options) }
800 }
801
802 #[doc(alias = "CFStringFindWithOptionsAndLocale")]
808 #[cfg(feature = "CFLocale")]
809 #[inline]
810 pub unsafe fn find_with_options_and_locale(
811 &self,
812 string_to_find: Option<&CFString>,
813 range_to_search: CFRange,
814 search_options: CFStringCompareFlags,
815 locale: Option<&CFLocale>,
816 result: *mut CFRange,
817 ) -> bool {
818 extern "C-unwind" {
819 fn CFStringFindWithOptionsAndLocale(
820 the_string: &CFString,
821 string_to_find: Option<&CFString>,
822 range_to_search: CFRange,
823 search_options: CFStringCompareFlags,
824 locale: Option<&CFLocale>,
825 result: *mut CFRange,
826 ) -> Boolean;
827 }
828 let ret = unsafe {
829 CFStringFindWithOptionsAndLocale(
830 self,
831 string_to_find,
832 range_to_search,
833 search_options,
834 locale,
835 result,
836 )
837 };
838 ret != 0
839 }
840
841 #[doc(alias = "CFStringFindWithOptions")]
846 #[inline]
847 pub unsafe fn find_with_options(
848 &self,
849 string_to_find: Option<&CFString>,
850 range_to_search: CFRange,
851 search_options: CFStringCompareFlags,
852 result: *mut CFRange,
853 ) -> bool {
854 extern "C-unwind" {
855 fn CFStringFindWithOptions(
856 the_string: &CFString,
857 string_to_find: Option<&CFString>,
858 range_to_search: CFRange,
859 search_options: CFStringCompareFlags,
860 result: *mut CFRange,
861 ) -> Boolean;
862 }
863 let ret = unsafe {
864 CFStringFindWithOptions(
865 self,
866 string_to_find,
867 range_to_search,
868 search_options,
869 result,
870 )
871 };
872 ret != 0
873 }
874
875 #[doc(alias = "CFStringCreateArrayWithFindResults")]
881 #[cfg(feature = "CFArray")]
882 #[inline]
883 pub unsafe fn new_array_with_find_results(
884 alloc: Option<&CFAllocator>,
885 the_string: Option<&CFString>,
886 string_to_find: Option<&CFString>,
887 range_to_search: CFRange,
888 compare_options: CFStringCompareFlags,
889 ) -> Option<CFRetained<CFArray>> {
890 extern "C-unwind" {
891 fn CFStringCreateArrayWithFindResults(
892 alloc: Option<&CFAllocator>,
893 the_string: Option<&CFString>,
894 string_to_find: Option<&CFString>,
895 range_to_search: CFRange,
896 compare_options: CFStringCompareFlags,
897 ) -> Option<NonNull<CFArray>>;
898 }
899 let ret = unsafe {
900 CFStringCreateArrayWithFindResults(
901 alloc,
902 the_string,
903 string_to_find,
904 range_to_search,
905 compare_options,
906 )
907 };
908 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
909 }
910
911 #[doc(alias = "CFStringFind")]
912 #[inline]
913 pub fn find(
914 &self,
915 string_to_find: Option<&CFString>,
916 compare_options: CFStringCompareFlags,
917 ) -> CFRange {
918 extern "C-unwind" {
919 fn CFStringFind(
920 the_string: &CFString,
921 string_to_find: Option<&CFString>,
922 compare_options: CFStringCompareFlags,
923 ) -> CFRange;
924 }
925 unsafe { CFStringFind(self, string_to_find, compare_options) }
926 }
927
928 #[doc(alias = "CFStringHasPrefix")]
929 #[inline]
930 pub fn has_prefix(&self, prefix: Option<&CFString>) -> bool {
931 extern "C-unwind" {
932 fn CFStringHasPrefix(the_string: &CFString, prefix: Option<&CFString>) -> Boolean;
933 }
934 let ret = unsafe { CFStringHasPrefix(self, prefix) };
935 ret != 0
936 }
937
938 #[doc(alias = "CFStringHasSuffix")]
939 #[inline]
940 pub fn has_suffix(&self, suffix: Option<&CFString>) -> bool {
941 extern "C-unwind" {
942 fn CFStringHasSuffix(the_string: &CFString, suffix: Option<&CFString>) -> Boolean;
943 }
944 let ret = unsafe { CFStringHasSuffix(self, suffix) };
945 ret != 0
946 }
947
948 #[doc(alias = "CFStringGetRangeOfComposedCharactersAtIndex")]
962 #[inline]
963 pub unsafe fn range_of_composed_characters_at_index(&self, the_index: CFIndex) -> CFRange {
964 extern "C-unwind" {
965 fn CFStringGetRangeOfComposedCharactersAtIndex(
966 the_string: &CFString,
967 the_index: CFIndex,
968 ) -> CFRange;
969 }
970 unsafe { CFStringGetRangeOfComposedCharactersAtIndex(self, the_index) }
971 }
972
973 #[doc(alias = "CFStringFindCharacterFromSet")]
1011 #[cfg(feature = "CFCharacterSet")]
1012 #[inline]
1013 pub unsafe fn find_character_from_set(
1014 &self,
1015 the_set: Option<&CFCharacterSet>,
1016 range_to_search: CFRange,
1017 search_options: CFStringCompareFlags,
1018 result: *mut CFRange,
1019 ) -> bool {
1020 extern "C-unwind" {
1021 fn CFStringFindCharacterFromSet(
1022 the_string: &CFString,
1023 the_set: Option<&CFCharacterSet>,
1024 range_to_search: CFRange,
1025 search_options: CFStringCompareFlags,
1026 result: *mut CFRange,
1027 ) -> Boolean;
1028 }
1029 let ret = unsafe {
1030 CFStringFindCharacterFromSet(self, the_set, range_to_search, search_options, result)
1031 };
1032 ret != 0
1033 }
1034
1035 #[doc(alias = "CFStringGetLineBounds")]
1041 #[inline]
1042 pub unsafe fn line_bounds(
1043 &self,
1044 range: CFRange,
1045 line_begin_index: *mut CFIndex,
1046 line_end_index: *mut CFIndex,
1047 contents_end_index: *mut CFIndex,
1048 ) {
1049 extern "C-unwind" {
1050 fn CFStringGetLineBounds(
1051 the_string: &CFString,
1052 range: CFRange,
1053 line_begin_index: *mut CFIndex,
1054 line_end_index: *mut CFIndex,
1055 contents_end_index: *mut CFIndex,
1056 );
1057 }
1058 unsafe {
1059 CFStringGetLineBounds(
1060 self,
1061 range,
1062 line_begin_index,
1063 line_end_index,
1064 contents_end_index,
1065 )
1066 }
1067 }
1068
1069 #[doc(alias = "CFStringGetParagraphBounds")]
1075 #[inline]
1076 pub unsafe fn paragraph_bounds(
1077 &self,
1078 range: CFRange,
1079 par_begin_index: *mut CFIndex,
1080 par_end_index: *mut CFIndex,
1081 contents_end_index: *mut CFIndex,
1082 ) {
1083 extern "C-unwind" {
1084 fn CFStringGetParagraphBounds(
1085 string: &CFString,
1086 range: CFRange,
1087 par_begin_index: *mut CFIndex,
1088 par_end_index: *mut CFIndex,
1089 contents_end_index: *mut CFIndex,
1090 );
1091 }
1092 unsafe {
1093 CFStringGetParagraphBounds(
1094 self,
1095 range,
1096 par_begin_index,
1097 par_end_index,
1098 contents_end_index,
1099 )
1100 }
1101 }
1102
1103 #[doc(alias = "CFStringGetHyphenationLocationBeforeIndex")]
1138 #[cfg(feature = "CFLocale")]
1139 #[inline]
1140 pub unsafe fn hyphenation_location_before_index(
1141 &self,
1142 location: CFIndex,
1143 limit_range: CFRange,
1144 options: CFOptionFlags,
1145 locale: Option<&CFLocale>,
1146 character: *mut UTF32Char,
1147 ) -> CFIndex {
1148 extern "C-unwind" {
1149 fn CFStringGetHyphenationLocationBeforeIndex(
1150 string: &CFString,
1151 location: CFIndex,
1152 limit_range: CFRange,
1153 options: CFOptionFlags,
1154 locale: Option<&CFLocale>,
1155 character: *mut UTF32Char,
1156 ) -> CFIndex;
1157 }
1158 unsafe {
1159 CFStringGetHyphenationLocationBeforeIndex(
1160 self,
1161 location,
1162 limit_range,
1163 options,
1164 locale,
1165 character,
1166 )
1167 }
1168 }
1169
1170 #[doc(alias = "CFStringIsHyphenationAvailableForLocale")]
1171 #[cfg(feature = "CFLocale")]
1172 #[inline]
1173 pub fn is_hyphenation_available_for_locale(locale: Option<&CFLocale>) -> bool {
1174 extern "C-unwind" {
1175 fn CFStringIsHyphenationAvailableForLocale(locale: Option<&CFLocale>) -> Boolean;
1176 }
1177 let ret = unsafe { CFStringIsHyphenationAvailableForLocale(locale) };
1178 ret != 0
1179 }
1180
1181 #[doc(alias = "CFStringCreateByCombiningStrings")]
1190 #[cfg(feature = "CFArray")]
1191 #[inline]
1192 pub unsafe fn new_by_combining_strings(
1193 alloc: Option<&CFAllocator>,
1194 the_array: Option<&CFArray>,
1195 separator_string: Option<&CFString>,
1196 ) -> Option<CFRetained<CFString>> {
1197 extern "C-unwind" {
1198 fn CFStringCreateByCombiningStrings(
1199 alloc: Option<&CFAllocator>,
1200 the_array: Option<&CFArray>,
1201 separator_string: Option<&CFString>,
1202 ) -> Option<NonNull<CFString>>;
1203 }
1204 let ret = unsafe { CFStringCreateByCombiningStrings(alloc, the_array, separator_string) };
1205 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1206 }
1207
1208 #[doc(alias = "CFStringCreateArrayBySeparatingStrings")]
1209 #[cfg(feature = "CFArray")]
1210 #[inline]
1211 pub fn new_array_by_separating_strings(
1212 alloc: Option<&CFAllocator>,
1213 the_string: Option<&CFString>,
1214 separator_string: Option<&CFString>,
1215 ) -> Option<CFRetained<CFArray>> {
1216 extern "C-unwind" {
1217 fn CFStringCreateArrayBySeparatingStrings(
1218 alloc: Option<&CFAllocator>,
1219 the_string: Option<&CFString>,
1220 separator_string: Option<&CFString>,
1221 ) -> Option<NonNull<CFArray>>;
1222 }
1223 let ret =
1224 unsafe { CFStringCreateArrayBySeparatingStrings(alloc, the_string, separator_string) };
1225 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1226 }
1227
1228 #[doc(alias = "CFStringGetIntValue")]
1230 #[inline]
1231 pub fn int_value(&self) -> i32 {
1232 extern "C-unwind" {
1233 fn CFStringGetIntValue(str: &CFString) -> i32;
1234 }
1235 unsafe { CFStringGetIntValue(self) }
1236 }
1237
1238 #[doc(alias = "CFStringGetDoubleValue")]
1239 #[inline]
1240 pub fn double_value(&self) -> c_double {
1241 extern "C-unwind" {
1242 fn CFStringGetDoubleValue(str: &CFString) -> c_double;
1243 }
1244 unsafe { CFStringGetDoubleValue(self) }
1245 }
1246}
1247
1248impl CFMutableString {
1249 #[doc(alias = "CFStringAppend")]
1251 #[inline]
1252 pub fn append(the_string: Option<&CFMutableString>, appended_string: Option<&CFString>) {
1253 extern "C-unwind" {
1254 fn CFStringAppend(
1255 the_string: Option<&CFMutableString>,
1256 appended_string: Option<&CFString>,
1257 );
1258 }
1259 unsafe { CFStringAppend(the_string, appended_string) }
1260 }
1261
1262 #[doc(alias = "CFStringAppendCharacters")]
1267 #[inline]
1268 pub unsafe fn append_characters(
1269 the_string: Option<&CFMutableString>,
1270 chars: *const UniChar,
1271 num_chars: CFIndex,
1272 ) {
1273 extern "C-unwind" {
1274 fn CFStringAppendCharacters(
1275 the_string: Option<&CFMutableString>,
1276 chars: *const UniChar,
1277 num_chars: CFIndex,
1278 );
1279 }
1280 unsafe { CFStringAppendCharacters(the_string, chars, num_chars) }
1281 }
1282
1283 #[doc(alias = "CFStringAppendPascalString")]
1288 #[inline]
1289 pub unsafe fn append_pascal_string(
1290 the_string: Option<&CFMutableString>,
1291 p_str: ConstStr255Param,
1292 encoding: CFStringEncoding,
1293 ) {
1294 extern "C-unwind" {
1295 fn CFStringAppendPascalString(
1296 the_string: Option<&CFMutableString>,
1297 p_str: ConstStr255Param,
1298 encoding: CFStringEncoding,
1299 );
1300 }
1301 unsafe { CFStringAppendPascalString(the_string, p_str, encoding) }
1302 }
1303
1304 #[doc(alias = "CFStringAppendCString")]
1309 #[inline]
1310 pub unsafe fn append_c_string(
1311 the_string: Option<&CFMutableString>,
1312 c_str: *const c_char,
1313 encoding: CFStringEncoding,
1314 ) {
1315 extern "C-unwind" {
1316 fn CFStringAppendCString(
1317 the_string: Option<&CFMutableString>,
1318 c_str: *const c_char,
1319 encoding: CFStringEncoding,
1320 );
1321 }
1322 unsafe { CFStringAppendCString(the_string, c_str, encoding) }
1323 }
1324
1325 #[doc(alias = "CFStringInsert")]
1330 #[inline]
1331 pub unsafe fn insert(
1332 str: Option<&CFMutableString>,
1333 idx: CFIndex,
1334 inserted_str: Option<&CFString>,
1335 ) {
1336 extern "C-unwind" {
1337 fn CFStringInsert(
1338 str: Option<&CFMutableString>,
1339 idx: CFIndex,
1340 inserted_str: Option<&CFString>,
1341 );
1342 }
1343 unsafe { CFStringInsert(str, idx, inserted_str) }
1344 }
1345
1346 #[doc(alias = "CFStringDelete")]
1350 #[inline]
1351 pub unsafe fn delete(the_string: Option<&CFMutableString>, range: CFRange) {
1352 extern "C-unwind" {
1353 fn CFStringDelete(the_string: Option<&CFMutableString>, range: CFRange);
1354 }
1355 unsafe { CFStringDelete(the_string, range) }
1356 }
1357
1358 #[doc(alias = "CFStringReplace")]
1363 #[inline]
1364 pub unsafe fn replace(
1365 the_string: Option<&CFMutableString>,
1366 range: CFRange,
1367 replacement: Option<&CFString>,
1368 ) {
1369 extern "C-unwind" {
1370 fn CFStringReplace(
1371 the_string: Option<&CFMutableString>,
1372 range: CFRange,
1373 replacement: Option<&CFString>,
1374 );
1375 }
1376 unsafe { CFStringReplace(the_string, range, replacement) }
1377 }
1378
1379 #[doc(alias = "CFStringReplaceAll")]
1380 #[inline]
1381 pub fn replace_all(the_string: Option<&CFMutableString>, replacement: Option<&CFString>) {
1382 extern "C-unwind" {
1383 fn CFStringReplaceAll(
1384 the_string: Option<&CFMutableString>,
1385 replacement: Option<&CFString>,
1386 );
1387 }
1388 unsafe { CFStringReplaceAll(the_string, replacement) }
1389 }
1390
1391 #[doc(alias = "CFStringFindAndReplace")]
1397 #[inline]
1398 pub unsafe fn find_and_replace(
1399 the_string: Option<&CFMutableString>,
1400 string_to_find: Option<&CFString>,
1401 replacement_string: Option<&CFString>,
1402 range_to_search: CFRange,
1403 compare_options: CFStringCompareFlags,
1404 ) -> CFIndex {
1405 extern "C-unwind" {
1406 fn CFStringFindAndReplace(
1407 the_string: Option<&CFMutableString>,
1408 string_to_find: Option<&CFString>,
1409 replacement_string: Option<&CFString>,
1410 range_to_search: CFRange,
1411 compare_options: CFStringCompareFlags,
1412 ) -> CFIndex;
1413 }
1414 unsafe {
1415 CFStringFindAndReplace(
1416 the_string,
1417 string_to_find,
1418 replacement_string,
1419 range_to_search,
1420 compare_options,
1421 )
1422 }
1423 }
1424
1425 #[doc(alias = "CFStringSetExternalCharactersNoCopy")]
1430 #[inline]
1431 pub unsafe fn set_external_characters_no_copy(
1432 the_string: Option<&CFMutableString>,
1433 chars: *mut UniChar,
1434 length: CFIndex,
1435 capacity: CFIndex,
1436 ) {
1437 extern "C-unwind" {
1438 fn CFStringSetExternalCharactersNoCopy(
1439 the_string: Option<&CFMutableString>,
1440 chars: *mut UniChar,
1441 length: CFIndex,
1442 capacity: CFIndex,
1443 );
1444 }
1445 unsafe { CFStringSetExternalCharactersNoCopy(the_string, chars, length, capacity) }
1446 }
1447
1448 #[doc(alias = "CFStringPad")]
1453 #[inline]
1454 pub unsafe fn pad(
1455 the_string: Option<&CFMutableString>,
1456 pad_string: Option<&CFString>,
1457 length: CFIndex,
1458 index_into_pad: CFIndex,
1459 ) {
1460 extern "C-unwind" {
1461 fn CFStringPad(
1462 the_string: Option<&CFMutableString>,
1463 pad_string: Option<&CFString>,
1464 length: CFIndex,
1465 index_into_pad: CFIndex,
1466 );
1467 }
1468 unsafe { CFStringPad(the_string, pad_string, length, index_into_pad) }
1469 }
1470
1471 #[doc(alias = "CFStringTrim")]
1472 #[inline]
1473 pub fn trim(the_string: Option<&CFMutableString>, trim_string: Option<&CFString>) {
1474 extern "C-unwind" {
1475 fn CFStringTrim(the_string: Option<&CFMutableString>, trim_string: Option<&CFString>);
1476 }
1477 unsafe { CFStringTrim(the_string, trim_string) }
1478 }
1479
1480 #[doc(alias = "CFStringTrimWhitespace")]
1481 #[inline]
1482 pub fn trim_whitespace(the_string: Option<&CFMutableString>) {
1483 extern "C-unwind" {
1484 fn CFStringTrimWhitespace(the_string: Option<&CFMutableString>);
1485 }
1486 unsafe { CFStringTrimWhitespace(the_string) }
1487 }
1488
1489 #[doc(alias = "CFStringLowercase")]
1490 #[cfg(feature = "CFLocale")]
1491 #[inline]
1492 pub fn lowercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>) {
1493 extern "C-unwind" {
1494 fn CFStringLowercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
1495 }
1496 unsafe { CFStringLowercase(the_string, locale) }
1497 }
1498
1499 #[doc(alias = "CFStringUppercase")]
1500 #[cfg(feature = "CFLocale")]
1501 #[inline]
1502 pub fn uppercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>) {
1503 extern "C-unwind" {
1504 fn CFStringUppercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
1505 }
1506 unsafe { CFStringUppercase(the_string, locale) }
1507 }
1508
1509 #[doc(alias = "CFStringCapitalize")]
1510 #[cfg(feature = "CFLocale")]
1511 #[inline]
1512 pub fn capitalize(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>) {
1513 extern "C-unwind" {
1514 fn CFStringCapitalize(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
1515 }
1516 unsafe { CFStringCapitalize(the_string, locale) }
1517 }
1518}
1519
1520#[repr(transparent)]
1527#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1528pub struct CFStringNormalizationForm(pub CFIndex);
1529impl CFStringNormalizationForm {
1530 #[doc(alias = "kCFStringNormalizationFormD")]
1531 pub const D: Self = Self(0);
1532 #[doc(alias = "kCFStringNormalizationFormKD")]
1533 pub const KD: Self = Self(1);
1534 #[doc(alias = "kCFStringNormalizationFormC")]
1535 pub const C: Self = Self(2);
1536 #[doc(alias = "kCFStringNormalizationFormKC")]
1537 pub const KC: Self = Self(3);
1538}
1539
1540#[cfg(feature = "objc2")]
1541unsafe impl Encode for CFStringNormalizationForm {
1542 const ENCODING: Encoding = CFIndex::ENCODING;
1543}
1544
1545#[cfg(feature = "objc2")]
1546unsafe impl RefEncode for CFStringNormalizationForm {
1547 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1548}
1549
1550impl CFMutableString {
1551 #[doc(alias = "CFStringNormalize")]
1566 #[inline]
1567 pub unsafe fn normalize(
1568 the_string: Option<&CFMutableString>,
1569 the_form: CFStringNormalizationForm,
1570 ) {
1571 extern "C-unwind" {
1572 fn CFStringNormalize(
1573 the_string: Option<&CFMutableString>,
1574 the_form: CFStringNormalizationForm,
1575 );
1576 }
1577 unsafe { CFStringNormalize(the_string, the_form) }
1578 }
1579
1580 #[doc(alias = "CFStringFold")]
1604 #[cfg(feature = "CFLocale")]
1605 #[inline]
1606 pub fn fold(
1607 the_string: Option<&CFMutableString>,
1608 the_flags: CFStringCompareFlags,
1609 the_locale: Option<&CFLocale>,
1610 ) {
1611 extern "C-unwind" {
1612 fn CFStringFold(
1613 the_string: Option<&CFMutableString>,
1614 the_flags: CFStringCompareFlags,
1615 the_locale: Option<&CFLocale>,
1616 );
1617 }
1618 unsafe { CFStringFold(the_string, the_flags, the_locale) }
1619 }
1620
1621 #[doc(alias = "CFStringTransform")]
1627 #[inline]
1628 pub unsafe fn transform(
1629 string: Option<&CFMutableString>,
1630 range: *mut CFRange,
1631 transform: Option<&CFString>,
1632 reverse: bool,
1633 ) -> bool {
1634 extern "C-unwind" {
1635 fn CFStringTransform(
1636 string: Option<&CFMutableString>,
1637 range: *mut CFRange,
1638 transform: Option<&CFString>,
1639 reverse: Boolean,
1640 ) -> Boolean;
1641 }
1642 let ret = unsafe { CFStringTransform(string, range, transform, reverse as _) };
1643 ret != 0
1644 }
1645}
1646
1647extern "C" {
1648 pub static kCFStringTransformStripCombiningMarks: Option<&'static CFString>;
1650}
1651
1652extern "C" {
1653 pub static kCFStringTransformToLatin: Option<&'static CFString>;
1655}
1656
1657extern "C" {
1658 pub static kCFStringTransformFullwidthHalfwidth: Option<&'static CFString>;
1660}
1661
1662extern "C" {
1663 pub static kCFStringTransformLatinKatakana: Option<&'static CFString>;
1665}
1666
1667extern "C" {
1668 pub static kCFStringTransformLatinHiragana: Option<&'static CFString>;
1670}
1671
1672extern "C" {
1673 pub static kCFStringTransformHiraganaKatakana: Option<&'static CFString>;
1675}
1676
1677extern "C" {
1678 pub static kCFStringTransformMandarinLatin: Option<&'static CFString>;
1680}
1681
1682extern "C" {
1683 pub static kCFStringTransformLatinHangul: Option<&'static CFString>;
1685}
1686
1687extern "C" {
1688 pub static kCFStringTransformLatinArabic: Option<&'static CFString>;
1690}
1691
1692extern "C" {
1693 pub static kCFStringTransformLatinHebrew: Option<&'static CFString>;
1695}
1696
1697extern "C" {
1698 pub static kCFStringTransformLatinThai: Option<&'static CFString>;
1700}
1701
1702extern "C" {
1703 pub static kCFStringTransformLatinCyrillic: Option<&'static CFString>;
1705}
1706
1707extern "C" {
1708 pub static kCFStringTransformLatinGreek: Option<&'static CFString>;
1710}
1711
1712extern "C" {
1713 pub static kCFStringTransformToXMLHex: Option<&'static CFString>;
1715}
1716
1717extern "C" {
1718 pub static kCFStringTransformToUnicodeName: Option<&'static CFString>;
1720}
1721
1722extern "C" {
1723 pub static kCFStringTransformStripDiacritics: Option<&'static CFString>;
1725}
1726
1727impl CFString {
1728 #[doc(alias = "CFStringIsEncodingAvailable")]
1730 #[inline]
1731 pub fn is_encoding_available(encoding: CFStringEncoding) -> bool {
1732 extern "C-unwind" {
1733 fn CFStringIsEncodingAvailable(encoding: CFStringEncoding) -> Boolean;
1734 }
1735 let ret = unsafe { CFStringIsEncodingAvailable(encoding) };
1736 ret != 0
1737 }
1738
1739 #[doc(alias = "CFStringGetListOfAvailableEncodings")]
1740 #[inline]
1741 pub fn list_of_available_encodings() -> *const CFStringEncoding {
1742 extern "C-unwind" {
1743 fn CFStringGetListOfAvailableEncodings() -> *const CFStringEncoding;
1744 }
1745 unsafe { CFStringGetListOfAvailableEncodings() }
1746 }
1747
1748 #[doc(alias = "CFStringGetNameOfEncoding")]
1749 #[inline]
1750 pub fn name_of_encoding(encoding: CFStringEncoding) -> Option<CFRetained<CFString>> {
1751 extern "C-unwind" {
1752 fn CFStringGetNameOfEncoding(encoding: CFStringEncoding) -> Option<NonNull<CFString>>;
1753 }
1754 let ret = unsafe { CFStringGetNameOfEncoding(encoding) };
1755 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1756 }
1757
1758 #[doc(alias = "CFStringConvertEncodingToNSStringEncoding")]
1759 #[inline]
1760 pub fn convert_encoding_to_ns_string_encoding(encoding: CFStringEncoding) -> c_ulong {
1761 extern "C-unwind" {
1762 fn CFStringConvertEncodingToNSStringEncoding(encoding: CFStringEncoding) -> c_ulong;
1763 }
1764 unsafe { CFStringConvertEncodingToNSStringEncoding(encoding) }
1765 }
1766
1767 #[doc(alias = "CFStringConvertNSStringEncodingToEncoding")]
1768 #[inline]
1769 pub fn convert_ns_string_encoding_to_encoding(encoding: c_ulong) -> CFStringEncoding {
1770 extern "C-unwind" {
1771 fn CFStringConvertNSStringEncodingToEncoding(encoding: c_ulong) -> CFStringEncoding;
1772 }
1773 unsafe { CFStringConvertNSStringEncodingToEncoding(encoding) }
1774 }
1775
1776 #[doc(alias = "CFStringConvertEncodingToWindowsCodepage")]
1777 #[inline]
1778 pub fn convert_encoding_to_windows_codepage(encoding: CFStringEncoding) -> u32 {
1779 extern "C-unwind" {
1780 fn CFStringConvertEncodingToWindowsCodepage(encoding: CFStringEncoding) -> u32;
1781 }
1782 unsafe { CFStringConvertEncodingToWindowsCodepage(encoding) }
1783 }
1784
1785 #[doc(alias = "CFStringConvertWindowsCodepageToEncoding")]
1786 #[inline]
1787 pub fn convert_windows_codepage_to_encoding(codepage: u32) -> CFStringEncoding {
1788 extern "C-unwind" {
1789 fn CFStringConvertWindowsCodepageToEncoding(codepage: u32) -> CFStringEncoding;
1790 }
1791 unsafe { CFStringConvertWindowsCodepageToEncoding(codepage) }
1792 }
1793
1794 #[doc(alias = "CFStringConvertIANACharSetNameToEncoding")]
1795 #[inline]
1796 pub fn convert_iana_char_set_name_to_encoding(&self) -> CFStringEncoding {
1797 extern "C-unwind" {
1798 fn CFStringConvertIANACharSetNameToEncoding(the_string: &CFString) -> CFStringEncoding;
1799 }
1800 unsafe { CFStringConvertIANACharSetNameToEncoding(self) }
1801 }
1802
1803 #[doc(alias = "CFStringConvertEncodingToIANACharSetName")]
1804 #[inline]
1805 pub fn convert_encoding_to_iana_char_set_name(
1806 encoding: CFStringEncoding,
1807 ) -> Option<CFRetained<CFString>> {
1808 extern "C-unwind" {
1809 fn CFStringConvertEncodingToIANACharSetName(
1810 encoding: CFStringEncoding,
1811 ) -> Option<NonNull<CFString>>;
1812 }
1813 let ret = unsafe { CFStringConvertEncodingToIANACharSetName(encoding) };
1814 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1815 }
1816
1817 #[doc(alias = "CFStringGetMostCompatibleMacStringEncoding")]
1818 #[inline]
1819 pub fn most_compatible_mac_string_encoding(encoding: CFStringEncoding) -> CFStringEncoding {
1820 extern "C-unwind" {
1821 fn CFStringGetMostCompatibleMacStringEncoding(
1822 encoding: CFStringEncoding,
1823 ) -> CFStringEncoding;
1824 }
1825 unsafe { CFStringGetMostCompatibleMacStringEncoding(encoding) }
1826 }
1827}
1828
1829#[repr(C)]
1831#[derive(Clone, Copy, Debug, PartialEq)]
1832pub struct CFStringInlineBuffer {
1833 pub buffer: [UniChar; 64],
1834 pub theString: *const CFString,
1835 pub directUniCharBuffer: *const UniChar,
1836 pub directCStringBuffer: *const c_char,
1837 pub rangeToBuffer: CFRange,
1838 pub bufferedRangeStart: CFIndex,
1839 pub bufferedRangeEnd: CFIndex,
1840}
1841
1842#[cfg(feature = "objc2")]
1843unsafe impl Encode for CFStringInlineBuffer {
1844 const ENCODING: Encoding = Encoding::Struct(
1845 "?",
1846 &[
1847 <[UniChar; 64]>::ENCODING,
1848 <*const CFString>::ENCODING,
1849 <*const UniChar>::ENCODING,
1850 <*const c_char>::ENCODING,
1851 <CFRange>::ENCODING,
1852 <CFIndex>::ENCODING,
1853 <CFIndex>::ENCODING,
1854 ],
1855 );
1856}
1857
1858#[cfg(feature = "objc2")]
1859unsafe impl RefEncode for CFStringInlineBuffer {
1860 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1861}
1862
1863impl CFString {
1864 }
1876
1877#[inline]
1878pub extern "C-unwind" fn CFShow(obj: Option<&CFType>) {
1879 extern "C-unwind" {
1880 fn CFShow(obj: Option<&CFType>);
1881 }
1882 unsafe { CFShow(obj) }
1883}
1884
1885#[inline]
1886pub extern "C-unwind" fn CFShowStr(str: Option<&CFString>) {
1887 extern "C-unwind" {
1888 fn CFShowStr(str: Option<&CFString>);
1889 }
1890 unsafe { CFShowStr(str) }
1891}
1892
1893#[deprecated = "renamed to `CFString::with_pascal_string`"]
1894#[inline]
1895pub unsafe extern "C-unwind" fn CFStringCreateWithPascalString(
1896 alloc: Option<&CFAllocator>,
1897 p_str: ConstStr255Param,
1898 encoding: CFStringEncoding,
1899) -> Option<CFRetained<CFString>> {
1900 extern "C-unwind" {
1901 fn CFStringCreateWithPascalString(
1902 alloc: Option<&CFAllocator>,
1903 p_str: ConstStr255Param,
1904 encoding: CFStringEncoding,
1905 ) -> Option<NonNull<CFString>>;
1906 }
1907 let ret = unsafe { CFStringCreateWithPascalString(alloc, p_str, encoding) };
1908 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1909}
1910
1911#[deprecated = "renamed to `CFString::with_c_string`"]
1912#[inline]
1913pub unsafe extern "C-unwind" fn CFStringCreateWithCString(
1914 alloc: Option<&CFAllocator>,
1915 c_str: *const c_char,
1916 encoding: CFStringEncoding,
1917) -> Option<CFRetained<CFString>> {
1918 extern "C-unwind" {
1919 fn CFStringCreateWithCString(
1920 alloc: Option<&CFAllocator>,
1921 c_str: *const c_char,
1922 encoding: CFStringEncoding,
1923 ) -> Option<NonNull<CFString>>;
1924 }
1925 let ret = unsafe { CFStringCreateWithCString(alloc, c_str, encoding) };
1926 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1927}
1928
1929#[deprecated = "renamed to `CFString::with_bytes`"]
1930#[inline]
1931pub unsafe extern "C-unwind" fn CFStringCreateWithBytes(
1932 alloc: Option<&CFAllocator>,
1933 bytes: *const u8,
1934 num_bytes: CFIndex,
1935 encoding: CFStringEncoding,
1936 is_external_representation: bool,
1937) -> Option<CFRetained<CFString>> {
1938 extern "C-unwind" {
1939 fn CFStringCreateWithBytes(
1940 alloc: Option<&CFAllocator>,
1941 bytes: *const u8,
1942 num_bytes: CFIndex,
1943 encoding: CFStringEncoding,
1944 is_external_representation: Boolean,
1945 ) -> Option<NonNull<CFString>>;
1946 }
1947 let ret = unsafe {
1948 CFStringCreateWithBytes(
1949 alloc,
1950 bytes,
1951 num_bytes,
1952 encoding,
1953 is_external_representation as _,
1954 )
1955 };
1956 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1957}
1958
1959#[deprecated = "renamed to `CFString::with_characters`"]
1960#[inline]
1961pub unsafe extern "C-unwind" fn CFStringCreateWithCharacters(
1962 alloc: Option<&CFAllocator>,
1963 chars: *const UniChar,
1964 num_chars: CFIndex,
1965) -> Option<CFRetained<CFString>> {
1966 extern "C-unwind" {
1967 fn CFStringCreateWithCharacters(
1968 alloc: Option<&CFAllocator>,
1969 chars: *const UniChar,
1970 num_chars: CFIndex,
1971 ) -> Option<NonNull<CFString>>;
1972 }
1973 let ret = unsafe { CFStringCreateWithCharacters(alloc, chars, num_chars) };
1974 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1975}
1976
1977#[deprecated = "renamed to `CFString::with_pascal_string_no_copy`"]
1978#[inline]
1979pub unsafe extern "C-unwind" fn CFStringCreateWithPascalStringNoCopy(
1980 alloc: Option<&CFAllocator>,
1981 p_str: ConstStr255Param,
1982 encoding: CFStringEncoding,
1983 contents_deallocator: Option<&CFAllocator>,
1984) -> Option<CFRetained<CFString>> {
1985 extern "C-unwind" {
1986 fn CFStringCreateWithPascalStringNoCopy(
1987 alloc: Option<&CFAllocator>,
1988 p_str: ConstStr255Param,
1989 encoding: CFStringEncoding,
1990 contents_deallocator: Option<&CFAllocator>,
1991 ) -> Option<NonNull<CFString>>;
1992 }
1993 let ret = unsafe {
1994 CFStringCreateWithPascalStringNoCopy(alloc, p_str, encoding, contents_deallocator)
1995 };
1996 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1997}
1998
1999#[deprecated = "renamed to `CFString::with_c_string_no_copy`"]
2000#[inline]
2001pub unsafe extern "C-unwind" fn CFStringCreateWithCStringNoCopy(
2002 alloc: Option<&CFAllocator>,
2003 c_str: *const c_char,
2004 encoding: CFStringEncoding,
2005 contents_deallocator: Option<&CFAllocator>,
2006) -> Option<CFRetained<CFString>> {
2007 extern "C-unwind" {
2008 fn CFStringCreateWithCStringNoCopy(
2009 alloc: Option<&CFAllocator>,
2010 c_str: *const c_char,
2011 encoding: CFStringEncoding,
2012 contents_deallocator: Option<&CFAllocator>,
2013 ) -> Option<NonNull<CFString>>;
2014 }
2015 let ret =
2016 unsafe { CFStringCreateWithCStringNoCopy(alloc, c_str, encoding, contents_deallocator) };
2017 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2018}
2019
2020#[deprecated = "renamed to `CFString::with_bytes_no_copy`"]
2021#[inline]
2022pub unsafe extern "C-unwind" fn CFStringCreateWithBytesNoCopy(
2023 alloc: Option<&CFAllocator>,
2024 bytes: *const u8,
2025 num_bytes: CFIndex,
2026 encoding: CFStringEncoding,
2027 is_external_representation: bool,
2028 contents_deallocator: Option<&CFAllocator>,
2029) -> Option<CFRetained<CFString>> {
2030 extern "C-unwind" {
2031 fn CFStringCreateWithBytesNoCopy(
2032 alloc: Option<&CFAllocator>,
2033 bytes: *const u8,
2034 num_bytes: CFIndex,
2035 encoding: CFStringEncoding,
2036 is_external_representation: Boolean,
2037 contents_deallocator: Option<&CFAllocator>,
2038 ) -> Option<NonNull<CFString>>;
2039 }
2040 let ret = unsafe {
2041 CFStringCreateWithBytesNoCopy(
2042 alloc,
2043 bytes,
2044 num_bytes,
2045 encoding,
2046 is_external_representation as _,
2047 contents_deallocator,
2048 )
2049 };
2050 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2051}
2052
2053#[deprecated = "renamed to `CFString::with_characters_no_copy`"]
2054#[inline]
2055pub unsafe extern "C-unwind" fn CFStringCreateWithCharactersNoCopy(
2056 alloc: Option<&CFAllocator>,
2057 chars: *const UniChar,
2058 num_chars: CFIndex,
2059 contents_deallocator: Option<&CFAllocator>,
2060) -> Option<CFRetained<CFString>> {
2061 extern "C-unwind" {
2062 fn CFStringCreateWithCharactersNoCopy(
2063 alloc: Option<&CFAllocator>,
2064 chars: *const UniChar,
2065 num_chars: CFIndex,
2066 contents_deallocator: Option<&CFAllocator>,
2067 ) -> Option<NonNull<CFString>>;
2068 }
2069 let ret = unsafe {
2070 CFStringCreateWithCharactersNoCopy(alloc, chars, num_chars, contents_deallocator)
2071 };
2072 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2073}
2074
2075#[deprecated = "renamed to `CFString::with_substring`"]
2076#[inline]
2077pub unsafe extern "C-unwind" fn CFStringCreateWithSubstring(
2078 alloc: Option<&CFAllocator>,
2079 str: Option<&CFString>,
2080 range: CFRange,
2081) -> Option<CFRetained<CFString>> {
2082 extern "C-unwind" {
2083 fn CFStringCreateWithSubstring(
2084 alloc: Option<&CFAllocator>,
2085 str: Option<&CFString>,
2086 range: CFRange,
2087 ) -> Option<NonNull<CFString>>;
2088 }
2089 let ret = unsafe { CFStringCreateWithSubstring(alloc, str, range) };
2090 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2091}
2092
2093#[deprecated = "renamed to `CFString::new_copy`"]
2094#[inline]
2095pub extern "C-unwind" fn CFStringCreateCopy(
2096 alloc: Option<&CFAllocator>,
2097 the_string: Option<&CFString>,
2098) -> Option<CFRetained<CFString>> {
2099 extern "C-unwind" {
2100 fn CFStringCreateCopy(
2101 alloc: Option<&CFAllocator>,
2102 the_string: Option<&CFString>,
2103 ) -> Option<NonNull<CFString>>;
2104 }
2105 let ret = unsafe { CFStringCreateCopy(alloc, the_string) };
2106 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2107}
2108
2109#[deprecated = "renamed to `CFMutableString::new`"]
2110#[inline]
2111pub extern "C-unwind" fn CFStringCreateMutable(
2112 alloc: Option<&CFAllocator>,
2113 max_length: CFIndex,
2114) -> Option<CFRetained<CFMutableString>> {
2115 extern "C-unwind" {
2116 fn CFStringCreateMutable(
2117 alloc: Option<&CFAllocator>,
2118 max_length: CFIndex,
2119 ) -> Option<NonNull<CFMutableString>>;
2120 }
2121 let ret = unsafe { CFStringCreateMutable(alloc, max_length) };
2122 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2123}
2124
2125#[deprecated = "renamed to `CFMutableString::new_copy`"]
2126#[inline]
2127pub extern "C-unwind" fn CFStringCreateMutableCopy(
2128 alloc: Option<&CFAllocator>,
2129 max_length: CFIndex,
2130 the_string: Option<&CFString>,
2131) -> Option<CFRetained<CFMutableString>> {
2132 extern "C-unwind" {
2133 fn CFStringCreateMutableCopy(
2134 alloc: Option<&CFAllocator>,
2135 max_length: CFIndex,
2136 the_string: Option<&CFString>,
2137 ) -> Option<NonNull<CFMutableString>>;
2138 }
2139 let ret = unsafe { CFStringCreateMutableCopy(alloc, max_length, the_string) };
2140 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2141}
2142
2143#[deprecated = "renamed to `CFMutableString::with_external_characters_no_copy`"]
2144#[inline]
2145pub unsafe extern "C-unwind" fn CFStringCreateMutableWithExternalCharactersNoCopy(
2146 alloc: Option<&CFAllocator>,
2147 chars: *mut UniChar,
2148 num_chars: CFIndex,
2149 capacity: CFIndex,
2150 external_characters_allocator: Option<&CFAllocator>,
2151) -> Option<CFRetained<CFMutableString>> {
2152 extern "C-unwind" {
2153 fn CFStringCreateMutableWithExternalCharactersNoCopy(
2154 alloc: Option<&CFAllocator>,
2155 chars: *mut UniChar,
2156 num_chars: CFIndex,
2157 capacity: CFIndex,
2158 external_characters_allocator: Option<&CFAllocator>,
2159 ) -> Option<NonNull<CFMutableString>>;
2160 }
2161 let ret = unsafe {
2162 CFStringCreateMutableWithExternalCharactersNoCopy(
2163 alloc,
2164 chars,
2165 num_chars,
2166 capacity,
2167 external_characters_allocator,
2168 )
2169 };
2170 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2171}
2172
2173#[deprecated = "renamed to `CFString::length`"]
2174#[inline]
2175pub extern "C-unwind" fn CFStringGetLength(the_string: &CFString) -> CFIndex {
2176 extern "C-unwind" {
2177 fn CFStringGetLength(the_string: &CFString) -> CFIndex;
2178 }
2179 unsafe { CFStringGetLength(the_string) }
2180}
2181
2182extern "C-unwind" {
2183 #[deprecated = "renamed to `CFString::character_at_index`"]
2184 pub fn CFStringGetCharacterAtIndex(the_string: &CFString, idx: CFIndex) -> UniChar;
2185}
2186
2187extern "C-unwind" {
2188 #[deprecated = "renamed to `CFString::characters`"]
2189 pub fn CFStringGetCharacters(the_string: &CFString, range: CFRange, buffer: *mut UniChar);
2190}
2191
2192#[deprecated = "renamed to `CFString::pascal_string`"]
2193#[inline]
2194pub unsafe extern "C-unwind" fn CFStringGetPascalString(
2195 the_string: &CFString,
2196 buffer: StringPtr,
2197 buffer_size: CFIndex,
2198 encoding: CFStringEncoding,
2199) -> bool {
2200 extern "C-unwind" {
2201 fn CFStringGetPascalString(
2202 the_string: &CFString,
2203 buffer: StringPtr,
2204 buffer_size: CFIndex,
2205 encoding: CFStringEncoding,
2206 ) -> Boolean;
2207 }
2208 let ret = unsafe { CFStringGetPascalString(the_string, buffer, buffer_size, encoding) };
2209 ret != 0
2210}
2211
2212#[deprecated = "renamed to `CFString::c_string`"]
2213#[inline]
2214pub unsafe extern "C-unwind" fn CFStringGetCString(
2215 the_string: &CFString,
2216 buffer: *mut c_char,
2217 buffer_size: CFIndex,
2218 encoding: CFStringEncoding,
2219) -> bool {
2220 extern "C-unwind" {
2221 fn CFStringGetCString(
2222 the_string: &CFString,
2223 buffer: *mut c_char,
2224 buffer_size: CFIndex,
2225 encoding: CFStringEncoding,
2226 ) -> Boolean;
2227 }
2228 let ret = unsafe { CFStringGetCString(the_string, buffer, buffer_size, encoding) };
2229 ret != 0
2230}
2231
2232#[deprecated = "renamed to `CFString::pascal_string_ptr`"]
2233#[inline]
2234pub extern "C-unwind" fn CFStringGetPascalStringPtr(
2235 the_string: &CFString,
2236 encoding: CFStringEncoding,
2237) -> ConstStringPtr {
2238 extern "C-unwind" {
2239 fn CFStringGetPascalStringPtr(
2240 the_string: &CFString,
2241 encoding: CFStringEncoding,
2242 ) -> ConstStringPtr;
2243 }
2244 unsafe { CFStringGetPascalStringPtr(the_string, encoding) }
2245}
2246
2247#[deprecated = "renamed to `CFString::c_string_ptr`"]
2248#[inline]
2249pub extern "C-unwind" fn CFStringGetCStringPtr(
2250 the_string: &CFString,
2251 encoding: CFStringEncoding,
2252) -> *const c_char {
2253 extern "C-unwind" {
2254 fn CFStringGetCStringPtr(
2255 the_string: &CFString,
2256 encoding: CFStringEncoding,
2257 ) -> *const c_char;
2258 }
2259 unsafe { CFStringGetCStringPtr(the_string, encoding) }
2260}
2261
2262#[deprecated = "renamed to `CFString::characters_ptr`"]
2263#[inline]
2264pub extern "C-unwind" fn CFStringGetCharactersPtr(the_string: &CFString) -> *const UniChar {
2265 extern "C-unwind" {
2266 fn CFStringGetCharactersPtr(the_string: &CFString) -> *const UniChar;
2267 }
2268 unsafe { CFStringGetCharactersPtr(the_string) }
2269}
2270
2271#[deprecated = "renamed to `CFString::bytes`"]
2272#[inline]
2273pub unsafe extern "C-unwind" fn CFStringGetBytes(
2274 the_string: &CFString,
2275 range: CFRange,
2276 encoding: CFStringEncoding,
2277 loss_byte: u8,
2278 is_external_representation: bool,
2279 buffer: *mut u8,
2280 max_buf_len: CFIndex,
2281 used_buf_len: *mut CFIndex,
2282) -> CFIndex {
2283 extern "C-unwind" {
2284 fn CFStringGetBytes(
2285 the_string: &CFString,
2286 range: CFRange,
2287 encoding: CFStringEncoding,
2288 loss_byte: u8,
2289 is_external_representation: Boolean,
2290 buffer: *mut u8,
2291 max_buf_len: CFIndex,
2292 used_buf_len: *mut CFIndex,
2293 ) -> CFIndex;
2294 }
2295 unsafe {
2296 CFStringGetBytes(
2297 the_string,
2298 range,
2299 encoding,
2300 loss_byte,
2301 is_external_representation as _,
2302 buffer,
2303 max_buf_len,
2304 used_buf_len,
2305 )
2306 }
2307}
2308
2309#[cfg(feature = "CFData")]
2310#[deprecated = "renamed to `CFString::from_external_representation`"]
2311#[inline]
2312pub extern "C-unwind" fn CFStringCreateFromExternalRepresentation(
2313 alloc: Option<&CFAllocator>,
2314 data: Option<&CFData>,
2315 encoding: CFStringEncoding,
2316) -> Option<CFRetained<CFString>> {
2317 extern "C-unwind" {
2318 fn CFStringCreateFromExternalRepresentation(
2319 alloc: Option<&CFAllocator>,
2320 data: Option<&CFData>,
2321 encoding: CFStringEncoding,
2322 ) -> Option<NonNull<CFString>>;
2323 }
2324 let ret = unsafe { CFStringCreateFromExternalRepresentation(alloc, data, encoding) };
2325 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2326}
2327
2328#[cfg(feature = "CFData")]
2329#[deprecated = "renamed to `CFString::new_external_representation`"]
2330#[inline]
2331pub extern "C-unwind" fn CFStringCreateExternalRepresentation(
2332 alloc: Option<&CFAllocator>,
2333 the_string: Option<&CFString>,
2334 encoding: CFStringEncoding,
2335 loss_byte: u8,
2336) -> Option<CFRetained<CFData>> {
2337 extern "C-unwind" {
2338 fn CFStringCreateExternalRepresentation(
2339 alloc: Option<&CFAllocator>,
2340 the_string: Option<&CFString>,
2341 encoding: CFStringEncoding,
2342 loss_byte: u8,
2343 ) -> Option<NonNull<CFData>>;
2344 }
2345 let ret =
2346 unsafe { CFStringCreateExternalRepresentation(alloc, the_string, encoding, loss_byte) };
2347 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2348}
2349
2350#[deprecated = "renamed to `CFString::smallest_encoding`"]
2351#[inline]
2352pub extern "C-unwind" fn CFStringGetSmallestEncoding(the_string: &CFString) -> CFStringEncoding {
2353 extern "C-unwind" {
2354 fn CFStringGetSmallestEncoding(the_string: &CFString) -> CFStringEncoding;
2355 }
2356 unsafe { CFStringGetSmallestEncoding(the_string) }
2357}
2358
2359#[deprecated = "renamed to `CFString::fastest_encoding`"]
2360#[inline]
2361pub extern "C-unwind" fn CFStringGetFastestEncoding(the_string: &CFString) -> CFStringEncoding {
2362 extern "C-unwind" {
2363 fn CFStringGetFastestEncoding(the_string: &CFString) -> CFStringEncoding;
2364 }
2365 unsafe { CFStringGetFastestEncoding(the_string) }
2366}
2367
2368#[deprecated = "renamed to `CFString::system_encoding`"]
2369#[inline]
2370pub extern "C-unwind" fn CFStringGetSystemEncoding() -> CFStringEncoding {
2371 extern "C-unwind" {
2372 fn CFStringGetSystemEncoding() -> CFStringEncoding;
2373 }
2374 unsafe { CFStringGetSystemEncoding() }
2375}
2376
2377#[deprecated = "renamed to `CFString::maximum_size_for_encoding`"]
2378#[inline]
2379pub extern "C-unwind" fn CFStringGetMaximumSizeForEncoding(
2380 length: CFIndex,
2381 encoding: CFStringEncoding,
2382) -> CFIndex {
2383 extern "C-unwind" {
2384 fn CFStringGetMaximumSizeForEncoding(
2385 length: CFIndex,
2386 encoding: CFStringEncoding,
2387 ) -> CFIndex;
2388 }
2389 unsafe { CFStringGetMaximumSizeForEncoding(length, encoding) }
2390}
2391
2392#[deprecated = "renamed to `CFString::file_system_representation`"]
2393#[inline]
2394pub unsafe extern "C-unwind" fn CFStringGetFileSystemRepresentation(
2395 string: &CFString,
2396 buffer: *mut c_char,
2397 max_buf_len: CFIndex,
2398) -> bool {
2399 extern "C-unwind" {
2400 fn CFStringGetFileSystemRepresentation(
2401 string: &CFString,
2402 buffer: *mut c_char,
2403 max_buf_len: CFIndex,
2404 ) -> Boolean;
2405 }
2406 let ret = unsafe { CFStringGetFileSystemRepresentation(string, buffer, max_buf_len) };
2407 ret != 0
2408}
2409
2410#[deprecated = "renamed to `CFString::maximum_size_of_file_system_representation`"]
2411#[inline]
2412pub extern "C-unwind" fn CFStringGetMaximumSizeOfFileSystemRepresentation(
2413 string: &CFString,
2414) -> CFIndex {
2415 extern "C-unwind" {
2416 fn CFStringGetMaximumSizeOfFileSystemRepresentation(string: &CFString) -> CFIndex;
2417 }
2418 unsafe { CFStringGetMaximumSizeOfFileSystemRepresentation(string) }
2419}
2420
2421#[deprecated = "renamed to `CFString::with_file_system_representation`"]
2422#[inline]
2423pub unsafe extern "C-unwind" fn CFStringCreateWithFileSystemRepresentation(
2424 alloc: Option<&CFAllocator>,
2425 buffer: *const c_char,
2426) -> Option<CFRetained<CFString>> {
2427 extern "C-unwind" {
2428 fn CFStringCreateWithFileSystemRepresentation(
2429 alloc: Option<&CFAllocator>,
2430 buffer: *const c_char,
2431 ) -> Option<NonNull<CFString>>;
2432 }
2433 let ret = unsafe { CFStringCreateWithFileSystemRepresentation(alloc, buffer) };
2434 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2435}
2436
2437extern "C-unwind" {
2438 #[cfg(feature = "CFLocale")]
2439 #[deprecated = "renamed to `CFString::compare_with_options_and_locale`"]
2440 pub fn CFStringCompareWithOptionsAndLocale(
2441 the_string1: &CFString,
2442 the_string2: Option<&CFString>,
2443 range_to_compare: CFRange,
2444 compare_options: CFStringCompareFlags,
2445 locale: Option<&CFLocale>,
2446 ) -> CFComparisonResult;
2447}
2448
2449extern "C-unwind" {
2450 #[deprecated = "renamed to `CFString::compare_with_options`"]
2451 pub fn CFStringCompareWithOptions(
2452 the_string1: &CFString,
2453 the_string2: Option<&CFString>,
2454 range_to_compare: CFRange,
2455 compare_options: CFStringCompareFlags,
2456 ) -> CFComparisonResult;
2457}
2458
2459#[deprecated = "renamed to `CFString::compare`"]
2460#[inline]
2461pub extern "C-unwind" fn CFStringCompare(
2462 the_string1: &CFString,
2463 the_string2: Option<&CFString>,
2464 compare_options: CFStringCompareFlags,
2465) -> CFComparisonResult {
2466 extern "C-unwind" {
2467 fn CFStringCompare(
2468 the_string1: &CFString,
2469 the_string2: Option<&CFString>,
2470 compare_options: CFStringCompareFlags,
2471 ) -> CFComparisonResult;
2472 }
2473 unsafe { CFStringCompare(the_string1, the_string2, compare_options) }
2474}
2475
2476#[cfg(feature = "CFLocale")]
2477#[deprecated = "renamed to `CFString::find_with_options_and_locale`"]
2478#[inline]
2479pub unsafe extern "C-unwind" fn CFStringFindWithOptionsAndLocale(
2480 the_string: &CFString,
2481 string_to_find: Option<&CFString>,
2482 range_to_search: CFRange,
2483 search_options: CFStringCompareFlags,
2484 locale: Option<&CFLocale>,
2485 result: *mut CFRange,
2486) -> bool {
2487 extern "C-unwind" {
2488 fn CFStringFindWithOptionsAndLocale(
2489 the_string: &CFString,
2490 string_to_find: Option<&CFString>,
2491 range_to_search: CFRange,
2492 search_options: CFStringCompareFlags,
2493 locale: Option<&CFLocale>,
2494 result: *mut CFRange,
2495 ) -> Boolean;
2496 }
2497 let ret = unsafe {
2498 CFStringFindWithOptionsAndLocale(
2499 the_string,
2500 string_to_find,
2501 range_to_search,
2502 search_options,
2503 locale,
2504 result,
2505 )
2506 };
2507 ret != 0
2508}
2509
2510#[deprecated = "renamed to `CFString::find_with_options`"]
2511#[inline]
2512pub unsafe extern "C-unwind" fn CFStringFindWithOptions(
2513 the_string: &CFString,
2514 string_to_find: Option<&CFString>,
2515 range_to_search: CFRange,
2516 search_options: CFStringCompareFlags,
2517 result: *mut CFRange,
2518) -> bool {
2519 extern "C-unwind" {
2520 fn CFStringFindWithOptions(
2521 the_string: &CFString,
2522 string_to_find: Option<&CFString>,
2523 range_to_search: CFRange,
2524 search_options: CFStringCompareFlags,
2525 result: *mut CFRange,
2526 ) -> Boolean;
2527 }
2528 let ret = unsafe {
2529 CFStringFindWithOptions(
2530 the_string,
2531 string_to_find,
2532 range_to_search,
2533 search_options,
2534 result,
2535 )
2536 };
2537 ret != 0
2538}
2539
2540#[cfg(feature = "CFArray")]
2541#[deprecated = "renamed to `CFString::new_array_with_find_results`"]
2542#[inline]
2543pub unsafe extern "C-unwind" fn CFStringCreateArrayWithFindResults(
2544 alloc: Option<&CFAllocator>,
2545 the_string: Option<&CFString>,
2546 string_to_find: Option<&CFString>,
2547 range_to_search: CFRange,
2548 compare_options: CFStringCompareFlags,
2549) -> Option<CFRetained<CFArray>> {
2550 extern "C-unwind" {
2551 fn CFStringCreateArrayWithFindResults(
2552 alloc: Option<&CFAllocator>,
2553 the_string: Option<&CFString>,
2554 string_to_find: Option<&CFString>,
2555 range_to_search: CFRange,
2556 compare_options: CFStringCompareFlags,
2557 ) -> Option<NonNull<CFArray>>;
2558 }
2559 let ret = unsafe {
2560 CFStringCreateArrayWithFindResults(
2561 alloc,
2562 the_string,
2563 string_to_find,
2564 range_to_search,
2565 compare_options,
2566 )
2567 };
2568 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2569}
2570
2571#[deprecated = "renamed to `CFString::find`"]
2572#[inline]
2573pub extern "C-unwind" fn CFStringFind(
2574 the_string: &CFString,
2575 string_to_find: Option<&CFString>,
2576 compare_options: CFStringCompareFlags,
2577) -> CFRange {
2578 extern "C-unwind" {
2579 fn CFStringFind(
2580 the_string: &CFString,
2581 string_to_find: Option<&CFString>,
2582 compare_options: CFStringCompareFlags,
2583 ) -> CFRange;
2584 }
2585 unsafe { CFStringFind(the_string, string_to_find, compare_options) }
2586}
2587
2588#[deprecated = "renamed to `CFString::has_prefix`"]
2589#[inline]
2590pub extern "C-unwind" fn CFStringHasPrefix(
2591 the_string: &CFString,
2592 prefix: Option<&CFString>,
2593) -> bool {
2594 extern "C-unwind" {
2595 fn CFStringHasPrefix(the_string: &CFString, prefix: Option<&CFString>) -> Boolean;
2596 }
2597 let ret = unsafe { CFStringHasPrefix(the_string, prefix) };
2598 ret != 0
2599}
2600
2601#[deprecated = "renamed to `CFString::has_suffix`"]
2602#[inline]
2603pub extern "C-unwind" fn CFStringHasSuffix(
2604 the_string: &CFString,
2605 suffix: Option<&CFString>,
2606) -> bool {
2607 extern "C-unwind" {
2608 fn CFStringHasSuffix(the_string: &CFString, suffix: Option<&CFString>) -> Boolean;
2609 }
2610 let ret = unsafe { CFStringHasSuffix(the_string, suffix) };
2611 ret != 0
2612}
2613
2614extern "C-unwind" {
2615 #[deprecated = "renamed to `CFString::range_of_composed_characters_at_index`"]
2616 pub fn CFStringGetRangeOfComposedCharactersAtIndex(
2617 the_string: &CFString,
2618 the_index: CFIndex,
2619 ) -> CFRange;
2620}
2621
2622#[cfg(feature = "CFCharacterSet")]
2623#[deprecated = "renamed to `CFString::find_character_from_set`"]
2624#[inline]
2625pub unsafe extern "C-unwind" fn CFStringFindCharacterFromSet(
2626 the_string: &CFString,
2627 the_set: Option<&CFCharacterSet>,
2628 range_to_search: CFRange,
2629 search_options: CFStringCompareFlags,
2630 result: *mut CFRange,
2631) -> bool {
2632 extern "C-unwind" {
2633 fn CFStringFindCharacterFromSet(
2634 the_string: &CFString,
2635 the_set: Option<&CFCharacterSet>,
2636 range_to_search: CFRange,
2637 search_options: CFStringCompareFlags,
2638 result: *mut CFRange,
2639 ) -> Boolean;
2640 }
2641 let ret = unsafe {
2642 CFStringFindCharacterFromSet(the_string, the_set, range_to_search, search_options, result)
2643 };
2644 ret != 0
2645}
2646
2647extern "C-unwind" {
2648 #[deprecated = "renamed to `CFString::line_bounds`"]
2649 pub fn CFStringGetLineBounds(
2650 the_string: &CFString,
2651 range: CFRange,
2652 line_begin_index: *mut CFIndex,
2653 line_end_index: *mut CFIndex,
2654 contents_end_index: *mut CFIndex,
2655 );
2656}
2657
2658extern "C-unwind" {
2659 #[deprecated = "renamed to `CFString::paragraph_bounds`"]
2660 pub fn CFStringGetParagraphBounds(
2661 string: &CFString,
2662 range: CFRange,
2663 par_begin_index: *mut CFIndex,
2664 par_end_index: *mut CFIndex,
2665 contents_end_index: *mut CFIndex,
2666 );
2667}
2668
2669extern "C-unwind" {
2670 #[cfg(feature = "CFLocale")]
2671 #[deprecated = "renamed to `CFString::hyphenation_location_before_index`"]
2672 pub fn CFStringGetHyphenationLocationBeforeIndex(
2673 string: &CFString,
2674 location: CFIndex,
2675 limit_range: CFRange,
2676 options: CFOptionFlags,
2677 locale: Option<&CFLocale>,
2678 character: *mut UTF32Char,
2679 ) -> CFIndex;
2680}
2681
2682#[cfg(feature = "CFLocale")]
2683#[deprecated = "renamed to `CFString::is_hyphenation_available_for_locale`"]
2684#[inline]
2685pub extern "C-unwind" fn CFStringIsHyphenationAvailableForLocale(
2686 locale: Option<&CFLocale>,
2687) -> bool {
2688 extern "C-unwind" {
2689 fn CFStringIsHyphenationAvailableForLocale(locale: Option<&CFLocale>) -> Boolean;
2690 }
2691 let ret = unsafe { CFStringIsHyphenationAvailableForLocale(locale) };
2692 ret != 0
2693}
2694
2695#[cfg(feature = "CFArray")]
2696#[deprecated = "renamed to `CFString::new_by_combining_strings`"]
2697#[inline]
2698pub unsafe extern "C-unwind" fn CFStringCreateByCombiningStrings(
2699 alloc: Option<&CFAllocator>,
2700 the_array: Option<&CFArray>,
2701 separator_string: Option<&CFString>,
2702) -> Option<CFRetained<CFString>> {
2703 extern "C-unwind" {
2704 fn CFStringCreateByCombiningStrings(
2705 alloc: Option<&CFAllocator>,
2706 the_array: Option<&CFArray>,
2707 separator_string: Option<&CFString>,
2708 ) -> Option<NonNull<CFString>>;
2709 }
2710 let ret = unsafe { CFStringCreateByCombiningStrings(alloc, the_array, separator_string) };
2711 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2712}
2713
2714#[cfg(feature = "CFArray")]
2715#[deprecated = "renamed to `CFString::new_array_by_separating_strings`"]
2716#[inline]
2717pub extern "C-unwind" fn CFStringCreateArrayBySeparatingStrings(
2718 alloc: Option<&CFAllocator>,
2719 the_string: Option<&CFString>,
2720 separator_string: Option<&CFString>,
2721) -> Option<CFRetained<CFArray>> {
2722 extern "C-unwind" {
2723 fn CFStringCreateArrayBySeparatingStrings(
2724 alloc: Option<&CFAllocator>,
2725 the_string: Option<&CFString>,
2726 separator_string: Option<&CFString>,
2727 ) -> Option<NonNull<CFArray>>;
2728 }
2729 let ret =
2730 unsafe { CFStringCreateArrayBySeparatingStrings(alloc, the_string, separator_string) };
2731 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2732}
2733
2734#[deprecated = "renamed to `CFString::int_value`"]
2735#[inline]
2736pub extern "C-unwind" fn CFStringGetIntValue(str: &CFString) -> i32 {
2737 extern "C-unwind" {
2738 fn CFStringGetIntValue(str: &CFString) -> i32;
2739 }
2740 unsafe { CFStringGetIntValue(str) }
2741}
2742
2743#[deprecated = "renamed to `CFString::double_value`"]
2744#[inline]
2745pub extern "C-unwind" fn CFStringGetDoubleValue(str: &CFString) -> c_double {
2746 extern "C-unwind" {
2747 fn CFStringGetDoubleValue(str: &CFString) -> c_double;
2748 }
2749 unsafe { CFStringGetDoubleValue(str) }
2750}
2751
2752#[deprecated = "renamed to `CFMutableString::append`"]
2753#[inline]
2754pub extern "C-unwind" fn CFStringAppend(
2755 the_string: Option<&CFMutableString>,
2756 appended_string: Option<&CFString>,
2757) {
2758 extern "C-unwind" {
2759 fn CFStringAppend(the_string: Option<&CFMutableString>, appended_string: Option<&CFString>);
2760 }
2761 unsafe { CFStringAppend(the_string, appended_string) }
2762}
2763
2764extern "C-unwind" {
2765 #[deprecated = "renamed to `CFMutableString::append_characters`"]
2766 pub fn CFStringAppendCharacters(
2767 the_string: Option<&CFMutableString>,
2768 chars: *const UniChar,
2769 num_chars: CFIndex,
2770 );
2771}
2772
2773extern "C-unwind" {
2774 #[deprecated = "renamed to `CFMutableString::append_pascal_string`"]
2775 pub fn CFStringAppendPascalString(
2776 the_string: Option<&CFMutableString>,
2777 p_str: ConstStr255Param,
2778 encoding: CFStringEncoding,
2779 );
2780}
2781
2782extern "C-unwind" {
2783 #[deprecated = "renamed to `CFMutableString::append_c_string`"]
2784 pub fn CFStringAppendCString(
2785 the_string: Option<&CFMutableString>,
2786 c_str: *const c_char,
2787 encoding: CFStringEncoding,
2788 );
2789}
2790
2791extern "C-unwind" {
2792 #[deprecated = "renamed to `CFMutableString::insert`"]
2793 pub fn CFStringInsert(
2794 str: Option<&CFMutableString>,
2795 idx: CFIndex,
2796 inserted_str: Option<&CFString>,
2797 );
2798}
2799
2800extern "C-unwind" {
2801 #[deprecated = "renamed to `CFMutableString::delete`"]
2802 pub fn CFStringDelete(the_string: Option<&CFMutableString>, range: CFRange);
2803}
2804
2805extern "C-unwind" {
2806 #[deprecated = "renamed to `CFMutableString::replace`"]
2807 pub fn CFStringReplace(
2808 the_string: Option<&CFMutableString>,
2809 range: CFRange,
2810 replacement: Option<&CFString>,
2811 );
2812}
2813
2814#[deprecated = "renamed to `CFMutableString::replace_all`"]
2815#[inline]
2816pub extern "C-unwind" fn CFStringReplaceAll(
2817 the_string: Option<&CFMutableString>,
2818 replacement: Option<&CFString>,
2819) {
2820 extern "C-unwind" {
2821 fn CFStringReplaceAll(the_string: Option<&CFMutableString>, replacement: Option<&CFString>);
2822 }
2823 unsafe { CFStringReplaceAll(the_string, replacement) }
2824}
2825
2826extern "C-unwind" {
2827 #[deprecated = "renamed to `CFMutableString::find_and_replace`"]
2828 pub fn CFStringFindAndReplace(
2829 the_string: Option<&CFMutableString>,
2830 string_to_find: Option<&CFString>,
2831 replacement_string: Option<&CFString>,
2832 range_to_search: CFRange,
2833 compare_options: CFStringCompareFlags,
2834 ) -> CFIndex;
2835}
2836
2837extern "C-unwind" {
2838 #[deprecated = "renamed to `CFMutableString::set_external_characters_no_copy`"]
2839 pub fn CFStringSetExternalCharactersNoCopy(
2840 the_string: Option<&CFMutableString>,
2841 chars: *mut UniChar,
2842 length: CFIndex,
2843 capacity: CFIndex,
2844 );
2845}
2846
2847extern "C-unwind" {
2848 #[deprecated = "renamed to `CFMutableString::pad`"]
2849 pub fn CFStringPad(
2850 the_string: Option<&CFMutableString>,
2851 pad_string: Option<&CFString>,
2852 length: CFIndex,
2853 index_into_pad: CFIndex,
2854 );
2855}
2856
2857#[deprecated = "renamed to `CFMutableString::trim`"]
2858#[inline]
2859pub extern "C-unwind" fn CFStringTrim(
2860 the_string: Option<&CFMutableString>,
2861 trim_string: Option<&CFString>,
2862) {
2863 extern "C-unwind" {
2864 fn CFStringTrim(the_string: Option<&CFMutableString>, trim_string: Option<&CFString>);
2865 }
2866 unsafe { CFStringTrim(the_string, trim_string) }
2867}
2868
2869#[deprecated = "renamed to `CFMutableString::trim_whitespace`"]
2870#[inline]
2871pub extern "C-unwind" fn CFStringTrimWhitespace(the_string: Option<&CFMutableString>) {
2872 extern "C-unwind" {
2873 fn CFStringTrimWhitespace(the_string: Option<&CFMutableString>);
2874 }
2875 unsafe { CFStringTrimWhitespace(the_string) }
2876}
2877
2878#[cfg(feature = "CFLocale")]
2879#[deprecated = "renamed to `CFMutableString::lowercase`"]
2880#[inline]
2881pub extern "C-unwind" fn CFStringLowercase(
2882 the_string: Option<&CFMutableString>,
2883 locale: Option<&CFLocale>,
2884) {
2885 extern "C-unwind" {
2886 fn CFStringLowercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
2887 }
2888 unsafe { CFStringLowercase(the_string, locale) }
2889}
2890
2891#[cfg(feature = "CFLocale")]
2892#[deprecated = "renamed to `CFMutableString::uppercase`"]
2893#[inline]
2894pub extern "C-unwind" fn CFStringUppercase(
2895 the_string: Option<&CFMutableString>,
2896 locale: Option<&CFLocale>,
2897) {
2898 extern "C-unwind" {
2899 fn CFStringUppercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
2900 }
2901 unsafe { CFStringUppercase(the_string, locale) }
2902}
2903
2904#[cfg(feature = "CFLocale")]
2905#[deprecated = "renamed to `CFMutableString::capitalize`"]
2906#[inline]
2907pub extern "C-unwind" fn CFStringCapitalize(
2908 the_string: Option<&CFMutableString>,
2909 locale: Option<&CFLocale>,
2910) {
2911 extern "C-unwind" {
2912 fn CFStringCapitalize(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
2913 }
2914 unsafe { CFStringCapitalize(the_string, locale) }
2915}
2916
2917extern "C-unwind" {
2918 #[deprecated = "renamed to `CFMutableString::normalize`"]
2919 pub fn CFStringNormalize(
2920 the_string: Option<&CFMutableString>,
2921 the_form: CFStringNormalizationForm,
2922 );
2923}
2924
2925#[cfg(feature = "CFLocale")]
2926#[deprecated = "renamed to `CFMutableString::fold`"]
2927#[inline]
2928pub extern "C-unwind" fn CFStringFold(
2929 the_string: Option<&CFMutableString>,
2930 the_flags: CFStringCompareFlags,
2931 the_locale: Option<&CFLocale>,
2932) {
2933 extern "C-unwind" {
2934 fn CFStringFold(
2935 the_string: Option<&CFMutableString>,
2936 the_flags: CFStringCompareFlags,
2937 the_locale: Option<&CFLocale>,
2938 );
2939 }
2940 unsafe { CFStringFold(the_string, the_flags, the_locale) }
2941}
2942
2943#[deprecated = "renamed to `CFMutableString::transform`"]
2944#[inline]
2945pub unsafe extern "C-unwind" fn CFStringTransform(
2946 string: Option<&CFMutableString>,
2947 range: *mut CFRange,
2948 transform: Option<&CFString>,
2949 reverse: bool,
2950) -> bool {
2951 extern "C-unwind" {
2952 fn CFStringTransform(
2953 string: Option<&CFMutableString>,
2954 range: *mut CFRange,
2955 transform: Option<&CFString>,
2956 reverse: Boolean,
2957 ) -> Boolean;
2958 }
2959 let ret = unsafe { CFStringTransform(string, range, transform, reverse as _) };
2960 ret != 0
2961}
2962
2963#[deprecated = "renamed to `CFString::is_encoding_available`"]
2964#[inline]
2965pub extern "C-unwind" fn CFStringIsEncodingAvailable(encoding: CFStringEncoding) -> bool {
2966 extern "C-unwind" {
2967 fn CFStringIsEncodingAvailable(encoding: CFStringEncoding) -> Boolean;
2968 }
2969 let ret = unsafe { CFStringIsEncodingAvailable(encoding) };
2970 ret != 0
2971}
2972
2973#[deprecated = "renamed to `CFString::list_of_available_encodings`"]
2974#[inline]
2975pub extern "C-unwind" fn CFStringGetListOfAvailableEncodings() -> *const CFStringEncoding {
2976 extern "C-unwind" {
2977 fn CFStringGetListOfAvailableEncodings() -> *const CFStringEncoding;
2978 }
2979 unsafe { CFStringGetListOfAvailableEncodings() }
2980}
2981
2982#[deprecated = "renamed to `CFString::name_of_encoding`"]
2983#[inline]
2984pub extern "C-unwind" fn CFStringGetNameOfEncoding(
2985 encoding: CFStringEncoding,
2986) -> Option<CFRetained<CFString>> {
2987 extern "C-unwind" {
2988 fn CFStringGetNameOfEncoding(encoding: CFStringEncoding) -> Option<NonNull<CFString>>;
2989 }
2990 let ret = unsafe { CFStringGetNameOfEncoding(encoding) };
2991 ret.map(|ret| unsafe { CFRetained::retain(ret) })
2992}
2993
2994#[deprecated = "renamed to `CFString::convert_encoding_to_ns_string_encoding`"]
2995#[inline]
2996pub extern "C-unwind" fn CFStringConvertEncodingToNSStringEncoding(
2997 encoding: CFStringEncoding,
2998) -> c_ulong {
2999 extern "C-unwind" {
3000 fn CFStringConvertEncodingToNSStringEncoding(encoding: CFStringEncoding) -> c_ulong;
3001 }
3002 unsafe { CFStringConvertEncodingToNSStringEncoding(encoding) }
3003}
3004
3005#[deprecated = "renamed to `CFString::convert_ns_string_encoding_to_encoding`"]
3006#[inline]
3007pub extern "C-unwind" fn CFStringConvertNSStringEncodingToEncoding(
3008 encoding: c_ulong,
3009) -> CFStringEncoding {
3010 extern "C-unwind" {
3011 fn CFStringConvertNSStringEncodingToEncoding(encoding: c_ulong) -> CFStringEncoding;
3012 }
3013 unsafe { CFStringConvertNSStringEncodingToEncoding(encoding) }
3014}
3015
3016#[deprecated = "renamed to `CFString::convert_encoding_to_windows_codepage`"]
3017#[inline]
3018pub extern "C-unwind" fn CFStringConvertEncodingToWindowsCodepage(
3019 encoding: CFStringEncoding,
3020) -> u32 {
3021 extern "C-unwind" {
3022 fn CFStringConvertEncodingToWindowsCodepage(encoding: CFStringEncoding) -> u32;
3023 }
3024 unsafe { CFStringConvertEncodingToWindowsCodepage(encoding) }
3025}
3026
3027#[deprecated = "renamed to `CFString::convert_windows_codepage_to_encoding`"]
3028#[inline]
3029pub extern "C-unwind" fn CFStringConvertWindowsCodepageToEncoding(
3030 codepage: u32,
3031) -> CFStringEncoding {
3032 extern "C-unwind" {
3033 fn CFStringConvertWindowsCodepageToEncoding(codepage: u32) -> CFStringEncoding;
3034 }
3035 unsafe { CFStringConvertWindowsCodepageToEncoding(codepage) }
3036}
3037
3038#[deprecated = "renamed to `CFString::convert_iana_char_set_name_to_encoding`"]
3039#[inline]
3040pub extern "C-unwind" fn CFStringConvertIANACharSetNameToEncoding(
3041 the_string: &CFString,
3042) -> CFStringEncoding {
3043 extern "C-unwind" {
3044 fn CFStringConvertIANACharSetNameToEncoding(the_string: &CFString) -> CFStringEncoding;
3045 }
3046 unsafe { CFStringConvertIANACharSetNameToEncoding(the_string) }
3047}
3048
3049#[deprecated = "renamed to `CFString::convert_encoding_to_iana_char_set_name`"]
3050#[inline]
3051pub extern "C-unwind" fn CFStringConvertEncodingToIANACharSetName(
3052 encoding: CFStringEncoding,
3053) -> Option<CFRetained<CFString>> {
3054 extern "C-unwind" {
3055 fn CFStringConvertEncodingToIANACharSetName(
3056 encoding: CFStringEncoding,
3057 ) -> Option<NonNull<CFString>>;
3058 }
3059 let ret = unsafe { CFStringConvertEncodingToIANACharSetName(encoding) };
3060 ret.map(|ret| unsafe { CFRetained::retain(ret) })
3061}
3062
3063#[deprecated = "renamed to `CFString::most_compatible_mac_string_encoding`"]
3064#[inline]
3065pub extern "C-unwind" fn CFStringGetMostCompatibleMacStringEncoding(
3066 encoding: CFStringEncoding,
3067) -> CFStringEncoding {
3068 extern "C-unwind" {
3069 fn CFStringGetMostCompatibleMacStringEncoding(
3070 encoding: CFStringEncoding,
3071 ) -> CFStringEncoding;
3072 }
3073 unsafe { CFStringGetMostCompatibleMacStringEncoding(encoding) }
3074}