Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

dcfmtsym.h

Go to the documentation of this file.
00001 /*
00002 ********************************************************************************
00003 *   Copyright (C) 1997-1999, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 ********************************************************************************
00006 *
00007 * File DCFMTSYM.H
00008 *
00009 * Modification History:
00010 * 
00011 *   Date        Name        Description
00012 *   02/19/97    aliu        Converted from java.
00013 *   03/18/97    clhuang     Updated per C++ implementation.
00014 *   03/27/97    helena      Updated to pass the simple test after code review.
00015 *   08/26/97    aliu        Added currency/intl currency symbol support.
00016 *   07/22/98    stephen     Changed to match C++ style 
00017 *                            currencySymbol -> fCurrencySymbol
00018 *                            Constants changed from CAPS to kCaps
00019 *   06/24/99    helena      Integrated Alan's NF enhancements and Java2 bug fixes
00020 *   09/22/00    grhoten     Marked deprecation tags with a pointer to replacement
00021 *                            functions.
00022 ********************************************************************************
00023 */
00024  
00025 #ifndef DCFMTSYM_H
00026 #define DCFMTSYM_H
00027  
00028 #include "unicode/utypes.h"
00029 #include "unicode/uobject.h"
00030 #include "unicode/locid.h"
00031 
00032 U_NAMESPACE_BEGIN
00033 
00073 class U_I18N_API DecimalFormatSymbols : public UObject {
00074 public:
00079     enum ENumberFormatSymbol {
00081         kDecimalSeparatorSymbol,
00083         kGroupingSeparatorSymbol,
00085         kPatternSeparatorSymbol,
00087         kPercentSymbol,
00089         kZeroDigitSymbol,
00091         kDigitSymbol,
00093         kMinusSignSymbol,
00095         kPlusSignSymbol,
00097         kCurrencySymbol,
00099         kIntlCurrencySymbol,
00101         kMonetarySeparatorSymbol,
00103         kExponentialSymbol,
00105         kPerMillSymbol,
00107         kPadEscapeSymbol,
00109         kInfinitySymbol,
00111         kNaNSymbol,
00113         kFormatSymbolCount
00114     };
00115 
00124     DecimalFormatSymbols(const Locale& locale, UErrorCode& status);
00125 
00136     DecimalFormatSymbols( UErrorCode& status);
00137 
00142     DecimalFormatSymbols(const DecimalFormatSymbols&);
00143 
00148     DecimalFormatSymbols& operator=(const DecimalFormatSymbols&);
00149 
00154     ~DecimalFormatSymbols();
00155 
00163     UBool operator==(const DecimalFormatSymbols& other) const;
00164 
00172     UBool operator!=(const DecimalFormatSymbols& other) const { return !operator==(other); }
00173 
00183     UnicodeString getSymbol(ENumberFormatSymbol symbol) const;
00184 
00194     void setSymbol(ENumberFormatSymbol symbol, UnicodeString value);
00195 
00199     inline Locale getLocale() const;
00200 
00206     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00207 
00213     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00214 
00215 private:
00226     void initialize(const Locale& locale, UErrorCode& success, UBool useLastResortData = FALSE);
00227 
00235     void initialize(const UnicodeString* numberElements, const UnicodeString* currencyElements);
00236 
00240     void initialize();
00241 
00242     void setCurrencyForSymbols();
00243 
00244     UnicodeString fSymbols[kFormatSymbolCount];
00245 
00246     Locale locale;
00247 
00248     static const char fgNumberElements[];
00249     static const char fgCurrencyElements[];
00250 
00255     static const char fgClassID;
00256 };
00257 
00258 
00259 // -------------------------------------
00260 
00261 inline UnicodeString
00262 DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const {
00263     if(symbol<kFormatSymbolCount) {
00264         return fSymbols[symbol];
00265     } else {
00266         return UnicodeString();
00267     }
00268 }
00269 
00270 // -------------------------------------
00271 
00272 /* TODO: This should use "const UnicodeString &value" */
00273 inline void
00274 DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, UnicodeString value) {
00275     if(symbol<kFormatSymbolCount) {
00276         fSymbols[symbol]=value;
00277     }
00278 }
00279 
00280 // -------------------------------------
00281 
00282 inline Locale
00283 DecimalFormatSymbols::getLocale() const {
00284     return locale;
00285 }
00286 
00287 
00288 U_NAMESPACE_END
00289 
00290 #endif // _DCFMTSYM
00291 //eof

Generated on Thu Aug 15 14:13:24 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001