1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 3fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* Copyright (C) 1997-2014, International Business Machines 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Corporation and others. All Rights Reserved. 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* File DCFMTSYM.H 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Modification History: 1085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho* 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Date Name Description 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 02/19/97 aliu Converted from java. 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 03/18/97 clhuang Updated per C++ implementation. 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 03/27/97 helena Updated to pass the simple test after code review. 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 08/26/97 aliu Added currency/intl currency symbol support. 1685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho* 07/22/98 stephen Changed to match C++ style 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* currencySymbol -> fCurrencySymbol 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Constants changed from CAPS to kCaps 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 09/22/00 grhoten Marked deprecation tags with a pointer to replacement 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* functions. 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 2485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef DCFMTSYM_H 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define DCFMTSYM_H 2785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 2927f654740f2a26ad62a5c155af9199af9e69b889claireho#include "unicode/uchar.h" 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/uobject.h" 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/locid.h" 35b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho#include "unicode/unum.h" 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 3885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * \file 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Symbols for formatting numbers. 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This class represents the set of symbols needed by DecimalFormat 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to format numbers. DecimalFormat creates for itself an instance of 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols from its locale data. If you need to change any 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of these symbols, you can get the DecimalFormatSymbols object from 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * your DecimalFormat and modify it. 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Here are the special characters used in the parts of the 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern, with notes on their usage. 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \code 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Symbol Meaning 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 0 a digit 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * # a digit, zero shows as absent 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . placeholder for decimal separator 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * , placeholder for grouping separator. 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ; separates formats. 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - default negative prefix. 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * % divide by 100 and show as percentage 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X any other characters can be used in the prefix or suffix 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ' used to quote special characters in a prefix or suffix. 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \endcode 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * [Notes] 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If there is no explicit negative subpattern, - is prefixed to the 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * positive form. That is, "0.00" alone is equivalent to "0.00;-0.00". 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The grouping separator is commonly used for thousands, but in some 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * countries for ten-thousands. The interval is a constant number of 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits between the grouping characters, such as 100,000,000 or 1,0000,0000. 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If you supply a pattern with multiple grouping characters, the interval 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * between the last one and the end of the integer is the one that is 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * used. So "#,##,###,####" == "######,####" == "##,####,####". 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This class only handles localized digits where the 10 digits are 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * contiguous in Unicode, from 0 to 9. Other digits sets (such as 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * superscripts) would need a different subclass. 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API DecimalFormatSymbols : public UObject { 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constants for specifying a number format symbol. 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru enum ENumberFormatSymbol { 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The decimal separator */ 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kDecimalSeparatorSymbol, 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The grouping separator */ 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kGroupingSeparatorSymbol, 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The pattern separator */ 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPatternSeparatorSymbol, 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The percent sign */ 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPercentSymbol, 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** Zero*/ 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kZeroDigitSymbol, 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** Character representing a digit in the pattern */ 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kDigitSymbol, 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The minus sign */ 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kMinusSignSymbol, 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The plus sign */ 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPlusSignSymbol, 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The currency symbol */ 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kCurrencySymbol, 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The international currency symbol */ 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kIntlCurrencySymbol, 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The monetary separator */ 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kMonetarySeparatorSymbol, 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** The exponential symbol */ 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kExponentialSymbol, 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** Per mill symbol - replaces kPermillSymbol */ 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPerMillSymbol, 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** Escape padding character */ 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPadEscapeSymbol, 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** Infinity symbol */ 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kInfinitySymbol, 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** Nan symbol */ 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kNaNSymbol, 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** Significant digit symbol 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 */ 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kSignificantDigitSymbol, 12685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** The monetary grouping separator 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.6 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kMonetaryGroupingSeparatorSymbol, 13027f654740f2a26ad62a5c155af9199af9e69b889claireho /** One 131103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 13227f654740f2a26ad62a5c155af9199af9e69b889claireho */ 13327f654740f2a26ad62a5c155af9199af9e69b889claireho kOneDigitSymbol, 13427f654740f2a26ad62a5c155af9199af9e69b889claireho /** Two 135103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 13627f654740f2a26ad62a5c155af9199af9e69b889claireho */ 13727f654740f2a26ad62a5c155af9199af9e69b889claireho kTwoDigitSymbol, 13827f654740f2a26ad62a5c155af9199af9e69b889claireho /** Three 139103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 14027f654740f2a26ad62a5c155af9199af9e69b889claireho */ 14127f654740f2a26ad62a5c155af9199af9e69b889claireho kThreeDigitSymbol, 14227f654740f2a26ad62a5c155af9199af9e69b889claireho /** Four 143103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 14427f654740f2a26ad62a5c155af9199af9e69b889claireho */ 14527f654740f2a26ad62a5c155af9199af9e69b889claireho kFourDigitSymbol, 14627f654740f2a26ad62a5c155af9199af9e69b889claireho /** Five 147103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 14827f654740f2a26ad62a5c155af9199af9e69b889claireho */ 14927f654740f2a26ad62a5c155af9199af9e69b889claireho kFiveDigitSymbol, 15027f654740f2a26ad62a5c155af9199af9e69b889claireho /** Six 151103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 15227f654740f2a26ad62a5c155af9199af9e69b889claireho */ 15327f654740f2a26ad62a5c155af9199af9e69b889claireho kSixDigitSymbol, 15427f654740f2a26ad62a5c155af9199af9e69b889claireho /** Seven 155103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 15627f654740f2a26ad62a5c155af9199af9e69b889claireho */ 15727f654740f2a26ad62a5c155af9199af9e69b889claireho kSevenDigitSymbol, 15827f654740f2a26ad62a5c155af9199af9e69b889claireho /** Eight 159103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 16027f654740f2a26ad62a5c155af9199af9e69b889claireho */ 16127f654740f2a26ad62a5c155af9199af9e69b889claireho kEightDigitSymbol, 16227f654740f2a26ad62a5c155af9199af9e69b889claireho /** Nine 163103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 16427f654740f2a26ad62a5c155af9199af9e69b889claireho */ 16527f654740f2a26ad62a5c155af9199af9e69b889claireho kNineDigitSymbol, 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** count symbol constants */ 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kFormatSymbolCount 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru }; 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormatSymbols object for the given locale. 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param locale The locale to get symbols for. 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Input/output parameter, set to success or 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * failure code upon return. 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols(const Locale& locale, UErrorCode& status); 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormatSymbols object for the default locale. 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This constructor will not fail. If the resource file data is 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * not available, it will use hard-coded last-resort data and 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set status to U_USING_FALLBACK_ERROR. 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Input/output parameter, set to success or 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * failure code upon return. 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 19059d709d503bab6e2b61931737e662dd293b40578ccornelius DecimalFormatSymbols(UErrorCode& status); 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1923ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes // BEGIN android-added: we need a default constructor for performance. 1933ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes // Proposed for ICU 4.8: http://icu-project.org/trac/ticket/7392 1943ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes DecimalFormatSymbols(); 1953ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes // END android-added 1963ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes 19759d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_DRAFT_API 19859d709d503bab6e2b61931737e662dd293b40578ccornelius /** 19959d709d503bab6e2b61931737e662dd293b40578ccornelius * Creates a DecimalFormatSymbols object with last-resort data. 20059d709d503bab6e2b61931737e662dd293b40578ccornelius * Intended for callers who cache the symbols data and 20159d709d503bab6e2b61931737e662dd293b40578ccornelius * set all symbols on the resulting object. 20259d709d503bab6e2b61931737e662dd293b40578ccornelius * 20359d709d503bab6e2b61931737e662dd293b40578ccornelius * The last-resort symbols are similar to those for the root data, 20459d709d503bab6e2b61931737e662dd293b40578ccornelius * except that the grouping separators are empty, 20559d709d503bab6e2b61931737e662dd293b40578ccornelius * the NaN symbol is U+FFFD rather than "NaN", 20659d709d503bab6e2b61931737e662dd293b40578ccornelius * and the CurrencySpacing patterns are empty. 20759d709d503bab6e2b61931737e662dd293b40578ccornelius * 20859d709d503bab6e2b61931737e662dd293b40578ccornelius * @param status Input/output parameter, set to success or 20959d709d503bab6e2b61931737e662dd293b40578ccornelius * failure code upon return. 21059d709d503bab6e2b61931737e662dd293b40578ccornelius * @return last-resort symbols 21159d709d503bab6e2b61931737e662dd293b40578ccornelius * @draft ICU 52 21259d709d503bab6e2b61931737e662dd293b40578ccornelius */ 21359d709d503bab6e2b61931737e662dd293b40578ccornelius static DecimalFormatSymbols* createWithLastResortData(UErrorCode& status); 21459d709d503bab6e2b61931737e662dd293b40578ccornelius#endif /* U_HIDE_DRAFT_API */ 21559d709d503bab6e2b61931737e662dd293b40578ccornelius 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Copy constructor. 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols(const DecimalFormatSymbols&); 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Assignment operator. 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols& operator=(const DecimalFormatSymbols&); 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Destructor. 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~DecimalFormatSymbols(); 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return true if another object is semantically equal to this one. 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param other the object to be compared with. 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return true if another object is semantically equal to this one. 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool operator==(const DecimalFormatSymbols& other) const; 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return true if another object is semantically unequal to this one. 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param other the object to be compared with. 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return true if another object is semantically unequal to this one. 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool operator!=(const DecimalFormatSymbols& other) const { return !operator==(other); } 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get one of the format symbols by its enum constant. 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Each symbol is stored as a string so that graphemes 25550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * (characters with modifier letters) can be used. 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbol Constant to indicate a number format symbol. 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the format symbols by the param 'symbol' 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline UnicodeString getSymbol(ENumberFormatSymbol symbol) const; 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set one of the format symbols by its enum constant. 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Each symbol is stored as a string so that graphemes 26650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * (characters with modifier letters) can be used. 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbol Constant to indicate a number format symbol. 26950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param value value of the format symbol 27027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param propogateDigits If false, setting the zero digit will not automatically set 1-9. 27127f654740f2a26ad62a5c155af9199af9e69b889claireho * The default behavior is to automatically set 1-9 if zero is being set and the value 27227f654740f2a26ad62a5c155af9199af9e69b889claireho * it is being set to corresponds to a known Unicode zero digit. 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 27527f654740f2a26ad62a5c155af9199af9e69b889claireho void setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits); 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the locale for which this object was constructed. 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.6 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline Locale getLocale() const; 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the locale for this object. Two flavors are available: 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * valid and actual locale. 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 29185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Get pattern string for 'CurrencySpacing' that can be applied to 29285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * currency format. 29385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * This API gets the CurrencySpacing data from ResourceBundle. The pattern can 29485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * be empty if there is no data from current locale and its parent locales. 29585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 296b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param type : UNUM_CURRENCY_MATCH, UNUM_CURRENCY_SURROUNDING_MATCH or UNUM_CURRENCY_INSERT. 29785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param beforeCurrency : true if the pattern is for before currency symbol. 29885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * false if the pattern is for after currency symbol. 29985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param status: Input/output parameter, set to success or 30085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * failure code upon return. 30185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @return pattern string for currencyMatch, surroundingMatch or spaceInsert. 30285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Return empty string if there is no data for this locale and its parent 30385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * locales. 304103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 30585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 306b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho const UnicodeString& getPatternForCurrencySpacing(UCurrencySpacing type, 30785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool beforeCurrency, 30885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status) const; 30985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 31085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Set pattern string for 'CurrencySpacing' that can be applied to 31185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * currency format. 31285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 313b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param type : UNUM_CURRENCY_MATCH, UNUM_CURRENCY_SURROUNDING_MATCH or UNUM_CURRENCY_INSERT. 31485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param beforeCurrency : true if the pattern is for before currency symbol. 31585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * false if the pattern is for after currency symbol. 31685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param pattern : pattern string to override current setting. 317103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8 31885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 319b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho void setPatternForCurrencySpacing(UCurrencySpacing type, 32085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool beforeCurrency, 32185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& pattern); 32285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 32385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for the actual class. 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.2 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UClassID getDynamicClassID() const; 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for this class. 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.2 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UClassID U_EXPORT2 getStaticClassID(); 336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 3383ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes // BEGIN android-removed: we need a default constructor for performance. 3393ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes // DecimalFormatSymbols(); // default constructor not implemented 3403ce95e4b8b5b2df764bd2deb9e2fb5564164910fElliott Hughes // END android-removed 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Initializes the symbols from the LocaleElements resource bundle. 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Note: The organization of LocaleElements badly needs to be 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cleaned up. 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param locale The locale to get symbols for. 348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param success Input/output parameter, set to success or 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * failure code upon return. 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param useLastResortData determine if use last resort data 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void initialize(const Locale& locale, UErrorCode& success, UBool useLastResortData = FALSE); 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Initialize the symbols with default values. 356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void initialize(); 358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setCurrencyForSymbols(); 360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * _Internal_ function - more efficient version of getSymbol, 364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returning a const reference to one of the symbol strings. 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The returned reference becomes invalid when the symbol is changed 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * or when the DecimalFormatSymbols are destroyed. 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ### TODO markus 2002oct11: Consider proposing getConstSymbol() to be really public. 368fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Note: moved #ifndef U_HIDE_INTERNAL_API after this, it is needed for inline in DecimalFormat 369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbol Constant to indicate a number format symbol. 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the format symbol by the param 'symbol' 372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline const UnicodeString &getConstSymbol(ENumberFormatSymbol symbol) const; 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 376fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius#ifndef U_HIDE_INTERNAL_API 377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns that pattern stored in currecy info. Internal API for use by NumberFormat API. 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline const UChar* getCurrencyPattern(void) const; 382103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_INTERNAL_API */ 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Private symbol strings. 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * They are either loaded from a resource bundle or otherwise owned. 388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * setSymbol() clones the symbol string. 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Readonly aliases can only come from a resource bundle, so that we can always 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * use fastCopyFrom() with them. 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If DecimalFormatSymbols becomes subclassable and the status of fSymbols changes 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * from private to protected, 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * or when fSymbols can be set any other way that allows them to be readonly aliases 395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to non-resource bundle strings, 396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * then regular UnicodeString copies must be used instead of fastCopyFrom(). 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fSymbols[kFormatSymbolCount]; 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Non-symbol variable for getConstSymbol(). Always empty. 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fNoSymbol; 407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Locale locale; 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru char actualLocale[ULOC_FULLNAME_CAPACITY]; 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru char validLocale[ULOC_FULLNAME_CAPACITY]; 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UChar* currPattern; 41385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 414b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UnicodeString currencySpcBeforeSym[UNUM_CURRENCY_SPACING_COUNT]; 415b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UnicodeString currencySpcAfterSym[UNUM_CURRENCY_SPACING_COUNT]; 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// ------------------------------------- 419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline UnicodeString 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const { 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString *strPtr; 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(symbol < kFormatSymbolCount) { 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru strPtr = &fSymbols[symbol]; 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } else { 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru strPtr = &fNoSymbol; 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return *strPtr; 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 43159d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_INTERNAL_API 43259d709d503bab6e2b61931737e662dd293b40578ccornelius 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline const UnicodeString & 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString *strPtr; 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(symbol < kFormatSymbolCount) { 437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru strPtr = &fSymbols[symbol]; 438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } else { 439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru strPtr = &fNoSymbol; 440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return *strPtr; 442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 443103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 44459d709d503bab6e2b61931737e662dd293b40578ccornelius#endif /* U_HIDE_INTERNAL_API */ 44559d709d503bab6e2b61931737e662dd293b40578ccornelius 446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// ------------------------------------- 448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline void 45027f654740f2a26ad62a5c155af9199af9e69b889clairehoDecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits = TRUE) { 451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if(symbol<kFormatSymbolCount) { 452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fSymbols[symbol]=value; 453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 45427f654740f2a26ad62a5c155af9199af9e69b889claireho 45527f654740f2a26ad62a5c155af9199af9e69b889claireho // If the zero digit is being set to a known zero digit according to Unicode, 45627f654740f2a26ad62a5c155af9199af9e69b889claireho // then we automatically set the corresponding 1-9 digits 45727f654740f2a26ad62a5c155af9199af9e69b889claireho if ( propogateDigits && symbol == kZeroDigitSymbol && value.countChar32() == 1 ) { 45827f654740f2a26ad62a5c155af9199af9e69b889claireho UChar32 sym = value.char32At(0); 45927f654740f2a26ad62a5c155af9199af9e69b889claireho if ( u_charDigitValue(sym) == 0 ) { 46027f654740f2a26ad62a5c155af9199af9e69b889claireho for ( int8_t i = 1 ; i<= 9 ; i++ ) { 46127f654740f2a26ad62a5c155af9199af9e69b889claireho sym++; 46227f654740f2a26ad62a5c155af9199af9e69b889claireho fSymbols[(int)kOneDigitSymbol+i-1] = UnicodeString(sym); 46327f654740f2a26ad62a5c155af9199af9e69b889claireho } 46427f654740f2a26ad62a5c155af9199af9e69b889claireho } 46527f654740f2a26ad62a5c155af9199af9e69b889claireho } 466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// ------------------------------------- 469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline Locale 471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormatSymbols::getLocale() const { 472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return locale; 473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 47559d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_INTERNAL_API 476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline const UChar* 477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormatSymbols::getCurrencyPattern() const { 478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return currPattern; 479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 48059d709d503bab6e2b61931737e662dd293b40578ccornelius#endif /* U_HIDE_INTERNAL_API */ 481103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */ 485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // _DCFMTSYM 487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof 488