mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Added iOS 4.0 and later methods to NSDateComponents. These methods will probably show up in OS X 10.7 and are easy enough to add now.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31810 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e970eb14d6
commit
fe41357041
3 changed files with 49 additions and 1 deletions
|
@ -1,8 +1,13 @@
|
|||
2010-12-31 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||
|
||||
* Headers/Foundation/NSCalendar.h:
|
||||
* Source/NSCalendar.m: Added iOS 4.0 and later methods to NSDateComponents.
|
||||
|
||||
2010-12-31 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||
|
||||
* Resources/GNUmakefile:
|
||||
* Resources/Languages/Locale.canonical: Added mapping to go from long
|
||||
locale identifiers to short identifiers used by ICU.
|
||||
locale identifiers to the shorter identifiers used by ICU.
|
||||
* Source/NSLocale.m: Implemented -canonical* and -preferredLanaguges methods.
|
||||
|
||||
2010-12-31 14:03 David Chisnall <theraven@gna.org>
|
||||
|
|
|
@ -83,6 +83,12 @@ enum
|
|||
NSInteger _weekday;
|
||||
NSInteger _weekdayOrdinal;
|
||||
NSInteger _quarter;
|
||||
// FIXME: In reality these are only available on iOS > 4. Will probably show
|
||||
// up in OS X 10.7.
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
NSCalendar *_cal;
|
||||
NSTimeZone *_tz;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (NSInteger) day;
|
||||
|
@ -112,6 +118,14 @@ enum
|
|||
- (NSInteger) quarter;
|
||||
- (void) setQuarter: (NSInteger) v;
|
||||
#endif
|
||||
|
||||
// FIXME: In reality these are only available on iOS > 4.
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (NSCalendar *) calendar;
|
||||
- (NSTimeZone *) timeZone;
|
||||
- (void) setCalendar: (NSCalendar *) cal;
|
||||
- (void) setTimeZone: (NSTimeZone *) tz;
|
||||
#endif
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -390,6 +390,9 @@ static UCalendarDateFields _NSCalendarUnitToDateField (NSCalendarUnit unit)
|
|||
_week = NSUndefinedDateComponent;
|
||||
_weekday = NSUndefinedDateComponent;
|
||||
_weekdayOrdinal = NSUndefinedDateComponent;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
_quarter = NSUndefinedDateComponent;
|
||||
#endif
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -449,6 +452,16 @@ static UCalendarDateFields _NSCalendarUnitToDateField (NSCalendarUnit unit)
|
|||
return _year;
|
||||
}
|
||||
|
||||
- (NSCalendar *) calendar
|
||||
{
|
||||
return _cal;
|
||||
}
|
||||
|
||||
- (NSTimeZone *) timeZone
|
||||
{
|
||||
return _tz;
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void) setDay: (NSInteger) v
|
||||
|
@ -506,6 +519,22 @@ static UCalendarDateFields _NSCalendarUnitToDateField (NSCalendarUnit unit)
|
|||
_year = v;
|
||||
}
|
||||
|
||||
- (void) setCalendar: (NSCalendar *) cal
|
||||
{
|
||||
if (_cal)
|
||||
RELEASE(_cal);
|
||||
|
||||
_cal = RETAIN(cal);
|
||||
}
|
||||
|
||||
- (void) setTimeZone: (NSTimeZone *) tz
|
||||
{
|
||||
if (_tz)
|
||||
RELEASE(_tz);
|
||||
|
||||
_tz = RETAIN(tz);
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
if (NSShouldRetainWithZone(self, zone))
|
||||
|
|
Loading…
Reference in a new issue