return *this;
}
+Format* CompactDecimalFormat::clone() const {
+ return new CompactDecimalFormat(*this);
+}
+
+void
+CompactDecimalFormat::parse(
+ const UnicodeString& /* text */,
+ Formattable& /* result */,
+ ParsePosition& /* parsePosition */) const {
+}
+
+void
+CompactDecimalFormat::parse(
+ const UnicodeString& /* text */,
+ Formattable& /* result */,
+ UErrorCode& status) const {
+ status = U_UNSUPPORTED_ERROR;
+}
+
+CurrencyAmount*
+CompactDecimalFormat::parseCurrency(
+ const UnicodeString& /* text */,
+ ParsePosition& /* pos */) const {
+ return nullptr;
+}
+
#endif /* #if !UCONFIG_NO_FORMATTING */
<ClInclude Include="number_scientific.h" />
<ClInclude Include="number_stringbuilder.h" />
<ClInclude Include="number_types.h" />
+ <ClInclude Include="number_utypes.h" />
<ClInclude Include="number_utils.h" />
<ClInclude Include="number_mapper.h" />
<ClInclude Include="number_multiplier.h" />
<ClInclude Include="number_currencysymbols.h" />
<ClInclude Include="number_skeletons.h" />
+ <ClInclude Include="fieldposutil.h" />
<ClInclude Include="numparse_stringsegment.h" />
<ClInclude Include="numparse_impl.h" />
<ClInclude Include="numparse_symbols.h" />
<ClInclude Include="number_types.h">
<Filter>formatting</Filter>
</ClInclude>
+ <ClInclude Include="number_utypes.h">
+ <Filter>formatting</Filter>
+ </ClInclude>
<ClInclude Include="number_utils.h">
<Filter>formatting</Filter>
</ClInclude>
<ClInclude Include="number_skeletons.h">
<Filter>formatting</Filter>
</ClInclude>
+ <ClInclude Include="fieldposutil.h">
+ <Filter>formatting</Filter>
+ </ClInclude>
<ClInclude Include="numparse_stringsegment.h">
<Filter>formatting</Filter>
</ClInclude>
<ClInclude Include="number_scientific.h" />
<ClInclude Include="number_stringbuilder.h" />
<ClInclude Include="number_types.h" />
+ <ClInclude Include="number_utypes.h" />
<ClInclude Include="number_utils.h" />
<ClInclude Include="number_mapper.h" />
<ClInclude Include="number_multiplier.h" />
<ClInclude Include="number_currencysymbols.h" />
<ClInclude Include="number_skeletons.h" />
+ <ClInclude Include="fieldposutil.h" />
<ClInclude Include="numparse_stringsegment.h" />
<ClInclude Include="numparse_impl.h" />
<ClInclude Include="numparse_symbols.h" />
namespace pluralimpl {
+// TODO: Remove this and replace with u"" literals. Was for EBCDIC compatibility.
+
static const UChar DOT = ((UChar) 0x002E);
static const UChar SINGLE_QUOTE = ((UChar) 0x0027);
static const UChar SLASH = ((UChar) 0x002F);
*/
CompactDecimalFormat& operator=(const CompactDecimalFormat& rhs);
+ /**
+ * Clone this Format object polymorphically. The caller owns the
+ * result and should delete it when done.
+ *
+ * @return a polymorphic copy of this CompactDecimalFormat.
+ * @stable ICU 51
+ */
+ virtual Format* clone() const;
+
using DecimalFormat::format;
+ /**
+ * CompactDecimalFormat does not support parsing. This implementation
+ * does nothing.
+ * @param text Unused.
+ * @param result Does not change.
+ * @param parsePosition Does not change.
+ * @see Formattable
+ * @stable ICU 51
+ */
+ void parse(const UnicodeString& text, Formattable& result,
+ ParsePosition& parsePosition) const U_OVERRIDE;
+
+ /**
+ * CompactDecimalFormat does not support parsing. This implementation
+ * sets status to U_UNSUPPORTED_ERROR
+ *
+ * @param text Unused.
+ * @param result Does not change.
+ * @param status Always set to U_UNSUPPORTED_ERROR.
+ * @stable ICU 51
+ */
+ void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const U_OVERRIDE;
+
+ /**
+ * Parses text from the given string as a currency amount. Unlike
+ * the parse() method, this method will attempt to parse a generic
+ * currency name, searching for a match of this object's locale's
+ * currency display names, or for a 3-letter ISO currency code.
+ * This method will fail if this format is not a currency format,
+ * that is, if it does not contain the currency pattern symbol
+ * (U+00A4) in its prefix or suffix. This implementation always returns
+ * NULL.
+ *
+ * @param text the string to parse
+ * @param pos input-output position; on input, the position within text
+ * to match; must have 0 <= pos.getIndex() < text.length();
+ * on output, the position after the last matched character.
+ * If the parse fails, the position in unchanged upon output.
+ * @return if parse succeeds, a pointer to a newly-created CurrencyAmount
+ * object (owned by the caller) containing information about
+ * the parsed currency; if parse fails, this is NULL.
+ * @internal
+ */
+ CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
+
/**
* Return the class ID for this class. This is useful only for
* comparing to a return value from getDynamicClassID(). For example:
#ifndef DECIMFMT_H
#define DECIMFMT_H
-#include <atomic>
#include "unicode/utypes.h"
/**
* \file
#if !UCONFIG_NO_FORMATTING
+#include <atomic>
#include "unicode/dcfmtsym.h"
#include "unicode/numfmt.h"
#include "unicode/locid.h"
U_NAMESPACE_BEGIN
-class DigitList;
class CurrencyPluralInfo;
-class Hashtable;
-class UnicodeSet;
class FieldPositionHandler;
-class FixedDecimal;
-class PluralRules;
class CompactDecimalFormat;
namespace number {
* pattern is invalid this will be set to a failure code.
* @stable ICU 2.0
*/
- explicit DecimalFormat(UErrorCode& status);
+ DecimalFormat(UErrorCode& status);
/**
* Create a DecimalFormat from the given pattern and the symbols
* @see #setParseNoExponent
* @internal This API is a technical preview. It may change in an upcoming release.
*/
- UBool isParseNoExponent() const;
+ virtual UBool isParseNoExponent() const;
/**
* {@icu} Specifies whether to stop parsing when an exponent separator is encountered. For
* @see #setParseCaseSensitive
* @internal This API is a technical preview. It may change in an upcoming release.
*/
- UBool isParseCaseSensitive() const;
+ virtual UBool isParseCaseSensitive() const;
/**
* {@icu} Whether to pay attention to case when parsing; default is to ignore case (perform
*
* @internal This API is a technical preview. It may change in an upcoming release.
*/
- void setParseCaseSensitive(UBool value);
+ virtual void setParseCaseSensitive(UBool value);
/**
* {@icu} Returns whether truncation of high-order integer digits should result in an error.
* @see setFormatFailIfMoreThanMaxDigits
* @internal This API is a technical preview. It may change in an upcoming release.
*/
- UBool isFormatFailIfMoreThanMaxDigits() const;
+ virtual UBool isFormatFailIfMoreThanMaxDigits() const;
/**
* {@icu} Sets whether truncation of high-order integer digits should result in an error.
/**
* Overload of grouping() for use on an rvalue reference.
*
- * @param rounder
+ * @param strategy
* The grouping strategy to use.
* @return The fluent chain.
* @see #grouping
* @provisional This API might change or be removed in a future release.
* @draft ICU 62
*/
- Derived grouping(const UGroupingStrategy& rounder) &&;
+ Derived grouping(const UGroupingStrategy& strategy) &&;
/**
* Specifies the minimum and maximum number of digits to render before the decimal mark.
/**
* Whether parsing is sensitive to case (lowercase/uppercase).
+ * TODO: Add to the test suite.
* @internal This API is a technical preview. It may change in an upcoming release.
*/
UNUM_PARSE_CASE_SENSITIVE = 0x1004,
/**
* Formatting: whether to show the plus sign on non-negative numbers.
+ * TODO: Add to the test suite.
* @internal This API is a technical preview. It may change in an upcoming release.
*/
UNUM_SIGN_ALWAYS_SHOWN = 0x1005,
#ifndef _DATADRIVENNUMBERFORMATTESTSUITE_H__
#define _DATADRIVENNUMBERFORMATTESTSUITE_H__
-#include "cmemory.h"
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/unistr.h"
#include "numberformattesttuple.h"
#include "intltest.h"
+#include "cmemory.h"
struct UCHARBUF;
class IntlTest;
#include "putilimp.h"
#include "plurrule_impl.h"
+#include "number_decimalquantity.h"
+
#include <stdio.h>
-#include <number_decimalquantity.h>
// This is an API test, not a unit test. It doesn't test very many cases, and doesn't
// try to test the full functionality. It just calls each function in the class and
// for that test suite. After the global settings, comes "begin", the
// per-test field names, and finally the test specific field values, 1 test
// per line.
+//
+// Field names:
+// J = ICU58
+// K = JDK
+// C = ICU4C
+// P = ICU4J parsing
+// Q = ICU4J formatting
+// S = ICU4J toPattern
+//
// For more information on the format of this file, including all the available
// field names, please see
// https://docs.google.com/document/d/1T2P0p953_Lh1pRwo-5CuPVrHlIBa_wcXElG-Hhg_WHM/edit?usp=sharing