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-2003, 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 
00030 #if !UCONFIG_NO_FORMATTING
00031 
00032 #include "unicode/uobject.h"
00033 #include "unicode/locid.h"
00034 
00035 U_NAMESPACE_BEGIN
00036 
00076 class U_I18N_API DecimalFormatSymbols : public UObject {
00077 public:
00082     enum ENumberFormatSymbol {
00084         kDecimalSeparatorSymbol,
00086         kGroupingSeparatorSymbol,
00088         kPatternSeparatorSymbol,
00090         kPercentSymbol,
00092         kZeroDigitSymbol,
00094         kDigitSymbol,
00096         kMinusSignSymbol,
00098         kPlusSignSymbol,
00100         kCurrencySymbol,
00102         kIntlCurrencySymbol,
00104         kMonetarySeparatorSymbol,
00106         kExponentialSymbol,
00108         kPerMillSymbol,
00110         kPadEscapeSymbol,
00112         kInfinitySymbol,
00114         kNaNSymbol,
00116         kFormatSymbolCount
00117     };
00118 
00127     DecimalFormatSymbols(const Locale& locale, UErrorCode& status);
00128 
00139     DecimalFormatSymbols( UErrorCode& status);
00140 
00145     DecimalFormatSymbols(const DecimalFormatSymbols&);
00146 
00151     DecimalFormatSymbols& operator=(const DecimalFormatSymbols&);
00152 
00157     ~DecimalFormatSymbols();
00158 
00166     UBool operator==(const DecimalFormatSymbols& other) const;
00167 
00175     UBool operator!=(const DecimalFormatSymbols& other) const { return !operator==(other); }
00176 
00186     inline UnicodeString getSymbol(ENumberFormatSymbol symbol) const;
00187 
00197     void setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value);
00198 
00203     inline Locale getLocale() const;
00204 
00210     virtual UClassID getDynamicClassID() const;
00211 
00217     static UClassID getStaticClassID();
00218 
00219 private:
00220     DecimalFormatSymbols(); // default constructor not implemented
00221 
00232     void initialize(const Locale& locale, UErrorCode& success, UBool useLastResortData = FALSE);
00233 
00241     void initialize(const UnicodeString* numberElements, int32_t numberElementsLength);
00242 
00246     void initialize();
00247 
00248     void setCurrencyForSymbols();
00249 
00250 public:
00262     inline const UnicodeString &getConstSymbol(ENumberFormatSymbol symbol) const;
00263 
00264 private:
00280     UnicodeString fSymbols[kFormatSymbolCount];
00281 
00286     UnicodeString fNoSymbol;
00287 
00288     Locale locale;
00289 
00290 };
00291 
00292 // -------------------------------------
00293 
00294 inline UnicodeString
00295 DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const {
00296     const UnicodeString *strPtr;
00297     if(symbol < kFormatSymbolCount) {
00298         strPtr = &fSymbols[symbol];
00299     } else {
00300         strPtr = &fNoSymbol;
00301     }
00302     return *strPtr;
00303 }
00304 
00305 inline const UnicodeString &
00306 DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const {
00307     const UnicodeString *strPtr;
00308     if(symbol < kFormatSymbolCount) {
00309         strPtr = &fSymbols[symbol];
00310     } else {
00311         strPtr = &fNoSymbol;
00312     }
00313     return *strPtr;
00314 }
00315 
00316 // -------------------------------------
00317 
00318 inline void
00319 DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value) {
00320     if(symbol<kFormatSymbolCount) {
00321         fSymbols[symbol]=value;
00322     }
00323 }
00324 
00325 // -------------------------------------
00326 
00327 inline Locale
00328 DecimalFormatSymbols::getLocale() const {
00329     return locale;
00330 }
00331 
00332 
00333 U_NAMESPACE_END
00334 
00335 #endif /* #if !UCONFIG_NO_FORMATTING */
00336 
00337 #endif // _DCFMTSYM
00338 //eof

Generated on Mon Nov 24 14:35:30 2003 for ICU 2.8 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001