ICU 69.1  69.1
numberformatter.h
Go to the documentation of this file.
1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 
4 #ifndef __NUMBERFORMATTER_H__
5 #define __NUMBERFORMATTER_H__
6 
7 #include "unicode/utypes.h"
8 
9 #if U_SHOW_CPLUSPLUS_API
10 
11 #if !UCONFIG_NO_FORMATTING
12 
13 #include "unicode/appendable.h"
14 #include "unicode/bytestream.h"
15 #include "unicode/currunit.h"
16 #include "unicode/dcfmtsym.h"
17 #include "unicode/fieldpos.h"
18 #include "unicode/formattedvalue.h"
19 #include "unicode/fpositer.h"
20 #include "unicode/measunit.h"
21 #include "unicode/nounit.h"
22 #include "unicode/parseerr.h"
23 #include "unicode/plurrule.h"
24 #include "unicode/ucurr.h"
25 #include "unicode/unum.h"
27 #include "unicode/uobject.h"
28 
84 U_NAMESPACE_BEGIN
85 
86 // Forward declarations:
87 class IFixedDecimal;
88 class FieldPositionIteratorHandler;
89 class FormattedStringBuilder;
90 
91 namespace numparse {
92 namespace impl {
93 
94 // Forward declarations:
95 class NumberParserImpl;
96 class MultiplierParseHandler;
97 
98 }
99 }
100 
101 namespace units {
102 
103 // Forward declarations:
104 class UnitsRouter;
105 
106 } // namespace units
107 
108 namespace number { // icu::number
109 
110 // Forward declarations:
111 class UnlocalizedNumberFormatter;
112 class LocalizedNumberFormatter;
113 class FormattedNumber;
114 class Notation;
115 class ScientificNotation;
116 class Precision;
117 class FractionPrecision;
118 class CurrencyPrecision;
119 class IncrementPrecision;
120 class IntegerWidth;
121 
122 namespace impl {
123 
124 // can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes
130 typedef int16_t digits_t;
131 
132 // can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization
139 static constexpr int32_t kInternalDefaultThreshold = 3;
140 
141 // Forward declarations:
142 class Padder;
143 struct MacroProps;
144 struct MicroProps;
145 class DecimalQuantity;
146 class UFormattedNumberData;
147 class NumberFormatterImpl;
148 struct ParsedPatternInfo;
149 class ScientificModifier;
150 class MultiplierProducer;
151 class RoundingImpl;
152 class ScientificHandler;
153 class Modifier;
154 class AffixPatternProvider;
155 class NumberPropertyMapper;
156 struct DecimalFormatProperties;
157 class MultiplierFormatHandler;
158 class CurrencySymbols;
159 class GeneratorHelpers;
160 class DecNum;
161 class NumberRangeFormatterImpl;
162 struct RangeMacroProps;
163 struct UFormattedNumberImpl;
164 class MutablePatternModifier;
165 class ImmutablePatternModifier;
166 struct DecimalFormatWarehouse;
167 
175 
176 } // namespace impl
177 
184 
191 
197 class U_I18N_API Notation : public UMemory {
198  public:
223  static ScientificNotation scientific();
224 
247  static ScientificNotation engineering();
248 
290  static CompactNotation compactShort();
291 
314  static CompactNotation compactLong();
315 
340  static SimpleNotation simple();
341 
342  private:
343  enum NotationType {
344  NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR
345  } fType;
346 
347  union NotationUnion {
348  // For NTN_SCIENTIFIC
359  } scientific;
360 
361  // For NTN_COMPACT
362  UNumberCompactStyle compactStyle;
363 
364  // For NTN_ERROR
365  UErrorCode errorCode;
366  } fUnion;
367 
369 
370  Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {}
371 
372  Notation(UErrorCode errorCode) : fType(NTN_ERROR) {
373  fUnion.errorCode = errorCode;
374  }
375 
376  Notation() : fType(NTN_SIMPLE), fUnion() {}
377 
378  UBool copyErrorTo(UErrorCode &status) const {
379  if (fType == NTN_ERROR) {
380  status = fUnion.errorCode;
381  return true;
382  }
383  return false;
384  }
385 
386  // To allow MacroProps to initialize empty instances:
387  friend struct impl::MacroProps;
388  friend class ScientificNotation;
389 
390  // To allow implementation to access internal types:
391  friend class impl::NumberFormatterImpl;
392  friend class impl::ScientificModifier;
393  friend class impl::ScientificHandler;
394 
395  // To allow access to the skeleton generation code:
396  friend class impl::GeneratorHelpers;
397 };
398 
408  public:
422  ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const;
423 
437  ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const;
438 
439  private:
440  // Inherit constructor
441  using Notation::Notation;
442 
443  // Raw constructor for NumberPropertyMapper
444  ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, impl::digits_t fMinExponentDigits,
445  UNumberSignDisplay fExponentSignDisplay);
446 
447  friend class Notation;
448 
449  // So that NumberPropertyMapper can create instances
450  friend class impl::NumberPropertyMapper;
451 };
452 
459 
468 class U_I18N_API Precision : public UMemory {
469 
470  public:
488  static Precision unlimited();
489 
496  static FractionPrecision integer();
497 
525  static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces);
526 
540  static FractionPrecision minFraction(int32_t minFractionPlaces);
541 
552  static FractionPrecision maxFraction(int32_t maxFractionPlaces);
553 
567  static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces);
568 
582  static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits);
583 
596  static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits);
597 
606  static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits);
607 
619  static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits,
620  int32_t maxSignificantDigits);
621 
641  static IncrementPrecision increment(double roundingIncrement);
642 
660  static CurrencyPrecision currency(UCurrencyUsage currencyUsage);
661 
662 #ifndef U_HIDE_DRAFT_API
663 
670  Precision trailingZeroDisplay(UNumberTrailingZeroDisplay trailingZeroDisplay) const;
671 #endif // U_HIDE_DRAFT_API
672 
673  private:
674  enum PrecisionType {
675  RND_BOGUS,
676  RND_NONE,
677  RND_FRACTION,
678  RND_SIGNIFICANT,
679  RND_FRACTION_SIGNIFICANT,
680 
681  // Used for strange increments like 3.14.
682  RND_INCREMENT,
683 
684  // Used for increments with 1 as the only digit. This is different than fraction
685  // rounding because it supports having additional trailing zeros. For example, this
686  // class is used to round with the increment 0.010.
687  RND_INCREMENT_ONE,
688 
689  // Used for increments with 5 as the only digit (nickel rounding).
690  RND_INCREMENT_FIVE,
691 
692  RND_CURRENCY,
693  RND_ERROR
694  } fType;
695 
696  union PrecisionUnion {
699  // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT
710  } fracSig;
713  // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE
715  double fIncrement;
720  } increment;
721  UCurrencyUsage currencyUsage; // For RND_CURRENCY
722  UErrorCode errorCode; // For RND_ERROR
723  } fUnion;
724 
726 
729 
730  Precision(const PrecisionType& type, const PrecisionUnion& union_)
731  : fType(type), fUnion(union_) {}
732 
733  Precision(UErrorCode errorCode) : fType(RND_ERROR) {
734  fUnion.errorCode = errorCode;
735  }
736 
737  Precision() : fType(RND_BOGUS) {}
738 
739  bool isBogus() const {
740  return fType == RND_BOGUS;
741  }
742 
743  UBool copyErrorTo(UErrorCode &status) const {
744  if (fType == RND_ERROR) {
745  status = fUnion.errorCode;
746  return true;
747  }
748  return false;
749  }
750 
751  // On the parent type so that this method can be called internally on Precision instances.
752  Precision withCurrency(const CurrencyUnit &currency, UErrorCode &status) const;
753 
754  static FractionPrecision constructFraction(int32_t minFrac, int32_t maxFrac);
755 
756  static Precision constructSignificant(int32_t minSig, int32_t maxSig);
757 
758  static Precision constructFractionSignificant(
759  const FractionPrecision &base,
760  int32_t minSig,
761  int32_t maxSig,
762  UNumberRoundingPriority priority);
763 
764  static IncrementPrecision constructIncrement(double increment, int32_t minFrac);
765 
766  static CurrencyPrecision constructCurrency(UCurrencyUsage usage);
767 
768  // To allow MacroProps/MicroProps to initialize bogus instances:
769  friend struct impl::MacroProps;
770  friend struct impl::MicroProps;
771 
772  // To allow NumberFormatterImpl to access isBogus() and other internal methods:
773  friend class impl::NumberFormatterImpl;
774 
775  // To allow NumberPropertyMapper to create instances from DecimalFormatProperties:
776  friend class impl::NumberPropertyMapper;
777 
778  // To allow access to the main implementation class:
779  friend class impl::RoundingImpl;
780 
781  // To allow child classes to call private methods:
782  friend class FractionPrecision;
783  friend class CurrencyPrecision;
784  friend class IncrementPrecision;
785 
786  // To allow access to the skeleton generation code:
787  friend class impl::GeneratorHelpers;
788 
789  // To allow access to isBogus and the default (bogus) constructor:
790  friend class units::UnitsRouter;
791 };
792 
803  public:
804 #ifndef U_HIDE_DRAFT_API
805 
819  Precision withSignificantDigits(
820  int32_t minSignificantDigits,
821  int32_t maxSignificantDigits,
822  UNumberRoundingPriority priority) const;
823 #endif // U_HIDE_DRAFT_API
824 
842  Precision withMinDigits(int32_t minSignificantDigits) const;
843 
861  Precision withMaxDigits(int32_t maxSignificantDigits) const;
862 
863  private:
864  // Inherit constructor
865  using Precision::Precision;
866 
867  // To allow parent class to call this class's constructor:
868  friend class Precision;
869 };
870 
881  public:
899  Precision withCurrency(const CurrencyUnit &currency) const;
900 
901  private:
902  // Inherit constructor
903  using Precision::Precision;
904 
905  // To allow parent class to call this class's constructor:
906  friend class Precision;
907 };
908 
919  public:
935  Precision withMinFraction(int32_t minFrac) const;
936 
937  private:
938  // Inherit constructor
939  using Precision::Precision;
940 
941  // To allow parent class to call this class's constructor:
942  friend class Precision;
943 };
944 
955  public:
967  static IntegerWidth zeroFillTo(int32_t minInt);
968 
980  IntegerWidth truncateAt(int32_t maxInt);
981 
982  private:
983  union {
984  struct {
985  impl::digits_t fMinInt;
986  impl::digits_t fMaxInt;
987  bool fFormatFailIfMoreThanMaxDigits;
988  } minMaxInt;
989  UErrorCode errorCode;
990  } fUnion;
991  bool fHasError = false;
992 
993  IntegerWidth(impl::digits_t minInt, impl::digits_t maxInt, bool formatFailIfMoreThanMaxDigits);
994 
995  IntegerWidth(UErrorCode errorCode) { // NOLINT
996  fUnion.errorCode = errorCode;
997  fHasError = true;
998  }
999 
1000  IntegerWidth() { // NOLINT
1001  fUnion.minMaxInt.fMinInt = -1;
1002  }
1003 
1005  static IntegerWidth standard() {
1006  return IntegerWidth::zeroFillTo(1);
1007  }
1008 
1009  bool isBogus() const {
1010  return !fHasError && fUnion.minMaxInt.fMinInt == -1;
1011  }
1012 
1013  UBool copyErrorTo(UErrorCode &status) const {
1014  if (fHasError) {
1015  status = fUnion.errorCode;
1016  return true;
1017  }
1018  return false;
1019  }
1020 
1021  void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const;
1022 
1023  bool operator==(const IntegerWidth& other) const;
1024 
1025  // To allow MacroProps/MicroProps to initialize empty instances:
1026  friend struct impl::MacroProps;
1027  friend struct impl::MicroProps;
1028 
1029  // To allow NumberFormatterImpl to access isBogus():
1030  friend class impl::NumberFormatterImpl;
1031 
1032  // To allow the use of this class when formatting:
1033  friend class impl::MutablePatternModifier;
1034  friend class impl::ImmutablePatternModifier;
1035 
1036  // So that NumberPropertyMapper can create instances
1037  friend class impl::NumberPropertyMapper;
1038 
1039  // To allow access to the skeleton generation code:
1040  friend class impl::GeneratorHelpers;
1041 };
1042 
1051 class U_I18N_API Scale : public UMemory {
1052  public:
1059  static Scale none();
1060 
1071  static Scale powerOfTen(int32_t power);
1072 
1085  static Scale byDecimal(StringPiece multiplicand);
1086 
1095  static Scale byDouble(double multiplicand);
1096 
1103  static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power);
1104 
1105  // We need a custom destructor for the DecNum, which means we need to declare
1106  // the copy/move constructor/assignment quartet.
1107 
1109  Scale(const Scale& other);
1110 
1112  Scale& operator=(const Scale& other);
1113 
1115  Scale(Scale&& src) U_NOEXCEPT;
1116 
1118  Scale& operator=(Scale&& src) U_NOEXCEPT;
1119 
1121  ~Scale();
1122 
1123 #ifndef U_HIDE_INTERNAL_API
1124 
1125  Scale(int32_t magnitude, impl::DecNum* arbitraryToAdopt);
1126 #endif /* U_HIDE_INTERNAL_API */
1127 
1128  private:
1129  int32_t fMagnitude;
1130  impl::DecNum* fArbitrary;
1131  UErrorCode fError;
1132 
1133  Scale(UErrorCode error) : fMagnitude(0), fArbitrary(nullptr), fError(error) {}
1134 
1135  Scale() : fMagnitude(0), fArbitrary(nullptr), fError(U_ZERO_ERROR) {}
1136 
1137  bool isValid() const {
1138  return fMagnitude != 0 || fArbitrary != nullptr;
1139  }
1140 
1141  UBool copyErrorTo(UErrorCode &status) const {
1142  if (U_FAILURE(fError)) {
1143  status = fError;
1144  return true;
1145  }
1146  return false;
1147  }
1148 
1149  void applyTo(impl::DecimalQuantity& quantity) const;
1150 
1151  void applyReciprocalTo(impl::DecimalQuantity& quantity) const;
1152 
1153  // To allow MacroProps/MicroProps to initialize empty instances:
1154  friend struct impl::MacroProps;
1155  friend struct impl::MicroProps;
1156 
1157  // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1158  friend class impl::NumberFormatterImpl;
1159 
1160  // To allow the helper class MultiplierFormatHandler access to private fields:
1161  friend class impl::MultiplierFormatHandler;
1162 
1163  // To allow access to the skeleton generation code:
1164  friend class impl::GeneratorHelpers;
1165 
1166  // To allow access to parsing code:
1167  friend class ::icu::numparse::impl::NumberParserImpl;
1168  friend class ::icu::numparse::impl::MultiplierParseHandler;
1169 };
1170 
1171 namespace impl {
1172 
1173 // Do not enclose entire StringProp with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1179 
1180 #ifndef U_HIDE_INTERNAL_API
1181 
1182  public:
1184  StringProp(const StringProp &other);
1185 
1187  StringProp &operator=(const StringProp &other);
1188 
1191 
1193  StringProp &operator=(StringProp &&src) U_NOEXCEPT;
1194 
1196  ~StringProp();
1197 
1199  int16_t length() const {
1200  return fLength;
1201  }
1202 
1206  void set(StringPiece value);
1207 
1209  bool isSet() const {
1210  return fLength > 0;
1211  }
1212 
1213 #endif // U_HIDE_INTERNAL_API
1214 
1215  private:
1216  char *fValue;
1217  int16_t fLength;
1218  UErrorCode fError;
1219 
1220  StringProp() : fValue(nullptr), fLength(0), fError(U_ZERO_ERROR) {
1221  }
1222 
1224  UBool copyErrorTo(UErrorCode &status) const {
1225  if (U_FAILURE(fError)) {
1226  status = fError;
1227  return true;
1228  }
1229  return false;
1230  }
1231 
1232  // Allow NumberFormatterImpl to access fValue.
1233  friend class impl::NumberFormatterImpl;
1234 
1235  // Allow skeleton generation code to access private members.
1236  friend class impl::GeneratorHelpers;
1237 
1238  // Allow MacroProps/MicroProps to initialize empty instances and to call
1239  // copyErrorTo().
1240  friend struct impl::MacroProps;
1241 };
1242 
1243 // Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1246  public:
1248  SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {}
1249 
1251  SymbolsWrapper(const SymbolsWrapper &other);
1252 
1254  SymbolsWrapper &operator=(const SymbolsWrapper &other);
1255 
1257  SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT;
1258 
1260  SymbolsWrapper &operator=(SymbolsWrapper&& src) U_NOEXCEPT;
1261 
1263  ~SymbolsWrapper();
1264 
1265 #ifndef U_HIDE_INTERNAL_API
1266 
1271  void setTo(const DecimalFormatSymbols &dfs);
1272 
1277  void setTo(const NumberingSystem *ns);
1278 
1283  bool isDecimalFormatSymbols() const;
1284 
1289  bool isNumberingSystem() const;
1290 
1295  const DecimalFormatSymbols *getDecimalFormatSymbols() const;
1296 
1301  const NumberingSystem *getNumberingSystem() const;
1302 
1303 #endif // U_HIDE_INTERNAL_API
1304 
1306  UBool copyErrorTo(UErrorCode &status) const {
1307  if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) {
1308  status = U_MEMORY_ALLOCATION_ERROR;
1309  return true;
1310  } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) {
1311  status = U_MEMORY_ALLOCATION_ERROR;
1312  return true;
1313  }
1314  return false;
1315  }
1316 
1317  private:
1318  enum SymbolsPointerType {
1319  SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS
1320  } fType;
1321 
1322  union {
1323  const DecimalFormatSymbols *dfs;
1324  const NumberingSystem *ns;
1325  } fPtr;
1326 
1327  void doCopyFrom(const SymbolsWrapper &other);
1328 
1329  void doMoveFrom(SymbolsWrapper&& src);
1330 
1331  void doCleanup();
1332 };
1333 
1334 // Do not enclose entire Grouper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1336 class U_I18N_API Grouper : public UMemory {
1337  public:
1338 #ifndef U_HIDE_INTERNAL_API
1339 
1340  static Grouper forStrategy(UNumberGroupingStrategy grouping);
1341 
1346  static Grouper forProperties(const DecimalFormatProperties& properties);
1347 
1348  // Future: static Grouper forProperties(DecimalFormatProperties& properties);
1349 
1351  Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
1352  : fGrouping1(grouping1),
1353  fGrouping2(grouping2),
1354  fMinGrouping(minGrouping),
1355  fStrategy(strategy) {}
1356 
1358  int16_t getPrimary() const;
1359 
1361  int16_t getSecondary() const;
1362 #endif // U_HIDE_INTERNAL_API
1363 
1364  private:
1373  int16_t fGrouping1;
1374  int16_t fGrouping2;
1375 
1383  int16_t fMinGrouping;
1384 
1389  UNumberGroupingStrategy fStrategy;
1390 
1391  Grouper() : fGrouping1(-3) {}
1392 
1393  bool isBogus() const {
1394  return fGrouping1 == -3;
1395  }
1396 
1398  void setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale);
1399 
1400  bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const;
1401 
1402  // To allow MacroProps/MicroProps to initialize empty instances:
1403  friend struct MacroProps;
1404  friend struct MicroProps;
1405 
1406  // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1407  friend class NumberFormatterImpl;
1408 
1409  // To allow NumberParserImpl to perform setLocaleData():
1410  friend class ::icu::numparse::impl::NumberParserImpl;
1411 
1412  // To allow access to the skeleton generation code:
1413  friend class impl::GeneratorHelpers;
1414 };
1415 
1416 // Do not enclose entire Padder with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1418 class U_I18N_API Padder : public UMemory {
1419  public:
1420 #ifndef U_HIDE_INTERNAL_API
1421 
1422  static Padder none();
1423 
1425  static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position);
1426 
1428  static Padder forProperties(const DecimalFormatProperties& properties);
1429 #endif // U_HIDE_INTERNAL_API
1430 
1431  private:
1432  UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding
1433  union {
1434  struct {
1435  int32_t fCp;
1436  UNumberFormatPadPosition fPosition;
1437  } padding;
1438  UErrorCode errorCode;
1439  } fUnion;
1440 
1441  Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position);
1442 
1443  Padder(int32_t width);
1444 
1445  Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT
1446  fUnion.errorCode = errorCode;
1447  }
1448 
1449  Padder() : fWidth(-2) {} // NOLINT
1450 
1451  bool isBogus() const {
1452  return fWidth == -2;
1453  }
1454 
1455  UBool copyErrorTo(UErrorCode &status) const {
1456  if (fWidth == -3) {
1457  status = fUnion.errorCode;
1458  return true;
1459  }
1460  return false;
1461  }
1462 
1463  bool isValid() const {
1464  return fWidth > 0;
1465  }
1466 
1467  int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2,
1468  FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
1469  UErrorCode &status) const;
1470 
1471  // To allow MacroProps/MicroProps to initialize empty instances:
1472  friend struct MacroProps;
1473  friend struct MicroProps;
1474 
1475  // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1476  friend class impl::NumberFormatterImpl;
1477 
1478  // To allow access to the skeleton generation code:
1479  friend class impl::GeneratorHelpers;
1480 };
1481 
1482 // Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1484 struct U_I18N_API MacroProps : public UMemory {
1487 
1489  MeasureUnit unit; // = MeasureUnit(); (the base dimensionless unit)
1490 
1492  MeasureUnit perUnit; // = MeasureUnit(); (the base dimensionless unit)
1493 
1495  Precision precision; // = Precision(); (bogus)
1496 
1499 
1501  Grouper grouper; // = Grouper(); (bogus)
1502 
1504  Padder padder; // = Padder(); (bogus)
1505 
1507  IntegerWidth integerWidth; // = IntegerWidth(); (bogus)
1508 
1511 
1512  // UNUM_XYZ_COUNT denotes null (bogus) values.
1513 
1516 
1519 
1522 
1524  Scale scale; // = Scale(); (benign value)
1525 
1527  StringProp usage; // = StringProp(); (no usage)
1528 
1530  StringProp unitDisplayCase; // = StringProp(); (nominative)
1531 
1533  const AffixPatternProvider* affixProvider = nullptr; // no ownership
1534 
1536  const PluralRules* rules = nullptr; // no ownership
1537 
1539  int32_t threshold = kInternalDefaultThreshold;
1540 
1543 
1544  // NOTE: Uses default copy and move constructors.
1545 
1550  bool copyErrorTo(UErrorCode &status) const {
1551  return notation.copyErrorTo(status) || precision.copyErrorTo(status) ||
1552  padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) ||
1553  symbols.copyErrorTo(status) || scale.copyErrorTo(status) || usage.copyErrorTo(status) ||
1554  unitDisplayCase.copyErrorTo(status);
1555  }
1556 };
1557 
1558 } // namespace impl
1559 
1560 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
1561 // Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
1562 // is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
1563 // inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
1564 // fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
1565 // they will all be passed to the linker, and the linker will still find and export all the class members.
1566 #pragma warning(push)
1567 #pragma warning(disable: 4661)
1568 #endif
1569 
1575 template<typename Derived>
1577  public:
1606  Derived notation(const Notation &notation) const &;
1607 
1617  Derived notation(const Notation &notation) &&;
1618 
1667  Derived unit(const icu::MeasureUnit &unit) const &;
1668 
1678  Derived unit(const icu::MeasureUnit &unit) &&;
1679 
1693  Derived adoptUnit(icu::MeasureUnit *unit) const &;
1694 
1704  Derived adoptUnit(icu::MeasureUnit *unit) &&;
1705 
1728  Derived perUnit(const icu::MeasureUnit &perUnit) const &;
1729 
1739  Derived perUnit(const icu::MeasureUnit &perUnit) &&;
1740 
1754  Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &;
1755 
1765  Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&;
1766 
1797  Derived precision(const Precision& precision) const &;
1798 
1808  Derived precision(const Precision& precision) &&;
1809 
1828  Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &;
1829 
1838  Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&;
1839 
1867  Derived grouping(UNumberGroupingStrategy strategy) const &;
1868 
1878  Derived grouping(UNumberGroupingStrategy strategy) &&;
1879 
1904  Derived integerWidth(const IntegerWidth &style) const &;
1905 
1915  Derived integerWidth(const IntegerWidth &style) &&;
1916 
1957  Derived symbols(const DecimalFormatSymbols &symbols) const &;
1958 
1968  Derived symbols(const DecimalFormatSymbols &symbols) &&;
1969 
2003  Derived adoptSymbols(NumberingSystem *symbols) const &;
2004 
2014  Derived adoptSymbols(NumberingSystem *symbols) &&;
2015 
2041  Derived unitWidth(UNumberUnitWidth width) const &;
2042 
2052  Derived unitWidth(UNumberUnitWidth width) &&;
2053 
2079  Derived sign(UNumberSignDisplay style) const &;
2080 
2090  Derived sign(UNumberSignDisplay style) &&;
2091 
2117  Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
2118 
2128  Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
2129 
2154  Derived scale(const Scale &scale) const &;
2155 
2165  Derived scale(const Scale &scale) &&;
2166 
2167 #ifndef U_HIDE_DRAFT_API
2168 
2210  Derived usage(StringPiece usage) const &;
2211 
2219  Derived usage(StringPiece usage) &&;
2220 #endif // U_HIDE_DRAFT_API
2221 
2222 #ifndef U_HIDE_DRAFT_API
2223 #ifndef U_HIDE_INTERNAL_API
2224 
2230  Derived unitDisplayCase(StringPiece unitDisplayCase) const &;
2231 
2237  Derived unitDisplayCase(StringPiece unitDisplayCase) &&;
2238 #endif // U_HIDE_INTERNAL_API
2239 #endif // U_HIDE_DRAFT_API
2240 
2241 #ifndef U_HIDE_INTERNAL_API
2242 
2248  Derived padding(const impl::Padder &padder) const &;
2249 
2251  Derived padding(const impl::Padder &padder) &&;
2252 
2259  Derived threshold(int32_t threshold) const &;
2260 
2262  Derived threshold(int32_t threshold) &&;
2263 
2269  Derived macros(const impl::MacroProps& macros) const &;
2270 
2272  Derived macros(const impl::MacroProps& macros) &&;
2273 
2275  Derived macros(impl::MacroProps&& macros) const &;
2276 
2278  Derived macros(impl::MacroProps&& macros) &&;
2279 
2280 #endif /* U_HIDE_INTERNAL_API */
2281 
2299  UnicodeString toSkeleton(UErrorCode& status) const;
2300 
2312  LocalPointer<Derived> clone() const &;
2313 
2321  LocalPointer<Derived> clone() &&;
2322 
2329  UBool copyErrorTo(UErrorCode &outErrorCode) const {
2330  if (U_FAILURE(outErrorCode)) {
2331  // Do not overwrite the older error code
2332  return true;
2333  }
2334  fMacros.copyErrorTo(outErrorCode);
2335  return U_FAILURE(outErrorCode);
2336  }
2337 
2338  // NOTE: Uses default copy and move constructors.
2339 
2340  private:
2341  impl::MacroProps fMacros;
2342 
2343  // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
2344  NumberFormatterSettings() = default;
2345 
2346  friend class LocalizedNumberFormatter;
2347  friend class UnlocalizedNumberFormatter;
2348 
2349  // Give NumberRangeFormatter access to the MacroProps
2350  friend void impl::touchRangeLocales(impl::RangeMacroProps& macros);
2351  friend class impl::NumberRangeFormatterImpl;
2352 };
2353 
2363  : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory {
2364 
2365  public:
2375  LocalizedNumberFormatter locale(const icu::Locale &locale) const &;
2376 
2386  LocalizedNumberFormatter locale(const icu::Locale &locale) &&;
2387 
2393  UnlocalizedNumberFormatter() = default;
2394 
2400 
2407 
2412  UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other);
2413 
2420 
2421  private:
2423 
2424  explicit UnlocalizedNumberFormatter(
2426 
2427  // To give the fluent setters access to this class's constructor:
2429 
2430  // To give NumberFormatter::with() access to this class's constructor:
2431  friend class NumberFormatter;
2432 };
2433 
2443  : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory {
2444  public:
2456  FormattedNumber formatInt(int64_t value, UErrorCode &status) const;
2457 
2469  FormattedNumber formatDouble(double value, UErrorCode &status) const;
2470 
2485  FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const;
2486 
2487 #ifndef U_HIDE_INTERNAL_API
2488 
2492  FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const;
2493 
2497  void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const;
2498 
2503  const impl::NumberFormatterImpl* getCompiled() const;
2504 
2509  int32_t getCallCount() const;
2510 
2511 #endif /* U_HIDE_INTERNAL_API */
2512 
2526  Format* toFormat(UErrorCode& status) const;
2527 
2533  LocalizedNumberFormatter() = default;
2534 
2540 
2547 
2552  LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other);
2553 
2560 
2561 #ifndef U_HIDE_INTERNAL_API
2562 
2575  void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const;
2576 
2577 #endif /* U_HIDE_INTERNAL_API */
2578 
2584 
2585  private:
2586  // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal
2587  // header, and LocalPointer needs the full class definition in order to delete the instance.
2588  const impl::NumberFormatterImpl* fCompiled {nullptr};
2589  char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t
2590 
2591  // Owned pointer to a DecimalFormatWarehouse, used when copying a LocalizedNumberFormatter
2592  // from a DecimalFormat.
2593  const impl::DecimalFormatWarehouse* fWarehouse {nullptr};
2594 
2596 
2598 
2599  LocalizedNumberFormatter(const impl::MacroProps &macros, const Locale &locale);
2600 
2601  LocalizedNumberFormatter(impl::MacroProps &&macros, const Locale &locale);
2602 
2603  void resetCompiled();
2604 
2605  void lnfMoveHelper(LocalizedNumberFormatter&& src);
2606 
2607  void lnfCopyHelper(const LocalizedNumberFormatter& src, UErrorCode& status);
2608 
2612  bool computeCompiled(UErrorCode& status) const;
2613 
2614  // To give the fluent setters access to this class's constructor:
2617 
2618  // To give UnlocalizedNumberFormatter::locale() access to this class's constructor:
2619  friend class UnlocalizedNumberFormatter;
2620 };
2621 
2622 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
2623 // Warning 4661.
2624 #pragma warning(pop)
2625 #endif
2626 
2636  public:
2637 
2643  : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
2644 
2650 
2655  virtual ~FormattedNumber() U_OVERRIDE;
2656 
2658  FormattedNumber(const FormattedNumber&) = delete;
2659 
2661  FormattedNumber& operator=(const FormattedNumber&) = delete;
2662 
2667  FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
2668 
2669  // Copybrief: this method is older than the parent method
2677  UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
2678 
2679  // Copydoc: this method is new in ICU 64
2681  UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
2682 
2683  // Copybrief: this method is older than the parent method
2691  Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
2692 
2693  // Copydoc: this method is new in ICU 64
2695  UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
2696 
2715  template<typename StringClass>
2716  inline StringClass toDecimalNumber(UErrorCode& status) const;
2717 
2718 #ifndef U_HIDE_DRAFT_API
2719 
2730  MeasureUnit getOutputUnit(UErrorCode& status) const;
2731 
2738  const char *getGender(UErrorCode& status) const;
2739 #endif // U_HIDE_DRAFT_API
2740 
2741 #ifndef U_HIDE_INTERNAL_API
2742 
2747  void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const;
2748 
2753  void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
2754 
2755 #endif /* U_HIDE_INTERNAL_API */
2756 
2757  private:
2758  // Can't use LocalPointer because UFormattedNumberData is forward-declared
2759  const impl::UFormattedNumberData *fData;
2760 
2761  // Error code for the terminal methods
2762  UErrorCode fErrorCode;
2763 
2768  explicit FormattedNumber(impl::UFormattedNumberData *results)
2769  : fData(results), fErrorCode(U_ZERO_ERROR) {}
2770 
2771  explicit FormattedNumber(UErrorCode errorCode)
2772  : fData(nullptr), fErrorCode(errorCode) {}
2773 
2774  void toDecimalNumber(ByteSink& sink, UErrorCode& status) const;
2775 
2776  // To give LocalizedNumberFormatter format methods access to this class's constructor:
2777  friend class LocalizedNumberFormatter;
2778 
2779  // To give C API access to internals
2780  friend struct impl::UFormattedNumberImpl;
2781 };
2782 
2783 template<typename StringClass>
2784 StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const {
2785  StringClass result;
2786  StringByteSink<StringClass> sink(&result);
2787  toDecimalNumber(sink, status);
2788  return result;
2789 }
2790 
2797  public:
2805  static UnlocalizedNumberFormatter with();
2806 
2816  static LocalizedNumberFormatter withLocale(const Locale &locale);
2817 
2835  static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
2836 
2857  static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
2858  UParseError& perror, UErrorCode& status);
2859 
2863  NumberFormatter() = delete;
2864 };
2865 
2866 } // namespace number
2867 U_NAMESPACE_END
2868 
2869 #endif /* #if !UCONFIG_NO_FORMATTING */
2870 
2871 #endif /* U_SHOW_CPLUSPLUS_API */
2872 
2873 #endif // __NUMBERFORMATTER_H__
icu::number::Scale
A class that defines a quantity by which a number should be multiplied when formatting.
Definition: numberformatter.h:1051
icu::DecimalFormatSymbols
This class represents the set of symbols needed by DecimalFormat to format numbers.
Definition: dcfmtsym.h:86
UNUM_DECIMAL_SEPARATOR_COUNT
@ UNUM_DECIMAL_SEPARATOR_COUNT
One more than the highest UNumberDecimalSeparatorDisplay value.
Definition: unumberformatter.h:500
icu::number::Notation::NotationUnion::ScientificSettings::fEngineeringInterval
int8_t fEngineeringInterval
Definition: numberformatter.h:352
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:369
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxSig
impl::digits_t fMaxSig
Definition: numberformatter.h:707
fpositer.h
C++ API: FieldPosition Iterator.
parseerr.h
C API: Parse Error Information.
icu::number::impl::MacroProps::perUnit
MeasureUnit perUnit
Definition: numberformatter.h:1492
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fPriority
UNumberRoundingPriority fPriority
Definition: numberformatter.h:709
unumberformatter.h
C-compatible API for localized number formatting; not recommended for C++.
icu::number::impl::StringProp::length
int16_t length() const
Definition: numberformatter.h:1199
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::number::impl::touchRangeLocales
void touchRangeLocales(impl::RangeMacroProps &macros)
Used for NumberRangeFormatter and implemented in numrange_fluent.cpp.
icu::CurrencyUnit
A unit of currency, such as USD (U.S.
Definition: currunit.h:39
icu::number::IntegerWidth
A class that defines the strategy for padding and truncating integers before the decimal separator.
Definition: numberformatter.h:954
icu::number::impl::MacroProps::scale
Scale scale
Definition: numberformatter.h:1524
U_I18N_API
#define U_I18N_API
Definition: utypes.h:301
UNUM_UNIT_WIDTH_COUNT
@ UNUM_UNIT_WIDTH_COUNT
One more than the highest UNumberUnitWidth value.
Definition: unumberformatter.h:247
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
UNumberSignDisplay
UNumberSignDisplay
An enum declaring how to denote positive and negative numbers.
Definition: unumberformatter.h:370
U_NOEXCEPT
#define U_NOEXCEPT
Definition: platform.h:529
icu::number::impl::MacroProps::usage
StringProp usage
Definition: numberformatter.h:1527
icu::FormattedValue
An abstract formatted value: a string with associated field attributes.
Definition: formattedvalue.h:241
icu::number::IncrementPrecision
A class that defines a rounding precision parameterized by a rounding increment to be used when forma...
Definition: numberformatter.h:918
UNUM_SIGN_COUNT
@ UNUM_SIGN_COUNT
One more than the highest UNumberSignDisplay value.
Definition: unumberformatter.h:463
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
U_OVERRIDE
#define U_OVERRIDE
Definition: umachine.h:130
icu::PluralRules
Defines rules for mapping non-negative numeric values onto a small set of keywords.
Definition: plurrule.h:206
icu::number::Notation::NotationUnion::ScientificSettings
Definition: numberformatter.h:350
UCurrencyUsage
UCurrencyUsage
Currency Usage used for Decimal Format.
Definition: ucurr.h:41
icu::LocalPointer
"Smart pointer" class, deletes objects via the standard C++ delete operator.
Definition: localpointer.h:191
icu::number::NumberFormatterSettings::copyErrorTo
UBool copyErrorTo(UErrorCode &outErrorCode) const
Sets the UErrorCode if an error occurred in the fluent chain.
Definition: numberformatter.h:2329
U_MEMORY_ALLOCATION_ERROR
@ U_MEMORY_ALLOCATION_ERROR
Memory allocation error.
Definition: utypes.h:457
icu::number::impl::RangeMacroProps
Definition: numberrangeformatter.h:93
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
icu::Format
Base class for all formats.
Definition: format.h:98
fieldpos.h
C++ API: FieldPosition identifies the fields in a formatted output.
unum.h
C API: Compatibility APIs for number formatting.
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::number::impl::MacroProps::grouper
Grouper grouper
Definition: numberformatter.h:1501
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:467
icu::number::Notation::NotationUnion::ScientificSettings::fMinExponentDigits
impl::digits_t fMinExponentDigits
Definition: numberformatter.h:356
icu::number::impl::MacroProps::unitDisplayCase
StringProp unitDisplayCase
Definition: numberformatter.h:1530
U_FAILURE
#define U_FAILURE(x)
Does the error code indicate a failure?
Definition: utypes.h:719
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::number::impl::MacroProps::precision
Precision precision
Definition: numberformatter.h:1495
icu::number::Precision::PrecisionUnion::IncrementSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:719
UNumberRoundingPriority
UNumberRoundingPriority
An enum declaring how to resolve conflicts between maximum fraction digits and maximum significant di...
Definition: unumberformatter.h:120
icu::number::FormattedNumber
The result of a number formatting operation.
Definition: numberformatter.h:2635
icu::number::Notation::NotationUnion::ScientificSettings::fExponentSignDisplay
UNumberSignDisplay fExponentSignDisplay
Definition: numberformatter.h:358
icu::number::UnlocalizedNumberFormatter
A NumberFormatter that does not yet have a locale.
Definition: numberformatter.h:2362
icu::number::impl::Grouper
Definition: numberformatter.h:1336
icu::number::NumberFormatterSettings
An abstract base class for specifying settings related to number formatting.
Definition: numberformatter.h:1576
icu::number::impl::MacroProps::integerWidth
IntegerWidth integerWidth
Definition: numberformatter.h:1507
icu::number::Precision
A class that defines the rounding precision to be used when formatting numbers in NumberFormatter.
Definition: numberformatter.h:468
icu::number::impl::MacroProps::padder
Padder padder
Definition: numberformatter.h:1504
icu::UMemory
UMemory is the common ICU base class.
Definition: uobject.h:115
icu::number::impl::MacroProps::locale
Locale locale
Definition: numberformatter.h:1542
icu::number::impl::MacroProps::notation
Notation notation
Definition: numberformatter.h:1486
dcfmtsym.h
C++ API: Symbols for formatting numbers.
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:703
icu::number::Precision::PrecisionUnion::IncrementSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:717
icu::number::impl::MacroProps::symbols
SymbolsWrapper symbols
Definition: numberformatter.h:1510
U_ZERO_ERROR
@ U_ZERO_ERROR
No error, no warning.
Definition: utypes.h:449
appendable.h
C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts).
UNumberUnitWidth
UNumberUnitWidth
An enum declaring how to render units, including currencies.
Definition: unumberformatter.h:155
UNumberDecimalSeparatorDisplay
UNumberDecimalSeparatorDisplay
An enum declaring how to render the decimal separator.
Definition: unumberformatter.h:477
icu::number::impl::StringProp
Manages NumberFormatterSettings::usage()'s char* instance on the heap.
Definition: numberformatter.h:1178
UNumberTrailingZeroDisplay
UNumberTrailingZeroDisplay
An enum declaring how to render trailing zeros.
Definition: unumberformatter.h:512
formattedvalue.h
C++ API: Abstract operations for localized strings.
icu::number::FractionPrecision
A class that defines a rounding precision based on a number of fraction places and optionally signifi...
Definition: numberformatter.h:802
ucurr.h
C API: Encapsulates information about a currency.
icu::number::CurrencyPrecision
A class that defines a rounding precision parameterized by a currency to be used when formatting numb...
Definition: numberformatter.h:880
UNUM_ROUND_HALFEVEN
@ UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:291
icu::Appendable
Base class for objects to which Unicode characters and strings can be appended.
Definition: appendable.h:54
icu::number::Notation::NotationUnion::ScientificSettings::fRequireMinInt
bool fRequireMinInt
Definition: numberformatter.h:354
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinSig
impl::digits_t fMinSig
Definition: numberformatter.h:705
icu::number::impl::Grouper::Grouper
Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
Definition: numberformatter.h:1351
icu::NumberingSystem
Defines numbering systems.
Definition: numsys.h:60
icu::number::impl::SymbolsWrapper::copyErrorTo
UBool copyErrorTo(UErrorCode &status) const
Definition: numberformatter.h:1306
icu::number::Notation
A class that defines the notation style to be used when formatting numbers in NumberFormatter.
Definition: numberformatter.h:197
icu::number::impl::digits_t
int16_t digits_t
Datatype for minimum/maximum fraction digits.
Definition: numberformatter.h:130
icu::number::ScientificNotation
A class that defines the scientific notation style to be used when formatting numbers in NumberFormat...
Definition: numberformatter.h:407
UNumberFormatRoundingMode
UNumberFormatRoundingMode
The possible number format rounding modes.
Definition: unum.h:282
icu::StringByteSink
Implementation of ByteSink that writes to a "string".
Definition: bytestream.h:267
icu::number::Precision::PrecisionUnion::FractionSignificantSettings
Definition: numberformatter.h:698
UNUM_TRAILING_ZERO_AUTO
@ UNUM_TRAILING_ZERO_AUTO
Display trailing zeros according to the settings for minimum fraction and significant digits.
Definition: unumberformatter.h:518
icu::number::impl::StringProp::isSet
bool isSet() const
Definition: numberformatter.h:1209
icu::number::impl::Padder
Definition: numberformatter.h:1418
icu::number::impl::SymbolsWrapper::SymbolsWrapper
SymbolsWrapper()
Definition: numberformatter.h:1248
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:701
uobject.h
C++ API: Common ICU base class UObject.
nounit.h
C++ API: units for percent and permille.
plurrule.h
C++ API: PluralRules object.
icu::number::NumberFormatter
See the main description in numberformatter.h for documentation and examples.
Definition: numberformatter.h:2796
U_INVALID_STATE_ERROR
@ U_INVALID_STATE_ERROR
Requested operation can not be completed with ICU in its current state.
Definition: utypes.h:478
icu::number::Precision::PrecisionUnion::IncrementSettings
Definition: numberformatter.h:712
UNumberGroupingStrategy
UNumberGroupingStrategy
An enum declaring the strategy for when and how to display grouping separators (i....
Definition: unumberformatter.h:276
icu::number::FormattedNumber::FormattedNumber
FormattedNumber()
Default constructor; makes an empty FormattedNumber.
Definition: numberformatter.h:2642
icu::number::impl::SymbolsWrapper
Definition: numberformatter.h:1245
measunit.h
C++ API: A unit for measuring a quantity.
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:328
icu::number::Precision::PrecisionUnion::IncrementSettings::fIncrement
double fIncrement
Definition: numberformatter.h:715
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:60
bytestream.h
C++ API: Interface for writing bytes, and implementation classes.
currunit.h
C++ API: Currency Unit Information.
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
icu::number::LocalizedNumberFormatter
A NumberFormatter that has a locale associated with it; this means .format() methods are available.
Definition: numberformatter.h:2442
icu::number::impl::MacroProps
Definition: numberformatter.h:1484
icu::number::impl::MacroProps::copyErrorTo
bool copyErrorTo(UErrorCode &status) const
Check all members for errors.
Definition: numberformatter.h:1550
icu::ConstrainedFieldPosition
Represents a span of a string containing a given field.
Definition: formattedvalue.h:41
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:339
icu::number::impl::MacroProps::unit
MeasureUnit unit
Definition: numberformatter.h:1489