/*
********************************************************************************
-* Copyright (C) 1997-2010, International Business Machines
+* Copyright (C) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
#include "unicode/uobject.h"
#include "unicode/locid.h"
+#include "unicode/unum.h"
/**
* \file
*/
kMonetaryGroupingSeparatorSymbol,
/** One
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kOneDigitSymbol,
/** Two
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kTwoDigitSymbol,
/** Three
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kThreeDigitSymbol,
/** Four
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kFourDigitSymbol,
/** Five
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kFiveDigitSymbol,
/** Six
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kSixDigitSymbol,
/** Seven
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kSevenDigitSymbol,
/** Eight
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kEightDigitSymbol,
/** Nine
- * @draft ICU 4.6
+ * @stable ICU 4.6
*/
kNineDigitSymbol,
/** count symbol constants */
kFormatSymbolCount
};
- /**
- * Constants for specifying currency spacing
- * @draft ICU 4.2
- */
- enum ECurrencySpacing {
- kCurrencyMatch,
- kSurroundingMatch,
- kInsert,
- kCurrencySpacingCount
- };
-
/**
* Create a DecimalFormatSymbols object for the given locale.
*
* failure code upon return.
* @stable ICU 2.0
*/
- DecimalFormatSymbols( UErrorCode& status);
+ 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
+ * set all symbols on the resulting object.
+ *
+ * The last-resort symbols are similar to those for the root data,
+ * except that the grouping separators are empty,
+ * the NaN symbol is U+FFFD rather than "NaN",
+ * and the CurrencySpacing patterns are empty.
+ *
+ * @param status Input/output parameter, set to success or
+ * failure code upon return.
+ * @return last-resort symbols
+ * @draft ICU 52
+ */
+ static DecimalFormatSymbols* createWithLastResortData(UErrorCode& status);
+#endif /* U_HIDE_DRAFT_API */
/**
* Copy constructor.
* This API gets the CurrencySpacing data from ResourceBundle. The pattern can
* be empty if there is no data from current locale and its parent locales.
*
- * @param type : kCurrencyMatch, kSurroundingMatch or kInsert.
+ * @param type : UNUM_CURRENCY_MATCH, UNUM_CURRENCY_SURROUNDING_MATCH or UNUM_CURRENCY_INSERT.
* @param beforeCurrency : true if the pattern is for before currency symbol.
* false if the pattern is for after currency symbol.
* @param status: Input/output parameter, set to success or
* @return pattern string for currencyMatch, surroundingMatch or spaceInsert.
* Return empty string if there is no data for this locale and its parent
* locales.
- * @draft ICU 4.2
+ * @stable ICU 4.8
*/
- const UnicodeString& getPatternForCurrencySpacing(ECurrencySpacing type,
+ const UnicodeString& getPatternForCurrencySpacing(UCurrencySpacing type,
UBool beforeCurrency,
UErrorCode& status) const;
/**
* Set pattern string for 'CurrencySpacing' that can be applied to
* currency format.
*
- * @param type : kCurrencyMatch, kSurroundingMatch or kInsert.
+ * @param type : UNUM_CURRENCY_MATCH, UNUM_CURRENCY_SURROUNDING_MATCH or UNUM_CURRENCY_INSERT.
* @param beforeCurrency : true if the pattern is for before currency symbol.
* false if the pattern is for after currency symbol.
* @param pattern : pattern string to override current setting.
- * @draft ICU 4.2
+ * @stable ICU 4.8
*/
- void setPatternForCurrencySpacing(ECurrencySpacing type,
+ void setPatternForCurrencySpacing(UCurrencySpacing type,
UBool beforeCurrency,
const UnicodeString& pattern);
static UClassID U_EXPORT2 getStaticClassID();
private:
- DecimalFormatSymbols(); // default constructor not implemented
+ DecimalFormatSymbols();
/**
* Initializes the symbols from the LocaleElements resource bundle.
* 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
*
* @param symbol Constant to indicate a number format symbol.
* @return the format symbol by the param 'symbol'
*/
inline const UnicodeString &getConstSymbol(ENumberFormatSymbol symbol) const;
+#ifndef U_HIDE_INTERNAL_API
/**
* Returns that pattern stored in currecy info. Internal API for use by NumberFormat API.
* @internal
*/
inline const UChar* getCurrencyPattern(void) const;
+#endif /* U_HIDE_INTERNAL_API */
private:
/**
char validLocale[ULOC_FULLNAME_CAPACITY];
const UChar* currPattern;
- UnicodeString currencySpcBeforeSym[kCurrencySpacingCount];
- UnicodeString currencySpcAfterSym[kCurrencySpacingCount];
+ UnicodeString currencySpcBeforeSym[UNUM_CURRENCY_SPACING_COUNT];
+ UnicodeString currencySpcAfterSym[UNUM_CURRENCY_SPACING_COUNT];
};
// -------------------------------------
return *strPtr;
}
+#ifndef U_HIDE_INTERNAL_API
+
inline const UnicodeString &
DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const {
const UnicodeString *strPtr;
return *strPtr;
}
+#endif /* U_HIDE_INTERNAL_API */
+
+
// -------------------------------------
inline void
return locale;
}
+#ifndef U_HIDE_INTERNAL_API
inline const UChar*
DecimalFormatSymbols::getCurrencyPattern() const {
return currPattern;
}
+#endif /* U_HIDE_INTERNAL_API */
+
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */