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"))]
64extern_conformance!(
65 unsafe impl NSCoding for NSISO8601DateFormatter {}
66);
67
68#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
69extern_conformance!(
70 unsafe impl NSCopying for NSISO8601DateFormatter {}
71);
72
73#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
74unsafe impl CopyingHelper for NSISO8601DateFormatter {
75 type Result = Self;
76}
77
78#[cfg(feature = "NSFormatter")]
79extern_conformance!(
80 unsafe impl NSObjectProtocol for NSISO8601DateFormatter {}
81);
82
83#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
84extern_conformance!(
85 unsafe impl NSSecureCoding for NSISO8601DateFormatter {}
86);
87
88#[cfg(feature = "NSFormatter")]
89impl NSISO8601DateFormatter {
90 extern_methods!(
91 #[cfg(feature = "NSTimeZone")]
92 #[unsafe(method(timeZone))]
93 #[unsafe(method_family = none)]
94 pub fn timeZone(&self) -> Retained<NSTimeZone>;
95
96 #[cfg(feature = "NSTimeZone")]
97 #[unsafe(method(setTimeZone:))]
101 #[unsafe(method_family = none)]
102 pub fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
103
104 #[unsafe(method(formatOptions))]
105 #[unsafe(method_family = none)]
106 pub fn formatOptions(&self) -> NSISO8601DateFormatOptions;
107
108 #[unsafe(method(setFormatOptions:))]
110 #[unsafe(method_family = none)]
111 pub fn setFormatOptions(&self, format_options: NSISO8601DateFormatOptions);
112
113 #[unsafe(method(init))]
114 #[unsafe(method_family = init)]
115 pub fn init(this: Allocated<Self>) -> Retained<Self>;
116
117 #[cfg(all(feature = "NSDate", feature = "NSString"))]
118 #[unsafe(method(stringFromDate:))]
119 #[unsafe(method_family = none)]
120 pub fn stringFromDate(&self, date: &NSDate) -> Retained<NSString>;
121
122 #[cfg(all(feature = "NSDate", feature = "NSString"))]
123 #[unsafe(method(dateFromString:))]
124 #[unsafe(method_family = none)]
125 pub fn dateFromString(&self, string: &NSString) -> Option<Retained<NSDate>>;
126
127 #[cfg(all(feature = "NSDate", feature = "NSString", feature = "NSTimeZone"))]
128 #[unsafe(method(stringFromDate:timeZone:formatOptions:))]
129 #[unsafe(method_family = none)]
130 pub fn stringFromDate_timeZone_formatOptions(
131 date: &NSDate,
132 time_zone: &NSTimeZone,
133 format_options: NSISO8601DateFormatOptions,
134 ) -> Retained<NSString>;
135 );
136}
137
138#[cfg(feature = "NSFormatter")]
140impl NSISO8601DateFormatter {
141 extern_methods!(
142 #[unsafe(method(new))]
143 #[unsafe(method_family = new)]
144 pub fn new() -> Retained<Self>;
145 );
146}
147
148#[cfg(feature = "NSFormatter")]
149impl DefaultRetained for NSISO8601DateFormatter {
150 #[inline]
151 fn default_retained() -> Retained<Self> {
152 Self::new()
153 }
154}