objc2_foundation/generated/
NSISO8601DateFormatter.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsiso8601dateformatoptions?language=objc)
10// NS_OPTIONS
11#[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    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsiso8601dateformatter?language=objc)
57    #[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 unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
95
96        #[cfg(feature = "NSTimeZone")]
97        /// Setter for [`timeZone`][Self::timeZone].
98        #[unsafe(method(setTimeZone:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
101
102        #[unsafe(method(formatOptions))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn formatOptions(&self) -> NSISO8601DateFormatOptions;
105
106        /// Setter for [`formatOptions`][Self::formatOptions].
107        #[unsafe(method(setFormatOptions:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn setFormatOptions(&self, format_options: NSISO8601DateFormatOptions);
110
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
114
115        #[cfg(all(feature = "NSDate", feature = "NSString"))]
116        #[unsafe(method(stringFromDate:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn stringFromDate(&self, date: &NSDate) -> Retained<NSString>;
119
120        #[cfg(all(feature = "NSDate", feature = "NSString"))]
121        #[unsafe(method(dateFromString:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn dateFromString(&self, string: &NSString) -> Option<Retained<NSDate>>;
124
125        #[cfg(all(feature = "NSDate", feature = "NSString", feature = "NSTimeZone"))]
126        #[unsafe(method(stringFromDate:timeZone:formatOptions:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn stringFromDate_timeZone_formatOptions(
129            date: &NSDate,
130            time_zone: &NSTimeZone,
131            format_options: NSISO8601DateFormatOptions,
132        ) -> Retained<NSString>;
133    );
134}
135
136/// Methods declared on superclass `NSObject`.
137#[cfg(feature = "NSFormatter")]
138impl NSISO8601DateFormatter {
139    extern_methods!(
140        #[unsafe(method(new))]
141        #[unsafe(method_family = new)]
142        pub unsafe fn new() -> Retained<Self>;
143    );
144}