objc2_foundation/generated/
NSCalendarDate.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[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 fn calendarDate() -> Retained<AnyObject>;
50
51 #[cfg(feature = "NSString")]
52 #[deprecated = "Use NSDateFormatter instead"]
56 #[unsafe(method(dateWithString:calendarFormat:locale:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn dateWithString_calendarFormat_locale(
59 description: &NSString,
60 format: &NSString,
61 locale: Option<&AnyObject>,
62 ) -> Option<Retained<AnyObject>>;
63
64 #[cfg(feature = "NSString")]
65 #[deprecated = "Use NSDateFormatter instead"]
66 #[unsafe(method(dateWithString:calendarFormat:))]
67 #[unsafe(method_family = none)]
68 pub fn dateWithString_calendarFormat(
69 description: &NSString,
70 format: &NSString,
71 ) -> Option<Retained<AnyObject>>;
72
73 #[cfg(feature = "NSTimeZone")]
74 #[deprecated = "Use NSCalendar and NSDateComponents instead"]
75 #[unsafe(method(dateWithYear:month:day:hour:minute:second:timeZone:))]
76 #[unsafe(method_family = none)]
77 pub fn dateWithYear_month_day_hour_minute_second_timeZone(
78 year: NSInteger,
79 month: NSUInteger,
80 day: NSUInteger,
81 hour: NSUInteger,
82 minute: NSUInteger,
83 second: NSUInteger,
84 a_time_zone: Option<&NSTimeZone>,
85 ) -> Retained<AnyObject>;
86
87 #[deprecated = "Use NSCalendar instead"]
88 #[unsafe(method(dateByAddingYears:months:days:hours:minutes:seconds:))]
89 #[unsafe(method_family = none)]
90 pub fn dateByAddingYears_months_days_hours_minutes_seconds(
91 &self,
92 year: NSInteger,
93 month: NSInteger,
94 day: NSInteger,
95 hour: NSInteger,
96 minute: NSInteger,
97 second: NSInteger,
98 ) -> Retained<NSCalendarDate>;
99
100 #[deprecated]
101 #[unsafe(method(dayOfCommonEra))]
102 #[unsafe(method_family = none)]
103 pub fn dayOfCommonEra(&self) -> NSInteger;
104
105 #[deprecated]
106 #[unsafe(method(dayOfMonth))]
107 #[unsafe(method_family = none)]
108 pub fn dayOfMonth(&self) -> NSInteger;
109
110 #[deprecated]
111 #[unsafe(method(dayOfWeek))]
112 #[unsafe(method_family = none)]
113 pub fn dayOfWeek(&self) -> NSInteger;
114
115 #[deprecated]
116 #[unsafe(method(dayOfYear))]
117 #[unsafe(method_family = none)]
118 pub fn dayOfYear(&self) -> NSInteger;
119
120 #[deprecated]
121 #[unsafe(method(hourOfDay))]
122 #[unsafe(method_family = none)]
123 pub fn hourOfDay(&self) -> NSInteger;
124
125 #[deprecated]
126 #[unsafe(method(minuteOfHour))]
127 #[unsafe(method_family = none)]
128 pub fn minuteOfHour(&self) -> NSInteger;
129
130 #[deprecated]
131 #[unsafe(method(monthOfYear))]
132 #[unsafe(method_family = none)]
133 pub fn monthOfYear(&self) -> NSInteger;
134
135 #[deprecated]
136 #[unsafe(method(secondOfMinute))]
137 #[unsafe(method_family = none)]
138 pub fn secondOfMinute(&self) -> NSInteger;
139
140 #[deprecated]
141 #[unsafe(method(yearOfCommonEra))]
142 #[unsafe(method_family = none)]
143 pub fn yearOfCommonEra(&self) -> NSInteger;
144
145 #[cfg(feature = "NSString")]
146 #[deprecated]
147 #[unsafe(method(calendarFormat))]
148 #[unsafe(method_family = none)]
149 pub fn calendarFormat(&self) -> Retained<NSString>;
150
151 #[cfg(feature = "NSString")]
152 #[deprecated]
156 #[unsafe(method(descriptionWithCalendarFormat:locale:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn descriptionWithCalendarFormat_locale(
159 &self,
160 format: &NSString,
161 locale: Option<&AnyObject>,
162 ) -> Retained<NSString>;
163
164 #[cfg(feature = "NSString")]
165 #[deprecated]
166 #[unsafe(method(descriptionWithCalendarFormat:))]
167 #[unsafe(method_family = none)]
168 pub fn descriptionWithCalendarFormat(&self, format: &NSString) -> Retained<NSString>;
169
170 #[cfg(feature = "NSString")]
171 #[deprecated]
175 #[unsafe(method(descriptionWithLocale:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn descriptionWithLocale(
178 &self,
179 locale: Option<&AnyObject>,
180 ) -> Retained<NSString>;
181
182 #[cfg(feature = "NSTimeZone")]
183 #[deprecated]
184 #[unsafe(method(timeZone))]
185 #[unsafe(method_family = none)]
186 pub fn timeZone(&self) -> Retained<NSTimeZone>;
187
188 #[cfg(feature = "NSString")]
189 #[deprecated = "Use NSDateFormatter instead"]
193 #[unsafe(method(initWithString:calendarFormat:locale:))]
194 #[unsafe(method_family = init)]
195 pub unsafe fn initWithString_calendarFormat_locale(
196 this: Allocated<Self>,
197 description: &NSString,
198 format: &NSString,
199 locale: Option<&AnyObject>,
200 ) -> Option<Retained<Self>>;
201
202 #[cfg(feature = "NSString")]
203 #[deprecated = "Use NSDateFormatter instead"]
204 #[unsafe(method(initWithString:calendarFormat:))]
205 #[unsafe(method_family = init)]
206 pub fn initWithString_calendarFormat(
207 this: Allocated<Self>,
208 description: &NSString,
209 format: &NSString,
210 ) -> Option<Retained<Self>>;
211
212 #[cfg(feature = "NSString")]
213 #[deprecated = "Use NSDateFormatter instead"]
214 #[unsafe(method(initWithString:))]
215 #[unsafe(method_family = init)]
216 pub fn initWithString(
217 this: Allocated<Self>,
218 description: &NSString,
219 ) -> Option<Retained<Self>>;
220
221 #[cfg(feature = "NSTimeZone")]
222 #[deprecated = "Use NSCalendar and NSDateComponents instead"]
223 #[unsafe(method(initWithYear:month:day:hour:minute:second:timeZone:))]
224 #[unsafe(method_family = init)]
225 pub fn initWithYear_month_day_hour_minute_second_timeZone(
226 this: Allocated<Self>,
227 year: NSInteger,
228 month: NSUInteger,
229 day: NSUInteger,
230 hour: NSUInteger,
231 minute: NSUInteger,
232 second: NSUInteger,
233 a_time_zone: Option<&NSTimeZone>,
234 ) -> Retained<Self>;
235
236 #[cfg(feature = "NSString")]
237 #[deprecated]
238 #[unsafe(method(setCalendarFormat:))]
239 #[unsafe(method_family = none)]
240 pub fn setCalendarFormat(&self, format: Option<&NSString>);
241
242 #[cfg(feature = "NSTimeZone")]
243 #[deprecated]
244 #[unsafe(method(setTimeZone:))]
245 #[unsafe(method_family = none)]
246 pub fn setTimeZone(&self, a_time_zone: Option<&NSTimeZone>);
247
248 #[deprecated]
257 #[unsafe(method(years:months:days:hours:minutes:seconds:sinceDate:))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn years_months_days_hours_minutes_seconds_sinceDate(
260 &self,
261 yp: *mut NSInteger,
262 mop: *mut NSInteger,
263 dp: *mut NSInteger,
264 hp: *mut NSInteger,
265 mip: *mut NSInteger,
266 sp: *mut NSInteger,
267 date: &NSCalendarDate,
268 );
269
270 #[deprecated]
271 #[unsafe(method(distantFuture))]
272 #[unsafe(method_family = none)]
273 pub fn distantFuture() -> Retained<Self>;
274
275 #[deprecated]
276 #[unsafe(method(distantPast))]
277 #[unsafe(method_family = none)]
278 pub fn distantPast() -> Retained<Self>;
279 );
280}
281
282#[cfg(feature = "NSDate")]
284impl NSCalendarDate {
285 extern_methods!(
286 #[unsafe(method(init))]
287 #[unsafe(method_family = init)]
288 pub fn init(this: Allocated<Self>) -> Retained<Self>;
289
290 #[unsafe(method(initWithTimeIntervalSinceReferenceDate:))]
291 #[unsafe(method_family = init)]
292 pub fn initWithTimeIntervalSinceReferenceDate(
293 this: Allocated<Self>,
294 ti: NSTimeInterval,
295 ) -> Retained<Self>;
296
297 #[cfg(feature = "NSCoder")]
298 #[unsafe(method(initWithCoder:))]
302 #[unsafe(method_family = init)]
303 pub unsafe fn initWithCoder(
304 this: Allocated<Self>,
305 coder: &NSCoder,
306 ) -> Option<Retained<Self>>;
307 );
308}
309
310#[cfg(feature = "NSDate")]
312impl NSCalendarDate {
313 extern_methods!(
314 #[unsafe(method(new))]
315 #[unsafe(method_family = new)]
316 pub fn new() -> Retained<Self>;
317 );
318}
319
320#[cfg(feature = "NSDate")]
321impl DefaultRetained for NSCalendarDate {
322 #[inline]
323 fn default_retained() -> Retained<Self> {
324 Self::new()
325 }
326}
327
328#[cfg(feature = "NSDate")]
330impl NSDate {
331 extern_methods!(
332 #[cfg(feature = "NSString")]
333 #[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
337 #[unsafe(method(dateWithNaturalLanguageString:locale:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn dateWithNaturalLanguageString_locale(
340 string: &NSString,
341 locale: Option<&AnyObject>,
342 ) -> Option<Retained<AnyObject>>;
343
344 #[cfg(feature = "NSString")]
345 #[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
346 #[unsafe(method(dateWithNaturalLanguageString:))]
347 #[unsafe(method_family = none)]
348 pub fn dateWithNaturalLanguageString(string: &NSString) -> Option<Retained<AnyObject>>;
349
350 #[cfg(feature = "NSString")]
351 #[deprecated = "Use NSDateFormatter instead"]
352 #[unsafe(method(dateWithString:))]
353 #[unsafe(method_family = none)]
354 pub fn dateWithString(a_string: &NSString) -> Retained<AnyObject>;
355
356 #[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
357 #[deprecated]
358 #[unsafe(method(dateWithCalendarFormat:timeZone:))]
359 #[unsafe(method_family = none)]
360 pub fn dateWithCalendarFormat_timeZone(
361 &self,
362 format: Option<&NSString>,
363 a_time_zone: Option<&NSTimeZone>,
364 ) -> Retained<NSCalendarDate>;
365
366 #[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
367 #[deprecated]
371 #[unsafe(method(descriptionWithCalendarFormat:timeZone:locale:))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn descriptionWithCalendarFormat_timeZone_locale(
374 &self,
375 format: Option<&NSString>,
376 a_time_zone: Option<&NSTimeZone>,
377 locale: Option<&AnyObject>,
378 ) -> Option<Retained<NSString>>;
379
380 #[cfg(feature = "NSString")]
381 #[deprecated = "Use NSDateFormatter instead"]
382 #[unsafe(method(initWithString:))]
383 #[unsafe(method_family = init)]
384 pub fn initWithString(
385 this: Allocated<Self>,
386 description: &NSString,
387 ) -> Option<Retained<Self>>;
388 );
389}