X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/57a6839dcb3bba09e8228b822b290604668416fe..38fbf2fd31f5cd99b500914d6037b1d06b608645:/icuSources/i18n/unicode/dcfmtsym.h?ds=sidebyside diff --git a/icuSources/i18n/unicode/dcfmtsym.h b/icuSources/i18n/unicode/dcfmtsym.h index 662d58b2..83815a4a 100644 --- a/icuSources/i18n/unicode/dcfmtsym.h +++ b/icuSources/i18n/unicode/dcfmtsym.h @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** -* Copyright (C) 1997-2014, International Business Machines +* Copyright (C) 1997-2016, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -33,6 +35,7 @@ #include "unicode/uobject.h" #include "unicode/locid.h" #include "unicode/unum.h" +#include "unicode/unistr.h" /** * \file @@ -40,6 +43,7 @@ */ +#if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** @@ -163,8 +167,12 @@ public: * @stable ICU 4.6 */ kNineDigitSymbol, + /** Multiplication sign. + * @stable ICU 54 + */ + kExponentMultiplicationSymbol, /** count symbol constants */ - kFormatSymbolCount + kFormatSymbolCount = kNineDigitSymbol + 2 }; /** @@ -189,7 +197,6 @@ public: */ DecimalFormatSymbols(UErrorCode& status); -#ifndef U_HIDE_DRAFT_API /** * Creates a DecimalFormatSymbols object with last-resort data. * Intended for callers who cache the symbols data and @@ -203,10 +210,9 @@ public: * @param status Input/output parameter, set to success or * failure code upon return. * @return last-resort symbols - * @draft ICU 52 + * @stable ICU 52 */ static DecimalFormatSymbols* createWithLastResortData(UErrorCode& status); -#endif /* U_HIDE_DRAFT_API */ /** * Copy constructor. @@ -352,13 +358,30 @@ private: void setCurrencyForSymbols(); public: + +#ifndef U_HIDE_INTERNAL_API + /** + * @internal For ICU use only + */ + inline UBool isCustomCurrencySymbol() const { + return fIsCustomCurrencySymbol; + } + + /** + * @internal For ICU use only + */ + inline UBool isCustomIntlCurrencySymbol() const { + return fIsCustomIntlCurrencySymbol; + } +#endif /* U_HIDE_INTERNAL_API */ + /** * _Internal_ function - more efficient version of getSymbol, * returning a const reference to one of the symbol strings. * The returned reference becomes invalid when the symbol is changed * or when the DecimalFormatSymbols are destroyed. * ### TODO markus 2002oct11: Consider proposing getConstSymbol() to be really public. - * Note: moved #ifndef U_HIDE_INTERNAL_API after this, it is needed for inline in DecimalFormat + * Note: moved #ifndef U_HIDE_INTERNAL_API after this, since this is needed for inline in DecimalFormat * * @param symbol Constant to indicate a number format symbol. * @return the format symbol by the param 'symbol' @@ -371,7 +394,7 @@ public: * Returns that pattern stored in currecy info. Internal API for use by NumberFormat API. * @internal */ - inline const UChar* getCurrencyPattern(void) const; + inline const char16_t* getCurrencyPattern(void) const; #endif /* U_HIDE_INTERNAL_API */ private: @@ -402,10 +425,12 @@ private: char actualLocale[ULOC_FULLNAME_CAPACITY]; char validLocale[ULOC_FULLNAME_CAPACITY]; - const UChar* currPattern; + const char16_t* currPattern; UnicodeString currencySpcBeforeSym[UNUM_CURRENCY_SPACING_COUNT]; UnicodeString currencySpcAfterSym[UNUM_CURRENCY_SPACING_COUNT]; + UBool fIsCustomCurrencySymbol; + UBool fIsCustomIntlCurrencySymbol; }; // ------------------------------------- @@ -421,8 +446,7 @@ DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const { return *strPtr; } -#ifndef U_HIDE_INTERNAL_API - +// See comments above for this function. Not hidden with #ifndef U_HIDE_INTERNAL_API inline const UnicodeString & DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { const UnicodeString *strPtr; @@ -434,13 +458,16 @@ DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { return *strPtr; } -#endif /* U_HIDE_INTERNAL_API */ - - // ------------------------------------- inline void DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits = TRUE) { + if (symbol == kCurrencySymbol) { + fIsCustomCurrencySymbol = TRUE; + } + else if (symbol == kIntlCurrencySymbol) { + fIsCustomIntlCurrencySymbol = TRUE; + } if(symbol