1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9
10use crate::*;
11
12#[repr(C)]
14pub struct CFAttributedString {
15 inner: [u8; 0],
16 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
17}
18
19cf_type!(
20 unsafe impl CFAttributedString {}
21);
22#[cfg(feature = "objc2")]
23cf_objc2_type!(
24 unsafe impl RefEncode<"__CFAttributedString"> for CFAttributedString {}
25);
26
27#[repr(C)]
29pub struct CFMutableAttributedString {
30 inner: [u8; 0],
31 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
32}
33
34cf_type!(
35 unsafe impl CFMutableAttributedString: CFAttributedString {}
36);
37#[cfg(feature = "objc2")]
38cf_objc2_type!(
39 unsafe impl RefEncode<"__CFAttributedString"> for CFMutableAttributedString {}
40);
41
42unsafe impl ConcreteType for CFAttributedString {
43 #[doc(alias = "CFAttributedStringGetTypeID")]
45 #[inline]
46 fn type_id() -> CFTypeID {
47 extern "C-unwind" {
48 fn CFAttributedStringGetTypeID() -> CFTypeID;
49 }
50 unsafe { CFAttributedStringGetTypeID() }
51 }
52}
53
54impl CFAttributedString {
55 #[doc(alias = "CFAttributedStringCreate")]
57 #[cfg(feature = "CFDictionary")]
58 #[inline]
59 pub unsafe fn new(
60 alloc: Option<&CFAllocator>,
61 str: Option<&CFString>,
62 attributes: Option<&CFDictionary>,
63 ) -> Option<CFRetained<CFAttributedString>> {
64 extern "C-unwind" {
65 fn CFAttributedStringCreate(
66 alloc: Option<&CFAllocator>,
67 str: Option<&CFString>,
68 attributes: Option<&CFDictionary>,
69 ) -> Option<NonNull<CFAttributedString>>;
70 }
71 let ret = unsafe { CFAttributedStringCreate(alloc, str, attributes) };
72 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
73 }
74
75 #[doc(alias = "CFAttributedStringCreateWithSubstring")]
77 #[inline]
78 pub unsafe fn with_substring(
79 alloc: Option<&CFAllocator>,
80 a_str: Option<&CFAttributedString>,
81 range: CFRange,
82 ) -> Option<CFRetained<CFAttributedString>> {
83 extern "C-unwind" {
84 fn CFAttributedStringCreateWithSubstring(
85 alloc: Option<&CFAllocator>,
86 a_str: Option<&CFAttributedString>,
87 range: CFRange,
88 ) -> Option<NonNull<CFAttributedString>>;
89 }
90 let ret = unsafe { CFAttributedStringCreateWithSubstring(alloc, a_str, range) };
91 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
92 }
93
94 #[doc(alias = "CFAttributedStringCreateCopy")]
96 #[inline]
97 pub fn new_copy(
98 alloc: Option<&CFAllocator>,
99 a_str: Option<&CFAttributedString>,
100 ) -> Option<CFRetained<CFAttributedString>> {
101 extern "C-unwind" {
102 fn CFAttributedStringCreateCopy(
103 alloc: Option<&CFAllocator>,
104 a_str: Option<&CFAttributedString>,
105 ) -> Option<NonNull<CFAttributedString>>;
106 }
107 let ret = unsafe { CFAttributedStringCreateCopy(alloc, a_str) };
108 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
109 }
110
111 #[doc(alias = "CFAttributedStringGetString")]
113 #[inline]
114 pub fn string(self: &CFAttributedString) -> Option<CFRetained<CFString>> {
115 extern "C-unwind" {
116 fn CFAttributedStringGetString(a_str: &CFAttributedString)
117 -> Option<NonNull<CFString>>;
118 }
119 let ret = unsafe { CFAttributedStringGetString(self) };
120 ret.map(|ret| unsafe { CFRetained::retain(ret) })
121 }
122
123 #[doc(alias = "CFAttributedStringGetLength")]
125 #[inline]
126 pub fn length(self: &CFAttributedString) -> CFIndex {
127 extern "C-unwind" {
128 fn CFAttributedStringGetLength(a_str: &CFAttributedString) -> CFIndex;
129 }
130 unsafe { CFAttributedStringGetLength(self) }
131 }
132
133 #[doc(alias = "CFAttributedStringGetAttributes")]
137 #[cfg(feature = "CFDictionary")]
138 #[inline]
139 pub unsafe fn attributes(
140 self: &CFAttributedString,
141 loc: CFIndex,
142 effective_range: *mut CFRange,
143 ) -> Option<CFRetained<CFDictionary>> {
144 extern "C-unwind" {
145 fn CFAttributedStringGetAttributes(
146 a_str: &CFAttributedString,
147 loc: CFIndex,
148 effective_range: *mut CFRange,
149 ) -> Option<NonNull<CFDictionary>>;
150 }
151 let ret = unsafe { CFAttributedStringGetAttributes(self, loc, effective_range) };
152 ret.map(|ret| unsafe { CFRetained::retain(ret) })
153 }
154
155 #[doc(alias = "CFAttributedStringGetAttribute")]
157 #[inline]
158 pub unsafe fn attribute(
159 self: &CFAttributedString,
160 loc: CFIndex,
161 attr_name: Option<&CFString>,
162 effective_range: *mut CFRange,
163 ) -> Option<CFRetained<CFType>> {
164 extern "C-unwind" {
165 fn CFAttributedStringGetAttribute(
166 a_str: &CFAttributedString,
167 loc: CFIndex,
168 attr_name: Option<&CFString>,
169 effective_range: *mut CFRange,
170 ) -> Option<NonNull<CFType>>;
171 }
172 let ret = unsafe { CFAttributedStringGetAttribute(self, loc, attr_name, effective_range) };
173 ret.map(|ret| unsafe { CFRetained::retain(ret) })
174 }
175
176 #[doc(alias = "CFAttributedStringGetAttributesAndLongestEffectiveRange")]
178 #[cfg(feature = "CFDictionary")]
179 #[inline]
180 pub unsafe fn attributes_and_longest_effective_range(
181 self: &CFAttributedString,
182 loc: CFIndex,
183 in_range: CFRange,
184 longest_effective_range: *mut CFRange,
185 ) -> Option<CFRetained<CFDictionary>> {
186 extern "C-unwind" {
187 fn CFAttributedStringGetAttributesAndLongestEffectiveRange(
188 a_str: &CFAttributedString,
189 loc: CFIndex,
190 in_range: CFRange,
191 longest_effective_range: *mut CFRange,
192 ) -> Option<NonNull<CFDictionary>>;
193 }
194 let ret = unsafe {
195 CFAttributedStringGetAttributesAndLongestEffectiveRange(
196 self,
197 loc,
198 in_range,
199 longest_effective_range,
200 )
201 };
202 ret.map(|ret| unsafe { CFRetained::retain(ret) })
203 }
204
205 #[doc(alias = "CFAttributedStringGetAttributeAndLongestEffectiveRange")]
207 #[inline]
208 pub unsafe fn attribute_and_longest_effective_range(
209 self: &CFAttributedString,
210 loc: CFIndex,
211 attr_name: Option<&CFString>,
212 in_range: CFRange,
213 longest_effective_range: *mut CFRange,
214 ) -> Option<CFRetained<CFType>> {
215 extern "C-unwind" {
216 fn CFAttributedStringGetAttributeAndLongestEffectiveRange(
217 a_str: &CFAttributedString,
218 loc: CFIndex,
219 attr_name: Option<&CFString>,
220 in_range: CFRange,
221 longest_effective_range: *mut CFRange,
222 ) -> Option<NonNull<CFType>>;
223 }
224 let ret = unsafe {
225 CFAttributedStringGetAttributeAndLongestEffectiveRange(
226 self,
227 loc,
228 attr_name,
229 in_range,
230 longest_effective_range,
231 )
232 };
233 ret.map(|ret| unsafe { CFRetained::retain(ret) })
234 }
235}
236
237impl CFMutableAttributedString {
238 #[doc(alias = "CFAttributedStringCreateMutableCopy")]
240 #[inline]
241 pub fn new_copy(
242 alloc: Option<&CFAllocator>,
243 max_length: CFIndex,
244 a_str: Option<&CFAttributedString>,
245 ) -> Option<CFRetained<CFMutableAttributedString>> {
246 extern "C-unwind" {
247 fn CFAttributedStringCreateMutableCopy(
248 alloc: Option<&CFAllocator>,
249 max_length: CFIndex,
250 a_str: Option<&CFAttributedString>,
251 ) -> Option<NonNull<CFMutableAttributedString>>;
252 }
253 let ret = unsafe { CFAttributedStringCreateMutableCopy(alloc, max_length, a_str) };
254 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
255 }
256
257 #[doc(alias = "CFAttributedStringCreateMutable")]
259 #[inline]
260 pub fn new(
261 alloc: Option<&CFAllocator>,
262 max_length: CFIndex,
263 ) -> Option<CFRetained<CFMutableAttributedString>> {
264 extern "C-unwind" {
265 fn CFAttributedStringCreateMutable(
266 alloc: Option<&CFAllocator>,
267 max_length: CFIndex,
268 ) -> Option<NonNull<CFMutableAttributedString>>;
269 }
270 let ret = unsafe { CFAttributedStringCreateMutable(alloc, max_length) };
271 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
272 }
273
274 #[doc(alias = "CFAttributedStringReplaceString")]
278 #[inline]
279 pub unsafe fn replace_string(
280 a_str: Option<&CFMutableAttributedString>,
281 range: CFRange,
282 replacement: Option<&CFString>,
283 ) {
284 extern "C-unwind" {
285 fn CFAttributedStringReplaceString(
286 a_str: Option<&CFMutableAttributedString>,
287 range: CFRange,
288 replacement: Option<&CFString>,
289 );
290 }
291 unsafe { CFAttributedStringReplaceString(a_str, range, replacement) }
292 }
293
294 #[doc(alias = "CFAttributedStringGetMutableString")]
298 #[inline]
299 pub fn mutable_string(
300 a_str: Option<&CFMutableAttributedString>,
301 ) -> Option<CFRetained<CFMutableString>> {
302 extern "C-unwind" {
303 fn CFAttributedStringGetMutableString(
304 a_str: Option<&CFMutableAttributedString>,
305 ) -> Option<NonNull<CFMutableString>>;
306 }
307 let ret = unsafe { CFAttributedStringGetMutableString(a_str) };
308 ret.map(|ret| unsafe { CFRetained::retain(ret) })
309 }
310
311 #[doc(alias = "CFAttributedStringSetAttributes")]
313 #[cfg(feature = "CFDictionary")]
314 #[inline]
315 pub unsafe fn set_attributes(
316 a_str: Option<&CFMutableAttributedString>,
317 range: CFRange,
318 replacement: Option<&CFDictionary>,
319 clear_other_attributes: bool,
320 ) {
321 extern "C-unwind" {
322 fn CFAttributedStringSetAttributes(
323 a_str: Option<&CFMutableAttributedString>,
324 range: CFRange,
325 replacement: Option<&CFDictionary>,
326 clear_other_attributes: Boolean,
327 );
328 }
329 unsafe {
330 CFAttributedStringSetAttributes(a_str, range, replacement, clear_other_attributes as _)
331 }
332 }
333
334 #[doc(alias = "CFAttributedStringSetAttribute")]
336 #[inline]
337 pub unsafe fn set_attribute(
338 a_str: Option<&CFMutableAttributedString>,
339 range: CFRange,
340 attr_name: Option<&CFString>,
341 value: Option<&CFType>,
342 ) {
343 extern "C-unwind" {
344 fn CFAttributedStringSetAttribute(
345 a_str: Option<&CFMutableAttributedString>,
346 range: CFRange,
347 attr_name: Option<&CFString>,
348 value: Option<&CFType>,
349 );
350 }
351 unsafe { CFAttributedStringSetAttribute(a_str, range, attr_name, value) }
352 }
353
354 #[doc(alias = "CFAttributedStringRemoveAttribute")]
356 #[inline]
357 pub unsafe fn remove_attribute(
358 a_str: Option<&CFMutableAttributedString>,
359 range: CFRange,
360 attr_name: Option<&CFString>,
361 ) {
362 extern "C-unwind" {
363 fn CFAttributedStringRemoveAttribute(
364 a_str: Option<&CFMutableAttributedString>,
365 range: CFRange,
366 attr_name: Option<&CFString>,
367 );
368 }
369 unsafe { CFAttributedStringRemoveAttribute(a_str, range, attr_name) }
370 }
371
372 #[doc(alias = "CFAttributedStringReplaceAttributedString")]
374 #[inline]
375 pub unsafe fn replace_attributed_string(
376 a_str: Option<&CFMutableAttributedString>,
377 range: CFRange,
378 replacement: Option<&CFAttributedString>,
379 ) {
380 extern "C-unwind" {
381 fn CFAttributedStringReplaceAttributedString(
382 a_str: Option<&CFMutableAttributedString>,
383 range: CFRange,
384 replacement: Option<&CFAttributedString>,
385 );
386 }
387 unsafe { CFAttributedStringReplaceAttributedString(a_str, range, replacement) }
388 }
389
390 #[doc(alias = "CFAttributedStringBeginEditing")]
392 #[inline]
393 pub fn begin_editing(a_str: Option<&CFMutableAttributedString>) {
394 extern "C-unwind" {
395 fn CFAttributedStringBeginEditing(a_str: Option<&CFMutableAttributedString>);
396 }
397 unsafe { CFAttributedStringBeginEditing(a_str) }
398 }
399
400 #[doc(alias = "CFAttributedStringEndEditing")]
402 #[inline]
403 pub fn end_editing(a_str: Option<&CFMutableAttributedString>) {
404 extern "C-unwind" {
405 fn CFAttributedStringEndEditing(a_str: Option<&CFMutableAttributedString>);
406 }
407 unsafe { CFAttributedStringEndEditing(a_str) }
408 }
409}
410
411impl CFAttributedString {
412 #[doc(alias = "CFAttributedStringGetBidiLevelsAndResolvedDirections")]
414 #[inline]
415 pub unsafe fn bidi_levels_and_resolved_directions(
416 self: &CFAttributedString,
417 range: CFRange,
418 base_direction: i8,
419 bidi_levels: *mut u8,
420 base_directions: *mut u8,
421 ) -> bool {
422 extern "C-unwind" {
423 fn CFAttributedStringGetBidiLevelsAndResolvedDirections(
424 attributed_string: &CFAttributedString,
425 range: CFRange,
426 base_direction: i8,
427 bidi_levels: *mut u8,
428 base_directions: *mut u8,
429 ) -> bool;
430 }
431 unsafe {
432 CFAttributedStringGetBidiLevelsAndResolvedDirections(
433 self,
434 range,
435 base_direction,
436 bidi_levels,
437 base_directions,
438 )
439 }
440 }
441}
442
443#[cfg(feature = "CFDictionary")]
444#[deprecated = "renamed to `CFAttributedString::new`"]
445#[inline]
446pub unsafe extern "C-unwind" fn CFAttributedStringCreate(
447 alloc: Option<&CFAllocator>,
448 str: Option<&CFString>,
449 attributes: Option<&CFDictionary>,
450) -> Option<CFRetained<CFAttributedString>> {
451 extern "C-unwind" {
452 fn CFAttributedStringCreate(
453 alloc: Option<&CFAllocator>,
454 str: Option<&CFString>,
455 attributes: Option<&CFDictionary>,
456 ) -> Option<NonNull<CFAttributedString>>;
457 }
458 let ret = unsafe { CFAttributedStringCreate(alloc, str, attributes) };
459 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
460}
461
462#[deprecated = "renamed to `CFAttributedString::with_substring`"]
463#[inline]
464pub unsafe extern "C-unwind" fn CFAttributedStringCreateWithSubstring(
465 alloc: Option<&CFAllocator>,
466 a_str: Option<&CFAttributedString>,
467 range: CFRange,
468) -> Option<CFRetained<CFAttributedString>> {
469 extern "C-unwind" {
470 fn CFAttributedStringCreateWithSubstring(
471 alloc: Option<&CFAllocator>,
472 a_str: Option<&CFAttributedString>,
473 range: CFRange,
474 ) -> Option<NonNull<CFAttributedString>>;
475 }
476 let ret = unsafe { CFAttributedStringCreateWithSubstring(alloc, a_str, range) };
477 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
478}
479
480#[deprecated = "renamed to `CFAttributedString::new_copy`"]
481#[inline]
482pub extern "C-unwind" fn CFAttributedStringCreateCopy(
483 alloc: Option<&CFAllocator>,
484 a_str: Option<&CFAttributedString>,
485) -> Option<CFRetained<CFAttributedString>> {
486 extern "C-unwind" {
487 fn CFAttributedStringCreateCopy(
488 alloc: Option<&CFAllocator>,
489 a_str: Option<&CFAttributedString>,
490 ) -> Option<NonNull<CFAttributedString>>;
491 }
492 let ret = unsafe { CFAttributedStringCreateCopy(alloc, a_str) };
493 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
494}
495
496#[deprecated = "renamed to `CFAttributedString::string`"]
497#[inline]
498pub extern "C-unwind" fn CFAttributedStringGetString(
499 a_str: &CFAttributedString,
500) -> Option<CFRetained<CFString>> {
501 extern "C-unwind" {
502 fn CFAttributedStringGetString(a_str: &CFAttributedString) -> Option<NonNull<CFString>>;
503 }
504 let ret = unsafe { CFAttributedStringGetString(a_str) };
505 ret.map(|ret| unsafe { CFRetained::retain(ret) })
506}
507
508#[deprecated = "renamed to `CFAttributedString::length`"]
509#[inline]
510pub extern "C-unwind" fn CFAttributedStringGetLength(a_str: &CFAttributedString) -> CFIndex {
511 extern "C-unwind" {
512 fn CFAttributedStringGetLength(a_str: &CFAttributedString) -> CFIndex;
513 }
514 unsafe { CFAttributedStringGetLength(a_str) }
515}
516
517#[cfg(feature = "CFDictionary")]
518#[deprecated = "renamed to `CFAttributedString::attributes`"]
519#[inline]
520pub unsafe extern "C-unwind" fn CFAttributedStringGetAttributes(
521 a_str: &CFAttributedString,
522 loc: CFIndex,
523 effective_range: *mut CFRange,
524) -> Option<CFRetained<CFDictionary>> {
525 extern "C-unwind" {
526 fn CFAttributedStringGetAttributes(
527 a_str: &CFAttributedString,
528 loc: CFIndex,
529 effective_range: *mut CFRange,
530 ) -> Option<NonNull<CFDictionary>>;
531 }
532 let ret = unsafe { CFAttributedStringGetAttributes(a_str, loc, effective_range) };
533 ret.map(|ret| unsafe { CFRetained::retain(ret) })
534}
535
536#[deprecated = "renamed to `CFAttributedString::attribute`"]
537#[inline]
538pub unsafe extern "C-unwind" fn CFAttributedStringGetAttribute(
539 a_str: &CFAttributedString,
540 loc: CFIndex,
541 attr_name: Option<&CFString>,
542 effective_range: *mut CFRange,
543) -> Option<CFRetained<CFType>> {
544 extern "C-unwind" {
545 fn CFAttributedStringGetAttribute(
546 a_str: &CFAttributedString,
547 loc: CFIndex,
548 attr_name: Option<&CFString>,
549 effective_range: *mut CFRange,
550 ) -> Option<NonNull<CFType>>;
551 }
552 let ret = unsafe { CFAttributedStringGetAttribute(a_str, loc, attr_name, effective_range) };
553 ret.map(|ret| unsafe { CFRetained::retain(ret) })
554}
555
556#[cfg(feature = "CFDictionary")]
557#[deprecated = "renamed to `CFAttributedString::attributes_and_longest_effective_range`"]
558#[inline]
559pub unsafe extern "C-unwind" fn CFAttributedStringGetAttributesAndLongestEffectiveRange(
560 a_str: &CFAttributedString,
561 loc: CFIndex,
562 in_range: CFRange,
563 longest_effective_range: *mut CFRange,
564) -> Option<CFRetained<CFDictionary>> {
565 extern "C-unwind" {
566 fn CFAttributedStringGetAttributesAndLongestEffectiveRange(
567 a_str: &CFAttributedString,
568 loc: CFIndex,
569 in_range: CFRange,
570 longest_effective_range: *mut CFRange,
571 ) -> Option<NonNull<CFDictionary>>;
572 }
573 let ret = unsafe {
574 CFAttributedStringGetAttributesAndLongestEffectiveRange(
575 a_str,
576 loc,
577 in_range,
578 longest_effective_range,
579 )
580 };
581 ret.map(|ret| unsafe { CFRetained::retain(ret) })
582}
583
584#[deprecated = "renamed to `CFAttributedString::attribute_and_longest_effective_range`"]
585#[inline]
586pub unsafe extern "C-unwind" fn CFAttributedStringGetAttributeAndLongestEffectiveRange(
587 a_str: &CFAttributedString,
588 loc: CFIndex,
589 attr_name: Option<&CFString>,
590 in_range: CFRange,
591 longest_effective_range: *mut CFRange,
592) -> Option<CFRetained<CFType>> {
593 extern "C-unwind" {
594 fn CFAttributedStringGetAttributeAndLongestEffectiveRange(
595 a_str: &CFAttributedString,
596 loc: CFIndex,
597 attr_name: Option<&CFString>,
598 in_range: CFRange,
599 longest_effective_range: *mut CFRange,
600 ) -> Option<NonNull<CFType>>;
601 }
602 let ret = unsafe {
603 CFAttributedStringGetAttributeAndLongestEffectiveRange(
604 a_str,
605 loc,
606 attr_name,
607 in_range,
608 longest_effective_range,
609 )
610 };
611 ret.map(|ret| unsafe { CFRetained::retain(ret) })
612}
613
614#[deprecated = "renamed to `CFMutableAttributedString::new_copy`"]
615#[inline]
616pub extern "C-unwind" fn CFAttributedStringCreateMutableCopy(
617 alloc: Option<&CFAllocator>,
618 max_length: CFIndex,
619 a_str: Option<&CFAttributedString>,
620) -> Option<CFRetained<CFMutableAttributedString>> {
621 extern "C-unwind" {
622 fn CFAttributedStringCreateMutableCopy(
623 alloc: Option<&CFAllocator>,
624 max_length: CFIndex,
625 a_str: Option<&CFAttributedString>,
626 ) -> Option<NonNull<CFMutableAttributedString>>;
627 }
628 let ret = unsafe { CFAttributedStringCreateMutableCopy(alloc, max_length, a_str) };
629 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
630}
631
632#[deprecated = "renamed to `CFMutableAttributedString::new`"]
633#[inline]
634pub extern "C-unwind" fn CFAttributedStringCreateMutable(
635 alloc: Option<&CFAllocator>,
636 max_length: CFIndex,
637) -> Option<CFRetained<CFMutableAttributedString>> {
638 extern "C-unwind" {
639 fn CFAttributedStringCreateMutable(
640 alloc: Option<&CFAllocator>,
641 max_length: CFIndex,
642 ) -> Option<NonNull<CFMutableAttributedString>>;
643 }
644 let ret = unsafe { CFAttributedStringCreateMutable(alloc, max_length) };
645 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
646}
647
648extern "C-unwind" {
649 #[deprecated = "renamed to `CFMutableAttributedString::replace_string`"]
650 pub fn CFAttributedStringReplaceString(
651 a_str: Option<&CFMutableAttributedString>,
652 range: CFRange,
653 replacement: Option<&CFString>,
654 );
655}
656
657#[deprecated = "renamed to `CFMutableAttributedString::mutable_string`"]
658#[inline]
659pub extern "C-unwind" fn CFAttributedStringGetMutableString(
660 a_str: Option<&CFMutableAttributedString>,
661) -> Option<CFRetained<CFMutableString>> {
662 extern "C-unwind" {
663 fn CFAttributedStringGetMutableString(
664 a_str: Option<&CFMutableAttributedString>,
665 ) -> Option<NonNull<CFMutableString>>;
666 }
667 let ret = unsafe { CFAttributedStringGetMutableString(a_str) };
668 ret.map(|ret| unsafe { CFRetained::retain(ret) })
669}
670
671#[cfg(feature = "CFDictionary")]
672#[deprecated = "renamed to `CFMutableAttributedString::set_attributes`"]
673#[inline]
674pub unsafe extern "C-unwind" fn CFAttributedStringSetAttributes(
675 a_str: Option<&CFMutableAttributedString>,
676 range: CFRange,
677 replacement: Option<&CFDictionary>,
678 clear_other_attributes: bool,
679) {
680 extern "C-unwind" {
681 fn CFAttributedStringSetAttributes(
682 a_str: Option<&CFMutableAttributedString>,
683 range: CFRange,
684 replacement: Option<&CFDictionary>,
685 clear_other_attributes: Boolean,
686 );
687 }
688 unsafe {
689 CFAttributedStringSetAttributes(a_str, range, replacement, clear_other_attributes as _)
690 }
691}
692
693extern "C-unwind" {
694 #[deprecated = "renamed to `CFMutableAttributedString::set_attribute`"]
695 pub fn CFAttributedStringSetAttribute(
696 a_str: Option<&CFMutableAttributedString>,
697 range: CFRange,
698 attr_name: Option<&CFString>,
699 value: Option<&CFType>,
700 );
701}
702
703extern "C-unwind" {
704 #[deprecated = "renamed to `CFMutableAttributedString::remove_attribute`"]
705 pub fn CFAttributedStringRemoveAttribute(
706 a_str: Option<&CFMutableAttributedString>,
707 range: CFRange,
708 attr_name: Option<&CFString>,
709 );
710}
711
712extern "C-unwind" {
713 #[deprecated = "renamed to `CFMutableAttributedString::replace_attributed_string`"]
714 pub fn CFAttributedStringReplaceAttributedString(
715 a_str: Option<&CFMutableAttributedString>,
716 range: CFRange,
717 replacement: Option<&CFAttributedString>,
718 );
719}
720
721#[deprecated = "renamed to `CFMutableAttributedString::begin_editing`"]
722#[inline]
723pub extern "C-unwind" fn CFAttributedStringBeginEditing(a_str: Option<&CFMutableAttributedString>) {
724 extern "C-unwind" {
725 fn CFAttributedStringBeginEditing(a_str: Option<&CFMutableAttributedString>);
726 }
727 unsafe { CFAttributedStringBeginEditing(a_str) }
728}
729
730#[deprecated = "renamed to `CFMutableAttributedString::end_editing`"]
731#[inline]
732pub extern "C-unwind" fn CFAttributedStringEndEditing(a_str: Option<&CFMutableAttributedString>) {
733 extern "C-unwind" {
734 fn CFAttributedStringEndEditing(a_str: Option<&CFMutableAttributedString>);
735 }
736 unsafe { CFAttributedStringEndEditing(a_str) }
737}
738
739extern "C-unwind" {
740 #[deprecated = "renamed to `CFAttributedString::bidi_levels_and_resolved_directions`"]
741 pub fn CFAttributedStringGetBidiLevelsAndResolvedDirections(
742 attributed_string: &CFAttributedString,
743 range: CFRange,
744 base_direction: i8,
745 bidi_levels: *mut u8,
746 base_directions: *mut u8,
747 ) -> bool;
748}