mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Finished calendar code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31937 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4d6360552e
commit
a33c9a2da0
3 changed files with 31 additions and 9 deletions
|
@ -1,6 +1,11 @@
|
||||||
2011-01-23 Stefan Bidigaray <stefanbidi@gmail.com>
|
2011-01-23 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||||
|
|
||||||
* Headers/Foundation/NSDateFormatter.m:
|
* Headers/Foundation/NSDateFormatter.h:
|
||||||
|
* Source/NSDateFormatter.m: Redo the calendar code.
|
||||||
|
|
||||||
|
2011-01-23 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||||
|
|
||||||
|
* Headers/Foundation/NSDateFormatter.h:
|
||||||
* Source/NSDateFormatter.m: Add calendar.
|
* Source/NSDateFormatter.m: Add calendar.
|
||||||
* Source/NSNumberFormatter.m: Compile again.
|
* Source/NSNumberFormatter.m: Compile again.
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,6 @@ typedef NSUInteger NSDateFormatterBehavior;
|
||||||
NSUInteger _behavior;
|
NSUInteger _behavior;
|
||||||
NSLocale *_locale;
|
NSLocale *_locale;
|
||||||
NSTimeZone *_tz;
|
NSTimeZone *_tz;
|
||||||
NSCalendar *_calendar;
|
|
||||||
NSDateFormatterStyle _timeStyle;
|
NSDateFormatterStyle _timeStyle;
|
||||||
NSDateFormatterStyle _dateStyle;
|
NSDateFormatterStyle _dateStyle;
|
||||||
void *_formatter;
|
void *_formatter;
|
||||||
|
|
|
@ -87,7 +87,6 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
_behavior = _defaultBehavior;
|
_behavior = _defaultBehavior;
|
||||||
_locale = RETAIN([NSLocale currentLocale]);
|
_locale = RETAIN([NSLocale currentLocale]);
|
||||||
_tz = RETAIN([NSTimeZone defaultTimeZone]);
|
_tz = RETAIN([NSTimeZone defaultTimeZone]);
|
||||||
_calendar = RETAIN([NSCalendar currentCalendar]);
|
|
||||||
|
|
||||||
[self _resetUDateFormat];
|
[self _resetUDateFormat];
|
||||||
|
|
||||||
|
@ -404,17 +403,24 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
|
|
||||||
- (NSCalendar *) calendar
|
- (NSCalendar *) calendar
|
||||||
{
|
{
|
||||||
return _calendar;
|
return [_locale objectForKey: NSLocaleCalendar];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setCalendar: (NSCalendar *) calendar
|
- (void) setCalendar: (NSCalendar *) calendar
|
||||||
{
|
{
|
||||||
if (calendar == _calendar)
|
NSMutableDictionary *dict;
|
||||||
return;
|
NSLocale *locale;
|
||||||
RELEASE(_calendar);
|
|
||||||
|
|
||||||
_calendar = RETAIN(calendar);
|
dict = [[NSLocale componentsFromLocaleIdentifier: [_locale localeIdentifier]]
|
||||||
[self _resetUDateFormat];
|
mutableCopy];
|
||||||
|
[dict setValue: calendar forKey: NSLocaleCalendar];
|
||||||
|
locale = [[NSLocale alloc] initWithLocaleIdentifier:
|
||||||
|
[NSLocale localeIdentifierFromComponents: (NSDictionary *)dict]];
|
||||||
|
[self setLocale: locale];
|
||||||
|
/* Don't have to use udat_setCalendar here because -setLocale: will take care
|
||||||
|
of setting the calendar when it resets the formatter. */
|
||||||
|
RELEASE(locale);
|
||||||
|
RELEASE(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDate *) defaultDate
|
- (NSDate *) defaultDate
|
||||||
|
@ -483,7 +489,13 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
|
|
||||||
- (NSString *) AMSymbol
|
- (NSString *) AMSymbol
|
||||||
{
|
{
|
||||||
|
#if GS_USE_ICU == 1
|
||||||
|
NSArray *array = [self _getSymbols: UDAT_AM_PMS];
|
||||||
|
|
||||||
|
return [array objectAtIndex: 0];
|
||||||
|
#else
|
||||||
return nil;
|
return nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setAMSymbol: (NSString *) string
|
- (void) setAMSymbol: (NSString *) string
|
||||||
|
@ -493,7 +505,13 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
|
||||||
|
|
||||||
- (NSString *) PMSymbol
|
- (NSString *) PMSymbol
|
||||||
{
|
{
|
||||||
|
#if GS_USE_ICU == 1
|
||||||
|
NSArray *array = [self _getSymbols: UDAT_AM_PMS];
|
||||||
|
|
||||||
|
return [array objectAtIndex: 1];
|
||||||
|
#else
|
||||||
return nil;
|
return nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setPMSymbol: (NSString *) string
|
- (void) setPMSymbol: (NSString *) string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue