]> granicus.if.org Git - icu/commitdiff
ICU-13634 Changes from pre-merge code light-review.
authorShane Carr <shane@unicode.org>
Tue, 24 Apr 2018 01:19:44 +0000 (01:19 +0000)
committerShane Carr <shane@unicode.org>
Tue, 24 Apr 2018 01:19:44 +0000 (01:19 +0000)
X-SVN-Rev: 41267

12 files changed:
icu4c/source/i18n/compactdecimalformat.cpp
icu4c/source/i18n/i18n.vcxproj
icu4c/source/i18n/i18n.vcxproj.filters
icu4c/source/i18n/i18n_uwp.vcxproj
icu4c/source/i18n/plurrule_impl.h
icu4c/source/i18n/unicode/compactdecimalformat.h
icu4c/source/i18n/unicode/decimfmt.h
icu4c/source/i18n/unicode/numberformatter.h
icu4c/source/i18n/unicode/unum.h
icu4c/source/test/intltest/datadrivennumberformattestsuite.h
icu4c/source/test/intltest/dcfmapts.cpp
icu4c/source/test/testdata/numberformattestspecification.txt

index 7405330a6a475a066256c5c36ec303aae86d66ab..c3facfbc619c270998bb55979d422a1d0694226b 100644 (file)
@@ -44,5 +44,31 @@ CompactDecimalFormat& CompactDecimalFormat::operator=(const CompactDecimalFormat
     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 */
index bdd87d3cff832c7a80ebf688fb9b22331cf80900..a2cce5f62cee1fb69eb74be0f0842953a8d19150 100644 (file)
     <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" />
index 4b5743c505f1316d76638f4f4196231854f8bfdd..7e1dbb8c11515db591e5b1ac14c93cde9669d5ad 100644 (file)
     <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>
index 972b8ddf958dd10bf71753c319b7b630c5faa01c..2cd3e7af62af0a53cd5aabd42ca2c68cb349c117 100644 (file)
     <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" />
index a0d3f4a564a01a86213a4d02ec6d9a4875940dc0..43ca84f27f56c95a27a61140d475cf23573d57b1 100644 (file)
@@ -42,6 +42,8 @@ class VisibleDigits;
 
 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);
index 967a9adbee9213981ce1acf07b92d1793a58a8bf..e7995d375bac0b783e3a554e19ce9d757c1aaf06 100644 (file)
@@ -94,8 +94,62 @@ public:
      */
     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:
index 8e42b0aabd493a8a37600e8a857e3a8730a9018b..a8339559d1f1712cb7366326f0a3ea98779e5cfe 100644 (file)
@@ -27,7 +27,6 @@
 #ifndef DECIMFMT_H
 #define DECIMFMT_H
 
-#include <atomic>
 #include "unicode/utypes.h"
 /**
  * \file
@@ -36,6 +35,7 @@
 
 #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 {
@@ -712,7 +707,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      *                  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
@@ -1733,7 +1728,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      * @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
@@ -1751,7 +1746,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      * @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
@@ -1762,7 +1757,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      *
      * @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.
@@ -1771,7 +1766,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      * @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.
index b3f80afe6d2f0f751ac1d911eeac30ec7474610e..9b3a1ed72965d15e12d187725592e09c1d83c24e 100644 (file)
@@ -1676,14 +1676,14 @@ class U_I18N_API NumberFormatterSettings {
     /**
      * 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.
index 89d5e2fb5a82b0391ecd1df535c3e59c4e9bf701..1808c8d36b942e81d6ca36f7070af8386eee37e0 100644 (file)
@@ -1078,12 +1078,14 @@ typedef enum UNumberFormatAttribute {
 
   /**
    * 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,
index 4363e900ba57a62df3cdd771294380b6982787dc..45c284687272abed5e80478030693cad389d72f4 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef _DATADRIVENNUMBERFORMATTESTSUITE_H__
 #define _DATADRIVENNUMBERFORMATTESTSUITE_H__
 
-#include "cmemory.h"
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_FORMATTING
@@ -18,6 +17,7 @@
 #include "unicode/unistr.h"
 #include "numberformattesttuple.h"
 #include "intltest.h"
+#include "cmemory.h"
 
 struct UCHARBUF;
 class IntlTest;
index 611015c15952232c124b68d38990e3ad925f4caa..33014340c3df3bb25ec31a77345743ae47e358c5 100644 (file)
@@ -22,8 +22,9 @@
 
 #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
index cd5b479d1f8fe9d5c2c88bbc144e560a9e4c53f9..5f607833e60d5fa41fc35aa00cb8c0fdc364be51 100644 (file)
@@ -8,6 +8,15 @@
 // 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