ICU 68.2  68.2
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 
85 U_NAMESPACE_BEGIN
86 
87 // Forward declarations:
88 class IFixedDecimal;
89 class FieldPositionIteratorHandler;
90 class FormattedStringBuilder;
91 
92 namespace numparse {
93 namespace impl {
94 
95 // Forward declarations:
96 class NumberParserImpl;
97 class MultiplierParseHandler;
98 
99 }
100 }
101 
102 namespace units {
103 
104 // Forward declarations:
105 class UnitsRouter;
106 
107 } // namespace units
108 
109 namespace number { // icu::number
110 
111 // Forward declarations:
112 class UnlocalizedNumberFormatter;
113 class LocalizedNumberFormatter;
114 class FormattedNumber;
115 class Notation;
116 class ScientificNotation;
117 class Precision;
118 class FractionPrecision;
119 class CurrencyPrecision;
120 class IncrementPrecision;
121 class IntegerWidth;
122 
123 namespace impl {
124 
125 // can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes
131 typedef int16_t digits_t;
132 
133 // can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization
140 static constexpr int32_t kInternalDefaultThreshold = 3;
141 
142 // Forward declarations:
143 class Padder;
144 struct MacroProps;
145 struct MicroProps;
146 class DecimalQuantity;
147 class UFormattedNumberData;
148 class NumberFormatterImpl;
149 struct ParsedPatternInfo;
150 class ScientificModifier;
151 class MultiplierProducer;
152 class RoundingImpl;
153 class ScientificHandler;
154 class Modifier;
155 class AffixPatternProvider;
156 class NumberPropertyMapper;
157 struct DecimalFormatProperties;
158 class MultiplierFormatHandler;
159 class CurrencySymbols;
160 class GeneratorHelpers;
161 class DecNum;
162 class NumberRangeFormatterImpl;
163 struct RangeMacroProps;
164 struct UFormattedNumberImpl;
165 class MutablePatternModifier;
166 class ImmutablePatternModifier;
167 struct DecimalFormatWarehouse;
168 
176 
177 } // namespace impl
178 
185 
192 
198 class U_I18N_API Notation : public UMemory {
199  public:
224  static ScientificNotation scientific();
225 
248  static ScientificNotation engineering();
249 
291  static CompactNotation compactShort();
292 
315  static CompactNotation compactLong();
316 
341  static SimpleNotation simple();
342 
343  private:
344  enum NotationType {
345  NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR
346  } fType;
347 
348  union NotationUnion {
349  // For NTN_SCIENTIFIC
360  } scientific;
361 
362  // For NTN_COMPACT
363  UNumberCompactStyle compactStyle;
364 
365  // For NTN_ERROR
366  UErrorCode errorCode;
367  } fUnion;
368 
370 
371  Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {}
372 
373  Notation(UErrorCode errorCode) : fType(NTN_ERROR) {
374  fUnion.errorCode = errorCode;
375  }
376 
377  Notation() : fType(NTN_SIMPLE), fUnion() {}
378 
379  UBool copyErrorTo(UErrorCode &status) const {
380  if (fType == NTN_ERROR) {
381  status = fUnion.errorCode;
382  return true;
383  }
384  return false;
385  }
386 
387  // To allow MacroProps to initialize empty instances:
388  friend struct impl::MacroProps;
389  friend class ScientificNotation;
390 
391  // To allow implementation to access internal types:
392  friend class impl::NumberFormatterImpl;
393  friend class impl::ScientificModifier;
394  friend class impl::ScientificHandler;
395 
396  // To allow access to the skeleton generation code:
397  friend class impl::GeneratorHelpers;
398 };
399 
409  public:
423  ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const;
424 
438  ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const;
439 
440  private:
441  // Inherit constructor
442  using Notation::Notation;
443 
444  // Raw constructor for NumberPropertyMapper
445  ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, impl::digits_t fMinExponentDigits,
446  UNumberSignDisplay fExponentSignDisplay);
447 
448  friend class Notation;
449 
450  // So that NumberPropertyMapper can create instances
451  friend class impl::NumberPropertyMapper;
452 };
453 
460 
469 class U_I18N_API Precision : public UMemory {
470 
471  public:
489  static Precision unlimited();
490 
497  static FractionPrecision integer();
498 
526  static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces);
527 
541  static FractionPrecision minFraction(int32_t minFractionPlaces);
542 
553  static FractionPrecision maxFraction(int32_t maxFractionPlaces);
554 
568  static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces);
569 
583  static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits);
584 
597  static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits);
598 
607  static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits);
608 
620  static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits,
621  int32_t maxSignificantDigits);
622 
642  static IncrementPrecision increment(double roundingIncrement);
643 
661  static CurrencyPrecision currency(UCurrencyUsage currencyUsage);
662 
663  private:
664  enum PrecisionType {
665  RND_BOGUS,
666  RND_NONE,
667  RND_FRACTION,
668  RND_SIGNIFICANT,
669  RND_FRACTION_SIGNIFICANT,
670 
671  // Used for strange increments like 3.14.
672  RND_INCREMENT,
673 
674  // Used for increments with 1 as the only digit. This is different than fraction
675  // rounding because it supports having additional trailing zeros. For example, this
676  // class is used to round with the increment 0.010.
677  RND_INCREMENT_ONE,
678 
679  // Used for increments with 5 as the only digit (nickel rounding).
680  RND_INCREMENT_FIVE,
681 
682  RND_CURRENCY,
683  RND_ERROR
684  } fType;
685 
686  union PrecisionUnion {
689  // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT
698  } fracSig;
701  // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE
703  double fIncrement;
708  } increment;
709  UCurrencyUsage currencyUsage; // For RND_CURRENCY
710  UErrorCode errorCode; // For RND_ERROR
711  } fUnion;
712 
715 
716  Precision(const PrecisionType& type, const PrecisionUnion& union_)
717  : fType(type), fUnion(union_) {}
718 
719  Precision(UErrorCode errorCode) : fType(RND_ERROR) {
720  fUnion.errorCode = errorCode;
721  }
722 
723  Precision() : fType(RND_BOGUS) {}
724 
725  bool isBogus() const {
726  return fType == RND_BOGUS;
727  }
728 
729  UBool copyErrorTo(UErrorCode &status) const {
730  if (fType == RND_ERROR) {
731  status = fUnion.errorCode;
732  return true;
733  }
734  return false;
735  }
736 
737  // On the parent type so that this method can be called internally on Precision instances.
738  Precision withCurrency(const CurrencyUnit &currency, UErrorCode &status) const;
739 
740  static FractionPrecision constructFraction(int32_t minFrac, int32_t maxFrac);
741 
742  static Precision constructSignificant(int32_t minSig, int32_t maxSig);
743 
744  static Precision
745  constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig);
746 
747  static IncrementPrecision constructIncrement(double increment, int32_t minFrac);
748 
749  static CurrencyPrecision constructCurrency(UCurrencyUsage usage);
750 
751  // To allow MacroProps/MicroProps to initialize bogus instances:
752  friend struct impl::MacroProps;
753  friend struct impl::MicroProps;
754 
755  // To allow NumberFormatterImpl to access isBogus() and other internal methods:
756  friend class impl::NumberFormatterImpl;
757 
758  // To allow NumberPropertyMapper to create instances from DecimalFormatProperties:
759  friend class impl::NumberPropertyMapper;
760 
761  // To allow access to the main implementation class:
762  friend class impl::RoundingImpl;
763 
764  // To allow child classes to call private methods:
765  friend class FractionPrecision;
766  friend class CurrencyPrecision;
767  friend class IncrementPrecision;
768 
769  // To allow access to the skeleton generation code:
770  friend class impl::GeneratorHelpers;
771 
772  // To allow access to isBogus and the default (bogus) constructor:
773  friend class units::UnitsRouter;
774 };
775 
786  public:
803  Precision withMinDigits(int32_t minSignificantDigits) const;
804 
822  Precision withMaxDigits(int32_t maxSignificantDigits) const;
823 
824  private:
825  // Inherit constructor
826  using Precision::Precision;
827 
828  // To allow parent class to call this class's constructor:
829  friend class Precision;
830 };
831 
842  public:
860  Precision withCurrency(const CurrencyUnit &currency) const;
861 
862  private:
863  // Inherit constructor
864  using Precision::Precision;
865 
866  // To allow parent class to call this class's constructor:
867  friend class Precision;
868 };
869 
880  public:
896  Precision withMinFraction(int32_t minFrac) const;
897 
898  private:
899  // Inherit constructor
900  using Precision::Precision;
901 
902  // To allow parent class to call this class's constructor:
903  friend class Precision;
904 };
905 
916  public:
928  static IntegerWidth zeroFillTo(int32_t minInt);
929 
941  IntegerWidth truncateAt(int32_t maxInt);
942 
943  private:
944  union {
945  struct {
946  impl::digits_t fMinInt;
947  impl::digits_t fMaxInt;
948  bool fFormatFailIfMoreThanMaxDigits;
949  } minMaxInt;
950  UErrorCode errorCode;
951  } fUnion;
952  bool fHasError = false;
953 
954  IntegerWidth(impl::digits_t minInt, impl::digits_t maxInt, bool formatFailIfMoreThanMaxDigits);
955 
956  IntegerWidth(UErrorCode errorCode) { // NOLINT
957  fUnion.errorCode = errorCode;
958  fHasError = true;
959  }
960 
961  IntegerWidth() { // NOLINT
962  fUnion.minMaxInt.fMinInt = -1;
963  }
964 
966  static IntegerWidth standard() {
967  return IntegerWidth::zeroFillTo(1);
968  }
969 
970  bool isBogus() const {
971  return !fHasError && fUnion.minMaxInt.fMinInt == -1;
972  }
973 
974  UBool copyErrorTo(UErrorCode &status) const {
975  if (fHasError) {
976  status = fUnion.errorCode;
977  return true;
978  }
979  return false;
980  }
981 
982  void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const;
983 
984  bool operator==(const IntegerWidth& other) const;
985 
986  // To allow MacroProps/MicroProps to initialize empty instances:
987  friend struct impl::MacroProps;
988  friend struct impl::MicroProps;
989 
990  // To allow NumberFormatterImpl to access isBogus():
991  friend class impl::NumberFormatterImpl;
992 
993  // To allow the use of this class when formatting:
994  friend class impl::MutablePatternModifier;
995  friend class impl::ImmutablePatternModifier;
996 
997  // So that NumberPropertyMapper can create instances
998  friend class impl::NumberPropertyMapper;
999 
1000  // To allow access to the skeleton generation code:
1001  friend class impl::GeneratorHelpers;
1002 };
1003 
1012 class U_I18N_API Scale : public UMemory {
1013  public:
1020  static Scale none();
1021 
1032  static Scale powerOfTen(int32_t power);
1033 
1046  static Scale byDecimal(StringPiece multiplicand);
1047 
1056  static Scale byDouble(double multiplicand);
1057 
1064  static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power);
1065 
1066  // We need a custom destructor for the DecNum, which means we need to declare
1067  // the copy/move constructor/assignment quartet.
1068 
1070  Scale(const Scale& other);
1071 
1073  Scale& operator=(const Scale& other);
1074 
1076  Scale(Scale&& src) U_NOEXCEPT;
1077 
1079  Scale& operator=(Scale&& src) U_NOEXCEPT;
1080 
1082  ~Scale();
1083 
1084 #ifndef U_HIDE_INTERNAL_API
1085 
1086  Scale(int32_t magnitude, impl::DecNum* arbitraryToAdopt);
1087 #endif /* U_HIDE_INTERNAL_API */
1088 
1089  private:
1090  int32_t fMagnitude;
1091  impl::DecNum* fArbitrary;
1092  UErrorCode fError;
1093 
1094  Scale(UErrorCode error) : fMagnitude(0), fArbitrary(nullptr), fError(error) {}
1095 
1096  Scale() : fMagnitude(0), fArbitrary(nullptr), fError(U_ZERO_ERROR) {}
1097 
1098  bool isValid() const {
1099  return fMagnitude != 0 || fArbitrary != nullptr;
1100  }
1101 
1102  UBool copyErrorTo(UErrorCode &status) const {
1103  if (U_FAILURE(fError)) {
1104  status = fError;
1105  return true;
1106  }
1107  return false;
1108  }
1109 
1110  void applyTo(impl::DecimalQuantity& quantity) const;
1111 
1112  void applyReciprocalTo(impl::DecimalQuantity& quantity) const;
1113 
1114  // To allow MacroProps/MicroProps to initialize empty instances:
1115  friend struct impl::MacroProps;
1116  friend struct impl::MicroProps;
1117 
1118  // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1119  friend class impl::NumberFormatterImpl;
1120 
1121  // To allow the helper class MultiplierFormatHandler access to private fields:
1122  friend class impl::MultiplierFormatHandler;
1123 
1124  // To allow access to the skeleton generation code:
1125  friend class impl::GeneratorHelpers;
1126 
1127  // To allow access to parsing code:
1128  friend class ::icu::numparse::impl::NumberParserImpl;
1129  friend class ::icu::numparse::impl::MultiplierParseHandler;
1130 };
1131 
1132 namespace impl {
1133 
1134 // Do not enclose entire Usage with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1139 class U_I18N_API Usage : public UMemory {
1140 
1141 #ifndef U_HIDE_INTERNAL_API
1142 
1143  public:
1145  Usage(const Usage& other);
1146 
1148  Usage& operator=(const Usage& other);
1149 
1151  Usage(Usage &&src) U_NOEXCEPT;
1152 
1154  Usage& operator=(Usage&& src) U_NOEXCEPT;
1155 
1157  ~Usage();
1158 
1160  int16_t length() const { return fLength; }
1161 
1165  void set(StringPiece value);
1166 
1168  bool isSet() const { return fLength > 0; }
1169 
1170 #endif // U_HIDE_INTERNAL_API
1171 
1172  private:
1173  char *fUsage;
1174  int16_t fLength;
1175  UErrorCode fError;
1176 
1177  Usage() : fUsage(nullptr), fLength(0), fError(U_ZERO_ERROR) {}
1178 
1180  UBool copyErrorTo(UErrorCode &status) const {
1181  if (U_FAILURE(fError)) {
1182  status = fError;
1183  return true;
1184  }
1185  return false;
1186  }
1187 
1188  // Allow NumberFormatterImpl to access fUsage.
1189  friend class impl::NumberFormatterImpl;
1190 
1191  // Allow skeleton generation code to access private members.
1192  friend class impl::GeneratorHelpers;
1193 
1194  // Allow MacroProps/MicroProps to initialize empty instances and to call
1195  // copyErrorTo().
1196  friend struct impl::MacroProps;
1197 };
1198 
1199 // Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1202  public:
1204  SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {}
1205 
1207  SymbolsWrapper(const SymbolsWrapper &other);
1208 
1210  SymbolsWrapper &operator=(const SymbolsWrapper &other);
1211 
1213  SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT;
1214 
1216  SymbolsWrapper &operator=(SymbolsWrapper&& src) U_NOEXCEPT;
1217 
1219  ~SymbolsWrapper();
1220 
1221 #ifndef U_HIDE_INTERNAL_API
1222 
1227  void setTo(const DecimalFormatSymbols &dfs);
1228 
1233  void setTo(const NumberingSystem *ns);
1234 
1239  bool isDecimalFormatSymbols() const;
1240 
1245  bool isNumberingSystem() const;
1246 
1251  const DecimalFormatSymbols *getDecimalFormatSymbols() const;
1252 
1257  const NumberingSystem *getNumberingSystem() const;
1258 
1259 #endif // U_HIDE_INTERNAL_API
1260 
1262  UBool copyErrorTo(UErrorCode &status) const {
1263  if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) {
1264  status = U_MEMORY_ALLOCATION_ERROR;
1265  return true;
1266  } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) {
1267  status = U_MEMORY_ALLOCATION_ERROR;
1268  return true;
1269  }
1270  return false;
1271  }
1272 
1273  private:
1274  enum SymbolsPointerType {
1275  SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS
1276  } fType;
1277 
1278  union {
1279  const DecimalFormatSymbols *dfs;
1280  const NumberingSystem *ns;
1281  } fPtr;
1282 
1283  void doCopyFrom(const SymbolsWrapper &other);
1284 
1285  void doMoveFrom(SymbolsWrapper&& src);
1286 
1287  void doCleanup();
1288 };
1289 
1290 // Do not enclose entire Grouper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1292 class U_I18N_API Grouper : public UMemory {
1293  public:
1294 #ifndef U_HIDE_INTERNAL_API
1295 
1296  static Grouper forStrategy(UNumberGroupingStrategy grouping);
1297 
1302  static Grouper forProperties(const DecimalFormatProperties& properties);
1303 
1304  // Future: static Grouper forProperties(DecimalFormatProperties& properties);
1305 
1307  Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
1308  : fGrouping1(grouping1),
1309  fGrouping2(grouping2),
1310  fMinGrouping(minGrouping),
1311  fStrategy(strategy) {}
1312 
1314  int16_t getPrimary() const;
1315 
1317  int16_t getSecondary() const;
1318 #endif // U_HIDE_INTERNAL_API
1319 
1320  private:
1329  int16_t fGrouping1;
1330  int16_t fGrouping2;
1331 
1339  int16_t fMinGrouping;
1340 
1345  UNumberGroupingStrategy fStrategy;
1346 
1347  Grouper() : fGrouping1(-3) {}
1348 
1349  bool isBogus() const {
1350  return fGrouping1 == -3;
1351  }
1352 
1354  void setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale);
1355 
1356  bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const;
1357 
1358  // To allow MacroProps/MicroProps to initialize empty instances:
1359  friend struct MacroProps;
1360  friend struct MicroProps;
1361 
1362  // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1363  friend class NumberFormatterImpl;
1364 
1365  // To allow NumberParserImpl to perform setLocaleData():
1366  friend class ::icu::numparse::impl::NumberParserImpl;
1367 
1368  // To allow access to the skeleton generation code:
1369  friend class impl::GeneratorHelpers;
1370 };
1371 
1372 // Do not enclose entire Padder with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1374 class U_I18N_API Padder : public UMemory {
1375  public:
1376 #ifndef U_HIDE_INTERNAL_API
1377 
1378  static Padder none();
1379 
1381  static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position);
1382 
1384  static Padder forProperties(const DecimalFormatProperties& properties);
1385 #endif // U_HIDE_INTERNAL_API
1386 
1387  private:
1388  UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding
1389  union {
1390  struct {
1391  int32_t fCp;
1392  UNumberFormatPadPosition fPosition;
1393  } padding;
1394  UErrorCode errorCode;
1395  } fUnion;
1396 
1397  Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position);
1398 
1399  Padder(int32_t width);
1400 
1401  Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT
1402  fUnion.errorCode = errorCode;
1403  }
1404 
1405  Padder() : fWidth(-2) {} // NOLINT
1406 
1407  bool isBogus() const {
1408  return fWidth == -2;
1409  }
1410 
1411  UBool copyErrorTo(UErrorCode &status) const {
1412  if (fWidth == -3) {
1413  status = fUnion.errorCode;
1414  return true;
1415  }
1416  return false;
1417  }
1418 
1419  bool isValid() const {
1420  return fWidth > 0;
1421  }
1422 
1423  int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2,
1424  FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
1425  UErrorCode &status) const;
1426 
1427  // To allow MacroProps/MicroProps to initialize empty instances:
1428  friend struct MacroProps;
1429  friend struct MicroProps;
1430 
1431  // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1432  friend class impl::NumberFormatterImpl;
1433 
1434  // To allow access to the skeleton generation code:
1435  friend class impl::GeneratorHelpers;
1436 };
1437 
1438 // Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1440 struct U_I18N_API MacroProps : public UMemory {
1443 
1445  MeasureUnit unit; // = MeasureUnit(); (the base dimensionless unit)
1446 
1448  MeasureUnit perUnit; // = MeasureUnit(); (the base dimensionless unit)
1449 
1451  Precision precision; // = Precision(); (bogus)
1452 
1455 
1457  Grouper grouper; // = Grouper(); (bogus)
1458 
1460  Padder padder; // = Padder(); (bogus)
1461 
1463  IntegerWidth integerWidth; // = IntegerWidth(); (bogus)
1464 
1467 
1468  // UNUM_XYZ_COUNT denotes null (bogus) values.
1469 
1472 
1475 
1478 
1480  Scale scale; // = Scale(); (benign value)
1481 
1483  Usage usage; // = Usage(); (no usage)
1484 
1486  const AffixPatternProvider* affixProvider = nullptr; // no ownership
1487 
1489  const PluralRules* rules = nullptr; // no ownership
1490 
1492  int32_t threshold = kInternalDefaultThreshold;
1493 
1496 
1497  // NOTE: Uses default copy and move constructors.
1498 
1503  bool copyErrorTo(UErrorCode &status) const {
1504  return notation.copyErrorTo(status) || precision.copyErrorTo(status) ||
1505  padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) ||
1506  symbols.copyErrorTo(status) || scale.copyErrorTo(status) || usage.copyErrorTo(status);
1507  }
1508 };
1509 
1510 } // namespace impl
1511 
1512 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
1513 // Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
1514 // is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
1515 // inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
1516 // fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
1517 // they will all be passed to the linker, and the linker will still find and export all the class members.
1518 #pragma warning(push)
1519 #pragma warning(disable: 4661)
1520 #endif
1521 
1527 template<typename Derived>
1529  public:
1558  Derived notation(const Notation &notation) const &;
1559 
1569  Derived notation(const Notation &notation) &&;
1570 
1619  Derived unit(const icu::MeasureUnit &unit) const &;
1620 
1630  Derived unit(const icu::MeasureUnit &unit) &&;
1631 
1645  Derived adoptUnit(icu::MeasureUnit *unit) const &;
1646 
1656  Derived adoptUnit(icu::MeasureUnit *unit) &&;
1657 
1680  Derived perUnit(const icu::MeasureUnit &perUnit) const &;
1681 
1691  Derived perUnit(const icu::MeasureUnit &perUnit) &&;
1692 
1706  Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &;
1707 
1717  Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&;
1718 
1749  Derived precision(const Precision& precision) const &;
1750 
1760  Derived precision(const Precision& precision) &&;
1761 
1780  Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &;
1781 
1790  Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&;
1791 
1819  Derived grouping(UNumberGroupingStrategy strategy) const &;
1820 
1830  Derived grouping(UNumberGroupingStrategy strategy) &&;
1831 
1856  Derived integerWidth(const IntegerWidth &style) const &;
1857 
1867  Derived integerWidth(const IntegerWidth &style) &&;
1868 
1909  Derived symbols(const DecimalFormatSymbols &symbols) const &;
1910 
1920  Derived symbols(const DecimalFormatSymbols &symbols) &&;
1921 
1955  Derived adoptSymbols(NumberingSystem *symbols) const &;
1956 
1966  Derived adoptSymbols(NumberingSystem *symbols) &&;
1967 
1993  Derived unitWidth(UNumberUnitWidth width) const &;
1994 
2004  Derived unitWidth(UNumberUnitWidth width) &&;
2005 
2031  Derived sign(UNumberSignDisplay style) const &;
2032 
2042  Derived sign(UNumberSignDisplay style) &&;
2043 
2069  Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
2070 
2080  Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
2081 
2106  Derived scale(const Scale &scale) const &;
2107 
2117  Derived scale(const Scale &scale) &&;
2118 
2119 #ifndef U_HIDE_DRAFT_API
2120 
2162  Derived usage(StringPiece usage) const &;
2163 
2171  Derived usage(StringPiece usage) &&;
2172 #endif // U_HIDE_DRAFT_API
2173 
2174 #ifndef U_HIDE_INTERNAL_API
2175 
2181  Derived padding(const impl::Padder &padder) const &;
2182 
2184  Derived padding(const impl::Padder &padder) &&;
2185 
2192  Derived threshold(int32_t threshold) const &;
2193 
2195  Derived threshold(int32_t threshold) &&;
2196 
2202  Derived macros(const impl::MacroProps& macros) const &;
2203 
2205  Derived macros(const impl::MacroProps& macros) &&;
2206 
2208  Derived macros(impl::MacroProps&& macros) const &;
2209 
2211  Derived macros(impl::MacroProps&& macros) &&;
2212 
2213 #endif /* U_HIDE_INTERNAL_API */
2214 
2229  UnicodeString toSkeleton(UErrorCode& status) const;
2230 
2242  LocalPointer<Derived> clone() const &;
2243 
2251  LocalPointer<Derived> clone() &&;
2252 
2259  UBool copyErrorTo(UErrorCode &outErrorCode) const {
2260  if (U_FAILURE(outErrorCode)) {
2261  // Do not overwrite the older error code
2262  return true;
2263  }
2264  fMacros.copyErrorTo(outErrorCode);
2265  return U_FAILURE(outErrorCode);
2266  }
2267 
2268  // NOTE: Uses default copy and move constructors.
2269 
2270  private:
2271  impl::MacroProps fMacros;
2272 
2273  // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
2274  NumberFormatterSettings() = default;
2275 
2276  friend class LocalizedNumberFormatter;
2277  friend class UnlocalizedNumberFormatter;
2278 
2279  // Give NumberRangeFormatter access to the MacroProps
2280  friend void impl::touchRangeLocales(impl::RangeMacroProps& macros);
2281  friend class impl::NumberRangeFormatterImpl;
2282 };
2283 
2293  : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory {
2294 
2295  public:
2305  LocalizedNumberFormatter locale(const icu::Locale &locale) const &;
2306 
2316  LocalizedNumberFormatter locale(const icu::Locale &locale) &&;
2317 
2323  UnlocalizedNumberFormatter() = default;
2324 
2330 
2337 
2342  UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other);
2343 
2350 
2351  private:
2353 
2354  explicit UnlocalizedNumberFormatter(
2356 
2357  // To give the fluent setters access to this class's constructor:
2359 
2360  // To give NumberFormatter::with() access to this class's constructor:
2361  friend class NumberFormatter;
2362 };
2363 
2373  : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory {
2374  public:
2386  FormattedNumber formatInt(int64_t value, UErrorCode &status) const;
2387 
2399  FormattedNumber formatDouble(double value, UErrorCode &status) const;
2400 
2415  FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const;
2416 
2417 #ifndef U_HIDE_INTERNAL_API
2418 
2422  FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const;
2423 
2427  void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const;
2428 
2433  const impl::NumberFormatterImpl* getCompiled() const;
2434 
2439  int32_t getCallCount() const;
2440 
2441 #endif /* U_HIDE_INTERNAL_API */
2442 
2456  Format* toFormat(UErrorCode& status) const;
2457 
2463  LocalizedNumberFormatter() = default;
2464 
2470 
2477 
2482  LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other);
2483 
2490 
2491 #ifndef U_HIDE_INTERNAL_API
2492 
2505  void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const;
2506 
2507 #endif /* U_HIDE_INTERNAL_API */
2508 
2514 
2515  private:
2516  // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal
2517  // header, and LocalPointer needs the full class definition in order to delete the instance.
2518  const impl::NumberFormatterImpl* fCompiled {nullptr};
2519  char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t
2520 
2521  // Owned pointer to a DecimalFormatWarehouse, used when copying a LocalizedNumberFormatter
2522  // from a DecimalFormat.
2523  const impl::DecimalFormatWarehouse* fWarehouse {nullptr};
2524 
2526 
2528 
2529  LocalizedNumberFormatter(const impl::MacroProps &macros, const Locale &locale);
2530 
2531  LocalizedNumberFormatter(impl::MacroProps &&macros, const Locale &locale);
2532 
2533  void resetCompiled();
2534 
2535  void lnfMoveHelper(LocalizedNumberFormatter&& src);
2536 
2537  void lnfCopyHelper(const LocalizedNumberFormatter& src, UErrorCode& status);
2538 
2542  bool computeCompiled(UErrorCode& status) const;
2543 
2544  // To give the fluent setters access to this class's constructor:
2547 
2548  // To give UnlocalizedNumberFormatter::locale() access to this class's constructor:
2549  friend class UnlocalizedNumberFormatter;
2550 };
2551 
2552 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
2553 // Warning 4661.
2554 #pragma warning(pop)
2555 #endif
2556 
2566  public:
2567 
2573  : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
2574 
2580 
2585  virtual ~FormattedNumber() U_OVERRIDE;
2586 
2588  FormattedNumber(const FormattedNumber&) = delete;
2589 
2591  FormattedNumber& operator=(const FormattedNumber&) = delete;
2592 
2597  FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
2598 
2599  // Copybrief: this method is older than the parent method
2607  UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
2608 
2609  // Copydoc: this method is new in ICU 64
2611  UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
2612 
2613  // Copybrief: this method is older than the parent method
2621  Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
2622 
2623  // Copydoc: this method is new in ICU 64
2625  UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
2626 
2645  template<typename StringClass>
2646  inline StringClass toDecimalNumber(UErrorCode& status) const;
2647 
2648 #ifndef U_HIDE_DRAFT_API
2649 
2660  MeasureUnit getOutputUnit(UErrorCode& status) const;
2661 #endif // U_HIDE_DRAFT_API
2662 
2663 #ifndef U_HIDE_INTERNAL_API
2664 
2669  void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const;
2670 
2675  void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
2676 
2677 #endif /* U_HIDE_INTERNAL_API */
2678 
2679  private:
2680  // Can't use LocalPointer because UFormattedNumberData is forward-declared
2681  const impl::UFormattedNumberData *fData;
2682 
2683  // Error code for the terminal methods
2684  UErrorCode fErrorCode;
2685 
2690  explicit FormattedNumber(impl::UFormattedNumberData *results)
2691  : fData(results), fErrorCode(U_ZERO_ERROR) {}
2692 
2693  explicit FormattedNumber(UErrorCode errorCode)
2694  : fData(nullptr), fErrorCode(errorCode) {}
2695 
2696  void toDecimalNumber(ByteSink& sink, UErrorCode& status) const;
2697 
2698  // To give LocalizedNumberFormatter format methods access to this class's constructor:
2699  friend class LocalizedNumberFormatter;
2700 
2701  // To give C API access to internals
2702  friend struct impl::UFormattedNumberImpl;
2703 };
2704 
2705 #ifndef U_HIDE_DRAFT_API
2706 // Note: This is draft ICU 65
2707 template<typename StringClass>
2708 StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const {
2709  StringClass result;
2710  StringByteSink<StringClass> sink(&result);
2711  toDecimalNumber(sink, status);
2712  return result;
2713 }
2714 #endif // U_HIDE_DRAFT_API
2715 
2722  public:
2730  static UnlocalizedNumberFormatter with();
2731 
2741  static LocalizedNumberFormatter withLocale(const Locale &locale);
2742 
2757  static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
2758 
2776  static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
2777  UParseError& perror, UErrorCode& status);
2778 
2782  NumberFormatter() = delete;
2783 };
2784 
2785 } // namespace number
2786 U_NAMESPACE_END
2787 
2788 #endif /* #if !UCONFIG_NO_FORMATTING */
2789 
2790 #endif /* U_SHOW_CPLUSPLUS_API */
2791 
2792 #endif // __NUMBERFORMATTER_H__
icu::number::Scale
A class that defines a quantity by which a number should be multiplied when formatting.
Definition: numberformatter.h:1012
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:419
icu::number::Notation::NotationUnion::ScientificSettings::fEngineeringInterval
int8_t fEngineeringInterval
Definition: numberformatter.h:353
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:237
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxSig
impl::digits_t fMaxSig
Definition: numberformatter.h:697
icu::number::impl::MacroProps::usage
Usage usage
Definition: numberformatter.h:1483
fpositer.h
C++ API: FieldPosition Iterator.
parseerr.h
C API: Parse Error Information.
icu::number::impl::MacroProps::perUnit
MeasureUnit perUnit
Definition: numberformatter.h:1448
unumberformatter.h
C-compatible API for localized number formatting; not recommended for C++.
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:915
icu::number::impl::MacroProps::scale
Scale scale
Definition: numberformatter.h:1480
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:189
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:312
U_NOEXCEPT
#define U_NOEXCEPT
Definition: platform.h:529
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:879
UNUM_SIGN_COUNT
@ UNUM_SIGN_COUNT
One more than the highest UNumberSignDisplay value.
Definition: unumberformatter.h:384
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:351
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::impl::Usage::length
int16_t length() const
Definition: numberformatter.h:1160
icu::number::NumberFormatterSettings::copyErrorTo
UBool copyErrorTo(UErrorCode &outErrorCode) const
Sets the UErrorCode if an error occurred in the fluent chain.
Definition: numberformatter.h:2259
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:294
icu::number::impl::MacroProps::grouper
Grouper grouper
Definition: numberformatter.h:1457
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:357
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:1451
icu::number::Precision::PrecisionUnion::IncrementSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:707
icu::number::FormattedNumber
The result of a number formatting operation.
Definition: numberformatter.h:2565
icu::number::Notation::NotationUnion::ScientificSettings::fExponentSignDisplay
UNumberSignDisplay fExponentSignDisplay
Definition: numberformatter.h:359
icu::number::UnlocalizedNumberFormatter
A NumberFormatter that does not yet have a locale.
Definition: numberformatter.h:2292
icu::number::impl::Grouper
Definition: numberformatter.h:1292
icu::number::NumberFormatterSettings
An abstract base class for specifying settings related to number formatting.
Definition: numberformatter.h:1528
icu::number::impl::MacroProps::integerWidth
IntegerWidth integerWidth
Definition: numberformatter.h:1463
icu::number::Precision
A class that defines the rounding precision to be used when formatting numbers in NumberFormatter.
Definition: numberformatter.h:469
icu::number::impl::MacroProps::padder
Padder padder
Definition: numberformatter.h:1460
icu::UMemory
UMemory is the common ICU base class.
Definition: uobject.h:115
icu::number::impl::MacroProps::locale
Locale locale
Definition: numberformatter.h:1495
icu::number::impl::MacroProps::notation
Notation notation
Definition: numberformatter.h:1442
dcfmtsym.h
C++ API: Symbols for formatting numbers.
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:693
icu::number::Precision::PrecisionUnion::IncrementSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:705
icu::number::impl::MacroProps::symbols
SymbolsWrapper symbols
Definition: numberformatter.h:1466
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:99
UNumberDecimalSeparatorDisplay
UNumberDecimalSeparatorDisplay
An enum declaring how to render the decimal separator.
Definition: unumberformatter.h:398
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:785
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:841
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:355
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinSig
impl::digits_t fMinSig
Definition: numberformatter.h:695
icu::number::impl::Grouper::Grouper
Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
Definition: numberformatter.h:1307
icu::NumberingSystem
Defines numbering systems.
Definition: numsys.h:60
icu::number::impl::SymbolsWrapper::copyErrorTo
UBool copyErrorTo(UErrorCode &status) const
Definition: numberformatter.h:1262
icu::number::Notation
A class that defines the notation style to be used when formatting numbers in NumberFormatter.
Definition: numberformatter.h:198
icu::number::impl::digits_t
int16_t digits_t
Datatype for minimum/maximum fraction digits.
Definition: numberformatter.h:131
icu::number::ScientificNotation
A class that defines the scientific notation style to be used when formatting numbers in NumberFormat...
Definition: numberformatter.h:408
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:269
icu::number::impl::Usage::isSet
bool isSet() const
Definition: numberformatter.h:1168
icu::number::Precision::PrecisionUnion::FractionSignificantSettings
Definition: numberformatter.h:688
icu::number::impl::Padder
Definition: numberformatter.h:1374
icu::number::impl::SymbolsWrapper::SymbolsWrapper
SymbolsWrapper()
Definition: numberformatter.h:1204
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:691
icu::number::impl::Usage
Manages NumberFormatterSettings::usage()'s char* instance on the heap.
Definition: numberformatter.h:1139
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:2721
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:700
UNumberGroupingStrategy
UNumberGroupingStrategy
An enum declaring the strategy for when and how to display grouping separators (i....
Definition: unumberformatter.h:218
icu::number::FormattedNumber::FormattedNumber
FormattedNumber()
Default constructor; makes an empty FormattedNumber.
Definition: numberformatter.h:2572
icu::number::impl::SymbolsWrapper
Definition: numberformatter.h:1201
measunit.h
C++ API: A unit for measuring a quantity.
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:311
icu::number::Precision::PrecisionUnion::IncrementSettings::fIncrement
double fIncrement
Definition: numberformatter.h:703
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:2372
icu::number::impl::MacroProps
Definition: numberformatter.h:1440
icu::number::impl::MacroProps::copyErrorTo
bool copyErrorTo(UErrorCode &status) const
Check all members for errors.
Definition: numberformatter.h:1503
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:322
icu::number::impl::MacroProps::unit
MeasureUnit unit
Definition: numberformatter.h:1445