1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDateIntervalFormatterStyle(pub NSUInteger);
impl NSDateIntervalFormatterStyle {
    pub const NSDateIntervalFormatterNoStyle: Self = Self(0);
    pub const NSDateIntervalFormatterShortStyle: Self = Self(1);
    pub const NSDateIntervalFormatterMediumStyle: Self = Self(2);
    pub const NSDateIntervalFormatterLongStyle: Self = Self(3);
    pub const NSDateIntervalFormatterFullStyle: Self = Self(4);
}

unsafe impl Encode for NSDateIntervalFormatterStyle {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSDateIntervalFormatterStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSFormatter")]
    pub struct NSDateIntervalFormatter;

    #[cfg(feature = "NSFormatter")]
    unsafe impl ClassType for NSDateIntervalFormatter {
        #[inherits(NSObject)]
        type Super = NSFormatter;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "NSFormatter")]
unsafe impl Send for NSDateIntervalFormatter {}

#[cfg(feature = "NSFormatter")]
unsafe impl Sync for NSDateIntervalFormatter {}

#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSDateIntervalFormatter {}

#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSDateIntervalFormatter {}

#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSDateIntervalFormatter {}

extern_methods!(
    #[cfg(feature = "NSFormatter")]
    unsafe impl NSDateIntervalFormatter {
        #[cfg(feature = "NSLocale")]
        #[method_id(@__retain_semantics Other locale)]
        pub unsafe fn locale(&self) -> Retained<NSLocale>;

        #[cfg(feature = "NSLocale")]
        #[method(setLocale:)]
        pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);

        #[cfg(feature = "NSCalendar")]
        #[method_id(@__retain_semantics Other calendar)]
        pub unsafe fn calendar(&self) -> Retained<NSCalendar>;

        #[cfg(feature = "NSCalendar")]
        #[method(setCalendar:)]
        pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);

        #[cfg(feature = "NSTimeZone")]
        #[method_id(@__retain_semantics Other timeZone)]
        pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;

        #[cfg(feature = "NSTimeZone")]
        #[method(setTimeZone:)]
        pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other dateTemplate)]
        pub unsafe fn dateTemplate(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[method(setDateTemplate:)]
        pub unsafe fn setDateTemplate(&self, date_template: Option<&NSString>);

        #[method(dateStyle)]
        pub unsafe fn dateStyle(&self) -> NSDateIntervalFormatterStyle;

        #[method(setDateStyle:)]
        pub unsafe fn setDateStyle(&self, date_style: NSDateIntervalFormatterStyle);

        #[method(timeStyle)]
        pub unsafe fn timeStyle(&self) -> NSDateIntervalFormatterStyle;

        #[method(setTimeStyle:)]
        pub unsafe fn setTimeStyle(&self, time_style: NSDateIntervalFormatterStyle);

        #[cfg(all(feature = "NSDate", feature = "NSString"))]
        #[method_id(@__retain_semantics Other stringFromDate:toDate:)]
        pub unsafe fn stringFromDate_toDate(
            &self,
            from_date: &NSDate,
            to_date: &NSDate,
        ) -> Retained<NSString>;

        #[cfg(all(feature = "NSDateInterval", feature = "NSString"))]
        #[method_id(@__retain_semantics Other stringFromDateInterval:)]
        pub unsafe fn stringFromDateInterval(
            &self,
            date_interval: &NSDateInterval,
        ) -> Option<Retained<NSString>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "NSFormatter")]
    unsafe impl NSDateIntervalFormatter {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);