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")]
75 #[inline]
76 pub unsafe fn with_pascal_string(
77 alloc: Option<&CFAllocator>,
78 p_str: ConstStr255Param,
79 encoding: CFStringEncoding,
80 ) -> Option<CFRetained<CFString>> {
81 extern "C-unwind" {
82 fn CFStringCreateWithPascalString(
83 alloc: Option<&CFAllocator>,
84 p_str: ConstStr255Param,
85 encoding: CFStringEncoding,
86 ) -> Option<NonNull<CFString>>;
87 }
88 let ret = unsafe { CFStringCreateWithPascalString(alloc, p_str, encoding) };
89 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
90 }
91
92 #[doc(alias = "CFStringCreateWithCString")]
93 #[inline]
94 pub unsafe fn with_c_string(
95 alloc: Option<&CFAllocator>,
96 c_str: *const c_char,
97 encoding: CFStringEncoding,
98 ) -> Option<CFRetained<CFString>> {
99 extern "C-unwind" {
100 fn CFStringCreateWithCString(
101 alloc: Option<&CFAllocator>,
102 c_str: *const c_char,
103 encoding: CFStringEncoding,
104 ) -> Option<NonNull<CFString>>;
105 }
106 let ret = unsafe { CFStringCreateWithCString(alloc, c_str, encoding) };
107 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
108 }
109
110 #[doc(alias = "CFStringCreateWithBytes")]
111 #[inline]
112 pub unsafe fn with_bytes(
113 alloc: Option<&CFAllocator>,
114 bytes: *const u8,
115 num_bytes: CFIndex,
116 encoding: CFStringEncoding,
117 is_external_representation: bool,
118 ) -> Option<CFRetained<CFString>> {
119 extern "C-unwind" {
120 fn CFStringCreateWithBytes(
121 alloc: Option<&CFAllocator>,
122 bytes: *const u8,
123 num_bytes: CFIndex,
124 encoding: CFStringEncoding,
125 is_external_representation: Boolean,
126 ) -> Option<NonNull<CFString>>;
127 }
128 let ret = unsafe {
129 CFStringCreateWithBytes(
130 alloc,
131 bytes,
132 num_bytes,
133 encoding,
134 is_external_representation as _,
135 )
136 };
137 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
138 }
139
140 #[doc(alias = "CFStringCreateWithCharacters")]
141 #[inline]
142 pub unsafe fn with_characters(
143 alloc: Option<&CFAllocator>,
144 chars: *const UniChar,
145 num_chars: CFIndex,
146 ) -> Option<CFRetained<CFString>> {
147 extern "C-unwind" {
148 fn CFStringCreateWithCharacters(
149 alloc: Option<&CFAllocator>,
150 chars: *const UniChar,
151 num_chars: CFIndex,
152 ) -> Option<NonNull<CFString>>;
153 }
154 let ret = unsafe { CFStringCreateWithCharacters(alloc, chars, num_chars) };
155 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
156 }
157
158 #[doc(alias = "CFStringCreateWithPascalStringNoCopy")]
159 #[inline]
160 pub unsafe fn with_pascal_string_no_copy(
161 alloc: Option<&CFAllocator>,
162 p_str: ConstStr255Param,
163 encoding: CFStringEncoding,
164 contents_deallocator: Option<&CFAllocator>,
165 ) -> Option<CFRetained<CFString>> {
166 extern "C-unwind" {
167 fn CFStringCreateWithPascalStringNoCopy(
168 alloc: Option<&CFAllocator>,
169 p_str: ConstStr255Param,
170 encoding: CFStringEncoding,
171 contents_deallocator: Option<&CFAllocator>,
172 ) -> Option<NonNull<CFString>>;
173 }
174 let ret = unsafe {
175 CFStringCreateWithPascalStringNoCopy(alloc, p_str, encoding, contents_deallocator)
176 };
177 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
178 }
179
180 #[doc(alias = "CFStringCreateWithCStringNoCopy")]
181 #[inline]
182 pub unsafe fn with_c_string_no_copy(
183 alloc: Option<&CFAllocator>,
184 c_str: *const c_char,
185 encoding: CFStringEncoding,
186 contents_deallocator: Option<&CFAllocator>,
187 ) -> Option<CFRetained<CFString>> {
188 extern "C-unwind" {
189 fn CFStringCreateWithCStringNoCopy(
190 alloc: Option<&CFAllocator>,
191 c_str: *const c_char,
192 encoding: CFStringEncoding,
193 contents_deallocator: Option<&CFAllocator>,
194 ) -> Option<NonNull<CFString>>;
195 }
196 let ret = unsafe {
197 CFStringCreateWithCStringNoCopy(alloc, c_str, encoding, contents_deallocator)
198 };
199 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
200 }
201
202 #[doc(alias = "CFStringCreateWithBytesNoCopy")]
203 #[inline]
204 pub unsafe fn with_bytes_no_copy(
205 alloc: Option<&CFAllocator>,
206 bytes: *const u8,
207 num_bytes: CFIndex,
208 encoding: CFStringEncoding,
209 is_external_representation: bool,
210 contents_deallocator: Option<&CFAllocator>,
211 ) -> Option<CFRetained<CFString>> {
212 extern "C-unwind" {
213 fn CFStringCreateWithBytesNoCopy(
214 alloc: Option<&CFAllocator>,
215 bytes: *const u8,
216 num_bytes: CFIndex,
217 encoding: CFStringEncoding,
218 is_external_representation: Boolean,
219 contents_deallocator: Option<&CFAllocator>,
220 ) -> Option<NonNull<CFString>>;
221 }
222 let ret = unsafe {
223 CFStringCreateWithBytesNoCopy(
224 alloc,
225 bytes,
226 num_bytes,
227 encoding,
228 is_external_representation as _,
229 contents_deallocator,
230 )
231 };
232 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
233 }
234
235 #[doc(alias = "CFStringCreateWithCharactersNoCopy")]
236 #[inline]
237 pub unsafe fn with_characters_no_copy(
238 alloc: Option<&CFAllocator>,
239 chars: *const UniChar,
240 num_chars: CFIndex,
241 contents_deallocator: Option<&CFAllocator>,
242 ) -> Option<CFRetained<CFString>> {
243 extern "C-unwind" {
244 fn CFStringCreateWithCharactersNoCopy(
245 alloc: Option<&CFAllocator>,
246 chars: *const UniChar,
247 num_chars: CFIndex,
248 contents_deallocator: Option<&CFAllocator>,
249 ) -> Option<NonNull<CFString>>;
250 }
251 let ret = unsafe {
252 CFStringCreateWithCharactersNoCopy(alloc, chars, num_chars, contents_deallocator)
253 };
254 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
255 }
256
257 #[doc(alias = "CFStringCreateWithSubstring")]
258 #[inline]
259 pub unsafe fn with_substring(
260 alloc: Option<&CFAllocator>,
261 str: Option<&CFString>,
262 range: CFRange,
263 ) -> Option<CFRetained<CFString>> {
264 extern "C-unwind" {
265 fn CFStringCreateWithSubstring(
266 alloc: Option<&CFAllocator>,
267 str: Option<&CFString>,
268 range: CFRange,
269 ) -> Option<NonNull<CFString>>;
270 }
271 let ret = unsafe { CFStringCreateWithSubstring(alloc, str, range) };
272 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
273 }
274
275 #[doc(alias = "CFStringCreateCopy")]
276 #[inline]
277 pub fn new_copy(
278 alloc: Option<&CFAllocator>,
279 the_string: Option<&CFString>,
280 ) -> Option<CFRetained<CFString>> {
281 extern "C-unwind" {
282 fn CFStringCreateCopy(
283 alloc: Option<&CFAllocator>,
284 the_string: Option<&CFString>,
285 ) -> Option<NonNull<CFString>>;
286 }
287 let ret = unsafe { CFStringCreateCopy(alloc, the_string) };
288 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
289 }
290}
291
292impl CFMutableString {
293 #[doc(alias = "CFStringCreateMutable")]
294 #[inline]
295 pub fn new(
296 alloc: Option<&CFAllocator>,
297 max_length: CFIndex,
298 ) -> Option<CFRetained<CFMutableString>> {
299 extern "C-unwind" {
300 fn CFStringCreateMutable(
301 alloc: Option<&CFAllocator>,
302 max_length: CFIndex,
303 ) -> Option<NonNull<CFMutableString>>;
304 }
305 let ret = unsafe { CFStringCreateMutable(alloc, max_length) };
306 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
307 }
308
309 #[doc(alias = "CFStringCreateMutableCopy")]
310 #[inline]
311 pub fn new_copy(
312 alloc: Option<&CFAllocator>,
313 max_length: CFIndex,
314 the_string: Option<&CFString>,
315 ) -> Option<CFRetained<CFMutableString>> {
316 extern "C-unwind" {
317 fn CFStringCreateMutableCopy(
318 alloc: Option<&CFAllocator>,
319 max_length: CFIndex,
320 the_string: Option<&CFString>,
321 ) -> Option<NonNull<CFMutableString>>;
322 }
323 let ret = unsafe { CFStringCreateMutableCopy(alloc, max_length, the_string) };
324 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
325 }
326
327 #[doc(alias = "CFStringCreateMutableWithExternalCharactersNoCopy")]
328 #[inline]
329 pub unsafe fn with_external_characters_no_copy(
330 alloc: Option<&CFAllocator>,
331 chars: *mut UniChar,
332 num_chars: CFIndex,
333 capacity: CFIndex,
334 external_characters_allocator: Option<&CFAllocator>,
335 ) -> Option<CFRetained<CFMutableString>> {
336 extern "C-unwind" {
337 fn CFStringCreateMutableWithExternalCharactersNoCopy(
338 alloc: Option<&CFAllocator>,
339 chars: *mut UniChar,
340 num_chars: CFIndex,
341 capacity: CFIndex,
342 external_characters_allocator: Option<&CFAllocator>,
343 ) -> Option<NonNull<CFMutableString>>;
344 }
345 let ret = unsafe {
346 CFStringCreateMutableWithExternalCharactersNoCopy(
347 alloc,
348 chars,
349 num_chars,
350 capacity,
351 external_characters_allocator,
352 )
353 };
354 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
355 }
356}
357
358impl CFString {
359 #[doc(alias = "CFStringGetLength")]
361 #[inline]
362 pub fn length(self: &CFString) -> CFIndex {
363 extern "C-unwind" {
364 fn CFStringGetLength(the_string: &CFString) -> CFIndex;
365 }
366 unsafe { CFStringGetLength(self) }
367 }
368
369 #[doc(alias = "CFStringGetCharacterAtIndex")]
370 #[inline]
371 pub unsafe fn character_at_index(self: &CFString, idx: CFIndex) -> UniChar {
372 extern "C-unwind" {
373 fn CFStringGetCharacterAtIndex(the_string: &CFString, idx: CFIndex) -> UniChar;
374 }
375 unsafe { CFStringGetCharacterAtIndex(self, idx) }
376 }
377
378 #[doc(alias = "CFStringGetCharacters")]
379 #[inline]
380 pub unsafe fn characters(self: &CFString, range: CFRange, buffer: *mut UniChar) {
381 extern "C-unwind" {
382 fn CFStringGetCharacters(the_string: &CFString, range: CFRange, buffer: *mut UniChar);
383 }
384 unsafe { CFStringGetCharacters(self, range, buffer) }
385 }
386
387 #[doc(alias = "CFStringGetPascalString")]
388 #[inline]
389 pub unsafe fn pascal_string(
390 self: &CFString,
391 buffer: StringPtr,
392 buffer_size: CFIndex,
393 encoding: CFStringEncoding,
394 ) -> bool {
395 extern "C-unwind" {
396 fn CFStringGetPascalString(
397 the_string: &CFString,
398 buffer: StringPtr,
399 buffer_size: CFIndex,
400 encoding: CFStringEncoding,
401 ) -> Boolean;
402 }
403 let ret = unsafe { CFStringGetPascalString(self, buffer, buffer_size, encoding) };
404 ret != 0
405 }
406
407 #[doc(alias = "CFStringGetCString")]
408 #[inline]
409 pub unsafe fn c_string(
410 self: &CFString,
411 buffer: *mut c_char,
412 buffer_size: CFIndex,
413 encoding: CFStringEncoding,
414 ) -> bool {
415 extern "C-unwind" {
416 fn CFStringGetCString(
417 the_string: &CFString,
418 buffer: *mut c_char,
419 buffer_size: CFIndex,
420 encoding: CFStringEncoding,
421 ) -> Boolean;
422 }
423 let ret = unsafe { CFStringGetCString(self, buffer, buffer_size, encoding) };
424 ret != 0
425 }
426
427 #[doc(alias = "CFStringGetPascalStringPtr")]
428 #[inline]
429 pub fn pascal_string_ptr(self: &CFString, encoding: CFStringEncoding) -> ConstStringPtr {
430 extern "C-unwind" {
431 fn CFStringGetPascalStringPtr(
432 the_string: &CFString,
433 encoding: CFStringEncoding,
434 ) -> ConstStringPtr;
435 }
436 unsafe { CFStringGetPascalStringPtr(self, encoding) }
437 }
438
439 #[doc(alias = "CFStringGetCStringPtr")]
440 #[inline]
441 pub fn c_string_ptr(self: &CFString, encoding: CFStringEncoding) -> *const c_char {
442 extern "C-unwind" {
443 fn CFStringGetCStringPtr(
444 the_string: &CFString,
445 encoding: CFStringEncoding,
446 ) -> *const c_char;
447 }
448 unsafe { CFStringGetCStringPtr(self, encoding) }
449 }
450
451 #[doc(alias = "CFStringGetCharactersPtr")]
452 #[inline]
453 pub fn characters_ptr(self: &CFString) -> *const UniChar {
454 extern "C-unwind" {
455 fn CFStringGetCharactersPtr(the_string: &CFString) -> *const UniChar;
456 }
457 unsafe { CFStringGetCharactersPtr(self) }
458 }
459
460 #[doc(alias = "CFStringGetBytes")]
461 #[inline]
462 pub unsafe fn bytes(
463 self: &CFString,
464 range: CFRange,
465 encoding: CFStringEncoding,
466 loss_byte: u8,
467 is_external_representation: bool,
468 buffer: *mut u8,
469 max_buf_len: CFIndex,
470 used_buf_len: *mut CFIndex,
471 ) -> CFIndex {
472 extern "C-unwind" {
473 fn CFStringGetBytes(
474 the_string: &CFString,
475 range: CFRange,
476 encoding: CFStringEncoding,
477 loss_byte: u8,
478 is_external_representation: Boolean,
479 buffer: *mut u8,
480 max_buf_len: CFIndex,
481 used_buf_len: *mut CFIndex,
482 ) -> CFIndex;
483 }
484 unsafe {
485 CFStringGetBytes(
486 self,
487 range,
488 encoding,
489 loss_byte,
490 is_external_representation as _,
491 buffer,
492 max_buf_len,
493 used_buf_len,
494 )
495 }
496 }
497
498 #[doc(alias = "CFStringCreateFromExternalRepresentation")]
499 #[cfg(feature = "CFData")]
500 #[inline]
501 pub fn from_external_representation(
502 alloc: Option<&CFAllocator>,
503 data: Option<&CFData>,
504 encoding: CFStringEncoding,
505 ) -> Option<CFRetained<CFString>> {
506 extern "C-unwind" {
507 fn CFStringCreateFromExternalRepresentation(
508 alloc: Option<&CFAllocator>,
509 data: Option<&CFData>,
510 encoding: CFStringEncoding,
511 ) -> Option<NonNull<CFString>>;
512 }
513 let ret = unsafe { CFStringCreateFromExternalRepresentation(alloc, data, encoding) };
514 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
515 }
516
517 #[doc(alias = "CFStringCreateExternalRepresentation")]
518 #[cfg(feature = "CFData")]
519 #[inline]
520 pub fn new_external_representation(
521 alloc: Option<&CFAllocator>,
522 the_string: Option<&CFString>,
523 encoding: CFStringEncoding,
524 loss_byte: u8,
525 ) -> Option<CFRetained<CFData>> {
526 extern "C-unwind" {
527 fn CFStringCreateExternalRepresentation(
528 alloc: Option<&CFAllocator>,
529 the_string: Option<&CFString>,
530 encoding: CFStringEncoding,
531 loss_byte: u8,
532 ) -> Option<NonNull<CFData>>;
533 }
534 let ret =
535 unsafe { CFStringCreateExternalRepresentation(alloc, the_string, encoding, loss_byte) };
536 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
537 }
538
539 #[doc(alias = "CFStringGetSmallestEncoding")]
540 #[inline]
541 pub fn smallest_encoding(self: &CFString) -> CFStringEncoding {
542 extern "C-unwind" {
543 fn CFStringGetSmallestEncoding(the_string: &CFString) -> CFStringEncoding;
544 }
545 unsafe { CFStringGetSmallestEncoding(self) }
546 }
547
548 #[doc(alias = "CFStringGetFastestEncoding")]
549 #[inline]
550 pub fn fastest_encoding(self: &CFString) -> CFStringEncoding {
551 extern "C-unwind" {
552 fn CFStringGetFastestEncoding(the_string: &CFString) -> CFStringEncoding;
553 }
554 unsafe { CFStringGetFastestEncoding(self) }
555 }
556
557 #[doc(alias = "CFStringGetSystemEncoding")]
558 #[inline]
559 pub fn system_encoding() -> CFStringEncoding {
560 extern "C-unwind" {
561 fn CFStringGetSystemEncoding() -> CFStringEncoding;
562 }
563 unsafe { CFStringGetSystemEncoding() }
564 }
565
566 #[doc(alias = "CFStringGetMaximumSizeForEncoding")]
567 #[inline]
568 pub fn maximum_size_for_encoding(length: CFIndex, encoding: CFStringEncoding) -> CFIndex {
569 extern "C-unwind" {
570 fn CFStringGetMaximumSizeForEncoding(
571 length: CFIndex,
572 encoding: CFStringEncoding,
573 ) -> CFIndex;
574 }
575 unsafe { CFStringGetMaximumSizeForEncoding(length, encoding) }
576 }
577
578 #[doc(alias = "CFStringGetFileSystemRepresentation")]
580 #[inline]
581 pub unsafe fn file_system_representation(
582 self: &CFString,
583 buffer: *mut c_char,
584 max_buf_len: CFIndex,
585 ) -> bool {
586 extern "C-unwind" {
587 fn CFStringGetFileSystemRepresentation(
588 string: &CFString,
589 buffer: *mut c_char,
590 max_buf_len: CFIndex,
591 ) -> Boolean;
592 }
593 let ret = unsafe { CFStringGetFileSystemRepresentation(self, buffer, max_buf_len) };
594 ret != 0
595 }
596
597 #[doc(alias = "CFStringGetMaximumSizeOfFileSystemRepresentation")]
598 #[inline]
599 pub fn maximum_size_of_file_system_representation(self: &CFString) -> CFIndex {
600 extern "C-unwind" {
601 fn CFStringGetMaximumSizeOfFileSystemRepresentation(string: &CFString) -> CFIndex;
602 }
603 unsafe { CFStringGetMaximumSizeOfFileSystemRepresentation(self) }
604 }
605
606 #[doc(alias = "CFStringCreateWithFileSystemRepresentation")]
607 #[inline]
608 pub unsafe fn with_file_system_representation(
609 alloc: Option<&CFAllocator>,
610 buffer: *const c_char,
611 ) -> Option<CFRetained<CFString>> {
612 extern "C-unwind" {
613 fn CFStringCreateWithFileSystemRepresentation(
614 alloc: Option<&CFAllocator>,
615 buffer: *const c_char,
616 ) -> Option<NonNull<CFString>>;
617 }
618 let ret = unsafe { CFStringCreateWithFileSystemRepresentation(alloc, buffer) };
619 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
620 }
621}
622
623#[repr(transparent)]
626#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
627pub struct CFStringCompareFlags(pub CFOptionFlags);
628bitflags::bitflags! {
629 impl CFStringCompareFlags: CFOptionFlags {
630 #[doc(alias = "kCFCompareCaseInsensitive")]
631 const CompareCaseInsensitive = 1;
632 #[doc(alias = "kCFCompareBackwards")]
633 const CompareBackwards = 4;
634 #[doc(alias = "kCFCompareAnchored")]
635 const CompareAnchored = 8;
636 #[doc(alias = "kCFCompareNonliteral")]
637 const CompareNonliteral = 16;
638 #[doc(alias = "kCFCompareLocalized")]
639 const CompareLocalized = 32;
640 #[doc(alias = "kCFCompareNumerically")]
641 const CompareNumerically = 64;
642 #[doc(alias = "kCFCompareDiacriticInsensitive")]
643 const CompareDiacriticInsensitive = 128;
644 #[doc(alias = "kCFCompareWidthInsensitive")]
645 const CompareWidthInsensitive = 256;
646 #[doc(alias = "kCFCompareForcedOrdering")]
647 const CompareForcedOrdering = 512;
648 }
649}
650
651#[cfg(feature = "objc2")]
652unsafe impl Encode for CFStringCompareFlags {
653 const ENCODING: Encoding = CFOptionFlags::ENCODING;
654}
655
656#[cfg(feature = "objc2")]
657unsafe impl RefEncode for CFStringCompareFlags {
658 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
659}
660
661impl CFString {
662 #[doc(alias = "CFStringCompareWithOptionsAndLocale")]
663 #[cfg(feature = "CFLocale")]
664 #[inline]
665 pub unsafe fn compare_with_options_and_locale(
666 self: &CFString,
667 the_string2: Option<&CFString>,
668 range_to_compare: CFRange,
669 compare_options: CFStringCompareFlags,
670 locale: Option<&CFLocale>,
671 ) -> CFComparisonResult {
672 extern "C-unwind" {
673 fn CFStringCompareWithOptionsAndLocale(
674 the_string1: &CFString,
675 the_string2: Option<&CFString>,
676 range_to_compare: CFRange,
677 compare_options: CFStringCompareFlags,
678 locale: Option<&CFLocale>,
679 ) -> CFComparisonResult;
680 }
681 unsafe {
682 CFStringCompareWithOptionsAndLocale(
683 self,
684 the_string2,
685 range_to_compare,
686 compare_options,
687 locale,
688 )
689 }
690 }
691
692 #[doc(alias = "CFStringCompareWithOptions")]
693 #[inline]
694 pub unsafe fn compare_with_options(
695 self: &CFString,
696 the_string2: Option<&CFString>,
697 range_to_compare: CFRange,
698 compare_options: CFStringCompareFlags,
699 ) -> CFComparisonResult {
700 extern "C-unwind" {
701 fn CFStringCompareWithOptions(
702 the_string1: &CFString,
703 the_string2: Option<&CFString>,
704 range_to_compare: CFRange,
705 compare_options: CFStringCompareFlags,
706 ) -> CFComparisonResult;
707 }
708 unsafe { CFStringCompareWithOptions(self, the_string2, range_to_compare, compare_options) }
709 }
710
711 #[doc(alias = "CFStringCompare")]
712 #[inline]
713 pub fn compare(
714 self: &CFString,
715 the_string2: Option<&CFString>,
716 compare_options: CFStringCompareFlags,
717 ) -> CFComparisonResult {
718 extern "C-unwind" {
719 fn CFStringCompare(
720 the_string1: &CFString,
721 the_string2: Option<&CFString>,
722 compare_options: CFStringCompareFlags,
723 ) -> CFComparisonResult;
724 }
725 unsafe { CFStringCompare(self, the_string2, compare_options) }
726 }
727
728 #[doc(alias = "CFStringFindWithOptionsAndLocale")]
729 #[cfg(feature = "CFLocale")]
730 #[inline]
731 pub unsafe fn find_with_options_and_locale(
732 self: &CFString,
733 string_to_find: Option<&CFString>,
734 range_to_search: CFRange,
735 search_options: CFStringCompareFlags,
736 locale: Option<&CFLocale>,
737 result: *mut CFRange,
738 ) -> bool {
739 extern "C-unwind" {
740 fn CFStringFindWithOptionsAndLocale(
741 the_string: &CFString,
742 string_to_find: Option<&CFString>,
743 range_to_search: CFRange,
744 search_options: CFStringCompareFlags,
745 locale: Option<&CFLocale>,
746 result: *mut CFRange,
747 ) -> Boolean;
748 }
749 let ret = unsafe {
750 CFStringFindWithOptionsAndLocale(
751 self,
752 string_to_find,
753 range_to_search,
754 search_options,
755 locale,
756 result,
757 )
758 };
759 ret != 0
760 }
761
762 #[doc(alias = "CFStringFindWithOptions")]
763 #[inline]
764 pub unsafe fn find_with_options(
765 self: &CFString,
766 string_to_find: Option<&CFString>,
767 range_to_search: CFRange,
768 search_options: CFStringCompareFlags,
769 result: *mut CFRange,
770 ) -> bool {
771 extern "C-unwind" {
772 fn CFStringFindWithOptions(
773 the_string: &CFString,
774 string_to_find: Option<&CFString>,
775 range_to_search: CFRange,
776 search_options: CFStringCompareFlags,
777 result: *mut CFRange,
778 ) -> Boolean;
779 }
780 let ret = unsafe {
781 CFStringFindWithOptions(
782 self,
783 string_to_find,
784 range_to_search,
785 search_options,
786 result,
787 )
788 };
789 ret != 0
790 }
791
792 #[doc(alias = "CFStringCreateArrayWithFindResults")]
793 #[cfg(feature = "CFArray")]
794 #[inline]
795 pub unsafe fn new_array_with_find_results(
796 alloc: Option<&CFAllocator>,
797 the_string: Option<&CFString>,
798 string_to_find: Option<&CFString>,
799 range_to_search: CFRange,
800 compare_options: CFStringCompareFlags,
801 ) -> Option<CFRetained<CFArray>> {
802 extern "C-unwind" {
803 fn CFStringCreateArrayWithFindResults(
804 alloc: Option<&CFAllocator>,
805 the_string: Option<&CFString>,
806 string_to_find: Option<&CFString>,
807 range_to_search: CFRange,
808 compare_options: CFStringCompareFlags,
809 ) -> Option<NonNull<CFArray>>;
810 }
811 let ret = unsafe {
812 CFStringCreateArrayWithFindResults(
813 alloc,
814 the_string,
815 string_to_find,
816 range_to_search,
817 compare_options,
818 )
819 };
820 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
821 }
822
823 #[doc(alias = "CFStringFind")]
824 #[inline]
825 pub fn find(
826 self: &CFString,
827 string_to_find: Option<&CFString>,
828 compare_options: CFStringCompareFlags,
829 ) -> CFRange {
830 extern "C-unwind" {
831 fn CFStringFind(
832 the_string: &CFString,
833 string_to_find: Option<&CFString>,
834 compare_options: CFStringCompareFlags,
835 ) -> CFRange;
836 }
837 unsafe { CFStringFind(self, string_to_find, compare_options) }
838 }
839
840 #[doc(alias = "CFStringHasPrefix")]
841 #[inline]
842 pub fn has_prefix(self: &CFString, prefix: Option<&CFString>) -> bool {
843 extern "C-unwind" {
844 fn CFStringHasPrefix(the_string: &CFString, prefix: Option<&CFString>) -> Boolean;
845 }
846 let ret = unsafe { CFStringHasPrefix(self, prefix) };
847 ret != 0
848 }
849
850 #[doc(alias = "CFStringHasSuffix")]
851 #[inline]
852 pub fn has_suffix(self: &CFString, suffix: Option<&CFString>) -> bool {
853 extern "C-unwind" {
854 fn CFStringHasSuffix(the_string: &CFString, suffix: Option<&CFString>) -> Boolean;
855 }
856 let ret = unsafe { CFStringHasSuffix(self, suffix) };
857 ret != 0
858 }
859
860 #[doc(alias = "CFStringGetRangeOfComposedCharactersAtIndex")]
874 #[inline]
875 pub unsafe fn range_of_composed_characters_at_index(
876 self: &CFString,
877 the_index: CFIndex,
878 ) -> CFRange {
879 extern "C-unwind" {
880 fn CFStringGetRangeOfComposedCharactersAtIndex(
881 the_string: &CFString,
882 the_index: CFIndex,
883 ) -> CFRange;
884 }
885 unsafe { CFStringGetRangeOfComposedCharactersAtIndex(self, the_index) }
886 }
887
888 #[doc(alias = "CFStringFindCharacterFromSet")]
921 #[cfg(feature = "CFCharacterSet")]
922 #[inline]
923 pub unsafe fn find_character_from_set(
924 self: &CFString,
925 the_set: Option<&CFCharacterSet>,
926 range_to_search: CFRange,
927 search_options: CFStringCompareFlags,
928 result: *mut CFRange,
929 ) -> bool {
930 extern "C-unwind" {
931 fn CFStringFindCharacterFromSet(
932 the_string: &CFString,
933 the_set: Option<&CFCharacterSet>,
934 range_to_search: CFRange,
935 search_options: CFStringCompareFlags,
936 result: *mut CFRange,
937 ) -> Boolean;
938 }
939 let ret = unsafe {
940 CFStringFindCharacterFromSet(self, the_set, range_to_search, search_options, result)
941 };
942 ret != 0
943 }
944
945 #[doc(alias = "CFStringGetLineBounds")]
946 #[inline]
947 pub unsafe fn line_bounds(
948 self: &CFString,
949 range: CFRange,
950 line_begin_index: *mut CFIndex,
951 line_end_index: *mut CFIndex,
952 contents_end_index: *mut CFIndex,
953 ) {
954 extern "C-unwind" {
955 fn CFStringGetLineBounds(
956 the_string: &CFString,
957 range: CFRange,
958 line_begin_index: *mut CFIndex,
959 line_end_index: *mut CFIndex,
960 contents_end_index: *mut CFIndex,
961 );
962 }
963 unsafe {
964 CFStringGetLineBounds(
965 self,
966 range,
967 line_begin_index,
968 line_end_index,
969 contents_end_index,
970 )
971 }
972 }
973
974 #[doc(alias = "CFStringGetParagraphBounds")]
975 #[inline]
976 pub unsafe fn paragraph_bounds(
977 self: &CFString,
978 range: CFRange,
979 par_begin_index: *mut CFIndex,
980 par_end_index: *mut CFIndex,
981 contents_end_index: *mut CFIndex,
982 ) {
983 extern "C-unwind" {
984 fn CFStringGetParagraphBounds(
985 string: &CFString,
986 range: CFRange,
987 par_begin_index: *mut CFIndex,
988 par_end_index: *mut CFIndex,
989 contents_end_index: *mut CFIndex,
990 );
991 }
992 unsafe {
993 CFStringGetParagraphBounds(
994 self,
995 range,
996 par_begin_index,
997 par_end_index,
998 contents_end_index,
999 )
1000 }
1001 }
1002
1003 #[doc(alias = "CFStringGetHyphenationLocationBeforeIndex")]
1033 #[cfg(feature = "CFLocale")]
1034 #[inline]
1035 pub unsafe fn hyphenation_location_before_index(
1036 self: &CFString,
1037 location: CFIndex,
1038 limit_range: CFRange,
1039 options: CFOptionFlags,
1040 locale: Option<&CFLocale>,
1041 character: *mut UTF32Char,
1042 ) -> CFIndex {
1043 extern "C-unwind" {
1044 fn CFStringGetHyphenationLocationBeforeIndex(
1045 string: &CFString,
1046 location: CFIndex,
1047 limit_range: CFRange,
1048 options: CFOptionFlags,
1049 locale: Option<&CFLocale>,
1050 character: *mut UTF32Char,
1051 ) -> CFIndex;
1052 }
1053 unsafe {
1054 CFStringGetHyphenationLocationBeforeIndex(
1055 self,
1056 location,
1057 limit_range,
1058 options,
1059 locale,
1060 character,
1061 )
1062 }
1063 }
1064
1065 #[doc(alias = "CFStringIsHyphenationAvailableForLocale")]
1066 #[cfg(feature = "CFLocale")]
1067 #[inline]
1068 pub fn is_hyphenation_available_for_locale(locale: Option<&CFLocale>) -> bool {
1069 extern "C-unwind" {
1070 fn CFStringIsHyphenationAvailableForLocale(locale: Option<&CFLocale>) -> Boolean;
1071 }
1072 let ret = unsafe { CFStringIsHyphenationAvailableForLocale(locale) };
1073 ret != 0
1074 }
1075
1076 #[doc(alias = "CFStringCreateByCombiningStrings")]
1078 #[cfg(feature = "CFArray")]
1079 #[inline]
1080 pub unsafe fn new_by_combining_strings(
1081 alloc: Option<&CFAllocator>,
1082 the_array: Option<&CFArray>,
1083 separator_string: Option<&CFString>,
1084 ) -> Option<CFRetained<CFString>> {
1085 extern "C-unwind" {
1086 fn CFStringCreateByCombiningStrings(
1087 alloc: Option<&CFAllocator>,
1088 the_array: Option<&CFArray>,
1089 separator_string: Option<&CFString>,
1090 ) -> Option<NonNull<CFString>>;
1091 }
1092 let ret = unsafe { CFStringCreateByCombiningStrings(alloc, the_array, separator_string) };
1093 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1094 }
1095
1096 #[doc(alias = "CFStringCreateArrayBySeparatingStrings")]
1097 #[cfg(feature = "CFArray")]
1098 #[inline]
1099 pub fn new_array_by_separating_strings(
1100 alloc: Option<&CFAllocator>,
1101 the_string: Option<&CFString>,
1102 separator_string: Option<&CFString>,
1103 ) -> Option<CFRetained<CFArray>> {
1104 extern "C-unwind" {
1105 fn CFStringCreateArrayBySeparatingStrings(
1106 alloc: Option<&CFAllocator>,
1107 the_string: Option<&CFString>,
1108 separator_string: Option<&CFString>,
1109 ) -> Option<NonNull<CFArray>>;
1110 }
1111 let ret =
1112 unsafe { CFStringCreateArrayBySeparatingStrings(alloc, the_string, separator_string) };
1113 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1114 }
1115
1116 #[doc(alias = "CFStringGetIntValue")]
1118 #[inline]
1119 pub fn int_value(self: &CFString) -> i32 {
1120 extern "C-unwind" {
1121 fn CFStringGetIntValue(str: &CFString) -> i32;
1122 }
1123 unsafe { CFStringGetIntValue(self) }
1124 }
1125
1126 #[doc(alias = "CFStringGetDoubleValue")]
1127 #[inline]
1128 pub fn double_value(self: &CFString) -> c_double {
1129 extern "C-unwind" {
1130 fn CFStringGetDoubleValue(str: &CFString) -> c_double;
1131 }
1132 unsafe { CFStringGetDoubleValue(self) }
1133 }
1134}
1135
1136impl CFMutableString {
1137 #[doc(alias = "CFStringAppend")]
1139 #[inline]
1140 pub fn append(the_string: Option<&CFMutableString>, appended_string: Option<&CFString>) {
1141 extern "C-unwind" {
1142 fn CFStringAppend(
1143 the_string: Option<&CFMutableString>,
1144 appended_string: Option<&CFString>,
1145 );
1146 }
1147 unsafe { CFStringAppend(the_string, appended_string) }
1148 }
1149
1150 #[doc(alias = "CFStringAppendCharacters")]
1151 #[inline]
1152 pub unsafe fn append_characters(
1153 the_string: Option<&CFMutableString>,
1154 chars: *const UniChar,
1155 num_chars: CFIndex,
1156 ) {
1157 extern "C-unwind" {
1158 fn CFStringAppendCharacters(
1159 the_string: Option<&CFMutableString>,
1160 chars: *const UniChar,
1161 num_chars: CFIndex,
1162 );
1163 }
1164 unsafe { CFStringAppendCharacters(the_string, chars, num_chars) }
1165 }
1166
1167 #[doc(alias = "CFStringAppendPascalString")]
1168 #[inline]
1169 pub unsafe fn append_pascal_string(
1170 the_string: Option<&CFMutableString>,
1171 p_str: ConstStr255Param,
1172 encoding: CFStringEncoding,
1173 ) {
1174 extern "C-unwind" {
1175 fn CFStringAppendPascalString(
1176 the_string: Option<&CFMutableString>,
1177 p_str: ConstStr255Param,
1178 encoding: CFStringEncoding,
1179 );
1180 }
1181 unsafe { CFStringAppendPascalString(the_string, p_str, encoding) }
1182 }
1183
1184 #[doc(alias = "CFStringAppendCString")]
1185 #[inline]
1186 pub unsafe fn append_c_string(
1187 the_string: Option<&CFMutableString>,
1188 c_str: *const c_char,
1189 encoding: CFStringEncoding,
1190 ) {
1191 extern "C-unwind" {
1192 fn CFStringAppendCString(
1193 the_string: Option<&CFMutableString>,
1194 c_str: *const c_char,
1195 encoding: CFStringEncoding,
1196 );
1197 }
1198 unsafe { CFStringAppendCString(the_string, c_str, encoding) }
1199 }
1200
1201 #[doc(alias = "CFStringInsert")]
1202 #[inline]
1203 pub unsafe fn insert(
1204 str: Option<&CFMutableString>,
1205 idx: CFIndex,
1206 inserted_str: Option<&CFString>,
1207 ) {
1208 extern "C-unwind" {
1209 fn CFStringInsert(
1210 str: Option<&CFMutableString>,
1211 idx: CFIndex,
1212 inserted_str: Option<&CFString>,
1213 );
1214 }
1215 unsafe { CFStringInsert(str, idx, inserted_str) }
1216 }
1217
1218 #[doc(alias = "CFStringDelete")]
1219 #[inline]
1220 pub unsafe fn delete(the_string: Option<&CFMutableString>, range: CFRange) {
1221 extern "C-unwind" {
1222 fn CFStringDelete(the_string: Option<&CFMutableString>, range: CFRange);
1223 }
1224 unsafe { CFStringDelete(the_string, range) }
1225 }
1226
1227 #[doc(alias = "CFStringReplace")]
1228 #[inline]
1229 pub unsafe fn replace(
1230 the_string: Option<&CFMutableString>,
1231 range: CFRange,
1232 replacement: Option<&CFString>,
1233 ) {
1234 extern "C-unwind" {
1235 fn CFStringReplace(
1236 the_string: Option<&CFMutableString>,
1237 range: CFRange,
1238 replacement: Option<&CFString>,
1239 );
1240 }
1241 unsafe { CFStringReplace(the_string, range, replacement) }
1242 }
1243
1244 #[doc(alias = "CFStringReplaceAll")]
1245 #[inline]
1246 pub fn replace_all(the_string: Option<&CFMutableString>, replacement: Option<&CFString>) {
1247 extern "C-unwind" {
1248 fn CFStringReplaceAll(
1249 the_string: Option<&CFMutableString>,
1250 replacement: Option<&CFString>,
1251 );
1252 }
1253 unsafe { CFStringReplaceAll(the_string, replacement) }
1254 }
1255
1256 #[doc(alias = "CFStringFindAndReplace")]
1257 #[inline]
1258 pub unsafe fn find_and_replace(
1259 the_string: Option<&CFMutableString>,
1260 string_to_find: Option<&CFString>,
1261 replacement_string: Option<&CFString>,
1262 range_to_search: CFRange,
1263 compare_options: CFStringCompareFlags,
1264 ) -> CFIndex {
1265 extern "C-unwind" {
1266 fn CFStringFindAndReplace(
1267 the_string: Option<&CFMutableString>,
1268 string_to_find: Option<&CFString>,
1269 replacement_string: Option<&CFString>,
1270 range_to_search: CFRange,
1271 compare_options: CFStringCompareFlags,
1272 ) -> CFIndex;
1273 }
1274 unsafe {
1275 CFStringFindAndReplace(
1276 the_string,
1277 string_to_find,
1278 replacement_string,
1279 range_to_search,
1280 compare_options,
1281 )
1282 }
1283 }
1284
1285 #[doc(alias = "CFStringSetExternalCharactersNoCopy")]
1286 #[inline]
1287 pub unsafe fn set_external_characters_no_copy(
1288 the_string: Option<&CFMutableString>,
1289 chars: *mut UniChar,
1290 length: CFIndex,
1291 capacity: CFIndex,
1292 ) {
1293 extern "C-unwind" {
1294 fn CFStringSetExternalCharactersNoCopy(
1295 the_string: Option<&CFMutableString>,
1296 chars: *mut UniChar,
1297 length: CFIndex,
1298 capacity: CFIndex,
1299 );
1300 }
1301 unsafe { CFStringSetExternalCharactersNoCopy(the_string, chars, length, capacity) }
1302 }
1303
1304 #[doc(alias = "CFStringPad")]
1305 #[inline]
1306 pub unsafe fn pad(
1307 the_string: Option<&CFMutableString>,
1308 pad_string: Option<&CFString>,
1309 length: CFIndex,
1310 index_into_pad: CFIndex,
1311 ) {
1312 extern "C-unwind" {
1313 fn CFStringPad(
1314 the_string: Option<&CFMutableString>,
1315 pad_string: Option<&CFString>,
1316 length: CFIndex,
1317 index_into_pad: CFIndex,
1318 );
1319 }
1320 unsafe { CFStringPad(the_string, pad_string, length, index_into_pad) }
1321 }
1322
1323 #[doc(alias = "CFStringTrim")]
1324 #[inline]
1325 pub fn trim(the_string: Option<&CFMutableString>, trim_string: Option<&CFString>) {
1326 extern "C-unwind" {
1327 fn CFStringTrim(the_string: Option<&CFMutableString>, trim_string: Option<&CFString>);
1328 }
1329 unsafe { CFStringTrim(the_string, trim_string) }
1330 }
1331
1332 #[doc(alias = "CFStringTrimWhitespace")]
1333 #[inline]
1334 pub fn trim_whitespace(the_string: Option<&CFMutableString>) {
1335 extern "C-unwind" {
1336 fn CFStringTrimWhitespace(the_string: Option<&CFMutableString>);
1337 }
1338 unsafe { CFStringTrimWhitespace(the_string) }
1339 }
1340
1341 #[doc(alias = "CFStringLowercase")]
1342 #[cfg(feature = "CFLocale")]
1343 #[inline]
1344 pub fn lowercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>) {
1345 extern "C-unwind" {
1346 fn CFStringLowercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
1347 }
1348 unsafe { CFStringLowercase(the_string, locale) }
1349 }
1350
1351 #[doc(alias = "CFStringUppercase")]
1352 #[cfg(feature = "CFLocale")]
1353 #[inline]
1354 pub fn uppercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>) {
1355 extern "C-unwind" {
1356 fn CFStringUppercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
1357 }
1358 unsafe { CFStringUppercase(the_string, locale) }
1359 }
1360
1361 #[doc(alias = "CFStringCapitalize")]
1362 #[cfg(feature = "CFLocale")]
1363 #[inline]
1364 pub fn capitalize(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>) {
1365 extern "C-unwind" {
1366 fn CFStringCapitalize(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
1367 }
1368 unsafe { CFStringCapitalize(the_string, locale) }
1369 }
1370}
1371
1372#[repr(transparent)]
1379#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1380pub struct CFStringNormalizationForm(pub CFIndex);
1381impl CFStringNormalizationForm {
1382 #[doc(alias = "kCFStringNormalizationFormD")]
1383 pub const D: Self = Self(0);
1384 #[doc(alias = "kCFStringNormalizationFormKD")]
1385 pub const KD: Self = Self(1);
1386 #[doc(alias = "kCFStringNormalizationFormC")]
1387 pub const C: Self = Self(2);
1388 #[doc(alias = "kCFStringNormalizationFormKC")]
1389 pub const KC: Self = Self(3);
1390}
1391
1392#[cfg(feature = "objc2")]
1393unsafe impl Encode for CFStringNormalizationForm {
1394 const ENCODING: Encoding = CFIndex::ENCODING;
1395}
1396
1397#[cfg(feature = "objc2")]
1398unsafe impl RefEncode for CFStringNormalizationForm {
1399 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1400}
1401
1402impl CFMutableString {
1403 #[doc(alias = "CFStringNormalize")]
1414 #[inline]
1415 pub unsafe fn normalize(
1416 the_string: Option<&CFMutableString>,
1417 the_form: CFStringNormalizationForm,
1418 ) {
1419 extern "C-unwind" {
1420 fn CFStringNormalize(
1421 the_string: Option<&CFMutableString>,
1422 the_form: CFStringNormalizationForm,
1423 );
1424 }
1425 unsafe { CFStringNormalize(the_string, the_form) }
1426 }
1427
1428 #[doc(alias = "CFStringFold")]
1452 #[cfg(feature = "CFLocale")]
1453 #[inline]
1454 pub fn fold(
1455 the_string: Option<&CFMutableString>,
1456 the_flags: CFStringCompareFlags,
1457 the_locale: Option<&CFLocale>,
1458 ) {
1459 extern "C-unwind" {
1460 fn CFStringFold(
1461 the_string: Option<&CFMutableString>,
1462 the_flags: CFStringCompareFlags,
1463 the_locale: Option<&CFLocale>,
1464 );
1465 }
1466 unsafe { CFStringFold(the_string, the_flags, the_locale) }
1467 }
1468
1469 #[doc(alias = "CFStringTransform")]
1470 #[inline]
1471 pub unsafe fn transform(
1472 string: Option<&CFMutableString>,
1473 range: *mut CFRange,
1474 transform: Option<&CFString>,
1475 reverse: bool,
1476 ) -> bool {
1477 extern "C-unwind" {
1478 fn CFStringTransform(
1479 string: Option<&CFMutableString>,
1480 range: *mut CFRange,
1481 transform: Option<&CFString>,
1482 reverse: Boolean,
1483 ) -> Boolean;
1484 }
1485 let ret = unsafe { CFStringTransform(string, range, transform, reverse as _) };
1486 ret != 0
1487 }
1488}
1489
1490extern "C" {
1491 pub static kCFStringTransformStripCombiningMarks: Option<&'static CFString>;
1493}
1494
1495extern "C" {
1496 pub static kCFStringTransformToLatin: Option<&'static CFString>;
1498}
1499
1500extern "C" {
1501 pub static kCFStringTransformFullwidthHalfwidth: Option<&'static CFString>;
1503}
1504
1505extern "C" {
1506 pub static kCFStringTransformLatinKatakana: Option<&'static CFString>;
1508}
1509
1510extern "C" {
1511 pub static kCFStringTransformLatinHiragana: Option<&'static CFString>;
1513}
1514
1515extern "C" {
1516 pub static kCFStringTransformHiraganaKatakana: Option<&'static CFString>;
1518}
1519
1520extern "C" {
1521 pub static kCFStringTransformMandarinLatin: Option<&'static CFString>;
1523}
1524
1525extern "C" {
1526 pub static kCFStringTransformLatinHangul: Option<&'static CFString>;
1528}
1529
1530extern "C" {
1531 pub static kCFStringTransformLatinArabic: Option<&'static CFString>;
1533}
1534
1535extern "C" {
1536 pub static kCFStringTransformLatinHebrew: Option<&'static CFString>;
1538}
1539
1540extern "C" {
1541 pub static kCFStringTransformLatinThai: Option<&'static CFString>;
1543}
1544
1545extern "C" {
1546 pub static kCFStringTransformLatinCyrillic: Option<&'static CFString>;
1548}
1549
1550extern "C" {
1551 pub static kCFStringTransformLatinGreek: Option<&'static CFString>;
1553}
1554
1555extern "C" {
1556 pub static kCFStringTransformToXMLHex: Option<&'static CFString>;
1558}
1559
1560extern "C" {
1561 pub static kCFStringTransformToUnicodeName: Option<&'static CFString>;
1563}
1564
1565extern "C" {
1566 pub static kCFStringTransformStripDiacritics: Option<&'static CFString>;
1568}
1569
1570impl CFString {
1571 #[doc(alias = "CFStringIsEncodingAvailable")]
1573 #[inline]
1574 pub fn is_encoding_available(encoding: CFStringEncoding) -> bool {
1575 extern "C-unwind" {
1576 fn CFStringIsEncodingAvailable(encoding: CFStringEncoding) -> Boolean;
1577 }
1578 let ret = unsafe { CFStringIsEncodingAvailable(encoding) };
1579 ret != 0
1580 }
1581
1582 #[doc(alias = "CFStringGetListOfAvailableEncodings")]
1583 #[inline]
1584 pub fn list_of_available_encodings() -> *const CFStringEncoding {
1585 extern "C-unwind" {
1586 fn CFStringGetListOfAvailableEncodings() -> *const CFStringEncoding;
1587 }
1588 unsafe { CFStringGetListOfAvailableEncodings() }
1589 }
1590
1591 #[doc(alias = "CFStringGetNameOfEncoding")]
1592 #[inline]
1593 pub fn name_of_encoding(encoding: CFStringEncoding) -> Option<CFRetained<CFString>> {
1594 extern "C-unwind" {
1595 fn CFStringGetNameOfEncoding(encoding: CFStringEncoding) -> Option<NonNull<CFString>>;
1596 }
1597 let ret = unsafe { CFStringGetNameOfEncoding(encoding) };
1598 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1599 }
1600
1601 #[doc(alias = "CFStringConvertEncodingToNSStringEncoding")]
1602 #[inline]
1603 pub fn convert_encoding_to_ns_string_encoding(encoding: CFStringEncoding) -> c_ulong {
1604 extern "C-unwind" {
1605 fn CFStringConvertEncodingToNSStringEncoding(encoding: CFStringEncoding) -> c_ulong;
1606 }
1607 unsafe { CFStringConvertEncodingToNSStringEncoding(encoding) }
1608 }
1609
1610 #[doc(alias = "CFStringConvertNSStringEncodingToEncoding")]
1611 #[inline]
1612 pub fn convert_ns_string_encoding_to_encoding(encoding: c_ulong) -> CFStringEncoding {
1613 extern "C-unwind" {
1614 fn CFStringConvertNSStringEncodingToEncoding(encoding: c_ulong) -> CFStringEncoding;
1615 }
1616 unsafe { CFStringConvertNSStringEncodingToEncoding(encoding) }
1617 }
1618
1619 #[doc(alias = "CFStringConvertEncodingToWindowsCodepage")]
1620 #[inline]
1621 pub fn convert_encoding_to_windows_codepage(encoding: CFStringEncoding) -> u32 {
1622 extern "C-unwind" {
1623 fn CFStringConvertEncodingToWindowsCodepage(encoding: CFStringEncoding) -> u32;
1624 }
1625 unsafe { CFStringConvertEncodingToWindowsCodepage(encoding) }
1626 }
1627
1628 #[doc(alias = "CFStringConvertWindowsCodepageToEncoding")]
1629 #[inline]
1630 pub fn convert_windows_codepage_to_encoding(codepage: u32) -> CFStringEncoding {
1631 extern "C-unwind" {
1632 fn CFStringConvertWindowsCodepageToEncoding(codepage: u32) -> CFStringEncoding;
1633 }
1634 unsafe { CFStringConvertWindowsCodepageToEncoding(codepage) }
1635 }
1636
1637 #[doc(alias = "CFStringConvertIANACharSetNameToEncoding")]
1638 #[inline]
1639 pub fn convert_iana_char_set_name_to_encoding(self: &CFString) -> CFStringEncoding {
1640 extern "C-unwind" {
1641 fn CFStringConvertIANACharSetNameToEncoding(the_string: &CFString) -> CFStringEncoding;
1642 }
1643 unsafe { CFStringConvertIANACharSetNameToEncoding(self) }
1644 }
1645
1646 #[doc(alias = "CFStringConvertEncodingToIANACharSetName")]
1647 #[inline]
1648 pub fn convert_encoding_to_iana_char_set_name(
1649 encoding: CFStringEncoding,
1650 ) -> Option<CFRetained<CFString>> {
1651 extern "C-unwind" {
1652 fn CFStringConvertEncodingToIANACharSetName(
1653 encoding: CFStringEncoding,
1654 ) -> Option<NonNull<CFString>>;
1655 }
1656 let ret = unsafe { CFStringConvertEncodingToIANACharSetName(encoding) };
1657 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1658 }
1659
1660 #[doc(alias = "CFStringGetMostCompatibleMacStringEncoding")]
1661 #[inline]
1662 pub fn most_compatible_mac_string_encoding(encoding: CFStringEncoding) -> CFStringEncoding {
1663 extern "C-unwind" {
1664 fn CFStringGetMostCompatibleMacStringEncoding(
1665 encoding: CFStringEncoding,
1666 ) -> CFStringEncoding;
1667 }
1668 unsafe { CFStringGetMostCompatibleMacStringEncoding(encoding) }
1669 }
1670}
1671
1672#[repr(C)]
1674#[derive(Clone, Copy, Debug, PartialEq)]
1675pub struct CFStringInlineBuffer {
1676 pub buffer: [UniChar; 64],
1677 pub theString: *const CFString,
1678 pub directUniCharBuffer: *const UniChar,
1679 pub directCStringBuffer: *const c_char,
1680 pub rangeToBuffer: CFRange,
1681 pub bufferedRangeStart: CFIndex,
1682 pub bufferedRangeEnd: CFIndex,
1683}
1684
1685#[cfg(feature = "objc2")]
1686unsafe impl Encode for CFStringInlineBuffer {
1687 const ENCODING: Encoding = Encoding::Struct(
1688 "?",
1689 &[
1690 <[UniChar; 64]>::ENCODING,
1691 <*const CFString>::ENCODING,
1692 <*const UniChar>::ENCODING,
1693 <*const c_char>::ENCODING,
1694 <CFRange>::ENCODING,
1695 <CFIndex>::ENCODING,
1696 <CFIndex>::ENCODING,
1697 ],
1698 );
1699}
1700
1701#[cfg(feature = "objc2")]
1702unsafe impl RefEncode for CFStringInlineBuffer {
1703 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1704}
1705
1706impl CFString {
1707 }
1719
1720#[inline]
1721pub extern "C-unwind" fn CFShow(obj: Option<&CFType>) {
1722 extern "C-unwind" {
1723 fn CFShow(obj: Option<&CFType>);
1724 }
1725 unsafe { CFShow(obj) }
1726}
1727
1728#[inline]
1729pub extern "C-unwind" fn CFShowStr(str: Option<&CFString>) {
1730 extern "C-unwind" {
1731 fn CFShowStr(str: Option<&CFString>);
1732 }
1733 unsafe { CFShowStr(str) }
1734}
1735
1736#[deprecated = "renamed to `CFString::with_pascal_string`"]
1737#[inline]
1738pub unsafe extern "C-unwind" fn CFStringCreateWithPascalString(
1739 alloc: Option<&CFAllocator>,
1740 p_str: ConstStr255Param,
1741 encoding: CFStringEncoding,
1742) -> Option<CFRetained<CFString>> {
1743 extern "C-unwind" {
1744 fn CFStringCreateWithPascalString(
1745 alloc: Option<&CFAllocator>,
1746 p_str: ConstStr255Param,
1747 encoding: CFStringEncoding,
1748 ) -> Option<NonNull<CFString>>;
1749 }
1750 let ret = unsafe { CFStringCreateWithPascalString(alloc, p_str, encoding) };
1751 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1752}
1753
1754#[deprecated = "renamed to `CFString::with_c_string`"]
1755#[inline]
1756pub unsafe extern "C-unwind" fn CFStringCreateWithCString(
1757 alloc: Option<&CFAllocator>,
1758 c_str: *const c_char,
1759 encoding: CFStringEncoding,
1760) -> Option<CFRetained<CFString>> {
1761 extern "C-unwind" {
1762 fn CFStringCreateWithCString(
1763 alloc: Option<&CFAllocator>,
1764 c_str: *const c_char,
1765 encoding: CFStringEncoding,
1766 ) -> Option<NonNull<CFString>>;
1767 }
1768 let ret = unsafe { CFStringCreateWithCString(alloc, c_str, encoding) };
1769 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1770}
1771
1772#[deprecated = "renamed to `CFString::with_bytes`"]
1773#[inline]
1774pub unsafe extern "C-unwind" fn CFStringCreateWithBytes(
1775 alloc: Option<&CFAllocator>,
1776 bytes: *const u8,
1777 num_bytes: CFIndex,
1778 encoding: CFStringEncoding,
1779 is_external_representation: bool,
1780) -> Option<CFRetained<CFString>> {
1781 extern "C-unwind" {
1782 fn CFStringCreateWithBytes(
1783 alloc: Option<&CFAllocator>,
1784 bytes: *const u8,
1785 num_bytes: CFIndex,
1786 encoding: CFStringEncoding,
1787 is_external_representation: Boolean,
1788 ) -> Option<NonNull<CFString>>;
1789 }
1790 let ret = unsafe {
1791 CFStringCreateWithBytes(
1792 alloc,
1793 bytes,
1794 num_bytes,
1795 encoding,
1796 is_external_representation as _,
1797 )
1798 };
1799 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1800}
1801
1802#[deprecated = "renamed to `CFString::with_characters`"]
1803#[inline]
1804pub unsafe extern "C-unwind" fn CFStringCreateWithCharacters(
1805 alloc: Option<&CFAllocator>,
1806 chars: *const UniChar,
1807 num_chars: CFIndex,
1808) -> Option<CFRetained<CFString>> {
1809 extern "C-unwind" {
1810 fn CFStringCreateWithCharacters(
1811 alloc: Option<&CFAllocator>,
1812 chars: *const UniChar,
1813 num_chars: CFIndex,
1814 ) -> Option<NonNull<CFString>>;
1815 }
1816 let ret = unsafe { CFStringCreateWithCharacters(alloc, chars, num_chars) };
1817 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1818}
1819
1820#[deprecated = "renamed to `CFString::with_pascal_string_no_copy`"]
1821#[inline]
1822pub unsafe extern "C-unwind" fn CFStringCreateWithPascalStringNoCopy(
1823 alloc: Option<&CFAllocator>,
1824 p_str: ConstStr255Param,
1825 encoding: CFStringEncoding,
1826 contents_deallocator: Option<&CFAllocator>,
1827) -> Option<CFRetained<CFString>> {
1828 extern "C-unwind" {
1829 fn CFStringCreateWithPascalStringNoCopy(
1830 alloc: Option<&CFAllocator>,
1831 p_str: ConstStr255Param,
1832 encoding: CFStringEncoding,
1833 contents_deallocator: Option<&CFAllocator>,
1834 ) -> Option<NonNull<CFString>>;
1835 }
1836 let ret = unsafe {
1837 CFStringCreateWithPascalStringNoCopy(alloc, p_str, encoding, contents_deallocator)
1838 };
1839 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1840}
1841
1842#[deprecated = "renamed to `CFString::with_c_string_no_copy`"]
1843#[inline]
1844pub unsafe extern "C-unwind" fn CFStringCreateWithCStringNoCopy(
1845 alloc: Option<&CFAllocator>,
1846 c_str: *const c_char,
1847 encoding: CFStringEncoding,
1848 contents_deallocator: Option<&CFAllocator>,
1849) -> Option<CFRetained<CFString>> {
1850 extern "C-unwind" {
1851 fn CFStringCreateWithCStringNoCopy(
1852 alloc: Option<&CFAllocator>,
1853 c_str: *const c_char,
1854 encoding: CFStringEncoding,
1855 contents_deallocator: Option<&CFAllocator>,
1856 ) -> Option<NonNull<CFString>>;
1857 }
1858 let ret =
1859 unsafe { CFStringCreateWithCStringNoCopy(alloc, c_str, encoding, contents_deallocator) };
1860 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1861}
1862
1863#[deprecated = "renamed to `CFString::with_bytes_no_copy`"]
1864#[inline]
1865pub unsafe extern "C-unwind" fn CFStringCreateWithBytesNoCopy(
1866 alloc: Option<&CFAllocator>,
1867 bytes: *const u8,
1868 num_bytes: CFIndex,
1869 encoding: CFStringEncoding,
1870 is_external_representation: bool,
1871 contents_deallocator: Option<&CFAllocator>,
1872) -> Option<CFRetained<CFString>> {
1873 extern "C-unwind" {
1874 fn CFStringCreateWithBytesNoCopy(
1875 alloc: Option<&CFAllocator>,
1876 bytes: *const u8,
1877 num_bytes: CFIndex,
1878 encoding: CFStringEncoding,
1879 is_external_representation: Boolean,
1880 contents_deallocator: Option<&CFAllocator>,
1881 ) -> Option<NonNull<CFString>>;
1882 }
1883 let ret = unsafe {
1884 CFStringCreateWithBytesNoCopy(
1885 alloc,
1886 bytes,
1887 num_bytes,
1888 encoding,
1889 is_external_representation as _,
1890 contents_deallocator,
1891 )
1892 };
1893 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1894}
1895
1896#[deprecated = "renamed to `CFString::with_characters_no_copy`"]
1897#[inline]
1898pub unsafe extern "C-unwind" fn CFStringCreateWithCharactersNoCopy(
1899 alloc: Option<&CFAllocator>,
1900 chars: *const UniChar,
1901 num_chars: CFIndex,
1902 contents_deallocator: Option<&CFAllocator>,
1903) -> Option<CFRetained<CFString>> {
1904 extern "C-unwind" {
1905 fn CFStringCreateWithCharactersNoCopy(
1906 alloc: Option<&CFAllocator>,
1907 chars: *const UniChar,
1908 num_chars: CFIndex,
1909 contents_deallocator: Option<&CFAllocator>,
1910 ) -> Option<NonNull<CFString>>;
1911 }
1912 let ret = unsafe {
1913 CFStringCreateWithCharactersNoCopy(alloc, chars, num_chars, contents_deallocator)
1914 };
1915 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1916}
1917
1918#[deprecated = "renamed to `CFString::with_substring`"]
1919#[inline]
1920pub unsafe extern "C-unwind" fn CFStringCreateWithSubstring(
1921 alloc: Option<&CFAllocator>,
1922 str: Option<&CFString>,
1923 range: CFRange,
1924) -> Option<CFRetained<CFString>> {
1925 extern "C-unwind" {
1926 fn CFStringCreateWithSubstring(
1927 alloc: Option<&CFAllocator>,
1928 str: Option<&CFString>,
1929 range: CFRange,
1930 ) -> Option<NonNull<CFString>>;
1931 }
1932 let ret = unsafe { CFStringCreateWithSubstring(alloc, str, range) };
1933 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1934}
1935
1936#[deprecated = "renamed to `CFString::new_copy`"]
1937#[inline]
1938pub extern "C-unwind" fn CFStringCreateCopy(
1939 alloc: Option<&CFAllocator>,
1940 the_string: Option<&CFString>,
1941) -> Option<CFRetained<CFString>> {
1942 extern "C-unwind" {
1943 fn CFStringCreateCopy(
1944 alloc: Option<&CFAllocator>,
1945 the_string: Option<&CFString>,
1946 ) -> Option<NonNull<CFString>>;
1947 }
1948 let ret = unsafe { CFStringCreateCopy(alloc, the_string) };
1949 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1950}
1951
1952#[deprecated = "renamed to `CFMutableString::new`"]
1953#[inline]
1954pub extern "C-unwind" fn CFStringCreateMutable(
1955 alloc: Option<&CFAllocator>,
1956 max_length: CFIndex,
1957) -> Option<CFRetained<CFMutableString>> {
1958 extern "C-unwind" {
1959 fn CFStringCreateMutable(
1960 alloc: Option<&CFAllocator>,
1961 max_length: CFIndex,
1962 ) -> Option<NonNull<CFMutableString>>;
1963 }
1964 let ret = unsafe { CFStringCreateMutable(alloc, max_length) };
1965 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1966}
1967
1968#[deprecated = "renamed to `CFMutableString::new_copy`"]
1969#[inline]
1970pub extern "C-unwind" fn CFStringCreateMutableCopy(
1971 alloc: Option<&CFAllocator>,
1972 max_length: CFIndex,
1973 the_string: Option<&CFString>,
1974) -> Option<CFRetained<CFMutableString>> {
1975 extern "C-unwind" {
1976 fn CFStringCreateMutableCopy(
1977 alloc: Option<&CFAllocator>,
1978 max_length: CFIndex,
1979 the_string: Option<&CFString>,
1980 ) -> Option<NonNull<CFMutableString>>;
1981 }
1982 let ret = unsafe { CFStringCreateMutableCopy(alloc, max_length, the_string) };
1983 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1984}
1985
1986#[deprecated = "renamed to `CFMutableString::with_external_characters_no_copy`"]
1987#[inline]
1988pub unsafe extern "C-unwind" fn CFStringCreateMutableWithExternalCharactersNoCopy(
1989 alloc: Option<&CFAllocator>,
1990 chars: *mut UniChar,
1991 num_chars: CFIndex,
1992 capacity: CFIndex,
1993 external_characters_allocator: Option<&CFAllocator>,
1994) -> Option<CFRetained<CFMutableString>> {
1995 extern "C-unwind" {
1996 fn CFStringCreateMutableWithExternalCharactersNoCopy(
1997 alloc: Option<&CFAllocator>,
1998 chars: *mut UniChar,
1999 num_chars: CFIndex,
2000 capacity: CFIndex,
2001 external_characters_allocator: Option<&CFAllocator>,
2002 ) -> Option<NonNull<CFMutableString>>;
2003 }
2004 let ret = unsafe {
2005 CFStringCreateMutableWithExternalCharactersNoCopy(
2006 alloc,
2007 chars,
2008 num_chars,
2009 capacity,
2010 external_characters_allocator,
2011 )
2012 };
2013 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2014}
2015
2016#[deprecated = "renamed to `CFString::length`"]
2017#[inline]
2018pub extern "C-unwind" fn CFStringGetLength(the_string: &CFString) -> CFIndex {
2019 extern "C-unwind" {
2020 fn CFStringGetLength(the_string: &CFString) -> CFIndex;
2021 }
2022 unsafe { CFStringGetLength(the_string) }
2023}
2024
2025extern "C-unwind" {
2026 #[deprecated = "renamed to `CFString::character_at_index`"]
2027 pub fn CFStringGetCharacterAtIndex(the_string: &CFString, idx: CFIndex) -> UniChar;
2028}
2029
2030extern "C-unwind" {
2031 #[deprecated = "renamed to `CFString::characters`"]
2032 pub fn CFStringGetCharacters(the_string: &CFString, range: CFRange, buffer: *mut UniChar);
2033}
2034
2035#[deprecated = "renamed to `CFString::pascal_string`"]
2036#[inline]
2037pub unsafe extern "C-unwind" fn CFStringGetPascalString(
2038 the_string: &CFString,
2039 buffer: StringPtr,
2040 buffer_size: CFIndex,
2041 encoding: CFStringEncoding,
2042) -> bool {
2043 extern "C-unwind" {
2044 fn CFStringGetPascalString(
2045 the_string: &CFString,
2046 buffer: StringPtr,
2047 buffer_size: CFIndex,
2048 encoding: CFStringEncoding,
2049 ) -> Boolean;
2050 }
2051 let ret = unsafe { CFStringGetPascalString(the_string, buffer, buffer_size, encoding) };
2052 ret != 0
2053}
2054
2055#[deprecated = "renamed to `CFString::c_string`"]
2056#[inline]
2057pub unsafe extern "C-unwind" fn CFStringGetCString(
2058 the_string: &CFString,
2059 buffer: *mut c_char,
2060 buffer_size: CFIndex,
2061 encoding: CFStringEncoding,
2062) -> bool {
2063 extern "C-unwind" {
2064 fn CFStringGetCString(
2065 the_string: &CFString,
2066 buffer: *mut c_char,
2067 buffer_size: CFIndex,
2068 encoding: CFStringEncoding,
2069 ) -> Boolean;
2070 }
2071 let ret = unsafe { CFStringGetCString(the_string, buffer, buffer_size, encoding) };
2072 ret != 0
2073}
2074
2075#[deprecated = "renamed to `CFString::pascal_string_ptr`"]
2076#[inline]
2077pub extern "C-unwind" fn CFStringGetPascalStringPtr(
2078 the_string: &CFString,
2079 encoding: CFStringEncoding,
2080) -> ConstStringPtr {
2081 extern "C-unwind" {
2082 fn CFStringGetPascalStringPtr(
2083 the_string: &CFString,
2084 encoding: CFStringEncoding,
2085 ) -> ConstStringPtr;
2086 }
2087 unsafe { CFStringGetPascalStringPtr(the_string, encoding) }
2088}
2089
2090#[deprecated = "renamed to `CFString::c_string_ptr`"]
2091#[inline]
2092pub extern "C-unwind" fn CFStringGetCStringPtr(
2093 the_string: &CFString,
2094 encoding: CFStringEncoding,
2095) -> *const c_char {
2096 extern "C-unwind" {
2097 fn CFStringGetCStringPtr(
2098 the_string: &CFString,
2099 encoding: CFStringEncoding,
2100 ) -> *const c_char;
2101 }
2102 unsafe { CFStringGetCStringPtr(the_string, encoding) }
2103}
2104
2105#[deprecated = "renamed to `CFString::characters_ptr`"]
2106#[inline]
2107pub extern "C-unwind" fn CFStringGetCharactersPtr(the_string: &CFString) -> *const UniChar {
2108 extern "C-unwind" {
2109 fn CFStringGetCharactersPtr(the_string: &CFString) -> *const UniChar;
2110 }
2111 unsafe { CFStringGetCharactersPtr(the_string) }
2112}
2113
2114#[deprecated = "renamed to `CFString::bytes`"]
2115#[inline]
2116pub unsafe extern "C-unwind" fn CFStringGetBytes(
2117 the_string: &CFString,
2118 range: CFRange,
2119 encoding: CFStringEncoding,
2120 loss_byte: u8,
2121 is_external_representation: bool,
2122 buffer: *mut u8,
2123 max_buf_len: CFIndex,
2124 used_buf_len: *mut CFIndex,
2125) -> CFIndex {
2126 extern "C-unwind" {
2127 fn CFStringGetBytes(
2128 the_string: &CFString,
2129 range: CFRange,
2130 encoding: CFStringEncoding,
2131 loss_byte: u8,
2132 is_external_representation: Boolean,
2133 buffer: *mut u8,
2134 max_buf_len: CFIndex,
2135 used_buf_len: *mut CFIndex,
2136 ) -> CFIndex;
2137 }
2138 unsafe {
2139 CFStringGetBytes(
2140 the_string,
2141 range,
2142 encoding,
2143 loss_byte,
2144 is_external_representation as _,
2145 buffer,
2146 max_buf_len,
2147 used_buf_len,
2148 )
2149 }
2150}
2151
2152#[cfg(feature = "CFData")]
2153#[deprecated = "renamed to `CFString::from_external_representation`"]
2154#[inline]
2155pub extern "C-unwind" fn CFStringCreateFromExternalRepresentation(
2156 alloc: Option<&CFAllocator>,
2157 data: Option<&CFData>,
2158 encoding: CFStringEncoding,
2159) -> Option<CFRetained<CFString>> {
2160 extern "C-unwind" {
2161 fn CFStringCreateFromExternalRepresentation(
2162 alloc: Option<&CFAllocator>,
2163 data: Option<&CFData>,
2164 encoding: CFStringEncoding,
2165 ) -> Option<NonNull<CFString>>;
2166 }
2167 let ret = unsafe { CFStringCreateFromExternalRepresentation(alloc, data, encoding) };
2168 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2169}
2170
2171#[cfg(feature = "CFData")]
2172#[deprecated = "renamed to `CFString::new_external_representation`"]
2173#[inline]
2174pub extern "C-unwind" fn CFStringCreateExternalRepresentation(
2175 alloc: Option<&CFAllocator>,
2176 the_string: Option<&CFString>,
2177 encoding: CFStringEncoding,
2178 loss_byte: u8,
2179) -> Option<CFRetained<CFData>> {
2180 extern "C-unwind" {
2181 fn CFStringCreateExternalRepresentation(
2182 alloc: Option<&CFAllocator>,
2183 the_string: Option<&CFString>,
2184 encoding: CFStringEncoding,
2185 loss_byte: u8,
2186 ) -> Option<NonNull<CFData>>;
2187 }
2188 let ret =
2189 unsafe { CFStringCreateExternalRepresentation(alloc, the_string, encoding, loss_byte) };
2190 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2191}
2192
2193#[deprecated = "renamed to `CFString::smallest_encoding`"]
2194#[inline]
2195pub extern "C-unwind" fn CFStringGetSmallestEncoding(the_string: &CFString) -> CFStringEncoding {
2196 extern "C-unwind" {
2197 fn CFStringGetSmallestEncoding(the_string: &CFString) -> CFStringEncoding;
2198 }
2199 unsafe { CFStringGetSmallestEncoding(the_string) }
2200}
2201
2202#[deprecated = "renamed to `CFString::fastest_encoding`"]
2203#[inline]
2204pub extern "C-unwind" fn CFStringGetFastestEncoding(the_string: &CFString) -> CFStringEncoding {
2205 extern "C-unwind" {
2206 fn CFStringGetFastestEncoding(the_string: &CFString) -> CFStringEncoding;
2207 }
2208 unsafe { CFStringGetFastestEncoding(the_string) }
2209}
2210
2211#[deprecated = "renamed to `CFString::system_encoding`"]
2212#[inline]
2213pub extern "C-unwind" fn CFStringGetSystemEncoding() -> CFStringEncoding {
2214 extern "C-unwind" {
2215 fn CFStringGetSystemEncoding() -> CFStringEncoding;
2216 }
2217 unsafe { CFStringGetSystemEncoding() }
2218}
2219
2220#[deprecated = "renamed to `CFString::maximum_size_for_encoding`"]
2221#[inline]
2222pub extern "C-unwind" fn CFStringGetMaximumSizeForEncoding(
2223 length: CFIndex,
2224 encoding: CFStringEncoding,
2225) -> CFIndex {
2226 extern "C-unwind" {
2227 fn CFStringGetMaximumSizeForEncoding(
2228 length: CFIndex,
2229 encoding: CFStringEncoding,
2230 ) -> CFIndex;
2231 }
2232 unsafe { CFStringGetMaximumSizeForEncoding(length, encoding) }
2233}
2234
2235#[deprecated = "renamed to `CFString::file_system_representation`"]
2236#[inline]
2237pub unsafe extern "C-unwind" fn CFStringGetFileSystemRepresentation(
2238 string: &CFString,
2239 buffer: *mut c_char,
2240 max_buf_len: CFIndex,
2241) -> bool {
2242 extern "C-unwind" {
2243 fn CFStringGetFileSystemRepresentation(
2244 string: &CFString,
2245 buffer: *mut c_char,
2246 max_buf_len: CFIndex,
2247 ) -> Boolean;
2248 }
2249 let ret = unsafe { CFStringGetFileSystemRepresentation(string, buffer, max_buf_len) };
2250 ret != 0
2251}
2252
2253#[deprecated = "renamed to `CFString::maximum_size_of_file_system_representation`"]
2254#[inline]
2255pub extern "C-unwind" fn CFStringGetMaximumSizeOfFileSystemRepresentation(
2256 string: &CFString,
2257) -> CFIndex {
2258 extern "C-unwind" {
2259 fn CFStringGetMaximumSizeOfFileSystemRepresentation(string: &CFString) -> CFIndex;
2260 }
2261 unsafe { CFStringGetMaximumSizeOfFileSystemRepresentation(string) }
2262}
2263
2264#[deprecated = "renamed to `CFString::with_file_system_representation`"]
2265#[inline]
2266pub unsafe extern "C-unwind" fn CFStringCreateWithFileSystemRepresentation(
2267 alloc: Option<&CFAllocator>,
2268 buffer: *const c_char,
2269) -> Option<CFRetained<CFString>> {
2270 extern "C-unwind" {
2271 fn CFStringCreateWithFileSystemRepresentation(
2272 alloc: Option<&CFAllocator>,
2273 buffer: *const c_char,
2274 ) -> Option<NonNull<CFString>>;
2275 }
2276 let ret = unsafe { CFStringCreateWithFileSystemRepresentation(alloc, buffer) };
2277 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2278}
2279
2280extern "C-unwind" {
2281 #[cfg(feature = "CFLocale")]
2282 #[deprecated = "renamed to `CFString::compare_with_options_and_locale`"]
2283 pub fn CFStringCompareWithOptionsAndLocale(
2284 the_string1: &CFString,
2285 the_string2: Option<&CFString>,
2286 range_to_compare: CFRange,
2287 compare_options: CFStringCompareFlags,
2288 locale: Option<&CFLocale>,
2289 ) -> CFComparisonResult;
2290}
2291
2292extern "C-unwind" {
2293 #[deprecated = "renamed to `CFString::compare_with_options`"]
2294 pub fn CFStringCompareWithOptions(
2295 the_string1: &CFString,
2296 the_string2: Option<&CFString>,
2297 range_to_compare: CFRange,
2298 compare_options: CFStringCompareFlags,
2299 ) -> CFComparisonResult;
2300}
2301
2302#[deprecated = "renamed to `CFString::compare`"]
2303#[inline]
2304pub extern "C-unwind" fn CFStringCompare(
2305 the_string1: &CFString,
2306 the_string2: Option<&CFString>,
2307 compare_options: CFStringCompareFlags,
2308) -> CFComparisonResult {
2309 extern "C-unwind" {
2310 fn CFStringCompare(
2311 the_string1: &CFString,
2312 the_string2: Option<&CFString>,
2313 compare_options: CFStringCompareFlags,
2314 ) -> CFComparisonResult;
2315 }
2316 unsafe { CFStringCompare(the_string1, the_string2, compare_options) }
2317}
2318
2319#[cfg(feature = "CFLocale")]
2320#[deprecated = "renamed to `CFString::find_with_options_and_locale`"]
2321#[inline]
2322pub unsafe extern "C-unwind" fn CFStringFindWithOptionsAndLocale(
2323 the_string: &CFString,
2324 string_to_find: Option<&CFString>,
2325 range_to_search: CFRange,
2326 search_options: CFStringCompareFlags,
2327 locale: Option<&CFLocale>,
2328 result: *mut CFRange,
2329) -> bool {
2330 extern "C-unwind" {
2331 fn CFStringFindWithOptionsAndLocale(
2332 the_string: &CFString,
2333 string_to_find: Option<&CFString>,
2334 range_to_search: CFRange,
2335 search_options: CFStringCompareFlags,
2336 locale: Option<&CFLocale>,
2337 result: *mut CFRange,
2338 ) -> Boolean;
2339 }
2340 let ret = unsafe {
2341 CFStringFindWithOptionsAndLocale(
2342 the_string,
2343 string_to_find,
2344 range_to_search,
2345 search_options,
2346 locale,
2347 result,
2348 )
2349 };
2350 ret != 0
2351}
2352
2353#[deprecated = "renamed to `CFString::find_with_options`"]
2354#[inline]
2355pub unsafe extern "C-unwind" fn CFStringFindWithOptions(
2356 the_string: &CFString,
2357 string_to_find: Option<&CFString>,
2358 range_to_search: CFRange,
2359 search_options: CFStringCompareFlags,
2360 result: *mut CFRange,
2361) -> bool {
2362 extern "C-unwind" {
2363 fn CFStringFindWithOptions(
2364 the_string: &CFString,
2365 string_to_find: Option<&CFString>,
2366 range_to_search: CFRange,
2367 search_options: CFStringCompareFlags,
2368 result: *mut CFRange,
2369 ) -> Boolean;
2370 }
2371 let ret = unsafe {
2372 CFStringFindWithOptions(
2373 the_string,
2374 string_to_find,
2375 range_to_search,
2376 search_options,
2377 result,
2378 )
2379 };
2380 ret != 0
2381}
2382
2383#[cfg(feature = "CFArray")]
2384#[deprecated = "renamed to `CFString::new_array_with_find_results`"]
2385#[inline]
2386pub unsafe extern "C-unwind" fn CFStringCreateArrayWithFindResults(
2387 alloc: Option<&CFAllocator>,
2388 the_string: Option<&CFString>,
2389 string_to_find: Option<&CFString>,
2390 range_to_search: CFRange,
2391 compare_options: CFStringCompareFlags,
2392) -> Option<CFRetained<CFArray>> {
2393 extern "C-unwind" {
2394 fn CFStringCreateArrayWithFindResults(
2395 alloc: Option<&CFAllocator>,
2396 the_string: Option<&CFString>,
2397 string_to_find: Option<&CFString>,
2398 range_to_search: CFRange,
2399 compare_options: CFStringCompareFlags,
2400 ) -> Option<NonNull<CFArray>>;
2401 }
2402 let ret = unsafe {
2403 CFStringCreateArrayWithFindResults(
2404 alloc,
2405 the_string,
2406 string_to_find,
2407 range_to_search,
2408 compare_options,
2409 )
2410 };
2411 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2412}
2413
2414#[deprecated = "renamed to `CFString::find`"]
2415#[inline]
2416pub extern "C-unwind" fn CFStringFind(
2417 the_string: &CFString,
2418 string_to_find: Option<&CFString>,
2419 compare_options: CFStringCompareFlags,
2420) -> CFRange {
2421 extern "C-unwind" {
2422 fn CFStringFind(
2423 the_string: &CFString,
2424 string_to_find: Option<&CFString>,
2425 compare_options: CFStringCompareFlags,
2426 ) -> CFRange;
2427 }
2428 unsafe { CFStringFind(the_string, string_to_find, compare_options) }
2429}
2430
2431#[deprecated = "renamed to `CFString::has_prefix`"]
2432#[inline]
2433pub extern "C-unwind" fn CFStringHasPrefix(
2434 the_string: &CFString,
2435 prefix: Option<&CFString>,
2436) -> bool {
2437 extern "C-unwind" {
2438 fn CFStringHasPrefix(the_string: &CFString, prefix: Option<&CFString>) -> Boolean;
2439 }
2440 let ret = unsafe { CFStringHasPrefix(the_string, prefix) };
2441 ret != 0
2442}
2443
2444#[deprecated = "renamed to `CFString::has_suffix`"]
2445#[inline]
2446pub extern "C-unwind" fn CFStringHasSuffix(
2447 the_string: &CFString,
2448 suffix: Option<&CFString>,
2449) -> bool {
2450 extern "C-unwind" {
2451 fn CFStringHasSuffix(the_string: &CFString, suffix: Option<&CFString>) -> Boolean;
2452 }
2453 let ret = unsafe { CFStringHasSuffix(the_string, suffix) };
2454 ret != 0
2455}
2456
2457extern "C-unwind" {
2458 #[deprecated = "renamed to `CFString::range_of_composed_characters_at_index`"]
2459 pub fn CFStringGetRangeOfComposedCharactersAtIndex(
2460 the_string: &CFString,
2461 the_index: CFIndex,
2462 ) -> CFRange;
2463}
2464
2465#[cfg(feature = "CFCharacterSet")]
2466#[deprecated = "renamed to `CFString::find_character_from_set`"]
2467#[inline]
2468pub unsafe extern "C-unwind" fn CFStringFindCharacterFromSet(
2469 the_string: &CFString,
2470 the_set: Option<&CFCharacterSet>,
2471 range_to_search: CFRange,
2472 search_options: CFStringCompareFlags,
2473 result: *mut CFRange,
2474) -> bool {
2475 extern "C-unwind" {
2476 fn CFStringFindCharacterFromSet(
2477 the_string: &CFString,
2478 the_set: Option<&CFCharacterSet>,
2479 range_to_search: CFRange,
2480 search_options: CFStringCompareFlags,
2481 result: *mut CFRange,
2482 ) -> Boolean;
2483 }
2484 let ret = unsafe {
2485 CFStringFindCharacterFromSet(the_string, the_set, range_to_search, search_options, result)
2486 };
2487 ret != 0
2488}
2489
2490extern "C-unwind" {
2491 #[deprecated = "renamed to `CFString::line_bounds`"]
2492 pub fn CFStringGetLineBounds(
2493 the_string: &CFString,
2494 range: CFRange,
2495 line_begin_index: *mut CFIndex,
2496 line_end_index: *mut CFIndex,
2497 contents_end_index: *mut CFIndex,
2498 );
2499}
2500
2501extern "C-unwind" {
2502 #[deprecated = "renamed to `CFString::paragraph_bounds`"]
2503 pub fn CFStringGetParagraphBounds(
2504 string: &CFString,
2505 range: CFRange,
2506 par_begin_index: *mut CFIndex,
2507 par_end_index: *mut CFIndex,
2508 contents_end_index: *mut CFIndex,
2509 );
2510}
2511
2512extern "C-unwind" {
2513 #[cfg(feature = "CFLocale")]
2514 #[deprecated = "renamed to `CFString::hyphenation_location_before_index`"]
2515 pub fn CFStringGetHyphenationLocationBeforeIndex(
2516 string: &CFString,
2517 location: CFIndex,
2518 limit_range: CFRange,
2519 options: CFOptionFlags,
2520 locale: Option<&CFLocale>,
2521 character: *mut UTF32Char,
2522 ) -> CFIndex;
2523}
2524
2525#[cfg(feature = "CFLocale")]
2526#[deprecated = "renamed to `CFString::is_hyphenation_available_for_locale`"]
2527#[inline]
2528pub extern "C-unwind" fn CFStringIsHyphenationAvailableForLocale(
2529 locale: Option<&CFLocale>,
2530) -> bool {
2531 extern "C-unwind" {
2532 fn CFStringIsHyphenationAvailableForLocale(locale: Option<&CFLocale>) -> Boolean;
2533 }
2534 let ret = unsafe { CFStringIsHyphenationAvailableForLocale(locale) };
2535 ret != 0
2536}
2537
2538#[cfg(feature = "CFArray")]
2539#[deprecated = "renamed to `CFString::new_by_combining_strings`"]
2540#[inline]
2541pub unsafe extern "C-unwind" fn CFStringCreateByCombiningStrings(
2542 alloc: Option<&CFAllocator>,
2543 the_array: Option<&CFArray>,
2544 separator_string: Option<&CFString>,
2545) -> Option<CFRetained<CFString>> {
2546 extern "C-unwind" {
2547 fn CFStringCreateByCombiningStrings(
2548 alloc: Option<&CFAllocator>,
2549 the_array: Option<&CFArray>,
2550 separator_string: Option<&CFString>,
2551 ) -> Option<NonNull<CFString>>;
2552 }
2553 let ret = unsafe { CFStringCreateByCombiningStrings(alloc, the_array, separator_string) };
2554 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2555}
2556
2557#[cfg(feature = "CFArray")]
2558#[deprecated = "renamed to `CFString::new_array_by_separating_strings`"]
2559#[inline]
2560pub extern "C-unwind" fn CFStringCreateArrayBySeparatingStrings(
2561 alloc: Option<&CFAllocator>,
2562 the_string: Option<&CFString>,
2563 separator_string: Option<&CFString>,
2564) -> Option<CFRetained<CFArray>> {
2565 extern "C-unwind" {
2566 fn CFStringCreateArrayBySeparatingStrings(
2567 alloc: Option<&CFAllocator>,
2568 the_string: Option<&CFString>,
2569 separator_string: Option<&CFString>,
2570 ) -> Option<NonNull<CFArray>>;
2571 }
2572 let ret =
2573 unsafe { CFStringCreateArrayBySeparatingStrings(alloc, the_string, separator_string) };
2574 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2575}
2576
2577#[deprecated = "renamed to `CFString::int_value`"]
2578#[inline]
2579pub extern "C-unwind" fn CFStringGetIntValue(str: &CFString) -> i32 {
2580 extern "C-unwind" {
2581 fn CFStringGetIntValue(str: &CFString) -> i32;
2582 }
2583 unsafe { CFStringGetIntValue(str) }
2584}
2585
2586#[deprecated = "renamed to `CFString::double_value`"]
2587#[inline]
2588pub extern "C-unwind" fn CFStringGetDoubleValue(str: &CFString) -> c_double {
2589 extern "C-unwind" {
2590 fn CFStringGetDoubleValue(str: &CFString) -> c_double;
2591 }
2592 unsafe { CFStringGetDoubleValue(str) }
2593}
2594
2595#[deprecated = "renamed to `CFMutableString::append`"]
2596#[inline]
2597pub extern "C-unwind" fn CFStringAppend(
2598 the_string: Option<&CFMutableString>,
2599 appended_string: Option<&CFString>,
2600) {
2601 extern "C-unwind" {
2602 fn CFStringAppend(the_string: Option<&CFMutableString>, appended_string: Option<&CFString>);
2603 }
2604 unsafe { CFStringAppend(the_string, appended_string) }
2605}
2606
2607extern "C-unwind" {
2608 #[deprecated = "renamed to `CFMutableString::append_characters`"]
2609 pub fn CFStringAppendCharacters(
2610 the_string: Option<&CFMutableString>,
2611 chars: *const UniChar,
2612 num_chars: CFIndex,
2613 );
2614}
2615
2616extern "C-unwind" {
2617 #[deprecated = "renamed to `CFMutableString::append_pascal_string`"]
2618 pub fn CFStringAppendPascalString(
2619 the_string: Option<&CFMutableString>,
2620 p_str: ConstStr255Param,
2621 encoding: CFStringEncoding,
2622 );
2623}
2624
2625extern "C-unwind" {
2626 #[deprecated = "renamed to `CFMutableString::append_c_string`"]
2627 pub fn CFStringAppendCString(
2628 the_string: Option<&CFMutableString>,
2629 c_str: *const c_char,
2630 encoding: CFStringEncoding,
2631 );
2632}
2633
2634extern "C-unwind" {
2635 #[deprecated = "renamed to `CFMutableString::insert`"]
2636 pub fn CFStringInsert(
2637 str: Option<&CFMutableString>,
2638 idx: CFIndex,
2639 inserted_str: Option<&CFString>,
2640 );
2641}
2642
2643extern "C-unwind" {
2644 #[deprecated = "renamed to `CFMutableString::delete`"]
2645 pub fn CFStringDelete(the_string: Option<&CFMutableString>, range: CFRange);
2646}
2647
2648extern "C-unwind" {
2649 #[deprecated = "renamed to `CFMutableString::replace`"]
2650 pub fn CFStringReplace(
2651 the_string: Option<&CFMutableString>,
2652 range: CFRange,
2653 replacement: Option<&CFString>,
2654 );
2655}
2656
2657#[deprecated = "renamed to `CFMutableString::replace_all`"]
2658#[inline]
2659pub extern "C-unwind" fn CFStringReplaceAll(
2660 the_string: Option<&CFMutableString>,
2661 replacement: Option<&CFString>,
2662) {
2663 extern "C-unwind" {
2664 fn CFStringReplaceAll(the_string: Option<&CFMutableString>, replacement: Option<&CFString>);
2665 }
2666 unsafe { CFStringReplaceAll(the_string, replacement) }
2667}
2668
2669extern "C-unwind" {
2670 #[deprecated = "renamed to `CFMutableString::find_and_replace`"]
2671 pub fn CFStringFindAndReplace(
2672 the_string: Option<&CFMutableString>,
2673 string_to_find: Option<&CFString>,
2674 replacement_string: Option<&CFString>,
2675 range_to_search: CFRange,
2676 compare_options: CFStringCompareFlags,
2677 ) -> CFIndex;
2678}
2679
2680extern "C-unwind" {
2681 #[deprecated = "renamed to `CFMutableString::set_external_characters_no_copy`"]
2682 pub fn CFStringSetExternalCharactersNoCopy(
2683 the_string: Option<&CFMutableString>,
2684 chars: *mut UniChar,
2685 length: CFIndex,
2686 capacity: CFIndex,
2687 );
2688}
2689
2690extern "C-unwind" {
2691 #[deprecated = "renamed to `CFMutableString::pad`"]
2692 pub fn CFStringPad(
2693 the_string: Option<&CFMutableString>,
2694 pad_string: Option<&CFString>,
2695 length: CFIndex,
2696 index_into_pad: CFIndex,
2697 );
2698}
2699
2700#[deprecated = "renamed to `CFMutableString::trim`"]
2701#[inline]
2702pub extern "C-unwind" fn CFStringTrim(
2703 the_string: Option<&CFMutableString>,
2704 trim_string: Option<&CFString>,
2705) {
2706 extern "C-unwind" {
2707 fn CFStringTrim(the_string: Option<&CFMutableString>, trim_string: Option<&CFString>);
2708 }
2709 unsafe { CFStringTrim(the_string, trim_string) }
2710}
2711
2712#[deprecated = "renamed to `CFMutableString::trim_whitespace`"]
2713#[inline]
2714pub extern "C-unwind" fn CFStringTrimWhitespace(the_string: Option<&CFMutableString>) {
2715 extern "C-unwind" {
2716 fn CFStringTrimWhitespace(the_string: Option<&CFMutableString>);
2717 }
2718 unsafe { CFStringTrimWhitespace(the_string) }
2719}
2720
2721#[cfg(feature = "CFLocale")]
2722#[deprecated = "renamed to `CFMutableString::lowercase`"]
2723#[inline]
2724pub extern "C-unwind" fn CFStringLowercase(
2725 the_string: Option<&CFMutableString>,
2726 locale: Option<&CFLocale>,
2727) {
2728 extern "C-unwind" {
2729 fn CFStringLowercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
2730 }
2731 unsafe { CFStringLowercase(the_string, locale) }
2732}
2733
2734#[cfg(feature = "CFLocale")]
2735#[deprecated = "renamed to `CFMutableString::uppercase`"]
2736#[inline]
2737pub extern "C-unwind" fn CFStringUppercase(
2738 the_string: Option<&CFMutableString>,
2739 locale: Option<&CFLocale>,
2740) {
2741 extern "C-unwind" {
2742 fn CFStringUppercase(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
2743 }
2744 unsafe { CFStringUppercase(the_string, locale) }
2745}
2746
2747#[cfg(feature = "CFLocale")]
2748#[deprecated = "renamed to `CFMutableString::capitalize`"]
2749#[inline]
2750pub extern "C-unwind" fn CFStringCapitalize(
2751 the_string: Option<&CFMutableString>,
2752 locale: Option<&CFLocale>,
2753) {
2754 extern "C-unwind" {
2755 fn CFStringCapitalize(the_string: Option<&CFMutableString>, locale: Option<&CFLocale>);
2756 }
2757 unsafe { CFStringCapitalize(the_string, locale) }
2758}
2759
2760extern "C-unwind" {
2761 #[deprecated = "renamed to `CFMutableString::normalize`"]
2762 pub fn CFStringNormalize(
2763 the_string: Option<&CFMutableString>,
2764 the_form: CFStringNormalizationForm,
2765 );
2766}
2767
2768#[cfg(feature = "CFLocale")]
2769#[deprecated = "renamed to `CFMutableString::fold`"]
2770#[inline]
2771pub extern "C-unwind" fn CFStringFold(
2772 the_string: Option<&CFMutableString>,
2773 the_flags: CFStringCompareFlags,
2774 the_locale: Option<&CFLocale>,
2775) {
2776 extern "C-unwind" {
2777 fn CFStringFold(
2778 the_string: Option<&CFMutableString>,
2779 the_flags: CFStringCompareFlags,
2780 the_locale: Option<&CFLocale>,
2781 );
2782 }
2783 unsafe { CFStringFold(the_string, the_flags, the_locale) }
2784}
2785
2786#[deprecated = "renamed to `CFMutableString::transform`"]
2787#[inline]
2788pub unsafe extern "C-unwind" fn CFStringTransform(
2789 string: Option<&CFMutableString>,
2790 range: *mut CFRange,
2791 transform: Option<&CFString>,
2792 reverse: bool,
2793) -> bool {
2794 extern "C-unwind" {
2795 fn CFStringTransform(
2796 string: Option<&CFMutableString>,
2797 range: *mut CFRange,
2798 transform: Option<&CFString>,
2799 reverse: Boolean,
2800 ) -> Boolean;
2801 }
2802 let ret = unsafe { CFStringTransform(string, range, transform, reverse as _) };
2803 ret != 0
2804}
2805
2806#[deprecated = "renamed to `CFString::is_encoding_available`"]
2807#[inline]
2808pub extern "C-unwind" fn CFStringIsEncodingAvailable(encoding: CFStringEncoding) -> bool {
2809 extern "C-unwind" {
2810 fn CFStringIsEncodingAvailable(encoding: CFStringEncoding) -> Boolean;
2811 }
2812 let ret = unsafe { CFStringIsEncodingAvailable(encoding) };
2813 ret != 0
2814}
2815
2816#[deprecated = "renamed to `CFString::list_of_available_encodings`"]
2817#[inline]
2818pub extern "C-unwind" fn CFStringGetListOfAvailableEncodings() -> *const CFStringEncoding {
2819 extern "C-unwind" {
2820 fn CFStringGetListOfAvailableEncodings() -> *const CFStringEncoding;
2821 }
2822 unsafe { CFStringGetListOfAvailableEncodings() }
2823}
2824
2825#[deprecated = "renamed to `CFString::name_of_encoding`"]
2826#[inline]
2827pub extern "C-unwind" fn CFStringGetNameOfEncoding(
2828 encoding: CFStringEncoding,
2829) -> Option<CFRetained<CFString>> {
2830 extern "C-unwind" {
2831 fn CFStringGetNameOfEncoding(encoding: CFStringEncoding) -> Option<NonNull<CFString>>;
2832 }
2833 let ret = unsafe { CFStringGetNameOfEncoding(encoding) };
2834 ret.map(|ret| unsafe { CFRetained::retain(ret) })
2835}
2836
2837#[deprecated = "renamed to `CFString::convert_encoding_to_ns_string_encoding`"]
2838#[inline]
2839pub extern "C-unwind" fn CFStringConvertEncodingToNSStringEncoding(
2840 encoding: CFStringEncoding,
2841) -> c_ulong {
2842 extern "C-unwind" {
2843 fn CFStringConvertEncodingToNSStringEncoding(encoding: CFStringEncoding) -> c_ulong;
2844 }
2845 unsafe { CFStringConvertEncodingToNSStringEncoding(encoding) }
2846}
2847
2848#[deprecated = "renamed to `CFString::convert_ns_string_encoding_to_encoding`"]
2849#[inline]
2850pub extern "C-unwind" fn CFStringConvertNSStringEncodingToEncoding(
2851 encoding: c_ulong,
2852) -> CFStringEncoding {
2853 extern "C-unwind" {
2854 fn CFStringConvertNSStringEncodingToEncoding(encoding: c_ulong) -> CFStringEncoding;
2855 }
2856 unsafe { CFStringConvertNSStringEncodingToEncoding(encoding) }
2857}
2858
2859#[deprecated = "renamed to `CFString::convert_encoding_to_windows_codepage`"]
2860#[inline]
2861pub extern "C-unwind" fn CFStringConvertEncodingToWindowsCodepage(
2862 encoding: CFStringEncoding,
2863) -> u32 {
2864 extern "C-unwind" {
2865 fn CFStringConvertEncodingToWindowsCodepage(encoding: CFStringEncoding) -> u32;
2866 }
2867 unsafe { CFStringConvertEncodingToWindowsCodepage(encoding) }
2868}
2869
2870#[deprecated = "renamed to `CFString::convert_windows_codepage_to_encoding`"]
2871#[inline]
2872pub extern "C-unwind" fn CFStringConvertWindowsCodepageToEncoding(
2873 codepage: u32,
2874) -> CFStringEncoding {
2875 extern "C-unwind" {
2876 fn CFStringConvertWindowsCodepageToEncoding(codepage: u32) -> CFStringEncoding;
2877 }
2878 unsafe { CFStringConvertWindowsCodepageToEncoding(codepage) }
2879}
2880
2881#[deprecated = "renamed to `CFString::convert_iana_char_set_name_to_encoding`"]
2882#[inline]
2883pub extern "C-unwind" fn CFStringConvertIANACharSetNameToEncoding(
2884 the_string: &CFString,
2885) -> CFStringEncoding {
2886 extern "C-unwind" {
2887 fn CFStringConvertIANACharSetNameToEncoding(the_string: &CFString) -> CFStringEncoding;
2888 }
2889 unsafe { CFStringConvertIANACharSetNameToEncoding(the_string) }
2890}
2891
2892#[deprecated = "renamed to `CFString::convert_encoding_to_iana_char_set_name`"]
2893#[inline]
2894pub extern "C-unwind" fn CFStringConvertEncodingToIANACharSetName(
2895 encoding: CFStringEncoding,
2896) -> Option<CFRetained<CFString>> {
2897 extern "C-unwind" {
2898 fn CFStringConvertEncodingToIANACharSetName(
2899 encoding: CFStringEncoding,
2900 ) -> Option<NonNull<CFString>>;
2901 }
2902 let ret = unsafe { CFStringConvertEncodingToIANACharSetName(encoding) };
2903 ret.map(|ret| unsafe { CFRetained::retain(ret) })
2904}
2905
2906#[deprecated = "renamed to `CFString::most_compatible_mac_string_encoding`"]
2907#[inline]
2908pub extern "C-unwind" fn CFStringGetMostCompatibleMacStringEncoding(
2909 encoding: CFStringEncoding,
2910) -> CFStringEncoding {
2911 extern "C-unwind" {
2912 fn CFStringGetMostCompatibleMacStringEncoding(
2913 encoding: CFStringEncoding,
2914 ) -> CFStringEncoding;
2915 }
2916 unsafe { CFStringGetMostCompatibleMacStringEncoding(encoding) }
2917}