Added stub for 10.4+ NSNumberFormatter methods.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31858 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Bidigaray 2011-01-08 18:05:42 +00:00
parent 8bf4eacfa7
commit 8af60212d5
5 changed files with 941 additions and 256 deletions

View file

@ -1,3 +1,10 @@
2011-01-07 Richard Frith-Macdonald <rfm@gnu.org>
* configure:
* configure.ac: Added check for unicode/unum.h.
* Headers/Foundation/NSNumberFormatter.h:
* Source/NSNumberFormatter.m: Added stub for 10.4+ methods.
2011-01-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSObject.m: Make zombie log message match current OSX.

View file

@ -37,7 +37,50 @@
extern "C" {
#endif
@class NSString, NSAttributedString, NSDictionary;
@class NSString, NSAttributedString, NSDictionary,
NSError, NSLocale, NSNumber;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
enum
{
NSNumberFormatterNoStyle = 0,
NSNumberFormatterDecimalStyle = 1,
NSNumberFormatterCurrencyStyle = 2,
NSNumberFormatterPercentStyle = 3,
NSNumberFormatterScientificStyle = 4,
NSNumberFormatterSpellOutStyle = 5
};
typedef NSUInteger NSNumberFormatterStyle;
enum
{
NSNumberFormatterBehaviorDefault = 0,
NSNumberFormatterBehavior10_0 = 1000,
NSNumberFormatterBehavior10_4 = 1040,
};
typedef NSUInteger NSNumberFormatterBehavior;
enum
{
NSNumberFormatterPadBeforePrefix = 0,
NSNumberFormatterPadAfterPrefix = 1,
NSNumberFormatterPadBeforeSuffix = 2,
NSNumberFormatterPadAfterSuffix = 3
};
typedef NSUInteger NSNumberFormatterPadPosition;
enum
{
NSNumberFormatterRoundCeiling = 0,
NSNumberFormatterRoundFloor = 1,
NSNumberFormatterRoundDown = 2,
NSNumberFormatterRoundUp = 3,
NSNumberFormatterRoundHalfEven = 4,
NSNumberFormatterRoundHalfDown = 5,
NSNumberFormatterRoundHalfUp = 6
};
typedef NSUInteger NSNumberFormatterRoundingMode;
#endif
/**
* <p><em><strong>This class is currently not implemented in GNUstep! All set
@ -304,16 +347,144 @@ extern "C" {
*/
- (void) setMinimum: (NSDecimalNumber*)aMinimum;
/**
* Returns the string version of this number based on the format
* specified.
*/
- (NSString *) stringFromNumber: (NSNumber *)number;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
- (void) setFormatterBehavior: (NSNumberFormatterBehavior) behavior;
- (NSNumberFormatterBehavior) formatterBehavior;
+ (void) setDefaultFormatterBehavior: (NSNumberFormatterBehavior) behavior;
+ (NSNumberFormatterBehavior) defaultFormatterBehavior;
- (void) setNumberStyle: (NSNumberFormatterStyle) style;
- (NSNumberFormatterStyle) numberStyle;
- (void) setGeneratesDecimalNumbers: (BOOL) flag;
- (BOOL) generatesDecimalNubmers;
- (void) setLocale: (NSLocale *) locale;
- (NSLocale *) locale;
- (void) setRoundingIncrement: (NSNumber *) number;
- (NSNumber *) roundingIncrement;
- (void) setRoundingMode: (NSNumberFormatterRoundingMode) mode;
- (NSNumberFormatterRoundingMode) roundingMode;
- (void) setFormatWidth: (NSUInteger) number;
- (NSUInteger) formatWidth;
- (void) setMultiplier: (NSNumber *) number;
- (NSNumber *) multiplier;
- (void) setPercentSymbol: (NSString *) string;
- (NSString *) percentSymbol;
- (void) setPerMillSymbol: (NSString *) string;
- (NSString *) perMillSymbol;
- (void) setMinusSign: (NSString *) string;
- (NSString *) minusSign;
- (void) setPlusSign: (NSString *) string;
- (NSString *) plusSign;
- (void) setExponentSymbol: (NSString *) string;
- (NSString *) exponentSymbol;
- (void) setZeroSymbol: (NSString *) string;
- (NSString *) zeroSymbol;
- (void) setNilSymbol: (NSString *) string;
- (NSString *) nilSymbol;
- (void) setNotANumberSymbol: (NSString *) string;
- (NSString *) notANumberSymbol;
- (void) setNegativeInfinitySymbol: (NSString *) string;
- (NSString *) negativeInfinitySymbol;
- (void) setPositiveInfinitySymbol: (NSString *) string;
- (NSString *) positiveInfinitySymbol;
- (void) setCurrencySymbol: (NSString *) string;
- (NSString *) currencySymbol;
- (void) setCurrencyCode: (NSString *) string;
- (NSString *) currencyCode;
- (void) setInternationalCurrencySymbol: (NSString *) string;
- (NSString *) internationalCurrencySymbol;
- (void) setPositivePrefix: (NSString *) string;
- (NSString *) positivePrefix;
- (void) setPositiveSuffix: (NSString *) string;
- (NSString *) positiveSuffix;
- (void) setNegativePrefix: (NSString *) string;
- (NSString *) negativePrefix;
- (void) setNegativeSuffix: (NSString *) string;
- (NSString *) negativeSuffix;
- (void) setTextAttributesForZero: (NSDictionary *) newAttributes;
- (NSDictionary *) textAttributesForZero;
- (void) setTextAttributesForNil: (NSDictionary *) newAttributes;
- (NSDictionary *) textAttributesForNil;
- (void) setTextAttributesForNotANumber: (NSDictionary *) newAttributes;
- (NSDictionary *) textAttributesForNotANumber;
- (void) setTextAttributesForPositiveInfinity: (NSDictionary *) newAttributes;
- (NSDictionary *) textAttributesForPositiveInfinity;
- (void) setTextAttributesForNegativeInfinity: (NSDictionary *) newAttributes;
- (NSDictionary *) textAttributesForNegativeInfinity;
- (void) setGroupingSeparator: (NSString *) string;
- (NSString *) groupingSeparator;
- (void) setUsesGroupingSeparator: (BOOL) flag;
- (BOOL) usesGroupingSeparator;
- (void) setAlwaysShowsDecimalSeparator: (BOOL) flag;
- (BOOL) alwaysShowsDecimalSeparator;
- (void) setCurrencyDecimalSeparator: (NSString *) string;
- (NSString *) currencyDecimalSeparator;
- (void) setGroupingSize: (NSUInteger) number;
- (NSUInteger) groupingSize;
- (void) setSecondaryGroupingSize: (NSUInteger) number;
- (NSUInteger) secondaryGroupingSize;
- (void) setPaddingCharacter: (NSString *) string;
- (NSString *) paddingCharacter;
- (void) setPaddingPosition: (NSNumberFormatterPadPosition) position;
- (NSNumberFormatterPadPosition) paddingPosition;
- (void) setMinimumIntegerDigits: (NSUInteger) number;
- (NSUInteger) minimumIntegerDigits;
- (void) setMinimumFractionDigits: (NSUInteger) number;
- (NSUInteger) minimumFractionDigits;
- (void) setMaximumIntegerDigits: (NSUInteger) number;
- (NSUInteger) maximumIntegerDigits;
- (void) setMaximumFractionDigits: (NSUInteger) number;
- (NSUInteger) maximumFractionDigits;
/**
* Returns the number for this string.
*/
- (NSNumber *) numberFromString: (NSString *)string;
- (NSNumber *) numberFromString: (NSString *) string;
/**
* Returns the string version of this number based on the format
* specified.
*/
- (NSString *) stringFromNumber: (NSNumber *) number;
- (BOOL) getObjectValue: (out id *) anObject
forString: (NSString *) aString
range: (NSRange) rangep
error: (out NSError **) error;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (void) setUsesSignificantDigits: (BOOL) flag;
- (BOOL) usesSignificantDigits;
- (void) setMinimumSignificantDigits: (NSUInteger) number;
- (NSUInteger) minimumSignificantDigits;
- (void) setMaximumSignificantDigits: (NSUInteger) number;
- (NSUInteger) maximumSignificantDigits;
- (void) setCurrencyGroupingSeparator: (NSString *) string;
- (NSString *) currencyGroupingSeparator;
- (void) setLenient: (BOOL) flag;
- (BOOL) isLenient;
- (void) setPartialStringValidationEnabled: (BOOL) enabled;
- (BOOL) isPartialStringValidationEnabled;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
+ (NSString *) localizedStringFromNumber: (NSNumber *) num
numberStyle: (NSNumberFormatterStyle) localizationStyle;
#endif
@end
#if defined(__cplusplus)

View file

@ -32,13 +32,20 @@
#import "Foundation/NSAttributedString.h"
#import "Foundation/NSDecimalNumber.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSError.h"
#import "Foundation/NSException.h"
#import "Foundation/NSLocale.h"
#import "Foundation/NSValue.h"
#import "Foundation/NSNumberFormatter.h"
#import "Foundation/NSUserDefaults.h"
#import "Foundation/NSCharacterSet.h"
#import "GNUstepBase/GSLocale.h"
#if defined(HAVE_UNICODE_UNUM_H)
# include <unicode/unum.h>
#endif
@implementation NSNumberFormatter
- (BOOL) allowsFloats
@ -800,4 +807,527 @@
return number;
}
- (void) setFormatterBehavior: (NSNumberFormatterBehavior) behavior
{
return;
}
- (NSNumberFormatterBehavior) formatterBehavior
{
return 0;
}
+ (void) setDefaultFormatterBehavior: (NSNumberFormatterBehavior) behavior
{
return;
}
+ (NSNumberFormatterBehavior) defaultFormatterBehavior
{
return 0;
}
- (void) setNumberStyle: (NSNumberFormatterStyle) style
{
return;
}
- (NSNumberFormatterStyle) numberStyle
{
return 0;
}
- (void) setGeneratesDecimalNumbers: (BOOL) flag
{
return;
}
- (BOOL) generatesDecimalNubmers
{
return NO;
}
- (void) setLocale: (NSLocale *) locale
{
return;
}
- (NSLocale *) locale
{
return nil;
}
- (void) setRoundingIncrement: (NSNumber *) number
{
return;
}
- (NSNumber *) roundingIncrement
{
return nil;
}
- (void) setRoundingMode: (NSNumberFormatterRoundingMode) mode
{
return;
}
- (NSNumberFormatterRoundingMode) roundingMode
{
return 0;
}
- (void) setFormatWidth: (NSUInteger) number
{
return;
}
- (NSUInteger) formatWidth
{
return 0;
}
- (void) setMultiplier: (NSNumber *) number
{
return;
}
- (NSNumber *) multiplier
{
return nil;
}
- (void) setPercentSymbol: (NSString *) string
{
return;
}
- (NSString *) percentSymbol
{
return nil;
}
- (void) setPerMillSymbol: (NSString *) string
{
return;
}
- (NSString *) perMillSymbol
{
return nil;
}
- (void) setMinusSign: (NSString *) string
{
return;
}
- (NSString *) minusSign
{
return nil;
}
- (void) setPlusSign: (NSString *) string
{
return;
}
- (NSString *) plusSign
{
return nil;
}
- (void) setExponentSymbol: (NSString *) string
{
return;
}
- (NSString *) exponentSymbol
{
return nil;
}
- (void) setZeroSymbol: (NSString *) string
{
return;
}
- (NSString *) zeroSymbol
{
return nil;
}
- (void) setNilSymbol: (NSString *) string
{
return;
}
- (NSString *) nilSymbol
{
return nil;
}
- (void) setNotANumberSymbol: (NSString *) string
{
return;
}
- (NSString *) notANumberSymbol
{
return nil;
}
- (void) setNegativeInfinitySymbol: (NSString *) string
{
return;
}
- (NSString *) negativeInfinitySymbol
{
return nil;
}
- (void) setPositiveInfinitySymbol: (NSString *) string
{
return;
}
- (NSString *) positiveInfinitySymbol
{
return nil;
}
- (void) setCurrencySymbol: (NSString *) string
{
return;
}
- (NSString *) currencySymbol
{
return nil;
}
- (void) setCurrencyCode: (NSString *) string
{
return;
}
- (NSString *) currencyCode
{
return nil;
}
- (void) setInternationalCurrencySymbol: (NSString *) string
{
return;
}
- (NSString *) internationalCurrencySymbol
{
return nil;
}
- (void) setPositivePrefix: (NSString *) string
{
return;
}
- (NSString *) positivePrefix
{
return nil;
}
- (void) setPositiveSuffix: (NSString *) string
{
return;
}
- (NSString *) positiveSuffix
{
return nil;
}
- (void) setNegativePrefix: (NSString *) string
{
return;
}
- (NSString *) negativePrefix
{
return nil;
}
- (void) setNegativeSuffix: (NSString *) string
{
return;
}
- (NSString *) negativeSuffix
{
return nil;
}
- (void) setTextAttributesForZero: (NSDictionary *) newAttributes
{
return;
}
- (NSDictionary *) textAttributesForZero
{
return nil;
}
- (void) setTextAttributesForNil: (NSDictionary *) newAttributes
{
return;
}
- (NSDictionary *) textAttributesForNil
{
return nil;
}
- (void) setTextAttributesForNotANumber: (NSDictionary *) newAttributes
{
return;
}
- (NSDictionary *) textAttributesForNotANumber
{
return nil;
}
- (void) setTextAttributesForPositiveInfinity: (NSDictionary *) newAttributes
{
return;
}
- (NSDictionary *) textAttributesForPositiveInfinity
{
return nil;
}
- (void) setTextAttributesForNegativeInfinity: (NSDictionary *) newAttributes
{
return;
}
- (NSDictionary *) textAttributesForNegativeInfinity
{
return nil;
}
- (void) setGroupingSeparator: (NSString *) string
{
return;
}
- (NSString *) groupingSeparator
{
return nil;
}
- (void) setUsesGroupingSeparator: (BOOL) flag
{
return;
}
- (BOOL) usesGroupingSeparator
{
return NO;
}
- (void) setAlwaysShowsDecimalSeparator: (BOOL) flag
{
return;
}
- (BOOL) alwaysShowsDecimalSeparator
{
return NO;
}
- (void) setCurrencyDecimalSeparator: (NSString *) string
{
return;
}
- (NSString *) currencyDecimalSeparator
{
return nil;
}
- (void) setGroupingSize: (NSUInteger) number
{
return;
}
- (NSUInteger) groupingSize
{
return 0;
}
- (void) setSecondaryGroupingSize: (NSUInteger) number
{
return;
}
- (NSUInteger) secondaryGroupingSize
{
return 0;
}
- (void) setPaddingCharacter: (NSString *) string
{
return;
}
- (NSString *) paddingCharacter
{
return nil;
}
- (void) setPaddingPosition: (NSNumberFormatterPadPosition) position
{
return;
}
- (NSNumberFormatterPadPosition) paddingPosition
{
return 0;
}
- (void) setMinimumIntegerDigits: (NSUInteger) number
{
return;
}
- (NSUInteger) minimumIntegerDigits
{
return 0;
}
- (void) setMinimumFractionDigits: (NSUInteger) number
{
return;
}
- (NSUInteger) minimumFractionDigits
{
return 0;
}
- (void) setMaximumIntegerDigits: (NSUInteger) number
{
return;
}
- (NSUInteger) maximumIntegerDigits
{
return 0;
}
- (void) setMaximumFractionDigits: (NSUInteger) number
{
return;
}
- (NSUInteger) maximumFractionDigits
{
return 0;
}
- (BOOL) getObjectValue: (out id *) anObject
forString: (NSString *) aString
range: (NSRange) rangep
error: (out NSError **) error
{
return NO;
}
- (void) setUsesSignificantDigits: (BOOL) flag
{
return;
}
- (BOOL) usesSignificantDigits
{
return NO;
}
- (void) setMinimumSignificantDigits: (NSUInteger) number
{
return;
}
- (NSUInteger) minimumSignificantDigits
{
return 0;
}
- (void) setMaximumSignificantDigits: (NSUInteger) number
{
return;
}
- (NSUInteger) maximumSignificantDigits
{
return 0;
}
- (void) setCurrencyGroupingSeparator: (NSString *) string
{
return;
}
- (NSString *) currencyGroupingSeparator
{
return nil;
}
- (void) setLenient: (BOOL) flag
{
return;
}
- (BOOL) isLenient
{
return NO;
}
- (void) setPartialStringValidationEnabled: (BOOL) enabled
{
return;
}
- (BOOL) isPartialStringValidationEnabled
{
return NO;
}
+ (NSString *) localizedStringFromNumber: (NSNumber *) num
numberStyle: (NSNumberFormatterStyle) localizationStyle
{
return nil;
}
@end

473
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -2690,7 +2690,7 @@ if test $enable_icu = yes; then
AC_CHECK_ICU(4.0, have_icu=yes, have_icu=no)
if test "$have_icu" = "yes"; then
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(unicode/uloc.h unicode/ulocdata.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h)
AC_CHECK_HEADERS(unicode/uloc.h unicode/ulocdata.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unum.h)
LIBS="$LIBS $ICU_LIBS"
HAVE_ICU=1
else