ICU 70.1 70.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"
26#include "unicode/unumberformatter.h"
27#include "unicode/uobject.h"
28
84U_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
174 void touchRangeLocales(impl::RangeMacroProps& macros);
175
176} // namespace impl
177
183 typedef Notation CompactNotation;
184
190 typedef Notation SimpleNotation;
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
350 struct ScientificSettings {
352 int8_t fEngineeringInterval;
354 bool fRequireMinInt;
356 impl::digits_t fMinExponentDigits;
358 UNumberSignDisplay fExponentSignDisplay;
359 } scientific;
360
361 // For NTN_COMPACT
362 UNumberCompactStyle compactStyle;
363
364 // For NTN_ERROR
365 UErrorCode errorCode;
366 } fUnion;
367
368 typedef NotationUnion::ScientificSettings ScientificSettings;
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
407 class U_I18N_API ScientificNotation : public Notation {
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
458 typedef Precision SignificantDigitsPrecision;
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
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 {
698 struct FractionSignificantSettings {
699 // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT
701 impl::digits_t fMinFrac;
703 impl::digits_t fMaxFrac;
705 impl::digits_t fMinSig;
707 impl::digits_t fMaxSig;
709 UNumberRoundingPriority fPriority;
710 } fracSig;
712 struct IncrementSettings {
713 // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE
715 double fIncrement;
717 impl::digits_t fMinFrac;
719 impl::digits_t fMaxFrac;
720 } increment;
721 UCurrencyUsage currencyUsage; // For RND_CURRENCY
722 UErrorCode errorCode; // For RND_ERROR
723 } fUnion;
724
725 UNumberTrailingZeroDisplay fTrailingZeroDisplay = UNUM_TRAILING_ZERO_AUTO;
726
727 typedef PrecisionUnion::FractionSignificantSettings FractionSignificantSettings;
728 typedef PrecisionUnion::IncrementSettings IncrementSettings;
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
802 class U_I18N_API FractionPrecision : public Precision {
803 public:
804#ifndef U_HIDE_DRAFT_API
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
880 class U_I18N_API CurrencyPrecision : public Precision {
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
918 class U_I18N_API IncrementPrecision : public Precision {
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
954 class U_I18N_API IntegerWidth : public UMemory {
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
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
1178 class U_I18N_API StringProp : public UMemory {
1179
1180#ifndef U_HIDE_INTERNAL_API
1181
1182 public:
1184 StringProp(const StringProp &other);
1185
1187 StringProp &operator=(const StringProp &other);
1188
1190 StringProp(StringProp &&src) U_NOEXCEPT;
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
1245 class U_I18N_API SymbolsWrapper : public UMemory {
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
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
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 {
1486 Notation notation;
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
1498 UNumberFormatRoundingMode roundingMode = UNUM_ROUND_HALFEVEN;
1499
1501 Grouper grouper; // = Grouper(); (bogus)
1502
1504 Padder padder; // = Padder(); (bogus)
1505
1507 IntegerWidth integerWidth; // = IntegerWidth(); (bogus)
1508
1510 SymbolsWrapper symbols;
1511
1512 // UNUM_XYZ_COUNT denotes null (bogus) values.
1513
1515 UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_COUNT;
1516
1518 UNumberSignDisplay sign = UNUM_SIGN_COUNT;
1519
1521 bool approximately = false;
1522
1524 UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT;
1525
1527 Scale scale; // = Scale(); (benign value)
1528
1530 StringProp usage; // = StringProp(); (no usage)
1531
1533 StringProp unitDisplayCase; // = StringProp(); (nominative)
1534
1536 const AffixPatternProvider* affixProvider = nullptr; // no ownership
1537
1539 const PluralRules* rules = nullptr; // no ownership
1540
1542 int32_t threshold = kInternalDefaultThreshold;
1543
1545 Locale locale;
1546
1547 // NOTE: Uses default copy and move constructors.
1548
1553 bool copyErrorTo(UErrorCode &status) const {
1554 return notation.copyErrorTo(status) || precision.copyErrorTo(status) ||
1555 padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) ||
1556 symbols.copyErrorTo(status) || scale.copyErrorTo(status) || usage.copyErrorTo(status) ||
1557 unitDisplayCase.copyErrorTo(status);
1558 }
1559};
1560
1561} // namespace impl
1562
1563#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
1564// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
1565// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
1566// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
1567// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
1568// they will all be passed to the linker, and the linker will still find and export all the class members.
1569#pragma warning(push)
1570#pragma warning(disable: 4661)
1571#endif
1572
1578 template<typename Derived>
1579 class U_I18N_API NumberFormatterSettings {
1580 public:
1609 Derived notation(const Notation &notation) const &;
1610
1620 Derived notation(const Notation &notation) &&;
1621
1670 Derived unit(const icu::MeasureUnit &unit) const &;
1671
1681 Derived unit(const icu::MeasureUnit &unit) &&;
1682
1696 Derived adoptUnit(icu::MeasureUnit *unit) const &;
1697
1707 Derived adoptUnit(icu::MeasureUnit *unit) &&;
1708
1731 Derived perUnit(const icu::MeasureUnit &perUnit) const &;
1732
1742 Derived perUnit(const icu::MeasureUnit &perUnit) &&;
1743
1757 Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &;
1758
1768 Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&;
1769
1800 Derived precision(const Precision& precision) const &;
1801
1811 Derived precision(const Precision& precision) &&;
1812
1831 Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &;
1832
1841 Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&;
1842
1870 Derived grouping(UNumberGroupingStrategy strategy) const &;
1871
1881 Derived grouping(UNumberGroupingStrategy strategy) &&;
1882
1907 Derived integerWidth(const IntegerWidth &style) const &;
1908
1918 Derived integerWidth(const IntegerWidth &style) &&;
1919
1960 Derived symbols(const DecimalFormatSymbols &symbols) const &;
1961
1971 Derived symbols(const DecimalFormatSymbols &symbols) &&;
1972
2006 Derived adoptSymbols(NumberingSystem *symbols) const &;
2007
2017 Derived adoptSymbols(NumberingSystem *symbols) &&;
2018
2044 Derived unitWidth(UNumberUnitWidth width) const &;
2045
2055 Derived unitWidth(UNumberUnitWidth width) &&;
2056
2082 Derived sign(UNumberSignDisplay style) const &;
2083
2093 Derived sign(UNumberSignDisplay style) &&;
2094
2120 Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
2121
2131 Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
2132
2157 Derived scale(const Scale &scale) const &;
2158
2168 Derived scale(const Scale &scale) &&;
2169
2212 Derived usage(StringPiece usage) const &;
2213
2221 Derived usage(StringPiece usage) &&;
2222
2223#ifndef U_HIDE_DRAFT_API
2224#ifndef U_HIDE_INTERNAL_API
2231 Derived unitDisplayCase(StringPiece unitDisplayCase) const &;
2232
2238 Derived unitDisplayCase(StringPiece unitDisplayCase) &&;
2239#endif // U_HIDE_INTERNAL_API
2240#endif // U_HIDE_DRAFT_API
2241
2242#ifndef U_HIDE_INTERNAL_API
2243
2249 Derived padding(const impl::Padder &padder) const &;
2250
2252 Derived padding(const impl::Padder &padder) &&;
2253
2260 Derived threshold(int32_t threshold) const &;
2261
2263 Derived threshold(int32_t threshold) &&;
2264
2270 Derived macros(const impl::MacroProps& macros) const &;
2271
2273 Derived macros(const impl::MacroProps& macros) &&;
2274
2276 Derived macros(impl::MacroProps&& macros) const &;
2277
2279 Derived macros(impl::MacroProps&& macros) &&;
2280
2281#endif /* U_HIDE_INTERNAL_API */
2282
2300 UnicodeString toSkeleton(UErrorCode& status) const;
2301
2313 LocalPointer<Derived> clone() const &;
2314
2322 LocalPointer<Derived> clone() &&;
2323
2330 UBool copyErrorTo(UErrorCode &outErrorCode) const {
2331 if (U_FAILURE(outErrorCode)) {
2332 // Do not overwrite the older error code
2333 return true;
2334 }
2335 fMacros.copyErrorTo(outErrorCode);
2336 return U_FAILURE(outErrorCode);
2337 }
2338
2339 // NOTE: Uses default copy and move constructors.
2340
2341 private:
2342 impl::MacroProps fMacros;
2343
2344 // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
2345 NumberFormatterSettings() = default;
2346
2347 friend class LocalizedNumberFormatter;
2348 friend class UnlocalizedNumberFormatter;
2349
2350 // Give NumberRangeFormatter access to the MacroProps
2351 friend void impl::touchRangeLocales(impl::RangeMacroProps& macros);
2352 friend class impl::NumberRangeFormatterImpl;
2353};
2354
2363 class U_I18N_API UnlocalizedNumberFormatter
2364 : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory {
2365
2366 public:
2376 LocalizedNumberFormatter locale(const icu::Locale &locale) const &;
2377
2387 LocalizedNumberFormatter locale(const icu::Locale &locale) &&;
2388
2394 UnlocalizedNumberFormatter() = default;
2395
2400 UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other);
2401
2407 UnlocalizedNumberFormatter(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
2408
2413 UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other);
2414
2420 UnlocalizedNumberFormatter& operator=(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
2421
2422 private:
2423 explicit UnlocalizedNumberFormatter(const NumberFormatterSettings<UnlocalizedNumberFormatter>& other);
2424
2425 explicit UnlocalizedNumberFormatter(
2426 NumberFormatterSettings<UnlocalizedNumberFormatter>&& src) U_NOEXCEPT;
2427
2428 // To give the fluent setters access to this class's constructor:
2429 friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
2430
2431 // To give NumberFormatter::with() access to this class's constructor:
2432 friend class NumberFormatter;
2433};
2434
2443 class U_I18N_API LocalizedNumberFormatter
2444 : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory {
2445 public:
2457 FormattedNumber formatInt(int64_t value, UErrorCode &status) const;
2458
2470 FormattedNumber formatDouble(double value, UErrorCode &status) const;
2471
2486 FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const;
2487
2488#ifndef U_HIDE_INTERNAL_API
2489
2490
2494 const DecimalFormatSymbols* getDecimalFormatSymbols() const;
2495
2499 FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const;
2500
2504 void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const;
2505
2510 const impl::NumberFormatterImpl* getCompiled() const;
2511
2516 int32_t getCallCount() const;
2517
2518#endif /* U_HIDE_INTERNAL_API */
2519
2533 Format* toFormat(UErrorCode& status) const;
2534
2540 LocalizedNumberFormatter() = default;
2541
2546 LocalizedNumberFormatter(const LocalizedNumberFormatter &other);
2547
2553 LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT;
2554
2559 LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other);
2560
2566 LocalizedNumberFormatter& operator=(LocalizedNumberFormatter&& src) U_NOEXCEPT;
2567
2568#ifndef U_HIDE_INTERNAL_API
2569
2582 void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const;
2583
2584#endif /* U_HIDE_INTERNAL_API */
2585
2590 ~LocalizedNumberFormatter();
2591
2592 private:
2593 // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal
2594 // header, and LocalPointer needs the full class definition in order to delete the instance.
2595 const impl::NumberFormatterImpl* fCompiled {nullptr};
2596 char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t
2597
2598 // Owned pointer to a DecimalFormatWarehouse, used when copying a LocalizedNumberFormatter
2599 // from a DecimalFormat.
2600 const impl::DecimalFormatWarehouse* fWarehouse {nullptr};
2601
2602 explicit LocalizedNumberFormatter(const NumberFormatterSettings<LocalizedNumberFormatter>& other);
2603
2604 explicit LocalizedNumberFormatter(NumberFormatterSettings<LocalizedNumberFormatter>&& src) U_NOEXCEPT;
2605
2606 LocalizedNumberFormatter(const impl::MacroProps &macros, const Locale &locale);
2607
2608 LocalizedNumberFormatter(impl::MacroProps &&macros, const Locale &locale);
2609
2610 void resetCompiled();
2611
2612 void lnfMoveHelper(LocalizedNumberFormatter&& src);
2613
2614 void lnfCopyHelper(const LocalizedNumberFormatter& src, UErrorCode& status);
2615
2619 bool computeCompiled(UErrorCode& status) const;
2620
2621 // To give the fluent setters access to this class's constructor:
2622 friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
2623 friend class NumberFormatterSettings<LocalizedNumberFormatter>;
2624
2625 // To give UnlocalizedNumberFormatter::locale() access to this class's constructor:
2626 friend class UnlocalizedNumberFormatter;
2627};
2628
2629#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
2630// Warning 4661.
2631#pragma warning(pop)
2632#endif
2633
2642 class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
2643 public:
2644
2649 FormattedNumber()
2650 : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
2651
2656 FormattedNumber(FormattedNumber&& src) U_NOEXCEPT;
2657
2662 virtual ~FormattedNumber() U_OVERRIDE;
2663
2665 FormattedNumber(const FormattedNumber&) = delete;
2666
2668 FormattedNumber& operator=(const FormattedNumber&) = delete;
2669
2674 FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
2675
2676 // Copybrief: this method is older than the parent method
2684 UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
2685
2686 // Copydoc: this method is new in ICU 64
2688 UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
2689
2690 // Copybrief: this method is older than the parent method
2698 Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
2699
2700 // Copydoc: this method is new in ICU 64
2702 UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
2703
2722 template<typename StringClass>
2723 inline StringClass toDecimalNumber(UErrorCode& status) const;
2724
2736 MeasureUnit getOutputUnit(UErrorCode& status) const;
2737
2738#ifndef U_HIDE_INTERNAL_API
2745 const char *getGender(UErrorCode& status) const;
2746
2751 void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const;
2752
2757 void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
2758
2759#endif /* U_HIDE_INTERNAL_API */
2760
2761 private:
2762 // Can't use LocalPointer because UFormattedNumberData is forward-declared
2763 const impl::UFormattedNumberData *fData;
2764
2765 // Error code for the terminal methods
2766 UErrorCode fErrorCode;
2767
2772 explicit FormattedNumber(impl::UFormattedNumberData *results)
2773 : fData(results), fErrorCode(U_ZERO_ERROR) {}
2774
2775 explicit FormattedNumber(UErrorCode errorCode)
2776 : fData(nullptr), fErrorCode(errorCode) {}
2777
2778 void toDecimalNumber(ByteSink& sink, UErrorCode& status) const;
2779
2780 // To give LocalizedNumberFormatter format methods access to this class's constructor:
2781 friend class LocalizedNumberFormatter;
2782
2783 // To give C API access to internals
2784 friend struct impl::UFormattedNumberImpl;
2785};
2786
2787 template<typename StringClass>
2788StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const {
2789 StringClass result;
2790 StringByteSink<StringClass> sink(&result);
2791 toDecimalNumber(sink, status);
2792 return result;
2793}
2794
2800 class U_I18N_API NumberFormatter final {
2801 public:
2809 static UnlocalizedNumberFormatter with();
2810
2820 static LocalizedNumberFormatter withLocale(const Locale &locale);
2821
2839 static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
2840
2861 static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
2862 UParseError& perror, UErrorCode& status);
2863
2867 NumberFormatter() = delete;
2868};
2869
2870} // namespace number
2871U_NAMESPACE_END
2872
2873#endif /* #if !UCONFIG_NO_FORMATTING */
2874
2875#endif /* U_SHOW_CPLUSPLUS_API */
2876
2877#endif // __NUMBERFORMATTER_H__
appendable.h
C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts).
bytestream.h
C++ API: Interface for writing bytes, and implementation classes.
icu::Appendable
Base class for objects to which Unicode characters and strings can be appended.
Definition: appendable.h:54
icu::ByteSink
A ByteSink can be filled with bytes.
Definition: bytestream.h:53
icu::ConstrainedFieldPosition
Represents a span of a string containing a given field.
Definition: formattedvalue.h:41
icu::CurrencyUnit
A unit of currency, such as USD (U.S.
Definition: currunit.h:39
icu::DecimalFormatSymbols
This class represents the set of symbols needed by DecimalFormat to format numbers.
Definition: dcfmtsym.h:86
icu::Format
Base class for all formats.
Definition: format.h:98
icu::FormattedValue
An abstract formatted value: a string with associated field attributes.
Definition: formattedvalue.h:241
icu::LocalPointer
"Smart pointer" class, deletes objects via the standard C++ delete operator.
Definition: localpointer.h:191
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:371
icu::NumberingSystem
Defines numbering systems.
Definition: numsys.h:60
icu::PluralRules
Defines rules for mapping non-negative numeric values onto a small set of keywords.
Definition: plurrule.h:206
icu::StringByteSink
Implementation of ByteSink that writes to a "string".
Definition: bytestream.h:267
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:60
icu::UMemory
UMemory is the common ICU base class.
Definition: uobject.h:115
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
icu::number::CurrencyPrecision
A class that defines a rounding precision parameterized by a currency to be used when formatting numb...
Definition: numberformatter.h:880
icu::number::CurrencyPrecision::withCurrency
Precision withCurrency(const CurrencyUnit &currency) const
Associates a currency with this rounding precision.
icu::number::FormattedNumber
The result of a number formatting operation.
Definition: numberformatter.h:2642
icu::number::FormattedNumber::getDecimalQuantity
void getDecimalQuantity(impl::DecimalQuantity &output, UErrorCode &status) const
Gets the raw DecimalQuantity for plural rule selection.
icu::number::FormattedNumber::FormattedNumber
FormattedNumber()
Default constructor; makes an empty FormattedNumber.
Definition: numberformatter.h:2649
icu::number::FormattedNumber::getAllFieldPositionsImpl
void getAllFieldPositionsImpl(FieldPositionIteratorHandler &fpih, UErrorCode &status) const
Populates the mutable builder type FieldPositionIteratorHandler.
icu::number::FormattedNumber::~FormattedNumber
virtual ~FormattedNumber() U_OVERRIDE
Destruct an instance of FormattedNumber.
icu::number::FormattedNumber::getGender
const char * getGender(UErrorCode &status) const
Gets the gender of the formatted output.
icu::number::FormattedNumber::FormattedNumber
FormattedNumber(FormattedNumber &&src) U_NOEXCEPT
Move constructor: Leaves the source FormattedNumber in an undefined state.
icu::number::FractionPrecision
A class that defines a rounding precision based on a number of fraction places and optionally signifi...
Definition: numberformatter.h:802
icu::number::FractionPrecision::withMinDigits
Precision withMinDigits(int32_t minSignificantDigits) const
Ensure that no less than this number of significant digits are retained when rounding according to fr...
icu::number::FractionPrecision::withSignificantDigits
Precision withSignificantDigits(int32_t minSignificantDigits, int32_t maxSignificantDigits, UNumberRoundingPriority priority) const
Override maximum fraction digits with maximum significant digits depending on the magnitude of the nu...
icu::number::FractionPrecision::withMaxDigits
Precision withMaxDigits(int32_t maxSignificantDigits) const
Ensure that no more than this number of significant digits are retained when rounding according to fr...
icu::number::IncrementPrecision
A class that defines a rounding precision parameterized by a rounding increment to be used when forma...
Definition: numberformatter.h:918
icu::number::IncrementPrecision::withMinFraction
Precision withMinFraction(int32_t minFrac) const
Specifies the minimum number of fraction digits to render after the decimal separator,...
icu::number::IntegerWidth
A class that defines the strategy for padding and truncating integers before the decimal separator.
Definition: numberformatter.h:954
icu::number::IntegerWidth::zeroFillTo
static IntegerWidth zeroFillTo(int32_t minInt)
Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal ...
icu::number::IntegerWidth::truncateAt
IntegerWidth truncateAt(int32_t maxInt)
Truncate numbers exceeding a certain number of numerals before the decimal separator.
icu::number::LocalizedNumberFormatter
A NumberFormatter that has a locale associated with it; this means .format() methods are available.
Definition: numberformatter.h:2444
icu::number::LocalizedNumberFormatter::toFormat
Format * toFormat(UErrorCode &status) const
Creates a representation of this LocalizedNumberFormat as an icu::Format, enabling the use of this nu...
icu::number::LocalizedNumberFormatter::getDecimalFormatSymbols
const DecimalFormatSymbols * getDecimalFormatSymbols() const
icu::number::LocalizedNumberFormatter::formatInt
FormattedNumber formatInt(int64_t value, UErrorCode &status) const
Format the given integer number to a string using the settings specified in the NumberFormatter fluen...
icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter
LocalizedNumberFormatter()=default
Default constructor: puts the formatter into a valid but undefined state.
icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter
LocalizedNumberFormatter(const LocalizedNumberFormatter &other)
Returns a copy of this LocalizedNumberFormatter.
icu::number::LocalizedNumberFormatter::getCompiled
const impl::NumberFormatterImpl * getCompiled() const
Internal method for testing.
icu::number::LocalizedNumberFormatter::getCallCount
int32_t getCallCount() const
Internal method for testing.
icu::number::LocalizedNumberFormatter::~LocalizedNumberFormatter
~LocalizedNumberFormatter()
Destruct this LocalizedNumberFormatter, cleaning up any memory it might own.
icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter
LocalizedNumberFormatter(LocalizedNumberFormatter &&src) U_NOEXCEPT
Move constructor: The source LocalizedNumberFormatter will be left in a valid but undefined state.
icu::number::LocalizedNumberFormatter::formatImpl
void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const
This is the core entrypoint to the number formatting pipeline.
icu::number::LocalizedNumberFormatter::formatDecimal
FormattedNumber formatDecimal(StringPiece value, UErrorCode &status) const
Format the given decimal number to a string using the settings specified in the NumberFormatter fluen...
icu::number::LocalizedNumberFormatter::operator=
LocalizedNumberFormatter & operator=(LocalizedNumberFormatter &&src) U_NOEXCEPT
Move assignment operator: The source LocalizedNumberFormatter will be left in a valid but undefined s...
icu::number::LocalizedNumberFormatter::getAffixImpl
void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString &result, UErrorCode &status) const
Internal method for DecimalFormat compatibility.
icu::number::LocalizedNumberFormatter::formatDecimalQuantity
FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity &dq, UErrorCode &status) const
Internal method.
icu::number::LocalizedNumberFormatter::formatDouble
FormattedNumber formatDouble(double value, UErrorCode &status) const
Format the given float or double to a string using the settings specified in the NumberFormatter flue...
icu::number::LocalizedNumberFormatter::operator=
LocalizedNumberFormatter & operator=(const LocalizedNumberFormatter &other)
Copy assignment operator.
icu::number::Notation
A class that defines the notation style to be used when formatting numbers in NumberFormatter.
Definition: numberformatter.h:197
icu::number::Notation::compactShort
static CompactNotation compactShort()
Print the number using short-form compact notation.
icu::number::Notation::engineering
static ScientificNotation engineering()
Print the number using engineering notation, a variant of scientific notation in which the exponent m...
icu::number::Notation::compactLong
static CompactNotation compactLong()
Print the number using long-form compact notation.
icu::number::Notation::simple
static SimpleNotation simple()
Print the number using simple notation without any scaling by powers of ten.
icu::number::Notation::scientific
static ScientificNotation scientific()
Print the number using scientific notation (also known as scientific form, standard index form,...
icu::number::NumberFormatterSettings
An abstract base class for specifying settings related to number formatting.
Definition: numberformatter.h:1579
icu::number::NumberFormatterSettings::unitDisplayCase
Derived unitDisplayCase(StringPiece unitDisplayCase) &&
Overload of unitDisplayCase() for use on an rvalue reference.
icu::number::NumberFormatterSettings::clone
LocalPointer< Derived > clone() const &
Returns the current (Un)LocalizedNumberFormatter as a LocalPointer wrapping a heap-allocated copy of ...
icu::number::NumberFormatterSettings::adoptSymbols
Derived adoptSymbols(NumberingSystem *symbols) const &
Specifies that the given numbering system should be used when fetching symbols.
icu::number::NumberFormatterSettings::precision
Derived precision(const Precision &precision) const &
Specifies the rounding precision to use when formatting numbers.
icu::number::NumberFormatterSettings::decimal
Derived decimal(UNumberDecimalSeparatorDisplay style) &&
Overload of decimal() for use on an rvalue reference.
icu::number::NumberFormatterSettings::unitWidth
Derived unitWidth(UNumberUnitWidth width) const &
Sets the width of the unit (measure unit or currency).
icu::number::NumberFormatterSettings::adoptUnit
Derived adoptUnit(icu::MeasureUnit *unit) const &
Like unit(), but takes ownership of a pointer.
icu::number::NumberFormatterSettings::perUnit
Derived perUnit(const icu::MeasureUnit &perUnit) &&
Overload of perUnit() for use on an rvalue reference.
icu::number::NumberFormatterSettings::padding
Derived padding(const impl::Padder &padder) &&
icu::number::NumberFormatterSettings::adoptSymbols
Derived adoptSymbols(NumberingSystem *symbols) &&
Overload of adoptSymbols() for use on an rvalue reference.
icu::number::NumberFormatterSettings::macros
Derived macros(const impl::MacroProps &macros) &&
icu::number::NumberFormatterSettings::roundingMode
Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&
Overload of roundingMode() for use on an rvalue reference.
icu::number::NumberFormatterSettings::integerWidth
Derived integerWidth(const IntegerWidth &style) const &
Specifies the minimum and maximum number of digits to render before the decimal mark.
icu::number::NumberFormatterSettings::macros
Derived macros(const impl::MacroProps &macros) const &
Internal fluent setter to overwrite the entire macros object.
icu::number::NumberFormatterSettings::threshold
Derived threshold(int32_t threshold) const &
Internal fluent setter to support a custom regulation threshold.
icu::number::NumberFormatterSettings::perUnit
Derived perUnit(const icu::MeasureUnit &perUnit) const &
Sets a unit to be used in the denominator.
icu::number::NumberFormatterSettings::integerWidth
Derived integerWidth(const IntegerWidth &style) &&
Overload of integerWidth() for use on an rvalue reference.
icu::number::NumberFormatterSettings::unitDisplayCase
Derived unitDisplayCase(StringPiece unitDisplayCase) const &
Specifies the desired case for a unit formatter's output (e.g.
icu::number::NumberFormatterSettings::grouping
Derived grouping(UNumberGroupingStrategy strategy) const &
Specifies the grouping strategy to use when formatting numbers.
icu::number::NumberFormatterSettings::unit
Derived unit(const icu::MeasureUnit &unit) const &
Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers.
icu::number::NumberFormatterSettings::usage
Derived usage(StringPiece usage) &&
Overload of usage() for use on an rvalue reference.
icu::number::NumberFormatterSettings::adoptPerUnit
Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &
Like perUnit(), but takes ownership of a pointer.
icu::number::NumberFormatterSettings::adoptUnit
Derived adoptUnit(icu::MeasureUnit *unit) &&
Overload of adoptUnit() for use on an rvalue reference.
icu::number::NumberFormatterSettings::scale
Derived scale(const Scale &scale) &&
Overload of scale() for use on an rvalue reference.
icu::number::NumberFormatterSettings::precision
Derived precision(const Precision &precision) &&
Overload of precision() for use on an rvalue reference.
icu::number::NumberFormatterSettings::symbols
Derived symbols(const DecimalFormatSymbols &symbols) &&
Overload of symbols() for use on an rvalue reference.
icu::number::NumberFormatterSettings::padding
Derived padding(const impl::Padder &padder) const &
Set the padding strategy.
icu::number::NumberFormatterSettings::notation
Derived notation(const Notation &notation) const &
Specifies the notation style (simple, scientific, or compact) for rendering numbers.
icu::number::NumberFormatterSettings::sign
Derived sign(UNumberSignDisplay style) const &
Sets the plus/minus sign display strategy.
icu::number::NumberFormatterSettings::threshold
Derived threshold(int32_t threshold) &&
icu::number::NumberFormatterSettings::roundingMode
Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &
Specifies how to determine the direction to round a number when it has more digits than fit in the de...
icu::number::NumberFormatterSettings::symbols
Derived symbols(const DecimalFormatSymbols &symbols) const &
Specifies the symbols (decimal separator, grouping separator, percent sign, numerals,...
icu::number::NumberFormatterSettings::macros
Derived macros(impl::MacroProps &&macros) &&
icu::number::NumberFormatterSettings::sign
Derived sign(UNumberSignDisplay style) &&
Overload of sign() for use on an rvalue reference.
icu::number::NumberFormatterSettings::toSkeleton
UnicodeString toSkeleton(UErrorCode &status) const
Creates a skeleton string representation of this number formatter.
icu::number::NumberFormatterSettings::grouping
Derived grouping(UNumberGroupingStrategy strategy) &&
Overload of grouping() for use on an rvalue reference.
icu::number::NumberFormatterSettings::usage
Derived usage(StringPiece usage) const &
Specifies the usage for which numbers will be formatted ("person-height", "road", "rainfall",...
icu::number::NumberFormatterSettings::adoptPerUnit
Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&
Overload of adoptPerUnit() for use on an rvalue reference.
icu::number::NumberFormatterSettings::unitWidth
Derived unitWidth(UNumberUnitWidth width) &&
Overload of unitWidth() for use on an rvalue reference.
icu::number::NumberFormatterSettings::decimal
Derived decimal(UNumberDecimalSeparatorDisplay style) const &
Sets the decimal separator display strategy.
icu::number::NumberFormatterSettings::unit
Derived unit(const icu::MeasureUnit &unit) &&
Overload of unit() for use on an rvalue reference.
icu::number::NumberFormatterSettings::macros
Derived macros(impl::MacroProps &&macros) const &
icu::number::NumberFormatterSettings::scale
Derived scale(const Scale &scale) const &
Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting.
icu::number::NumberFormatterSettings::notation
Derived notation(const Notation &notation) &&
Overload of notation() for use on an rvalue reference.
icu::number::NumberFormatter
See the main description in numberformatter.h for documentation and examples.
Definition: numberformatter.h:2800
icu::number::NumberFormatter::forSkeleton
static UnlocalizedNumberFormatter forSkeleton(const UnicodeString &skeleton, UParseError &perror, UErrorCode &status)
Call this method at the beginning of a NumberFormatter fluent chain to create an instance based on a ...
icu::number::NumberFormatter::forSkeleton
static UnlocalizedNumberFormatter forSkeleton(const UnicodeString &skeleton, UErrorCode &status)
Call this method at the beginning of a NumberFormatter fluent chain to create an instance based on a ...
icu::number::NumberFormatter::with
static UnlocalizedNumberFormatter with()
Call this method at the beginning of a NumberFormatter fluent chain in which the locale is not curren...
icu::number::NumberFormatter::NumberFormatter
NumberFormatter()=delete
Use factory methods instead of the constructor to create a NumberFormatter.
icu::number::NumberFormatter::withLocale
static LocalizedNumberFormatter withLocale(const Locale &locale)
Call this method at the beginning of a NumberFormatter fluent chain in which the locale is known at t...
icu::number::Precision
A class that defines the rounding precision to be used when formatting numbers in NumberFormatter.
Definition: numberformatter.h:468
icu::number::Precision::maxSignificantDigits
static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits)
Show numbers rounded if necessary to a certain number of significant digits/figures.
icu::number::Precision::fixedFraction
static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces)
Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal ...
icu::number::Precision::minSignificantDigits
static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits)
Always show at least a certain number of significant digits/figures, padding with zeros if necessary.
icu::number::Precision::maxFraction
static FractionPrecision maxFraction(int32_t maxFractionPlaces)
Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal ...
icu::number::Precision::increment
static IncrementPrecision increment(double roundingIncrement)
Show numbers rounded if necessary to the closest multiple of a certain rounding increment.
icu::number::Precision::currency
static CurrencyPrecision currency(UCurrencyUsage currencyUsage)
Show numbers rounded and padded according to the rules for the currency unit.
icu::number::Precision::minFraction
static FractionPrecision minFraction(int32_t minFractionPlaces)
Always show at least a certain number of fraction places after the decimal separator,...
icu::number::Precision::trailingZeroDisplay
Precision trailingZeroDisplay(UNumberTrailingZeroDisplay trailingZeroDisplay) const
Configure how trailing zeros are displayed on numbers.
icu::number::Precision::unlimited
static Precision unlimited()
Show all available digits to full precision.
icu::number::Precision::integer
static FractionPrecision integer()
Show numbers rounded if necessary to the nearest integer.
icu::number::Precision::fixedSignificantDigits
static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits)
Show numbers rounded if necessary to a certain number of significant digits or significant figures.
icu::number::Precision::minMaxFraction
static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces)
Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal ...
icu::number::Precision::minMaxSignificantDigits
static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits, int32_t maxSignificantDigits)
Show numbers rounded if necessary to a certain number of significant digits/figures; in addition,...
icu::number::Scale
A class that defines a quantity by which a number should be multiplied when formatting.
Definition: numberformatter.h:1051
icu::number::Scale::none
static Scale none()
Do not change the value of numbers when formatting or parsing.
icu::number::Scale::Scale
Scale(Scale &&src) U_NOEXCEPT
icu::number::Scale::powerOfTen
static Scale powerOfTen(int32_t power)
Multiply numbers by a power of ten before formatting.
icu::number::Scale::Scale
Scale(const Scale &other)
icu::number::Scale::byDoubleAndPowerOfTen
static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power)
Multiply a number by both a power of ten and by an arbitrary double value.
icu::number::Scale::byDecimal
static Scale byDecimal(StringPiece multiplicand)
Multiply numbers by an arbitrary value before formatting.
icu::number::Scale::Scale
Scale(int32_t magnitude, impl::DecNum *arbitraryToAdopt)
icu::number::Scale::operator=
Scale & operator=(const Scale &other)
icu::number::Scale::operator=
Scale & operator=(Scale &&src) U_NOEXCEPT
icu::number::Scale::~Scale
~Scale()
icu::number::Scale::byDouble
static Scale byDouble(double multiplicand)
Multiply numbers by an arbitrary value before formatting.
icu::number::ScientificNotation
A class that defines the scientific notation style to be used when formatting numbers in NumberFormat...
Definition: numberformatter.h:407
icu::number::ScientificNotation::withExponentSignDisplay
ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const
Sets whether to show the sign on positive and negative exponents in scientific notation.
icu::number::ScientificNotation::withMinExponentDigits
ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const
Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros ...
icu::number::UnlocalizedNumberFormatter
A NumberFormatter that does not yet have a locale.
Definition: numberformatter.h:2364
icu::number::UnlocalizedNumberFormatter::operator=
UnlocalizedNumberFormatter & operator=(UnlocalizedNumberFormatter &&src) U_NOEXCEPT
Move assignment operator: The source UnlocalizedNumberFormatter will be left in a valid but undefined...
icu::number::UnlocalizedNumberFormatter::UnlocalizedNumberFormatter
UnlocalizedNumberFormatter()=default
Default constructor: puts the formatter into a valid but undefined state.
icu::number::UnlocalizedNumberFormatter::UnlocalizedNumberFormatter
UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other)
Returns a copy of this UnlocalizedNumberFormatter.
icu::number::UnlocalizedNumberFormatter::locale
LocalizedNumberFormatter locale(const icu::Locale &locale) &&
Overload of locale() for use on an rvalue reference.
icu::number::UnlocalizedNumberFormatter::operator=
UnlocalizedNumberFormatter & operator=(const UnlocalizedNumberFormatter &other)
Copy assignment operator.
icu::number::UnlocalizedNumberFormatter::locale
LocalizedNumberFormatter locale(const icu::Locale &locale) const &
Associate the given locale with the number formatter.
icu::number::UnlocalizedNumberFormatter::UnlocalizedNumberFormatter
UnlocalizedNumberFormatter(UnlocalizedNumberFormatter &&src) U_NOEXCEPT
Move constructor: The source UnlocalizedNumberFormatter will be left in a valid but undefined state.
icu::number::impl::Grouper
Definition: numberformatter.h:1336
icu::number::impl::Grouper::forStrategy
static Grouper forStrategy(UNumberGroupingStrategy grouping)
icu::number::impl::Grouper::Grouper
Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
Definition: numberformatter.h:1351
icu::number::impl::Grouper::getSecondary
int16_t getSecondary() const
icu::number::impl::Grouper::forProperties
static Grouper forProperties(const DecimalFormatProperties &properties)
Resolve the values in Properties to a Grouper object.
icu::number::impl::Grouper::getPrimary
int16_t getPrimary() const
icu::number::impl::Padder
Definition: numberformatter.h:1418
icu::number::impl::Padder::forProperties
static Padder forProperties(const DecimalFormatProperties &properties)
icu::number::impl::Padder::codePoints
static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position)
icu::number::impl::Padder::none
static Padder none()
icu::number::impl::StringProp
Manages NumberFormatterSettings::usage()'s char* instance on the heap.
Definition: numberformatter.h:1178
icu::number::impl::StringProp::StringProp
StringProp(const StringProp &other)
icu::number::impl::StringProp::length
int16_t length() const
Definition: numberformatter.h:1199
icu::number::impl::StringProp::isSet
bool isSet() const
Definition: numberformatter.h:1209
icu::number::impl::StringProp::~StringProp
~StringProp()
icu::number::impl::StringProp::operator=
StringProp & operator=(StringProp &&src) U_NOEXCEPT
icu::number::impl::StringProp::operator=
StringProp & operator=(const StringProp &other)
icu::number::impl::StringProp::set
void set(StringPiece value)
icu::number::impl::StringProp::StringProp
StringProp(StringProp &&src) U_NOEXCEPT
icu::number::impl::SymbolsWrapper
Definition: numberformatter.h:1245
icu::number::impl::SymbolsWrapper::SymbolsWrapper
SymbolsWrapper()
Definition: numberformatter.h:1248
icu::number::impl::SymbolsWrapper::operator=
SymbolsWrapper & operator=(const SymbolsWrapper &other)
icu::number::impl::SymbolsWrapper::isNumberingSystem
bool isNumberingSystem() const
Whether the object is currently holding a NumberingSystem.
icu::number::impl::SymbolsWrapper::~SymbolsWrapper
~SymbolsWrapper()
icu::number::impl::SymbolsWrapper::SymbolsWrapper
SymbolsWrapper(SymbolsWrapper &&src) U_NOEXCEPT
icu::number::impl::SymbolsWrapper::operator=
SymbolsWrapper & operator=(SymbolsWrapper &&src) U_NOEXCEPT
icu::number::impl::SymbolsWrapper::getDecimalFormatSymbols
const DecimalFormatSymbols * getDecimalFormatSymbols() const
Get the DecimalFormatSymbols pointer.
icu::number::impl::SymbolsWrapper::SymbolsWrapper
SymbolsWrapper(const SymbolsWrapper &other)
icu::number::impl::SymbolsWrapper::setTo
void setTo(const DecimalFormatSymbols &dfs)
The provided object is copied, but we do not adopt it.
icu::number::impl::SymbolsWrapper::getNumberingSystem
const NumberingSystem * getNumberingSystem() const
Get the NumberingSystem pointer.
icu::number::impl::SymbolsWrapper::setTo
void setTo(const NumberingSystem *ns)
Adopt the provided object.
icu::number::impl::SymbolsWrapper::copyErrorTo
UBool copyErrorTo(UErrorCode &status) const
Definition: numberformatter.h:1306
icu::number::impl::SymbolsWrapper::isDecimalFormatSymbols
bool isDecimalFormatSymbols() const
Whether the object is currently holding a DecimalFormatSymbols.
currunit.h
C++ API: Currency Unit Information.
dcfmtsym.h
C++ API: Symbols for formatting numbers.
fieldpos.h
C++ API: FieldPosition identifies the fields in a formatted output.
formattedvalue.h
C++ API: Abstract operations for localized strings.
fpositer.h
C++ API: FieldPosition Iterator.
measunit.h
C++ API: A unit for measuring a quantity.
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
nounit.h
C++ API: units for percent and permille.
icu::number::impl::digits_t
int16_t digits_t
Datatype for minimum/maximum fraction digits.
Definition: numberformatter.h:130
icu::number::impl::touchRangeLocales
void touchRangeLocales(impl::RangeMacroProps &macros)
Used for NumberRangeFormatter and implemented in numrange_fluent.cpp.
parseerr.h
C API: Parse Error Information.
U_NOEXCEPT
#define U_NOEXCEPT
"noexcept" if supported, otherwise empty.
Definition: platform.h:529
plurrule.h
C++ API: PluralRules object.
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
icu::number::Notation::NotationUnion::ScientificSettings
Definition: numberformatter.h:350
icu::number::Notation::NotationUnion::ScientificSettings::fRequireMinInt
bool fRequireMinInt
Definition: numberformatter.h:354
icu::number::Notation::NotationUnion::ScientificSettings::fMinExponentDigits
impl::digits_t fMinExponentDigits
Definition: numberformatter.h:356
icu::number::Notation::NotationUnion::ScientificSettings::fExponentSignDisplay
UNumberSignDisplay fExponentSignDisplay
Definition: numberformatter.h:358
icu::number::Notation::NotationUnion::ScientificSettings::fEngineeringInterval
int8_t fEngineeringInterval
Definition: numberformatter.h:352
icu::number::Precision::PrecisionUnion::FractionSignificantSettings
Definition: numberformatter.h:698
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:701
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxSig
impl::digits_t fMaxSig
Definition: numberformatter.h:707
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fPriority
UNumberRoundingPriority fPriority
Definition: numberformatter.h:709
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:703
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinSig
impl::digits_t fMinSig
Definition: numberformatter.h:705
icu::number::Precision::PrecisionUnion::IncrementSettings
Definition: numberformatter.h:712
icu::number::Precision::PrecisionUnion::IncrementSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:719
icu::number::Precision::PrecisionUnion::IncrementSettings::fIncrement
double fIncrement
Definition: numberformatter.h:715
icu::number::Precision::PrecisionUnion::IncrementSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:717
icu::number::impl::MacroProps
Definition: numberformatter.h:1484
icu::number::impl::MacroProps::perUnit
MeasureUnit perUnit
Definition: numberformatter.h:1492
icu::number::impl::MacroProps::scale
Scale scale
Definition: numberformatter.h:1527
icu::number::impl::MacroProps::copyErrorTo
bool copyErrorTo(UErrorCode &status) const
Check all members for errors.
Definition: numberformatter.h:1553
icu::number::impl::MacroProps::usage
StringProp usage
Definition: numberformatter.h:1530
icu::number::impl::MacroProps::unitDisplayCase
StringProp unitDisplayCase
Definition: numberformatter.h:1533
icu::number::impl::MacroProps::locale
Locale locale
Definition: numberformatter.h:1545
icu::number::impl::MacroProps::precision
Precision precision
Definition: numberformatter.h:1495
icu::number::impl::MacroProps::integerWidth
IntegerWidth integerWidth
Definition: numberformatter.h:1507
icu::number::impl::MacroProps::padder
Padder padder
Definition: numberformatter.h:1504
icu::number::impl::MacroProps::grouper
Grouper grouper
Definition: numberformatter.h:1501
icu::number::impl::MacroProps::unit
MeasureUnit unit
Definition: numberformatter.h:1489
icu::number::impl::MacroProps::notation
Notation notation
Definition: numberformatter.h:1486
icu::number::impl::MacroProps::symbols
SymbolsWrapper symbols
Definition: numberformatter.h:1510
icu::number::impl::RangeMacroProps
Definition: numberrangeformatter.h:93
ucurr.h
C API: Encapsulates information about a currency.
UCurrencyUsage
UCurrencyUsage
Currency Usage used for Decimal Format.
Definition: ucurr.h:41
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:467
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
U_OVERRIDE
#define U_OVERRIDE
Defined to the C++11 "override" keyword if available.
Definition: umachine.h:130
unum.h
C API: Compatibility APIs for number formatting.
UNumberFormatRoundingMode
UNumberFormatRoundingMode
The possible number format rounding modes.
Definition: unum.h:282
UNUM_ROUND_HALFEVEN
@ UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:291
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:339
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:328
unumberformatter.h
C-compatible API for localized number formatting; not recommended for C++.
UNumberRoundingPriority
UNumberRoundingPriority
An enum declaring how to resolve conflicts between maximum fraction digits and maximum significant di...
Definition: unumberformatter.h:120
UNumberSignDisplay
UNumberSignDisplay
An enum declaring how to denote positive and negative numbers.
Definition: unumberformatter.h:368
UNUM_SIGN_COUNT
@ UNUM_SIGN_COUNT
One more than the highest UNumberSignDisplay value.
Definition: unumberformatter.h:461
UNumberDecimalSeparatorDisplay
UNumberDecimalSeparatorDisplay
An enum declaring how to render the decimal separator.
Definition: unumberformatter.h:475
UNUM_DECIMAL_SEPARATOR_COUNT
@ UNUM_DECIMAL_SEPARATOR_COUNT
One more than the highest UNumberDecimalSeparatorDisplay value.
Definition: unumberformatter.h:498
UNumberTrailingZeroDisplay
UNumberTrailingZeroDisplay
An enum declaring how to render trailing zeros.
Definition: unumberformatter.h:510
UNUM_TRAILING_ZERO_AUTO
@ UNUM_TRAILING_ZERO_AUTO
Display trailing zeros according to the settings for minimum fraction and significant digits.
Definition: unumberformatter.h:516
UNumberUnitWidth
UNumberUnitWidth
An enum declaring how to render units, including currencies.
Definition: unumberformatter.h:155
UNUM_UNIT_WIDTH_COUNT
@ UNUM_UNIT_WIDTH_COUNT
One more than the highest UNumberUnitWidth value.
Definition: unumberformatter.h:245
UNumberGroupingStrategy
UNumberGroupingStrategy
An enum declaring the strategy for when and how to display grouping separators (i....
Definition: unumberformatter.h:274
uobject.h
C++ API: Common ICU base class UObject.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
U_MEMORY_ALLOCATION_ERROR
@ U_MEMORY_ALLOCATION_ERROR
Memory allocation error.
Definition: utypes.h:457
U_INVALID_STATE_ERROR
@ U_INVALID_STATE_ERROR
Requested operation can not be completed with ICU in its current state.
Definition: utypes.h:478
U_ZERO_ERROR
@ U_ZERO_ERROR
No error, no warning.
Definition: utypes.h:449
U_FAILURE
#define U_FAILURE(x)
Does the error code indicate a failure?
Definition: utypes.h:717
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301