objc2_foundation/generated/
NSCalendarDate.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
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscalendardate?language=objc)
11    #[unsafe(super(NSDate, NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    #[cfg(feature = "NSDate")]
14    #[deprecated = "Use NSCalendar and NSDateComponents and NSDateFormatter instead"]
15    pub struct NSCalendarDate;
16);
17
18#[cfg(all(feature = "NSDate", feature = "NSObject"))]
19extern_conformance!(
20    unsafe impl NSCoding for NSCalendarDate {}
21);
22
23#[cfg(all(feature = "NSDate", feature = "NSObject"))]
24extern_conformance!(
25    unsafe impl NSCopying for NSCalendarDate {}
26);
27
28#[cfg(all(feature = "NSDate", feature = "NSObject"))]
29unsafe impl CopyingHelper for NSCalendarDate {
30    type Result = Self;
31}
32
33#[cfg(feature = "NSDate")]
34extern_conformance!(
35    unsafe impl NSObjectProtocol for NSCalendarDate {}
36);
37
38#[cfg(all(feature = "NSDate", feature = "NSObject"))]
39extern_conformance!(
40    unsafe impl NSSecureCoding for NSCalendarDate {}
41);
42
43#[cfg(feature = "NSDate")]
44impl NSCalendarDate {
45    extern_methods!(
46        #[deprecated = "Use NSCalendar instead"]
47        #[unsafe(method(calendarDate))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn calendarDate() -> Retained<AnyObject>;
50
51        #[cfg(feature = "NSString")]
52        #[deprecated = "Use NSDateFormatter instead"]
53        #[unsafe(method(dateWithString:calendarFormat:locale:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn dateWithString_calendarFormat_locale(
56            description: &NSString,
57            format: &NSString,
58            locale: Option<&AnyObject>,
59        ) -> Option<Retained<AnyObject>>;
60
61        #[cfg(feature = "NSString")]
62        #[deprecated = "Use NSDateFormatter instead"]
63        #[unsafe(method(dateWithString:calendarFormat:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn dateWithString_calendarFormat(
66            description: &NSString,
67            format: &NSString,
68        ) -> Option<Retained<AnyObject>>;
69
70        #[cfg(feature = "NSTimeZone")]
71        #[deprecated = "Use NSCalendar and NSDateComponents instead"]
72        #[unsafe(method(dateWithYear:month:day:hour:minute:second:timeZone:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn dateWithYear_month_day_hour_minute_second_timeZone(
75            year: NSInteger,
76            month: NSUInteger,
77            day: NSUInteger,
78            hour: NSUInteger,
79            minute: NSUInteger,
80            second: NSUInteger,
81            a_time_zone: Option<&NSTimeZone>,
82        ) -> Retained<AnyObject>;
83
84        #[deprecated = "Use NSCalendar instead"]
85        #[unsafe(method(dateByAddingYears:months:days:hours:minutes:seconds:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn dateByAddingYears_months_days_hours_minutes_seconds(
88            &self,
89            year: NSInteger,
90            month: NSInteger,
91            day: NSInteger,
92            hour: NSInteger,
93            minute: NSInteger,
94            second: NSInteger,
95        ) -> Retained<NSCalendarDate>;
96
97        #[deprecated]
98        #[unsafe(method(dayOfCommonEra))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn dayOfCommonEra(&self) -> NSInteger;
101
102        #[deprecated]
103        #[unsafe(method(dayOfMonth))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn dayOfMonth(&self) -> NSInteger;
106
107        #[deprecated]
108        #[unsafe(method(dayOfWeek))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn dayOfWeek(&self) -> NSInteger;
111
112        #[deprecated]
113        #[unsafe(method(dayOfYear))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn dayOfYear(&self) -> NSInteger;
116
117        #[deprecated]
118        #[unsafe(method(hourOfDay))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn hourOfDay(&self) -> NSInteger;
121
122        #[deprecated]
123        #[unsafe(method(minuteOfHour))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn minuteOfHour(&self) -> NSInteger;
126
127        #[deprecated]
128        #[unsafe(method(monthOfYear))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn monthOfYear(&self) -> NSInteger;
131
132        #[deprecated]
133        #[unsafe(method(secondOfMinute))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn secondOfMinute(&self) -> NSInteger;
136
137        #[deprecated]
138        #[unsafe(method(yearOfCommonEra))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn yearOfCommonEra(&self) -> NSInteger;
141
142        #[cfg(feature = "NSString")]
143        #[deprecated]
144        #[unsafe(method(calendarFormat))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn calendarFormat(&self) -> Retained<NSString>;
147
148        #[cfg(feature = "NSString")]
149        #[deprecated]
150        #[unsafe(method(descriptionWithCalendarFormat:locale:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn descriptionWithCalendarFormat_locale(
153            &self,
154            format: &NSString,
155            locale: Option<&AnyObject>,
156        ) -> Retained<NSString>;
157
158        #[cfg(feature = "NSString")]
159        #[deprecated]
160        #[unsafe(method(descriptionWithCalendarFormat:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn descriptionWithCalendarFormat(&self, format: &NSString)
163            -> Retained<NSString>;
164
165        #[cfg(feature = "NSString")]
166        #[deprecated]
167        #[unsafe(method(descriptionWithLocale:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn descriptionWithLocale(
170            &self,
171            locale: Option<&AnyObject>,
172        ) -> Retained<NSString>;
173
174        #[cfg(feature = "NSTimeZone")]
175        #[deprecated]
176        #[unsafe(method(timeZone))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
179
180        #[cfg(feature = "NSString")]
181        #[deprecated = "Use NSDateFormatter instead"]
182        #[unsafe(method(initWithString:calendarFormat:locale:))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn initWithString_calendarFormat_locale(
185            this: Allocated<Self>,
186            description: &NSString,
187            format: &NSString,
188            locale: Option<&AnyObject>,
189        ) -> Option<Retained<Self>>;
190
191        #[cfg(feature = "NSString")]
192        #[deprecated = "Use NSDateFormatter instead"]
193        #[unsafe(method(initWithString:calendarFormat:))]
194        #[unsafe(method_family = init)]
195        pub unsafe fn initWithString_calendarFormat(
196            this: Allocated<Self>,
197            description: &NSString,
198            format: &NSString,
199        ) -> Option<Retained<Self>>;
200
201        #[cfg(feature = "NSString")]
202        #[deprecated = "Use NSDateFormatter instead"]
203        #[unsafe(method(initWithString:))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn initWithString(
206            this: Allocated<Self>,
207            description: &NSString,
208        ) -> Option<Retained<Self>>;
209
210        #[cfg(feature = "NSTimeZone")]
211        #[deprecated = "Use NSCalendar and NSDateComponents instead"]
212        #[unsafe(method(initWithYear:month:day:hour:minute:second:timeZone:))]
213        #[unsafe(method_family = init)]
214        pub unsafe fn initWithYear_month_day_hour_minute_second_timeZone(
215            this: Allocated<Self>,
216            year: NSInteger,
217            month: NSUInteger,
218            day: NSUInteger,
219            hour: NSUInteger,
220            minute: NSUInteger,
221            second: NSUInteger,
222            a_time_zone: Option<&NSTimeZone>,
223        ) -> Retained<Self>;
224
225        #[cfg(feature = "NSString")]
226        #[deprecated]
227        #[unsafe(method(setCalendarFormat:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn setCalendarFormat(&self, format: Option<&NSString>);
230
231        #[cfg(feature = "NSTimeZone")]
232        #[deprecated]
233        #[unsafe(method(setTimeZone:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn setTimeZone(&self, a_time_zone: Option<&NSTimeZone>);
236
237        #[deprecated]
238        #[unsafe(method(years:months:days:hours:minutes:seconds:sinceDate:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn years_months_days_hours_minutes_seconds_sinceDate(
241            &self,
242            yp: *mut NSInteger,
243            mop: *mut NSInteger,
244            dp: *mut NSInteger,
245            hp: *mut NSInteger,
246            mip: *mut NSInteger,
247            sp: *mut NSInteger,
248            date: &NSCalendarDate,
249        );
250
251        #[deprecated]
252        #[unsafe(method(distantFuture))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn distantFuture() -> Retained<Self>;
255
256        #[deprecated]
257        #[unsafe(method(distantPast))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn distantPast() -> Retained<Self>;
260    );
261}
262
263/// Methods declared on superclass `NSDate`.
264#[cfg(feature = "NSDate")]
265impl NSCalendarDate {
266    extern_methods!(
267        #[unsafe(method(init))]
268        #[unsafe(method_family = init)]
269        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
270
271        #[unsafe(method(initWithTimeIntervalSinceReferenceDate:))]
272        #[unsafe(method_family = init)]
273        pub unsafe fn initWithTimeIntervalSinceReferenceDate(
274            this: Allocated<Self>,
275            ti: NSTimeInterval,
276        ) -> Retained<Self>;
277
278        #[cfg(feature = "NSCoder")]
279        #[unsafe(method(initWithCoder:))]
280        #[unsafe(method_family = init)]
281        pub unsafe fn initWithCoder(
282            this: Allocated<Self>,
283            coder: &NSCoder,
284        ) -> Option<Retained<Self>>;
285    );
286}
287
288/// Methods declared on superclass `NSObject`.
289#[cfg(feature = "NSDate")]
290impl NSCalendarDate {
291    extern_methods!(
292        #[unsafe(method(new))]
293        #[unsafe(method_family = new)]
294        pub unsafe fn new() -> Retained<Self>;
295    );
296}
297
298/// NSCalendarDateExtras.
299#[cfg(feature = "NSDate")]
300impl NSDate {
301    extern_methods!(
302        #[cfg(feature = "NSString")]
303        #[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
304        #[unsafe(method(dateWithNaturalLanguageString:locale:))]
305        #[unsafe(method_family = none)]
306        pub unsafe fn dateWithNaturalLanguageString_locale(
307            string: &NSString,
308            locale: Option<&AnyObject>,
309        ) -> Option<Retained<AnyObject>>;
310
311        #[cfg(feature = "NSString")]
312        #[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
313        #[unsafe(method(dateWithNaturalLanguageString:))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn dateWithNaturalLanguageString(
316            string: &NSString,
317        ) -> Option<Retained<AnyObject>>;
318
319        #[cfg(feature = "NSString")]
320        #[deprecated = "Use NSDateFormatter instead"]
321        #[unsafe(method(dateWithString:))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn dateWithString(a_string: &NSString) -> Retained<AnyObject>;
324
325        #[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
326        #[deprecated]
327        #[unsafe(method(dateWithCalendarFormat:timeZone:))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn dateWithCalendarFormat_timeZone(
330            &self,
331            format: Option<&NSString>,
332            a_time_zone: Option<&NSTimeZone>,
333        ) -> Retained<NSCalendarDate>;
334
335        #[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
336        #[deprecated]
337        #[unsafe(method(descriptionWithCalendarFormat:timeZone:locale:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn descriptionWithCalendarFormat_timeZone_locale(
340            &self,
341            format: Option<&NSString>,
342            a_time_zone: Option<&NSTimeZone>,
343            locale: Option<&AnyObject>,
344        ) -> Option<Retained<NSString>>;
345
346        #[cfg(feature = "NSString")]
347        #[deprecated = "Use NSDateFormatter instead"]
348        #[unsafe(method(initWithString:))]
349        #[unsafe(method_family = init)]
350        pub unsafe fn initWithString(
351            this: Allocated<Self>,
352            description: &NSString,
353        ) -> Option<Retained<Self>>;
354    );
355}