Implemented doesRelativeDateFormatting methods.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31994 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Bidigaray 2011-02-03 02:15:16 +00:00
parent 1c3cad8be8
commit a234bad5f3
2 changed files with 21 additions and 12 deletions

View file

@ -1,3 +1,8 @@
2011-02-02 Stefan Bidigaray <stefanbidi@gmail.com>
* Source/NSDateFormatter.m: ([-doesRelativeDateFormatting])
([-setDoesRelativeDateFormatting:]) Implemented methods.
2011-02-01 Richard Frith-Macdonald <rfm@gnu.org> 2011-02-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPointerArray.m: ([-allObjects]) implement missing method. * Source/NSPointerArray.m: ([-allObjects]) implement missing method.

View file

@ -43,6 +43,8 @@
// This is defined to be the same as UDAT_RELATIVE
#define FormatterDoesRelativeDateFormatting (1<<16)
#define BUFFER_SIZE 1024 #define BUFFER_SIZE 1024
@interface NSDateFormatter (PrivateMethods) @interface NSDateFormatter (PrivateMethods)
@ -54,18 +56,20 @@
static inline NSInteger _NSToUDateFormatStyle (NSDateFormatterStyle style) static inline NSInteger _NSToUDateFormatStyle (NSDateFormatterStyle style)
{ {
#if GS_USE_ICU == 1 #if GS_USE_ICU == 1
NSInteger relative =
(style & FormatterDoesRelativeDateFormatting) ? UDAT_RELATIVE : 0;
switch (style) switch (style)
{ {
case NSDateFormatterNoStyle: case NSDateFormatterNoStyle:
return UDAT_NONE; return (relative | UDAT_NONE);
case NSDateFormatterShortStyle: case NSDateFormatterShortStyle:
return UDAT_SHORT; return (relative | UDAT_SHORT);
case NSDateFormatterMediumStyle: case NSDateFormatterMediumStyle:
return UDAT_MEDIUM; return (relative | UDAT_MEDIUM);
case NSDateFormatterLongStyle: case NSDateFormatterLongStyle:
return UDAT_LONG; return (relative | UDAT_LONG);
case NSDateFormatterFullStyle: case NSDateFormatterFullStyle:
return UDAT_FULL; return (relative | UDAT_FULL);
} }
#endif #endif
return -1; return -1;
@ -257,12 +261,12 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
- (BOOL) generatesCalendarDates - (BOOL) generatesCalendarDates
{ {
return NO; return NO; // FIXME
} }
- (void) setGeneratesCalendarDates: (BOOL) flag - (void) setGeneratesCalendarDates: (BOOL) flag
{ {
return; return; // FIXME
} }
- (BOOL) isLenient - (BOOL) isLenient
@ -359,7 +363,7 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
range: (inout NSRange *) range range: (inout NSRange *) range
error: (out NSError **) error error: (out NSError **) error
{ {
return NO; return NO; // FIXME
} }
- (void) setDateFormat: (NSString *) string - (void) setDateFormat: (NSString *) string
@ -427,12 +431,12 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
- (NSDate *) defaultDate - (NSDate *) defaultDate
{ {
return nil; return nil; // FIXME
} }
- (void) setDefaultDate: (NSDate *) date - (void) setDefaultDate: (NSDate *) date
{ {
return; return; // FIXME
} }
- (NSLocale *) locale - (NSLocale *) locale
@ -888,12 +892,12 @@ static NSDateFormatterBehavior _defaultBehavior = 0;
- (BOOL) doesRelativeDateFormatting - (BOOL) doesRelativeDateFormatting
{ {
return NO; return (_dateStyle & FormatterDoesRelativeDateFormatting) ? YES : NO;
} }
- (void) setDoesRelativeDateFormatting: (BOOL) flag - (void) setDoesRelativeDateFormatting: (BOOL) flag
{ {
return; _dateStyle |= FormatterDoesRelativeDateFormatting;
} }
@end @end