1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[cfg(feature = "NSString")]
12pub type NSAttributedStringKey = NSString;
13
14#[cfg(feature = "NSString")]
17pub type NSAttributedStringFormattingContextKey = NSString;
18
19extern "C" {
20 #[cfg(feature = "NSString")]
22 pub static NSInflectionConceptsKey: &'static NSAttributedStringFormattingContextKey;
23}
24
25extern_class!(
26 #[unsafe(super(NSObject))]
28 #[derive(Debug, PartialEq, Eq, Hash)]
29 pub struct NSAttributedString;
30);
31
32#[cfg(feature = "NSObject")]
33extern_conformance!(
34 unsafe impl NSCoding for NSAttributedString {}
35);
36
37#[cfg(feature = "NSObject")]
38extern_conformance!(
39 unsafe impl NSCopying for NSAttributedString {}
40);
41
42#[cfg(feature = "NSObject")]
43unsafe impl CopyingHelper for NSAttributedString {
44 type Result = Self;
45}
46
47#[cfg(feature = "NSObject")]
48extern_conformance!(
49 unsafe impl NSMutableCopying for NSAttributedString {}
50);
51
52#[cfg(feature = "NSObject")]
53unsafe impl MutableCopyingHelper for NSAttributedString {
54 type Result = NSMutableAttributedString;
55}
56
57extern_conformance!(
58 unsafe impl NSObjectProtocol for NSAttributedString {}
59);
60
61#[cfg(feature = "NSObject")]
62extern_conformance!(
63 unsafe impl NSSecureCoding for NSAttributedString {}
64);
65
66impl NSAttributedString {
67 extern_methods!(
68 #[cfg(feature = "NSString")]
69 #[unsafe(method(string))]
70 #[unsafe(method_family = none)]
71 pub fn string(&self) -> Retained<NSString>;
72
73 #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
74 #[unsafe(method(attributesAtIndex:effectiveRange:))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn attributesAtIndex_effectiveRange(
77 &self,
78 location: NSUInteger,
79 range: NSRangePointer,
80 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
81 );
82}
83
84impl NSAttributedString {
86 extern_methods!(
87 #[unsafe(method(init))]
88 #[unsafe(method_family = init)]
89 pub fn init(this: Allocated<Self>) -> Retained<Self>;
90
91 #[unsafe(method(new))]
92 #[unsafe(method_family = new)]
93 pub fn new() -> Retained<Self>;
94 );
95}
96
97impl DefaultRetained for NSAttributedString {
98 #[inline]
99 fn default_retained() -> Retained<Self> {
100 Self::new()
101 }
102}
103
104#[repr(transparent)]
107#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
108pub struct NSAttributedStringEnumerationOptions(pub NSUInteger);
109bitflags::bitflags! {
110 impl NSAttributedStringEnumerationOptions: NSUInteger {
111 #[doc(alias = "NSAttributedStringEnumerationReverse")]
112 const Reverse = 1<<1;
113 #[doc(alias = "NSAttributedStringEnumerationLongestEffectiveRangeNotRequired")]
114 const LongestEffectiveRangeNotRequired = 1<<20;
115 }
116}
117
118unsafe impl Encode for NSAttributedStringEnumerationOptions {
119 const ENCODING: Encoding = NSUInteger::ENCODING;
120}
121
122unsafe impl RefEncode for NSAttributedStringEnumerationOptions {
123 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
124}
125
126impl NSAttributedString {
128 extern_methods!(
129 #[unsafe(method(length))]
130 #[unsafe(method_family = none)]
131 pub fn length(&self) -> NSUInteger;
132
133 #[cfg(all(feature = "NSRange", feature = "NSString"))]
134 #[unsafe(method(attribute:atIndex:effectiveRange:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn attribute_atIndex_effectiveRange(
137 &self,
138 attr_name: &NSAttributedStringKey,
139 location: NSUInteger,
140 range: NSRangePointer,
141 ) -> Option<Retained<AnyObject>>;
142
143 #[cfg(feature = "NSRange")]
144 #[unsafe(method(attributedSubstringFromRange:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn attributedSubstringFromRange(
147 &self,
148 range: NSRange,
149 ) -> Retained<NSAttributedString>;
150
151 #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
152 #[unsafe(method(attributesAtIndex:longestEffectiveRange:inRange:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn attributesAtIndex_longestEffectiveRange_inRange(
155 &self,
156 location: NSUInteger,
157 range: NSRangePointer,
158 range_limit: NSRange,
159 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
160
161 #[cfg(all(feature = "NSRange", feature = "NSString"))]
162 #[unsafe(method(attribute:atIndex:longestEffectiveRange:inRange:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn attribute_atIndex_longestEffectiveRange_inRange(
165 &self,
166 attr_name: &NSAttributedStringKey,
167 location: NSUInteger,
168 range: NSRangePointer,
169 range_limit: NSRange,
170 ) -> Option<Retained<AnyObject>>;
171
172 #[unsafe(method(isEqualToAttributedString:))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn isEqualToAttributedString(&self, other: &NSAttributedString) -> bool;
175
176 #[cfg(feature = "NSString")]
177 #[unsafe(method(initWithString:))]
178 #[unsafe(method_family = init)]
179 pub fn initWithString(this: Allocated<Self>, str: &NSString) -> Retained<Self>;
180
181 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
182 #[unsafe(method(initWithString:attributes:))]
183 #[unsafe(method_family = init)]
184 pub unsafe fn initWithString_attributes(
185 this: Allocated<Self>,
186 str: &NSString,
187 attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
188 ) -> Retained<Self>;
189
190 #[unsafe(method(initWithAttributedString:))]
191 #[unsafe(method_family = init)]
192 pub fn initWithAttributedString(
193 this: Allocated<Self>,
194 attr_str: &NSAttributedString,
195 ) -> Retained<Self>;
196
197 #[cfg(all(
198 feature = "NSDictionary",
199 feature = "NSRange",
200 feature = "NSString",
201 feature = "block2"
202 ))]
203 #[unsafe(method(enumerateAttributesInRange:options:usingBlock:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn enumerateAttributesInRange_options_usingBlock(
206 &self,
207 enumeration_range: NSRange,
208 opts: NSAttributedStringEnumerationOptions,
209 block: &block2::DynBlock<
210 dyn Fn(
211 NonNull<NSDictionary<NSAttributedStringKey, AnyObject>>,
212 NSRange,
213 NonNull<Bool>,
214 ) + '_,
215 >,
216 );
217
218 #[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
219 #[unsafe(method(enumerateAttribute:inRange:options:usingBlock:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn enumerateAttribute_inRange_options_usingBlock(
222 &self,
223 attr_name: &NSAttributedStringKey,
224 enumeration_range: NSRange,
225 opts: NSAttributedStringEnumerationOptions,
226 block: &block2::DynBlock<dyn Fn(*mut AnyObject, NSRange, NonNull<Bool>) + '_>,
227 );
228 );
229}
230
231impl NSMutableAttributedString {
235 extern_methods!(
236 #[cfg(feature = "NSString")]
237 #[unsafe(method(initWithString:))]
238 #[unsafe(method_family = init)]
239 pub fn initWithString(this: Allocated<Self>, str: &NSString) -> Retained<Self>;
240
241 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
242 #[unsafe(method(initWithString:attributes:))]
243 #[unsafe(method_family = init)]
244 pub unsafe fn initWithString_attributes(
245 this: Allocated<Self>,
246 str: &NSString,
247 attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
248 ) -> Retained<Self>;
249
250 #[unsafe(method(initWithAttributedString:))]
251 #[unsafe(method_family = init)]
252 pub fn initWithAttributedString(
253 this: Allocated<Self>,
254 attr_str: &NSAttributedString,
255 ) -> Retained<Self>;
256 );
257}
258
259extern_class!(
260 #[unsafe(super(NSAttributedString, NSObject))]
262 #[derive(Debug, PartialEq, Eq, Hash)]
263 pub struct NSMutableAttributedString;
264);
265
266#[cfg(feature = "NSObject")]
267extern_conformance!(
268 unsafe impl NSCoding for NSMutableAttributedString {}
269);
270
271#[cfg(feature = "NSObject")]
272extern_conformance!(
273 unsafe impl NSCopying for NSMutableAttributedString {}
274);
275
276#[cfg(feature = "NSObject")]
277unsafe impl CopyingHelper for NSMutableAttributedString {
278 type Result = NSAttributedString;
279}
280
281#[cfg(feature = "NSObject")]
282extern_conformance!(
283 unsafe impl NSMutableCopying for NSMutableAttributedString {}
284);
285
286#[cfg(feature = "NSObject")]
287unsafe impl MutableCopyingHelper for NSMutableAttributedString {
288 type Result = Self;
289}
290
291extern_conformance!(
292 unsafe impl NSObjectProtocol for NSMutableAttributedString {}
293);
294
295#[cfg(feature = "NSObject")]
296extern_conformance!(
297 unsafe impl NSSecureCoding for NSMutableAttributedString {}
298);
299
300impl NSMutableAttributedString {
301 extern_methods!(
302 #[cfg(all(feature = "NSRange", feature = "NSString"))]
303 #[unsafe(method(replaceCharactersInRange:withString:))]
304 #[unsafe(method_family = none)]
305 pub unsafe fn replaceCharactersInRange_withString(&self, range: NSRange, str: &NSString);
306
307 #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
308 #[unsafe(method(setAttributes:range:))]
309 #[unsafe(method_family = none)]
310 pub unsafe fn setAttributes_range(
311 &self,
312 attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
313 range: NSRange,
314 );
315 );
316}
317
318impl NSMutableAttributedString {
320 extern_methods!(
321 #[unsafe(method(init))]
322 #[unsafe(method_family = init)]
323 pub fn init(this: Allocated<Self>) -> Retained<Self>;
324
325 #[unsafe(method(new))]
326 #[unsafe(method_family = new)]
327 pub fn new() -> Retained<Self>;
328 );
329}
330
331impl DefaultRetained for NSMutableAttributedString {
332 #[inline]
333 fn default_retained() -> Retained<Self> {
334 Self::new()
335 }
336}
337
338impl NSMutableAttributedString {
340 extern_methods!(
341 #[cfg(feature = "NSString")]
342 #[unsafe(method(mutableString))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn mutableString(&self) -> Retained<NSMutableString>;
345
346 #[cfg(all(feature = "NSRange", feature = "NSString"))]
347 #[unsafe(method(addAttribute:value:range:))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn addAttribute_value_range(
350 &self,
351 name: &NSAttributedStringKey,
352 value: &AnyObject,
353 range: NSRange,
354 );
355
356 #[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
357 #[unsafe(method(addAttributes:range:))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn addAttributes_range(
360 &self,
361 attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
362 range: NSRange,
363 );
364
365 #[cfg(all(feature = "NSRange", feature = "NSString"))]
366 #[unsafe(method(removeAttribute:range:))]
367 #[unsafe(method_family = none)]
368 pub unsafe fn removeAttribute_range(&self, name: &NSAttributedStringKey, range: NSRange);
369
370 #[cfg(feature = "NSRange")]
371 #[unsafe(method(replaceCharactersInRange:withAttributedString:))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn replaceCharactersInRange_withAttributedString(
374 &self,
375 range: NSRange,
376 attr_string: &NSAttributedString,
377 );
378
379 #[unsafe(method(insertAttributedString:atIndex:))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn insertAttributedString_atIndex(
382 &self,
383 attr_string: &NSAttributedString,
384 loc: NSUInteger,
385 );
386
387 #[unsafe(method(appendAttributedString:))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn appendAttributedString(&self, attr_string: &NSAttributedString);
390
391 #[cfg(feature = "NSRange")]
392 #[unsafe(method(deleteCharactersInRange:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn deleteCharactersInRange(&self, range: NSRange);
395
396 #[unsafe(method(setAttributedString:))]
397 #[unsafe(method_family = none)]
398 pub fn setAttributedString(&self, attr_string: &NSAttributedString);
399
400 #[unsafe(method(beginEditing))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn beginEditing(&self);
403
404 #[unsafe(method(endEditing))]
405 #[unsafe(method_family = none)]
406 pub unsafe fn endEditing(&self);
407 );
408}
409
410#[repr(transparent)]
413#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
414pub struct NSInlinePresentationIntent(pub NSUInteger);
415bitflags::bitflags! {
416 impl NSInlinePresentationIntent: NSUInteger {
417 #[doc(alias = "NSInlinePresentationIntentEmphasized")]
418 const Emphasized = 1<<0;
419 #[doc(alias = "NSInlinePresentationIntentStronglyEmphasized")]
420 const StronglyEmphasized = 1<<1;
421 #[doc(alias = "NSInlinePresentationIntentCode")]
422 const Code = 1<<2;
423 #[doc(alias = "NSInlinePresentationIntentStrikethrough")]
424 const Strikethrough = 1<<5;
425 #[doc(alias = "NSInlinePresentationIntentSoftBreak")]
426 const SoftBreak = 1<<6;
427 #[doc(alias = "NSInlinePresentationIntentLineBreak")]
428 const LineBreak = 1<<7;
429 #[doc(alias = "NSInlinePresentationIntentInlineHTML")]
430 const InlineHTML = 1<<8;
431 #[doc(alias = "NSInlinePresentationIntentBlockHTML")]
432 const BlockHTML = 1<<9;
433 }
434}
435
436unsafe impl Encode for NSInlinePresentationIntent {
437 const ENCODING: Encoding = NSUInteger::ENCODING;
438}
439
440unsafe impl RefEncode for NSInlinePresentationIntent {
441 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
442}
443
444extern "C" {
445 #[cfg(feature = "NSString")]
447 pub static NSInlinePresentationIntentAttributeName: &'static NSAttributedStringKey;
448}
449
450extern "C" {
451 #[cfg(feature = "NSString")]
453 pub static NSAlternateDescriptionAttributeName: &'static NSAttributedStringKey;
454}
455
456extern "C" {
457 #[cfg(feature = "NSString")]
459 pub static NSImageURLAttributeName: &'static NSAttributedStringKey;
460}
461
462extern "C" {
463 #[cfg(feature = "NSString")]
465 pub static NSLanguageIdentifierAttributeName: &'static NSAttributedStringKey;
466}
467
468extern "C" {
469 #[cfg(feature = "NSString")]
471 pub static NSMarkdownSourcePositionAttributeName: &'static NSAttributedStringKey;
472}
473
474#[repr(transparent)]
477#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
478pub struct NSAttributedStringMarkdownParsingFailurePolicy(pub NSInteger);
479impl NSAttributedStringMarkdownParsingFailurePolicy {
480 #[doc(alias = "NSAttributedStringMarkdownParsingFailureReturnError")]
481 pub const ReturnError: Self = Self(0);
482 #[doc(alias = "NSAttributedStringMarkdownParsingFailureReturnPartiallyParsedIfPossible")]
483 pub const ReturnPartiallyParsedIfPossible: Self = Self(1);
484}
485
486unsafe impl Encode for NSAttributedStringMarkdownParsingFailurePolicy {
487 const ENCODING: Encoding = NSInteger::ENCODING;
488}
489
490unsafe impl RefEncode for NSAttributedStringMarkdownParsingFailurePolicy {
491 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
492}
493
494#[repr(transparent)]
497#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
498pub struct NSAttributedStringMarkdownInterpretedSyntax(pub NSInteger);
499impl NSAttributedStringMarkdownInterpretedSyntax {
500 #[doc(alias = "NSAttributedStringMarkdownInterpretedSyntaxFull")]
501 pub const Full: Self = Self(0);
502 #[doc(alias = "NSAttributedStringMarkdownInterpretedSyntaxInlineOnly")]
503 pub const InlineOnly: Self = Self(1);
504 #[doc(alias = "NSAttributedStringMarkdownInterpretedSyntaxInlineOnlyPreservingWhitespace")]
505 pub const InlineOnlyPreservingWhitespace: Self = Self(2);
506}
507
508unsafe impl Encode for NSAttributedStringMarkdownInterpretedSyntax {
509 const ENCODING: Encoding = NSInteger::ENCODING;
510}
511
512unsafe impl RefEncode for NSAttributedStringMarkdownInterpretedSyntax {
513 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
514}
515
516extern_class!(
517 #[unsafe(super(NSObject))]
519 #[derive(Debug, PartialEq, Eq, Hash)]
520 pub struct NSAttributedStringMarkdownSourcePosition;
521);
522
523#[cfg(feature = "NSObject")]
524extern_conformance!(
525 unsafe impl NSCoding for NSAttributedStringMarkdownSourcePosition {}
526);
527
528#[cfg(feature = "NSObject")]
529extern_conformance!(
530 unsafe impl NSCopying for NSAttributedStringMarkdownSourcePosition {}
531);
532
533#[cfg(feature = "NSObject")]
534unsafe impl CopyingHelper for NSAttributedStringMarkdownSourcePosition {
535 type Result = Self;
536}
537
538extern_conformance!(
539 unsafe impl NSObjectProtocol for NSAttributedStringMarkdownSourcePosition {}
540);
541
542#[cfg(feature = "NSObject")]
543extern_conformance!(
544 unsafe impl NSSecureCoding for NSAttributedStringMarkdownSourcePosition {}
545);
546
547impl NSAttributedStringMarkdownSourcePosition {
548 extern_methods!(
549 #[unsafe(method(startLine))]
550 #[unsafe(method_family = none)]
551 pub unsafe fn startLine(&self) -> NSInteger;
552
553 #[unsafe(method(startColumn))]
554 #[unsafe(method_family = none)]
555 pub unsafe fn startColumn(&self) -> NSInteger;
556
557 #[unsafe(method(endLine))]
558 #[unsafe(method_family = none)]
559 pub unsafe fn endLine(&self) -> NSInteger;
560
561 #[unsafe(method(endColumn))]
562 #[unsafe(method_family = none)]
563 pub unsafe fn endColumn(&self) -> NSInteger;
564
565 #[unsafe(method(initWithStartLine:startColumn:endLine:endColumn:))]
566 #[unsafe(method_family = init)]
567 pub unsafe fn initWithStartLine_startColumn_endLine_endColumn(
568 this: Allocated<Self>,
569 start_line: NSInteger,
570 start_column: NSInteger,
571 end_line: NSInteger,
572 end_column: NSInteger,
573 ) -> Retained<Self>;
574
575 #[cfg(all(feature = "NSRange", feature = "NSString"))]
576 #[unsafe(method(rangeInString:))]
577 #[unsafe(method_family = none)]
578 pub unsafe fn rangeInString(&self, string: &NSString) -> NSRange;
579 );
580}
581
582impl NSAttributedStringMarkdownSourcePosition {
584 extern_methods!(
585 #[unsafe(method(init))]
586 #[unsafe(method_family = init)]
587 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
588
589 #[unsafe(method(new))]
590 #[unsafe(method_family = new)]
591 pub unsafe fn new() -> Retained<Self>;
592 );
593}
594
595extern_class!(
596 #[unsafe(super(NSObject))]
598 #[derive(Debug, PartialEq, Eq, Hash)]
599 pub struct NSAttributedStringMarkdownParsingOptions;
600);
601
602#[cfg(feature = "NSObject")]
603extern_conformance!(
604 unsafe impl NSCopying for NSAttributedStringMarkdownParsingOptions {}
605);
606
607#[cfg(feature = "NSObject")]
608unsafe impl CopyingHelper for NSAttributedStringMarkdownParsingOptions {
609 type Result = Self;
610}
611
612extern_conformance!(
613 unsafe impl NSObjectProtocol for NSAttributedStringMarkdownParsingOptions {}
614);
615
616impl NSAttributedStringMarkdownParsingOptions {
617 extern_methods!(
618 #[unsafe(method(init))]
619 #[unsafe(method_family = init)]
620 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
621
622 #[unsafe(method(allowsExtendedAttributes))]
623 #[unsafe(method_family = none)]
624 pub unsafe fn allowsExtendedAttributes(&self) -> bool;
625
626 #[unsafe(method(setAllowsExtendedAttributes:))]
628 #[unsafe(method_family = none)]
629 pub unsafe fn setAllowsExtendedAttributes(&self, allows_extended_attributes: bool);
630
631 #[unsafe(method(interpretedSyntax))]
632 #[unsafe(method_family = none)]
633 pub unsafe fn interpretedSyntax(&self) -> NSAttributedStringMarkdownInterpretedSyntax;
634
635 #[unsafe(method(setInterpretedSyntax:))]
637 #[unsafe(method_family = none)]
638 pub unsafe fn setInterpretedSyntax(
639 &self,
640 interpreted_syntax: NSAttributedStringMarkdownInterpretedSyntax,
641 );
642
643 #[unsafe(method(failurePolicy))]
644 #[unsafe(method_family = none)]
645 pub unsafe fn failurePolicy(&self) -> NSAttributedStringMarkdownParsingFailurePolicy;
646
647 #[unsafe(method(setFailurePolicy:))]
649 #[unsafe(method_family = none)]
650 pub unsafe fn setFailurePolicy(
651 &self,
652 failure_policy: NSAttributedStringMarkdownParsingFailurePolicy,
653 );
654
655 #[cfg(feature = "NSString")]
656 #[unsafe(method(languageCode))]
657 #[unsafe(method_family = none)]
658 pub unsafe fn languageCode(&self) -> Option<Retained<NSString>>;
659
660 #[cfg(feature = "NSString")]
661 #[unsafe(method(setLanguageCode:))]
663 #[unsafe(method_family = none)]
664 pub unsafe fn setLanguageCode(&self, language_code: Option<&NSString>);
665
666 #[unsafe(method(appliesSourcePositionAttributes))]
667 #[unsafe(method_family = none)]
668 pub unsafe fn appliesSourcePositionAttributes(&self) -> bool;
669
670 #[unsafe(method(setAppliesSourcePositionAttributes:))]
672 #[unsafe(method_family = none)]
673 pub unsafe fn setAppliesSourcePositionAttributes(
674 &self,
675 applies_source_position_attributes: bool,
676 );
677 );
678}
679
680impl NSAttributedStringMarkdownParsingOptions {
682 extern_methods!(
683 #[unsafe(method(new))]
684 #[unsafe(method_family = new)]
685 pub unsafe fn new() -> Retained<Self>;
686 );
687}
688
689impl NSAttributedString {
691 extern_methods!(
692 #[cfg(all(feature = "NSError", feature = "NSURL"))]
693 #[unsafe(method(initWithContentsOfMarkdownFileAtURL:options:baseURL:error:_))]
694 #[unsafe(method_family = init)]
695 pub unsafe fn initWithContentsOfMarkdownFileAtURL_options_baseURL_error(
696 this: Allocated<Self>,
697 markdown_file: &NSURL,
698 options: Option<&NSAttributedStringMarkdownParsingOptions>,
699 base_url: Option<&NSURL>,
700 ) -> Result<Retained<Self>, Retained<NSError>>;
701
702 #[cfg(all(feature = "NSData", feature = "NSError", feature = "NSURL"))]
703 #[unsafe(method(initWithMarkdown:options:baseURL:error:_))]
704 #[unsafe(method_family = init)]
705 pub unsafe fn initWithMarkdown_options_baseURL_error(
706 this: Allocated<Self>,
707 markdown: &NSData,
708 options: Option<&NSAttributedStringMarkdownParsingOptions>,
709 base_url: Option<&NSURL>,
710 ) -> Result<Retained<Self>, Retained<NSError>>;
711
712 #[cfg(all(feature = "NSError", feature = "NSString", feature = "NSURL"))]
713 #[unsafe(method(initWithMarkdownString:options:baseURL:error:_))]
714 #[unsafe(method_family = init)]
715 pub unsafe fn initWithMarkdownString_options_baseURL_error(
716 this: Allocated<Self>,
717 markdown_string: &NSString,
718 options: Option<&NSAttributedStringMarkdownParsingOptions>,
719 base_url: Option<&NSURL>,
720 ) -> Result<Retained<Self>, Retained<NSError>>;
721 );
722}
723
724impl NSMutableAttributedString {
728 extern_methods!(
729 #[cfg(all(feature = "NSError", feature = "NSURL"))]
730 #[unsafe(method(initWithContentsOfMarkdownFileAtURL:options:baseURL:error:_))]
731 #[unsafe(method_family = init)]
732 pub unsafe fn initWithContentsOfMarkdownFileAtURL_options_baseURL_error(
733 this: Allocated<Self>,
734 markdown_file: &NSURL,
735 options: Option<&NSAttributedStringMarkdownParsingOptions>,
736 base_url: Option<&NSURL>,
737 ) -> Result<Retained<Self>, Retained<NSError>>;
738
739 #[cfg(all(feature = "NSData", feature = "NSError", feature = "NSURL"))]
740 #[unsafe(method(initWithMarkdown:options:baseURL:error:_))]
741 #[unsafe(method_family = init)]
742 pub unsafe fn initWithMarkdown_options_baseURL_error(
743 this: Allocated<Self>,
744 markdown: &NSData,
745 options: Option<&NSAttributedStringMarkdownParsingOptions>,
746 base_url: Option<&NSURL>,
747 ) -> Result<Retained<Self>, Retained<NSError>>;
748
749 #[cfg(all(feature = "NSError", feature = "NSString", feature = "NSURL"))]
750 #[unsafe(method(initWithMarkdownString:options:baseURL:error:_))]
751 #[unsafe(method_family = init)]
752 pub unsafe fn initWithMarkdownString_options_baseURL_error(
753 this: Allocated<Self>,
754 markdown_string: &NSString,
755 options: Option<&NSAttributedStringMarkdownParsingOptions>,
756 base_url: Option<&NSURL>,
757 ) -> Result<Retained<Self>, Retained<NSError>>;
758 );
759}
760
761#[repr(transparent)]
764#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
765pub struct NSAttributedStringFormattingOptions(pub NSUInteger);
766bitflags::bitflags! {
767 impl NSAttributedStringFormattingOptions: NSUInteger {
768 #[doc(alias = "NSAttributedStringFormattingInsertArgumentAttributesWithoutMerging")]
769 const InsertArgumentAttributesWithoutMerging = 1<<0;
770 #[doc(alias = "NSAttributedStringFormattingApplyReplacementIndexAttribute")]
771 const ApplyReplacementIndexAttribute = 1<<1;
772 }
773}
774
775unsafe impl Encode for NSAttributedStringFormattingOptions {
776 const ENCODING: Encoding = NSUInteger::ENCODING;
777}
778
779unsafe impl RefEncode for NSAttributedStringFormattingOptions {
780 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
781}
782
783impl NSAttributedString {
785 extern_methods!();
786}
787
788impl NSMutableAttributedString {
790 extern_methods!();
791}
792
793extern "C" {
794 #[cfg(feature = "NSString")]
796 pub static NSReplacementIndexAttributeName: &'static NSAttributedStringKey;
797}
798
799impl NSAttributedString {
801 extern_methods!(
802 #[unsafe(method(attributedStringByInflectingString))]
806 #[unsafe(method_family = none)]
807 pub unsafe fn attributedStringByInflectingString(&self) -> Retained<NSAttributedString>;
808 );
809}
810
811extern "C" {
812 #[cfg(feature = "NSString")]
814 pub static NSMorphologyAttributeName: &'static NSAttributedStringKey;
815}
816
817extern "C" {
818 #[cfg(feature = "NSString")]
820 pub static NSInflectionRuleAttributeName: &'static NSAttributedStringKey;
821}
822
823extern "C" {
824 #[cfg(feature = "NSString")]
826 pub static NSInflectionAgreementArgumentAttributeName: &'static NSAttributedStringKey;
827}
828
829extern "C" {
830 #[cfg(feature = "NSString")]
832 pub static NSInflectionAgreementConceptAttributeName: &'static NSAttributedStringKey;
833}
834
835extern "C" {
836 #[cfg(feature = "NSString")]
838 pub static NSInflectionReferentConceptAttributeName: &'static NSAttributedStringKey;
839}
840
841extern "C" {
842 #[cfg(feature = "NSString")]
844 pub static NSInflectionAlternativeAttributeName: &'static NSAttributedStringKey;
845}
846
847extern "C" {
848 #[cfg(feature = "NSString")]
850 pub static NSLocalizedNumberFormatAttributeName: &'static NSAttributedStringKey;
851}
852
853extern "C" {
854 #[cfg(feature = "NSString")]
856 pub static NSPresentationIntentAttributeName: &'static NSAttributedStringKey;
857}
858
859#[repr(transparent)]
862#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
863pub struct NSPresentationIntentKind(pub NSInteger);
864impl NSPresentationIntentKind {
865 #[doc(alias = "NSPresentationIntentKindParagraph")]
866 pub const Paragraph: Self = Self(0);
867 #[doc(alias = "NSPresentationIntentKindHeader")]
868 pub const Header: Self = Self(1);
869 #[doc(alias = "NSPresentationIntentKindOrderedList")]
870 pub const OrderedList: Self = Self(2);
871 #[doc(alias = "NSPresentationIntentKindUnorderedList")]
872 pub const UnorderedList: Self = Self(3);
873 #[doc(alias = "NSPresentationIntentKindListItem")]
874 pub const ListItem: Self = Self(4);
875 #[doc(alias = "NSPresentationIntentKindCodeBlock")]
876 pub const CodeBlock: Self = Self(5);
877 #[doc(alias = "NSPresentationIntentKindBlockQuote")]
878 pub const BlockQuote: Self = Self(6);
879 #[doc(alias = "NSPresentationIntentKindThematicBreak")]
880 pub const ThematicBreak: Self = Self(7);
881 #[doc(alias = "NSPresentationIntentKindTable")]
882 pub const Table: Self = Self(8);
883 #[doc(alias = "NSPresentationIntentKindTableHeaderRow")]
884 pub const TableHeaderRow: Self = Self(9);
885 #[doc(alias = "NSPresentationIntentKindTableRow")]
886 pub const TableRow: Self = Self(10);
887 #[doc(alias = "NSPresentationIntentKindTableCell")]
888 pub const TableCell: Self = Self(11);
889}
890
891unsafe impl Encode for NSPresentationIntentKind {
892 const ENCODING: Encoding = NSInteger::ENCODING;
893}
894
895unsafe impl RefEncode for NSPresentationIntentKind {
896 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
897}
898
899#[repr(transparent)]
902#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
903pub struct NSPresentationIntentTableColumnAlignment(pub NSInteger);
904impl NSPresentationIntentTableColumnAlignment {
905 #[doc(alias = "NSPresentationIntentTableColumnAlignmentLeft")]
906 pub const Left: Self = Self(0);
907 #[doc(alias = "NSPresentationIntentTableColumnAlignmentCenter")]
908 pub const Center: Self = Self(1);
909 #[doc(alias = "NSPresentationIntentTableColumnAlignmentRight")]
910 pub const Right: Self = Self(2);
911}
912
913unsafe impl Encode for NSPresentationIntentTableColumnAlignment {
914 const ENCODING: Encoding = NSInteger::ENCODING;
915}
916
917unsafe impl RefEncode for NSPresentationIntentTableColumnAlignment {
918 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
919}
920
921extern_class!(
922 #[unsafe(super(NSObject))]
924 #[derive(Debug, PartialEq, Eq, Hash)]
925 pub struct NSPresentationIntent;
926);
927
928#[cfg(feature = "NSObject")]
929extern_conformance!(
930 unsafe impl NSCoding for NSPresentationIntent {}
931);
932
933#[cfg(feature = "NSObject")]
934extern_conformance!(
935 unsafe impl NSCopying for NSPresentationIntent {}
936);
937
938#[cfg(feature = "NSObject")]
939unsafe impl CopyingHelper for NSPresentationIntent {
940 type Result = Self;
941}
942
943extern_conformance!(
944 unsafe impl NSObjectProtocol for NSPresentationIntent {}
945);
946
947#[cfg(feature = "NSObject")]
948extern_conformance!(
949 unsafe impl NSSecureCoding for NSPresentationIntent {}
950);
951
952impl NSPresentationIntent {
953 extern_methods!(
954 #[unsafe(method(intentKind))]
955 #[unsafe(method_family = none)]
956 pub unsafe fn intentKind(&self) -> NSPresentationIntentKind;
957
958 #[unsafe(method(init))]
959 #[unsafe(method_family = init)]
960 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
961
962 #[unsafe(method(parentIntent))]
963 #[unsafe(method_family = none)]
964 pub unsafe fn parentIntent(&self) -> Option<Retained<NSPresentationIntent>>;
965
966 #[unsafe(method(paragraphIntentWithIdentity:nestedInsideIntent:))]
967 #[unsafe(method_family = none)]
968 pub unsafe fn paragraphIntentWithIdentity_nestedInsideIntent(
969 identity: NSInteger,
970 parent: Option<&NSPresentationIntent>,
971 ) -> Retained<NSPresentationIntent>;
972
973 #[unsafe(method(headerIntentWithIdentity:level:nestedInsideIntent:))]
974 #[unsafe(method_family = none)]
975 pub unsafe fn headerIntentWithIdentity_level_nestedInsideIntent(
976 identity: NSInteger,
977 level: NSInteger,
978 parent: Option<&NSPresentationIntent>,
979 ) -> Retained<NSPresentationIntent>;
980
981 #[cfg(feature = "NSString")]
982 #[unsafe(method(codeBlockIntentWithIdentity:languageHint:nestedInsideIntent:))]
983 #[unsafe(method_family = none)]
984 pub unsafe fn codeBlockIntentWithIdentity_languageHint_nestedInsideIntent(
985 identity: NSInteger,
986 language_hint: Option<&NSString>,
987 parent: Option<&NSPresentationIntent>,
988 ) -> Retained<NSPresentationIntent>;
989
990 #[unsafe(method(thematicBreakIntentWithIdentity:nestedInsideIntent:))]
991 #[unsafe(method_family = none)]
992 pub unsafe fn thematicBreakIntentWithIdentity_nestedInsideIntent(
993 identity: NSInteger,
994 parent: Option<&NSPresentationIntent>,
995 ) -> Retained<NSPresentationIntent>;
996
997 #[unsafe(method(orderedListIntentWithIdentity:nestedInsideIntent:))]
998 #[unsafe(method_family = none)]
999 pub unsafe fn orderedListIntentWithIdentity_nestedInsideIntent(
1000 identity: NSInteger,
1001 parent: Option<&NSPresentationIntent>,
1002 ) -> Retained<NSPresentationIntent>;
1003
1004 #[unsafe(method(unorderedListIntentWithIdentity:nestedInsideIntent:))]
1005 #[unsafe(method_family = none)]
1006 pub unsafe fn unorderedListIntentWithIdentity_nestedInsideIntent(
1007 identity: NSInteger,
1008 parent: Option<&NSPresentationIntent>,
1009 ) -> Retained<NSPresentationIntent>;
1010
1011 #[unsafe(method(listItemIntentWithIdentity:ordinal:nestedInsideIntent:))]
1012 #[unsafe(method_family = none)]
1013 pub unsafe fn listItemIntentWithIdentity_ordinal_nestedInsideIntent(
1014 identity: NSInteger,
1015 ordinal: NSInteger,
1016 parent: Option<&NSPresentationIntent>,
1017 ) -> Retained<NSPresentationIntent>;
1018
1019 #[unsafe(method(blockQuoteIntentWithIdentity:nestedInsideIntent:))]
1020 #[unsafe(method_family = none)]
1021 pub unsafe fn blockQuoteIntentWithIdentity_nestedInsideIntent(
1022 identity: NSInteger,
1023 parent: Option<&NSPresentationIntent>,
1024 ) -> Retained<NSPresentationIntent>;
1025
1026 #[cfg(all(feature = "NSArray", feature = "NSValue"))]
1027 #[unsafe(method(tableIntentWithIdentity:columnCount:alignments:nestedInsideIntent:))]
1028 #[unsafe(method_family = none)]
1029 pub unsafe fn tableIntentWithIdentity_columnCount_alignments_nestedInsideIntent(
1030 identity: NSInteger,
1031 column_count: NSInteger,
1032 alignments: &NSArray<NSNumber>,
1033 parent: Option<&NSPresentationIntent>,
1034 ) -> Retained<NSPresentationIntent>;
1035
1036 #[unsafe(method(tableHeaderRowIntentWithIdentity:nestedInsideIntent:))]
1037 #[unsafe(method_family = none)]
1038 pub unsafe fn tableHeaderRowIntentWithIdentity_nestedInsideIntent(
1039 identity: NSInteger,
1040 parent: Option<&NSPresentationIntent>,
1041 ) -> Retained<NSPresentationIntent>;
1042
1043 #[unsafe(method(tableRowIntentWithIdentity:row:nestedInsideIntent:))]
1044 #[unsafe(method_family = none)]
1045 pub unsafe fn tableRowIntentWithIdentity_row_nestedInsideIntent(
1046 identity: NSInteger,
1047 row: NSInteger,
1048 parent: Option<&NSPresentationIntent>,
1049 ) -> Retained<NSPresentationIntent>;
1050
1051 #[unsafe(method(tableCellIntentWithIdentity:column:nestedInsideIntent:))]
1052 #[unsafe(method_family = none)]
1053 pub unsafe fn tableCellIntentWithIdentity_column_nestedInsideIntent(
1054 identity: NSInteger,
1055 column: NSInteger,
1056 parent: Option<&NSPresentationIntent>,
1057 ) -> Retained<NSPresentationIntent>;
1058
1059 #[unsafe(method(identity))]
1061 #[unsafe(method_family = none)]
1062 pub unsafe fn identity(&self) -> NSInteger;
1063
1064 #[unsafe(method(ordinal))]
1066 #[unsafe(method_family = none)]
1067 pub unsafe fn ordinal(&self) -> NSInteger;
1068
1069 #[cfg(all(feature = "NSArray", feature = "NSValue"))]
1070 #[unsafe(method(columnAlignments))]
1072 #[unsafe(method_family = none)]
1073 pub unsafe fn columnAlignments(&self) -> Option<Retained<NSArray<NSNumber>>>;
1074
1075 #[unsafe(method(columnCount))]
1077 #[unsafe(method_family = none)]
1078 pub unsafe fn columnCount(&self) -> NSInteger;
1079
1080 #[unsafe(method(headerLevel))]
1082 #[unsafe(method_family = none)]
1083 pub unsafe fn headerLevel(&self) -> NSInteger;
1084
1085 #[cfg(feature = "NSString")]
1086 #[unsafe(method(languageHint))]
1088 #[unsafe(method_family = none)]
1089 pub unsafe fn languageHint(&self) -> Option<Retained<NSString>>;
1090
1091 #[unsafe(method(column))]
1093 #[unsafe(method_family = none)]
1094 pub unsafe fn column(&self) -> NSInteger;
1095
1096 #[unsafe(method(row))]
1098 #[unsafe(method_family = none)]
1099 pub unsafe fn row(&self) -> NSInteger;
1100
1101 #[unsafe(method(indentationLevel))]
1104 #[unsafe(method_family = none)]
1105 pub unsafe fn indentationLevel(&self) -> NSInteger;
1106
1107 #[unsafe(method(isEquivalentToPresentationIntent:))]
1109 #[unsafe(method_family = none)]
1110 pub unsafe fn isEquivalentToPresentationIntent(&self, other: &NSPresentationIntent)
1111 -> bool;
1112 );
1113}
1114
1115impl NSPresentationIntent {
1117 extern_methods!(
1118 #[unsafe(method(new))]
1119 #[unsafe(method_family = new)]
1120 pub unsafe fn new() -> Retained<Self>;
1121 );
1122}