objc2_foundation/generated/
NSISO8601DateFormatter.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSISO8601DateFormatOptions(pub NSUInteger);
14bitflags::bitflags! {
15 impl NSISO8601DateFormatOptions: NSUInteger {
16 #[doc(alias = "NSISO8601DateFormatWithYear")]
17 const WithYear = 1;
18 #[doc(alias = "NSISO8601DateFormatWithMonth")]
19 const WithMonth = 2;
20 #[doc(alias = "NSISO8601DateFormatWithWeekOfYear")]
21 const WithWeekOfYear = 4;
22 #[doc(alias = "NSISO8601DateFormatWithDay")]
23 const WithDay = 16;
24 #[doc(alias = "NSISO8601DateFormatWithTime")]
25 const WithTime = 32;
26 #[doc(alias = "NSISO8601DateFormatWithTimeZone")]
27 const WithTimeZone = 64;
28 #[doc(alias = "NSISO8601DateFormatWithSpaceBetweenDateAndTime")]
29 const WithSpaceBetweenDateAndTime = 128;
30 #[doc(alias = "NSISO8601DateFormatWithDashSeparatorInDate")]
31 const WithDashSeparatorInDate = 256;
32 #[doc(alias = "NSISO8601DateFormatWithColonSeparatorInTime")]
33 const WithColonSeparatorInTime = 512;
34 #[doc(alias = "NSISO8601DateFormatWithColonSeparatorInTimeZone")]
35 const WithColonSeparatorInTimeZone = 1024;
36 #[doc(alias = "NSISO8601DateFormatWithFractionalSeconds")]
37 const WithFractionalSeconds = 2048;
38 #[doc(alias = "NSISO8601DateFormatWithFullDate")]
39 const WithFullDate = 275;
40 #[doc(alias = "NSISO8601DateFormatWithFullTime")]
41 const WithFullTime = 1632;
42 #[doc(alias = "NSISO8601DateFormatWithInternetDateTime")]
43 const WithInternetDateTime = 1907;
44 }
45}
46
47unsafe impl Encode for NSISO8601DateFormatOptions {
48 const ENCODING: Encoding = NSUInteger::ENCODING;
49}
50
51unsafe impl RefEncode for NSISO8601DateFormatOptions {
52 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55extern_class!(
56 #[unsafe(super(NSFormatter, NSObject))]
58 #[derive(Debug, PartialEq, Eq, Hash)]
59 #[cfg(feature = "NSFormatter")]
60 pub struct NSISO8601DateFormatter;
61);
62
63#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
64unsafe impl NSCoding for NSISO8601DateFormatter {}
65
66#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
67unsafe impl NSCopying for NSISO8601DateFormatter {}
68
69#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
70unsafe impl CopyingHelper for NSISO8601DateFormatter {
71 type Result = Self;
72}
73
74#[cfg(feature = "NSFormatter")]
75unsafe impl NSObjectProtocol for NSISO8601DateFormatter {}
76
77#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
78unsafe impl NSSecureCoding for NSISO8601DateFormatter {}
79
80#[cfg(feature = "NSFormatter")]
81impl NSISO8601DateFormatter {
82 extern_methods!(
83 #[cfg(feature = "NSTimeZone")]
84 #[unsafe(method(timeZone))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
87
88 #[cfg(feature = "NSTimeZone")]
89 #[unsafe(method(setTimeZone:))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
93
94 #[unsafe(method(formatOptions))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn formatOptions(&self) -> NSISO8601DateFormatOptions;
97
98 #[unsafe(method(setFormatOptions:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn setFormatOptions(&self, format_options: NSISO8601DateFormatOptions);
102
103 #[unsafe(method(init))]
104 #[unsafe(method_family = init)]
105 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
106
107 #[cfg(all(feature = "NSDate", feature = "NSString"))]
108 #[unsafe(method(stringFromDate:))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn stringFromDate(&self, date: &NSDate) -> Retained<NSString>;
111
112 #[cfg(all(feature = "NSDate", feature = "NSString"))]
113 #[unsafe(method(dateFromString:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn dateFromString(&self, string: &NSString) -> Option<Retained<NSDate>>;
116
117 #[cfg(all(feature = "NSDate", feature = "NSString", feature = "NSTimeZone"))]
118 #[unsafe(method(stringFromDate:timeZone:formatOptions:))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn stringFromDate_timeZone_formatOptions(
121 date: &NSDate,
122 time_zone: &NSTimeZone,
123 format_options: NSISO8601DateFormatOptions,
124 ) -> Retained<NSString>;
125 );
126}
127
128#[cfg(feature = "NSFormatter")]
130impl NSISO8601DateFormatter {
131 extern_methods!(
132 #[unsafe(method(new))]
133 #[unsafe(method_family = new)]
134 pub unsafe fn new() -> Retained<Self>;
135 );
136}