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