Logo Search packages:      
Sourcecode: icu version File versions

void DecimalFormat::setCurrencyForSymbols (  ) [private]

Update the currency object to match the symbols. This method is used only when the caller has passed in a symbols object that may not be the default object for its locale.

Definition at line 2704 of file decimfmt.cpp.

References getConstSymbol(), DecimalFormatSymbols::getLocale(), Locale::getName(), DecimalFormatSymbols::kCurrencySymbol, DecimalFormatSymbols::kIntlCurrencySymbol, NULL, U_SUCCESS, and U_ZERO_ERROR.

Referenced by adoptDecimalFormatSymbols(), and construct().

    /*Bug 4212072
      Update the affix strings accroding to symbols in order to keep
      the affix strings up to date.

    // With the introduction of the Currency object, the currency
    // symbols in the DFS object are ignored.  For backward
    // compatibility, we check any explicitly set DFS object.  If it
    // is a default symbols object for its locale, we change the
    // currency object to one for that locale.  If it is custom,
    // we set the currency to null.
    UErrorCode ec = U_ZERO_ERROR;
    const UChar* c = NULL;
    const char* loc = fSymbols->getLocale().getName();
    UChar intlCurrencySymbol[4];
    ucurr_forLocale(loc, intlCurrencySymbol, 4, &ec);
    UnicodeString currencySymbol;

    uprv_getStaticCurrencyName(intlCurrencySymbol, loc, currencySymbol, ec);
    if (U_SUCCESS(ec)
        && getConstSymbol(DecimalFormatSymbols::kCurrencySymbol) == currencySymbol
        && getConstSymbol(DecimalFormatSymbols::kIntlCurrencySymbol) == UnicodeString(intlCurrencySymbol))
        // Trap an error in mapping locale to currency.  If we can't
        // map, then don't fail and set the currency to "".
        c = intlCurrencySymbol;
    ec = U_ZERO_ERROR; // reset local error code!
    setCurrencyInternally(c, ec);

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index