Skip to content

Commit 276a05b

Browse files
Nullability annotations
1 parent c752cb6 commit 276a05b

File tree

1 file changed

+88
-88
lines changed

1 file changed

+88
-88
lines changed

Headers/Foundation/NSCalendar.h

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,24 @@ extern "C" {
4444
#endif
4545

4646
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
47-
GS_EXPORT NSString *const NSCalendarIdentifierGregorian;
48-
GS_EXPORT NSString *const NSCalendarIdentifierBuddhist;
49-
GS_EXPORT NSString *const NSCalendarIdentifierChinese;
50-
GS_EXPORT NSString *const NSCalendarIdentifierCoptic;
51-
GS_EXPORT NSString *const NSCalendarIdentifierEthiopicAmeteMihret;
52-
GS_EXPORT NSString *const NSCalendarIdentifierEthiopicAmeteAlem;
53-
GS_EXPORT NSString *const NSCalendarIdentifierHebrew;
54-
GS_EXPORT NSString *const NSCalendarIdentifierISO8601;
55-
GS_EXPORT NSString *const NSCalendarIdentifierIndian;
56-
GS_EXPORT NSString *const NSCalendarIdentifierIslamic;
57-
GS_EXPORT NSString *const NSCalendarIdentifierIslamicCivil;
58-
GS_EXPORT NSString *const NSCalendarIdentifierJapanese;
59-
GS_EXPORT NSString *const NSCalendarIdentifierPersian;
60-
GS_EXPORT NSString *const NSCalendarIdentifierRepublicOfChina;
47+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierGregorian;
48+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierBuddhist;
49+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierChinese;
50+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierCoptic;
51+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierEthiopicAmeteMihret;
52+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierEthiopicAmeteAlem;
53+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierHebrew;
54+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierISO8601;
55+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierIndian;
56+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierIslamic;
57+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierIslamicCivil;
58+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierJapanese;
59+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierPersian;
60+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierRepublicOfChina;
6161
#endif
6262
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
63-
GS_EXPORT NSString *const NSCalendarIdentifierIslamicTabular;
64-
GS_EXPORT NSString *const NSCalendarIdentifierIslamicUmmAlQura;
63+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierIslamicTabular;
64+
GS_EXPORT NSString * _Nonnull const NSCalendarIdentifierIslamicUmmAlQura;
6565
#endif
6666

6767
// NSCalendarOptions enum
@@ -179,10 +179,10 @@ GS_EXPORT_CLASS
179179
#endif
180180

181181
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
182-
- (NSCalendar *) calendar;
183-
- (NSTimeZone *) timeZone;
184-
- (void) setCalendar: (NSCalendar *) cal;
185-
- (void) setTimeZone: (NSTimeZone *) tz;
182+
- (NSCalendar * _Nullable) calendar;
183+
- (NSTimeZone * _Nullable) timeZone;
184+
- (void) setCalendar: (NSCalendar * _Nullable) cal;
185+
- (void) setTimeZone: (NSTimeZone * _Nullable) tz;
186186

187187
/**
188188
* <p>
@@ -194,7 +194,7 @@ GS_EXPORT_CLASS
194194
* calling this method.
195195
* </p>
196196
*/
197-
- (NSDate *) date;
197+
- (NSDate * _Nullable) date;
198198

199199
/** Returns the number of the week in this month. */
200200
- (NSInteger) weekOfMonth;
@@ -236,7 +236,7 @@ GS_EXPORT_CLASS
236236

237237
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
238238
- (BOOL) isValidDate;
239-
- (BOOL) isValidDateInCalendar: (NSCalendar *) calendar;
239+
- (BOOL) isValidDateInCalendar: (NSCalendar * _Nonnull) calendar;
240240
- (NSInteger) valueForComponent: (NSCalendarUnit) unit;
241241
- (void) setValue: (NSInteger) value
242242
forComponent: (NSCalendarUnit) unit;
@@ -260,12 +260,12 @@ GS_EXPORT_CLASS
260260
/**
261261
* Create a calendar with the given string as identifier.
262262
*/
263-
+ (id) calendarWithIdentifier: (NSString *) string;
263+
+ (id) calendarWithIdentifier: (NSString * _Nullable) string;
264264

265265
/**
266266
* Instantiate a calendar with the given string as identifier.
267267
*/
268-
- (id) initWithCalendarIdentifier: (NSString *) string;
268+
- (id) initWithCalendarIdentifier: (NSString * _Nullable) string;
269269

270270
/**
271271
* Returns the calendar identifier for the receiver.
@@ -275,8 +275,8 @@ GS_EXPORT_CLASS
275275
/**
276276
* Returns the calendar units specified by unitFlags for the given date object.
277277
*/
278-
- (NSDateComponents *) components: (NSUInteger) unitFlags
279-
fromDate: (NSDate *) date;
278+
- (NSDateComponents * _Nonnull) components: (NSUInteger) unitFlags
279+
fromDate: (NSDate * _Nonnull) date;
280280
/**
281281
* Compute the different between the specified components in the two dates.
282282
* Values are summed up as long as now higher-granularity unit is specified.
@@ -288,119 +288,119 @@ GS_EXPORT_CLASS
288288
* Please note that the NSWrapCalendarComponents option that should affect the
289289
* calculations is not presently supported.
290290
*/
291-
- (NSDateComponents *) components: (NSUInteger) unitFlags
292-
fromDate: (NSDate *) startingDate
293-
toDate: (NSDate *) resultDate
294-
options: (NSUInteger) opts;
291+
- (NSDateComponents * _Nonnull) components: (NSUInteger) unitFlags
292+
fromDate: (NSDate * _Nonnull) startingDate
293+
toDate: (NSDate * _Nonnull) resultDate
294+
options: (NSUInteger) opts;
295295

296296
/**
297297
* Returns a date object created by adding the NSDateComponents in comps to
298298
* to object date with the options specified by opts.
299299
*/
300-
- (NSDate *) dateByAddingComponents: (NSDateComponents *) comps
301-
toDate: (NSDate *) date
302-
options: (NSUInteger) opts;
300+
- (NSDate * _Nonnull) dateByAddingComponents: (NSDateComponents * _Nonnull) comps
301+
toDate: (NSDate * _Nonnull) date
302+
options: (NSUInteger) opts;
303303

304304
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
305305

306306
/**
307307
*
308308
*/
309-
- (NSDateComponents *)components:(NSCalendarUnit)unitFlags
310-
fromDateComponents:(NSDateComponents *)startingDateComp
311-
toDateComponents:(NSDateComponents *)resultDateComp
312-
options:(NSCalendarOptions)options;
309+
- (NSDateComponents * _Nonnull)components:(NSCalendarUnit)unitFlags
310+
fromDateComponents:(NSDateComponents * _Nonnull)startingDateComp
311+
toDateComponents:(NSDateComponents * _Nonnull)resultDateComp
312+
options:(NSCalendarOptions)options;
313313

314314
/**
315315
*
316316
*/
317-
- (NSDate *)dateByAddingUnit:(NSCalendarUnit)unit
318-
value:(NSInteger)value
319-
toDate:(NSDate *)date
320-
options:(NSCalendarOptions)options;
317+
- (NSDate * _Nullable)dateByAddingUnit:(NSCalendarUnit)unit
318+
value:(NSInteger)value
319+
toDate:(NSDate * _Nonnull)date
320+
options:(NSCalendarOptions)options;
321321

322322
/**
323323
*
324324
*/
325-
- (NSDate *)dateBySettingHour:(NSInteger)h
326-
minute:(NSInteger)m
327-
second:(NSInteger)s
328-
ofDate:(NSDate *)date
329-
options:(NSCalendarOptions)opts;
325+
- (NSDate * _Nullable)dateBySettingHour:(NSInteger)h
326+
minute:(NSInteger)m
327+
second:(NSInteger)s
328+
ofDate:(NSDate * _Nonnull)date
329+
options:(NSCalendarOptions)opts;
330330

331331
/**
332332
*
333333
*/
334-
- (NSDate *)dateWithEra:(NSInteger)eraValue
335-
year:(NSInteger)yearValue
336-
month:(NSInteger)monthValue
337-
day:(NSInteger)dayValue
338-
hour:(NSInteger)hourValue
339-
minute:(NSInteger)minuteValue
340-
second:(NSInteger)secondValue
341-
nanosecond:(NSInteger)nanosecondValue;
334+
- (NSDate * _Nullable)dateWithEra:(NSInteger)eraValue
335+
year:(NSInteger)yearValue
336+
month:(NSInteger)monthValue
337+
day:(NSInteger)dayValue
338+
hour:(NSInteger)hourValue
339+
minute:(NSInteger)minuteValue
340+
second:(NSInteger)secondValue
341+
nanosecond:(NSInteger)nanosecondValue;
342342

343343
/**
344344
*
345345
*/
346-
- (NSDate *)startOfDayForDate:(NSDate *)date;
346+
- (NSDate * _Nonnull)startOfDayForDate:(NSDate * _Nonnull)date;
347347

348348
/**
349349
*
350350
*/
351-
- (BOOL)isDate:(NSDate *)date1 inSameDayAsDate:(NSDate *)date2;
351+
- (BOOL)isDate:(NSDate * _Nonnull)date1 inSameDayAsDate:(NSDate * _Nonnull)date2;
352352

353353
/**
354354
*
355355
*/
356-
- (BOOL)isDate:(NSDate *)date1 equalToDate:(NSDate *)date2 toUnitGranularity:(NSCalendarUnit)unit;
356+
- (BOOL)isDate:(NSDate * _Nonnull)date1 equalToDate:(NSDate * _Nonnull)date2 toUnitGranularity:(NSCalendarUnit)unit;
357357

358358
/**
359359
*
360360
*/
361-
- (NSComparisonResult)compareDate:(NSDate *)date1 toDate:(NSDate *)date2 toUnitGranularity:(NSCalendarUnit)unit;
361+
- (NSComparisonResult)compareDate:(NSDate * _Nonnull)date1 toDate:(NSDate * _Nonnull)date2 toUnitGranularity:(NSCalendarUnit)unit;
362362

363363
/**
364364
*
365365
*/
366-
- (NSDate *)dateBySettingUnit:(NSCalendarUnit)unit value:(NSInteger)v ofDate:(NSDate *)date options:(NSCalendarOptions)opts;
366+
- (NSDate * _Nonnull)dateBySettingUnit:(NSCalendarUnit)unit value:(NSInteger)v ofDate:(NSDate * _Nonnull)date options:(NSCalendarOptions)opts;
367367

368368
/**
369369
*
370370
*/
371-
- (BOOL)isDateInWeekend:(NSDate *)date;
371+
- (BOOL)isDateInWeekend:(NSDate * _Nonnull)date;
372372

373373
/**
374374
*
375375
*/
376-
- (BOOL)nextWeekendStartDate:(out NSDate * _Nullable *)datep interval:(out NSTimeInterval *)tip options:(NSCalendarOptions)options afterDate:(NSDate *)date;
376+
- (BOOL)nextWeekendStartDate:(out NSDate * _Nullable *)datep interval:(out NSTimeInterval * _Nullable)tip options:(NSCalendarOptions)options afterDate:(NSDate * _Nonnull)date;
377377

378378
/**
379379
*
380380
*/
381-
- (BOOL)isDateInToday:(NSDate *)date;
381+
- (BOOL)isDateInToday:(NSDate * _Nonnull)date;
382382

383383
/**
384384
*
385385
*/
386-
- (BOOL)isDateInTomorrow:(NSDate *)date;
386+
- (BOOL)isDateInTomorrow:(NSDate * _Nonnull)date;
387387

388388
#endif
389389

390390
/**
391391
* Creates an NSDate from NSDateComponents in comps.
392392
*/
393-
- (NSDate *) dateFromComponents: (NSDateComponents *) comps;
393+
- (NSDate * _Nullable) dateFromComponents: (NSDateComponents *) comps;
394394

395395
/**
396396
* Returns the locale of the receiver.
397397
*/
398-
- (NSLocale *) locale;
398+
- (NSLocale * _Nullable) locale;
399399

400400
/**
401401
* Sets the locale of the receiver.
402402
*/
403-
- (void)setLocale: (NSLocale *) locale;
403+
- (void)setLocale: (NSLocale * _Nullable) locale;
404404

405405
/**
406406
* Returns the integer value of the first weekday (0-6).
@@ -425,12 +425,12 @@ GS_EXPORT_CLASS
425425
/**
426426
* Returns the NSTimeZone associated with the receiver.
427427
*/
428-
- (NSTimeZone *) timeZone;
428+
- (NSTimeZone * _Nonnull) timeZone;
429429

430430
/**
431431
* Sets tz as the current NSTimeZone of the receiver.
432432
*/
433-
- (void) setTimeZone: (NSTimeZone *) tz;
433+
- (void) setTimeZone: (NSTimeZone * _Nonnull) tz;
434434

435435
/**
436436
* Returns the maximum range of unit.
@@ -448,14 +448,14 @@ GS_EXPORT_CLASS
448448
*/
449449
- (NSUInteger) ordinalityOfUnit: (NSCalendarUnit) smaller
450450
inUnit: (NSCalendarUnit) larger
451-
forDate: (NSDate *) date;
451+
forDate: (NSDate * _Nonnull) date;
452452

453453
/**
454454
* Returns the range of unit smaller in larger in date.
455455
*/
456456
- (NSRange) rangeOfUnit: (NSCalendarUnit) smaller
457457
inUnit: (NSCalendarUnit) larger
458-
forDate: (NSDate *) date;
458+
forDate: (NSDate * _Nonnull) date;
459459

460460
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
461461
/**
@@ -467,44 +467,44 @@ GS_EXPORT_CLASS
467467
* Returns by referene the started time and duration of a given unit containing the given date.
468468
*/
469469
- (BOOL) rangeOfUnit: (NSCalendarUnit) unit
470-
startDate: (NSDate **) datep
470+
startDate: (NSDate * _Nullable * _Nullable) datep
471471
interval: (NSTimeInterval *)tip
472-
forDate: (NSDate *)date;
472+
forDate: (NSDate * _Nonnull)date;
473473
#endif
474474

475475
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
476476
/**
477477
* Returns by reference the era, year, month, and day from the given date.
478478
*/
479-
- (void) getEra: (NSInteger *)eraValuePointer
480-
year: (NSInteger *)yearValuePointer
481-
month: (NSInteger *)monthValuePointer
482-
day: (NSInteger *)dayValuePointer
483-
fromDate: (NSDate *)date;
479+
- (void) getEra: (NSInteger * _Nullable)eraValuePointer
480+
year: (NSInteger * _Nullable)yearValuePointer
481+
month: (NSInteger * _Nullable)monthValuePointer
482+
day: (NSInteger * _Nullable)dayValuePointer
483+
fromDate: (NSDate * _Nonnull)date;
484484

485485
/**
486486
* Returns by reference the hour, minute, second, and nanosecond from the given date.
487487
*/
488-
- (void) getHour: (NSInteger *)hourValuePointer
489-
minute: (NSInteger *)minuteValuePointer
490-
second: (NSInteger *)secondValuePointer
491-
nanosecond: (NSInteger *)nanosecondValuePointer
492-
fromDate: (NSDate *)date;
488+
- (void) getHour: (NSInteger * _Nullable)hourValuePointer
489+
minute: (NSInteger * _Nullable)minuteValuePointer
490+
second: (NSInteger * _Nullable)secondValuePointer
491+
nanosecond: (NSInteger * _Nullable)nanosecondValuePointer
492+
fromDate: (NSDate * _Nonnull)date;
493493

494494
/**
495495
* Returns by reference the era, year, week of year, and weekday from the given date.
496496
*/
497-
- (void) getEra: (NSInteger *)eraValuePointer
498-
yearForWeekOfYear: (NSInteger *)yearValuePointer
499-
weekOfYear: (NSInteger *)weekValuePointer
500-
weekday: (NSInteger *)weekdayValuePointer
501-
fromDate: (NSDate *)date;
497+
- (void) getEra: (NSInteger * _Nullable)eraValuePointer
498+
yearForWeekOfYear: (NSInteger * _Nullable)yearValuePointer
499+
weekOfYear: (NSInteger * _Nullable)weekValuePointer
500+
weekday: (NSInteger * _Nullable)weekdayValuePointer
501+
fromDate: (NSDate * _Nonnull)date;
502502

503503
/**
504504
* Returns the integer value of the specified unit from the given date.
505505
*/
506506
- (NSInteger) component: (NSCalendarUnit)unit
507-
fromDate: (NSDate *)date;
507+
fromDate: (NSDate * _Nonnull)date;
508508
#endif
509509

510510
@end

0 commit comments

Comments
 (0)