ICU 69.1: numberformatter.h Source File

ICU 69.1 69.1

numberformatter.h
Go to the documentation of this file.
1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3
4 #ifndef __NUMBERFORMATTER_H__
5 #define __NUMBERFORMATTER_H__
6
7 #include "unicode/utypes.h"
8
9 #if U_SHOW_CPLUSPLUS_API
10
11 #if !UCONFIG_NO_FORMATTING
12
13 #include "unicode/appendable.h"
14 #include "unicode/bytestream.h"
15 #include "unicode/currunit.h"
16 #include "unicode/dcfmtsym.h"
17 #include "unicode/fieldpos.h"
18 #include "unicode/formattedvalue.h"
19 #include "unicode/fpositer.h"
20 #include "unicode/measunit.h"
21 #include "unicode/nounit.h"
22 #include "unicode/parseerr.h"
23 #include "unicode/plurrule.h"
24 #include "unicode/ucurr.h"
25 #include "unicode/unum.h"
26 #include "unicode/unumberformatter.h"
27 #include "unicode/uobject.h"
28
84 U_NAMESPACE_BEGIN
85
86 // Forward declarations:
87 class IFixedDecimal;
88 class FieldPositionIteratorHandler;
89 class FormattedStringBuilder;
90
91 namespace numparse {
92 namespace impl {
93
94 // Forward declarations:
95 class NumberParserImpl;
96 class MultiplierParseHandler;
97
98 }
99 }
100
101 namespace units {
102
103 // Forward declarations:
104 class UnitsRouter;
105
106 } // namespace units
107
108 namespace number { // icu::number
109
110 // Forward declarations:
111 class UnlocalizedNumberFormatter;
112 class LocalizedNumberFormatter;
113 class FormattedNumber;
114 class Notation;
115 class ScientificNotation;
116 class Precision;
117 class FractionPrecision;
118 class CurrencyPrecision;
119 class IncrementPrecision;
120 class IntegerWidth;
121
122 namespace impl {
123
124 // can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes
130 typedef int16_t digits_t;
131
132 // can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization
139 static constexpr int32_t kInternalDefaultThreshold = 3;
140
141 // Forward declarations:
142 class Padder;
143 struct MacroProps;
144 struct MicroProps;
145 class DecimalQuantity;
146 class UFormattedNumberData;
147 class NumberFormatterImpl;
148 struct ParsedPatternInfo;
149 class ScientificModifier;
150 class MultiplierProducer;
151 class RoundingImpl;
152 class ScientificHandler;
153 class Modifier;
154 class AffixPatternProvider;
155 class NumberPropertyMapper;
156 struct DecimalFormatProperties;
157 class MultiplierFormatHandler;
158 class CurrencySymbols;
159 class GeneratorHelpers;
160 class DecNum;
161 class NumberRangeFormatterImpl;
162 struct RangeMacroProps;
163 struct UFormattedNumberImpl;
164 class MutablePatternModifier;
165 class ImmutablePatternModifier;
166 struct DecimalFormatWarehouse;
167
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 UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT;
1522
1524 Scale scale; // = Scale(); (benign value)
1525
1527 StringProp usage; // = StringProp(); (no usage)
1528
1530 StringProp unitDisplayCase; // = StringProp(); (nominative)
1531
1533 const AffixPatternProvider* affixProvider = nullptr; // no ownership
1534
1536 const PluralRules* rules = nullptr; // no ownership
1537
1539 int32_t threshold = kInternalDefaultThreshold;
1540
1542 Locale locale;
1543
1544 // NOTE: Uses default copy and move constructors.
1545
1550 bool copyErrorTo(UErrorCode &status) const {
1551 return notation.copyErrorTo(status) || precision.copyErrorTo(status) ||
1552 padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) ||
1553 symbols.copyErrorTo(status) || scale.copyErrorTo(status) || usage.copyErrorTo(status) ||
1554 unitDisplayCase.copyErrorTo(status);
1555 }
1556 };
1557
1558 } // namespace impl
1559
1560 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
1561 // Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
1562 // is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
1563 // inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
1564 // fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
1565 // they will all be passed to the linker, and the linker will still find and export all the class members.
1566 #pragma warning(push)
1567 #pragma warning(disable: 4661)
1568 #endif
1569
1575 template<typename Derived>
1576 class U_I18N_API NumberFormatterSettings {
1577 public:
1606 Derived notation(const Notation &notation) const &;
1607
1617 Derived notation(const Notation &notation) &&;
1618
1667 Derived unit(const icu::MeasureUnit &unit) const &;
1668
1678 Derived unit(const icu::MeasureUnit &unit) &&;
1679
1693 Derived adoptUnit(icu::MeasureUnit *unit) const &;
1694
1704 Derived adoptUnit(icu::MeasureUnit *unit) &&;
1705
1728 Derived perUnit(const icu::MeasureUnit &perUnit) const &;
1729
1739 Derived perUnit(const icu::MeasureUnit &perUnit) &&;
1740
1754 Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &;
1755
1765 Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&;
1766
1797 Derived precision(const Precision& precision) const &;
1798
1808 Derived precision(const Precision& precision) &&;
1809
1828 Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &;
1829
1838 Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&;
1839
1867 Derived grouping(UNumberGroupingStrategy strategy) const &;
1868
1878 Derived grouping(UNumberGroupingStrategy strategy) &&;
1879
1904 Derived integerWidth(const IntegerWidth &style) const &;
1905
1915 Derived integerWidth(const IntegerWidth &style) &&;
1916
1957 Derived symbols(const DecimalFormatSymbols &symbols) const &;
1958
1968 Derived symbols(const DecimalFormatSymbols &symbols) &&;
1969
2003 Derived adoptSymbols(NumberingSystem *symbols) const &;
2004
2014 Derived adoptSymbols(NumberingSystem *symbols) &&;
2015
2041 Derived unitWidth(UNumberUnitWidth width) const &;
2042
2052 Derived unitWidth(UNumberUnitWidth width) &&;
2053
2079 Derived sign(UNumberSignDisplay style) const &;
2080
2090 Derived sign(UNumberSignDisplay style) &&;
2091
2117 Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
2118
2128 Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
2129
2154 Derived scale(const Scale &scale) const &;
2155
2165 Derived scale(const Scale &scale) &&;
2166
2167 #ifndef U_HIDE_DRAFT_API
2210 Derived usage(StringPiece usage) const &;
2211
2219 Derived usage(StringPiece usage) &&;
2220 #endif // U_HIDE_DRAFT_API
2221
2222 #ifndef U_HIDE_DRAFT_API
2223 #ifndef U_HIDE_INTERNAL_API
2230 Derived unitDisplayCase(StringPiece unitDisplayCase) const &;
2231
2237 Derived unitDisplayCase(StringPiece unitDisplayCase) &&;
2238 #endif // U_HIDE_INTERNAL_API
2239 #endif // U_HIDE_DRAFT_API
2240
2241 #ifndef U_HIDE_INTERNAL_API
2242
2248 Derived padding(const impl::Padder &padder) const &;
2249
2251 Derived padding(const impl::Padder &padder) &&;
2252
2259 Derived threshold(int32_t threshold) const &;
2260
2262 Derived threshold(int32_t threshold) &&;
2263
2269 Derived macros(const impl::MacroProps& macros) const &;
2270
2272 Derived macros(const impl::MacroProps& macros) &&;
2273
2275 Derived macros(impl::MacroProps&& macros) const &;
2276
2278 Derived macros(impl::MacroProps&& macros) &&;
2279
2280 #endif /* U_HIDE_INTERNAL_API */
2281
2299 UnicodeString toSkeleton(UErrorCode& status) const;
2300
2312 LocalPointer<Derived> clone() const &;
2313
2321 LocalPointer<Derived> clone() &&;
2322
2329 UBool copyErrorTo(UErrorCode &outErrorCode) const {
2330 if (U_FAILURE(outErrorCode)) {
2331 // Do not overwrite the older error code
2332 return true;
2333 }
2334 fMacros.copyErrorTo(outErrorCode);
2335 return U_FAILURE(outErrorCode);
2336 }
2337
2338 // NOTE: Uses default copy and move constructors.
2339
2340 private:
2341 impl::MacroProps fMacros;
2342
2343 // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
2344 NumberFormatterSettings() = default;
2345
2346 friend class LocalizedNumberFormatter;
2347 friend class UnlocalizedNumberFormatter;
2348
2349 // Give NumberRangeFormatter access to the MacroProps
2350 friend void impl::touchRangeLocales(impl::RangeMacroProps& macros);
2351 friend class impl::NumberRangeFormatterImpl;
2352 };
2353
2362 class U_I18N_API UnlocalizedNumberFormatter
2363 : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory {
2364
2365 public:
2375 LocalizedNumberFormatter locale(const icu::Locale &locale) const &;
2376
2386 LocalizedNumberFormatter locale(const icu::Locale &locale) &&;
2387
2393 UnlocalizedNumberFormatter() = default;
2394
2399 UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other);
2400
2406 UnlocalizedNumberFormatter(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
2407
2412 UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other);
2413
2419 UnlocalizedNumberFormatter& operator=(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
2420
2421 private:
2422 explicit UnlocalizedNumberFormatter(const NumberFormatterSettings<UnlocalizedNumberFormatter>& other);
2423
2424 explicit UnlocalizedNumberFormatter(
2425 NumberFormatterSettings<UnlocalizedNumberFormatter>&& src) U_NOEXCEPT;
2426
2427 // To give the fluent setters access to this class's constructor:
2428 friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
2429
2430 // To give NumberFormatter::with() access to this class's constructor:
2431 friend class NumberFormatter;
2432 };
2433
2442 class U_I18N_API LocalizedNumberFormatter
2443 : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory {
2444 public:
2456 FormattedNumber formatInt(int64_t value, UErrorCode &status) const;
2457
2469 FormattedNumber formatDouble(double value, UErrorCode &status) const;
2470
2485 FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const;
2486
2487 #ifndef U_HIDE_INTERNAL_API
2488
2492 FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const;
2493
2497 void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const;
2498
2503 const impl::NumberFormatterImpl* getCompiled() const;
2504
2509 int32_t getCallCount() const;
2510
2511 #endif /* U_HIDE_INTERNAL_API */
2512
2526 Format* toFormat(UErrorCode& status) const;
2527
2533 LocalizedNumberFormatter() = default;
2534
2539 LocalizedNumberFormatter(const LocalizedNumberFormatter &other);
2540
2546 LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT;
2547
2552 LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other);
2553
2559 LocalizedNumberFormatter& operator=(LocalizedNumberFormatter&& src) U_NOEXCEPT;
2560
2561 #ifndef U_HIDE_INTERNAL_API
2562
2575 void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const;
2576
2577 #endif /* U_HIDE_INTERNAL_API */
2578
2583 ~LocalizedNumberFormatter();
2584
2585 private:
2586 // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal
2587 // header, and LocalPointer needs the full class definition in order to delete the instance.
2588 const impl::NumberFormatterImpl* fCompiled {nullptr};
2589 char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t
2590
2591 // Owned pointer to a DecimalFormatWarehouse, used when copying a LocalizedNumberFormatter
2592 // from a DecimalFormat.
2593 const impl::DecimalFormatWarehouse* fWarehouse {nullptr};
2594
2595 explicit LocalizedNumberFormatter(const NumberFormatterSettings<LocalizedNumberFormatter>& other);
2596
2597 explicit LocalizedNumberFormatter(NumberFormatterSettings<LocalizedNumberFormatter>&& src) U_NOEXCEPT;
2598
2599 LocalizedNumberFormatter(const impl::MacroProps &macros, const Locale &locale);
2600
2601 LocalizedNumberFormatter(impl::MacroProps &&macros, const Locale &locale);
2602
2603 void resetCompiled();
2604
2605 void lnfMoveHelper(LocalizedNumberFormatter&& src);
2606
2607 void lnfCopyHelper(const LocalizedNumberFormatter& src, UErrorCode& status);
2608
2612 bool computeCompiled(UErrorCode& status) const;
2613
2614 // To give the fluent setters access to this class's constructor:
2615 friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
2616 friend class NumberFormatterSettings<LocalizedNumberFormatter>;
2617
2618 // To give UnlocalizedNumberFormatter::locale() access to this class's constructor:
2619 friend class UnlocalizedNumberFormatter;
2620 };
2621
2622 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
2623 // Warning 4661.
2624 #pragma warning(pop)
2625 #endif
2626
2635 class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
2636 public:
2637
2642 FormattedNumber()
2643 : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
2644
2649 FormattedNumber(FormattedNumber&& src) U_NOEXCEPT;
2650
2655 virtual ~FormattedNumber() U_OVERRIDE;
2656
2658 FormattedNumber(const FormattedNumber&) = delete;
2659
2661 FormattedNumber& operator=(const FormattedNumber&) = delete;
2662
2667 FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
2668
2669 // Copybrief: this method is older than the parent method
2677 UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
2678
2679 // Copydoc: this method is new in ICU 64
2681 UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
2682
2683 // Copybrief: this method is older than the parent method
2691 Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
2692
2693 // Copydoc: this method is new in ICU 64
2695 UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
2696
2715 template<typename StringClass>
2716 inline StringClass toDecimalNumber(UErrorCode& status) const;
2717
2718 #ifndef U_HIDE_DRAFT_API
2730 MeasureUnit getOutputUnit(UErrorCode& status) const;
2731
2738 const char *getGender(UErrorCode& status) const;
2739 #endif // U_HIDE_DRAFT_API
2740
2741 #ifndef U_HIDE_INTERNAL_API
2742
2747 void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const;
2748
2753 void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
2754
2755 #endif /* U_HIDE_INTERNAL_API */
2756
2757 private:
2758 // Can't use LocalPointer because UFormattedNumberData is forward-declared
2759 const impl::UFormattedNumberData *fData;
2760
2761 // Error code for the terminal methods
2762 UErrorCode fErrorCode;
2763
2768 explicit FormattedNumber(impl::UFormattedNumberData *results)
2769 : fData(results), fErrorCode(U_ZERO_ERROR) {}
2770
2771 explicit FormattedNumber(UErrorCode errorCode)
2772 : fData(nullptr), fErrorCode(errorCode) {}
2773
2774 void toDecimalNumber(ByteSink& sink, UErrorCode& status) const;
2775
2776 // To give LocalizedNumberFormatter format methods access to this class's constructor:
2777 friend class LocalizedNumberFormatter;
2778
2779 // To give C API access to internals
2780 friend struct impl::UFormattedNumberImpl;
2781 };
2782
2783 template<typename StringClass>
2784 StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const {
2785 StringClass result;
2786 StringByteSink<StringClass> sink(&result);
2787 toDecimalNumber(sink, status);
2788 return result;
2789 }
2790
2796 class U_I18N_API NumberFormatter final {
2797 public:
2805 static UnlocalizedNumberFormatter with();
2806
2816 static LocalizedNumberFormatter withLocale(const Locale &locale);
2817
2835 static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
2836
2857 static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
2858 UParseError& perror, UErrorCode& status);
2859
2863 NumberFormatter() = delete;
2864 };
2865
2866 } // namespace number
2867 U_NAMESPACE_END
2868
2869 #endif /* #if !UCONFIG_NO_FORMATTING */
2870
2871 #endif /* U_SHOW_CPLUSPLUS_API */
2872
2873 #endif // __NUMBERFORMATTER_H__
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:369
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:2635
icu::number::FormattedNumber::getDecimalQuantity
void getDecimalQuantity(impl::DecimalQuantity &output, UErrorCode &status) const
Gets the raw DecimalQuantity for plural rule selection.
icu::number::FormattedNumber::getOutputUnit
MeasureUnit getOutputUnit(UErrorCode &status) const
Gets the resolved output unit.
icu::number::FormattedNumber::FormattedNumber
FormattedNumber()
Default constructor; makes an empty FormattedNumber.
Definition: numberformatter.h:2642
icu::number::FormattedNumber::getAllFieldPositionsImpl
void getAllFieldPositionsImpl(FieldPositionIteratorHandler &fpih, UErrorCode &status) const
Populates the mutable builder type FieldPositionIteratorHandler.
icu::number::FormattedNumber::getGender
const char * getGender(UErrorCode &status) const
Gets the gender of the formatted output.
icu::number::FormattedNumber::~FormattedNumber
virtual ~FormattedNumber() U_OVERRIDE
Destruct an instance of FormattedNumber.
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:2443
icu::number::LocalizedNumberFormatter::getCompiled
const impl::NumberFormatterImpl * getCompiled() const
Internal method for testing.
icu::number::LocalizedNumberFormatter::operator=
LocalizedNumberFormatter & operator=(const LocalizedNumberFormatter &other)
Copy assignment operator.
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::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::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::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::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::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::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::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:1576
icu::number::NumberFormatterSettings::unitDisplayCase
Derived unitDisplayCase(StringPiece unitDisplayCase) &&
Overload of unitDisplayCase() for use on an rvalue reference.
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::clone
LocalPointer< Derived > clone() const &
Returns the current (Un)LocalizedNumberFormatter as a LocalPointer wrapping a heap-allocated copy of ...
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:2796
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::operator=
Scale & operator=(const Scale &other)
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=(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:2363
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::operator=
UnlocalizedNumberFormatter & operator=(const UnlocalizedNumberFormatter &other)
Copy assignment operator.
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::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::operator=
StringProp & operator=(StringProp &&src) U_NOEXCEPT
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=(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=(SymbolsWrapper &&src) U_NOEXCEPT
icu::number::impl::SymbolsWrapper::operator=
SymbolsWrapper & operator=(const SymbolsWrapper &other)
icu::number::impl::SymbolsWrapper::getNumberingSystem
const NumberingSystem * getNumberingSystem() const
Get the NumberingSystem pointer.
icu::number::impl::SymbolsWrapper::isNumberingSystem
bool isNumberingSystem() const
Whether the object is currently holding a NumberingSystem.
icu::number::impl::SymbolsWrapper::getDecimalFormatSymbols
const DecimalFormatSymbols * getDecimalFormatSymbols() const
Get the DecimalFormatSymbols pointer.
icu::number::impl::SymbolsWrapper::~SymbolsWrapper
~SymbolsWrapper()
icu::number::impl::SymbolsWrapper::SymbolsWrapper
SymbolsWrapper(SymbolsWrapper &&src) U_NOEXCEPT
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::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:1524
icu::number::impl::MacroProps::copyErrorTo
bool copyErrorTo(UErrorCode &status) const
Check all members for errors.
Definition: numberformatter.h:1550
icu::number::impl::MacroProps::usage
StringProp usage
Definition: numberformatter.h:1527
icu::number::impl::MacroProps::unitDisplayCase
StringProp unitDisplayCase
Definition: numberformatter.h:1530
icu::number::impl::MacroProps::locale
Locale locale
Definition: numberformatter.h:1542
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:370
UNUM_SIGN_COUNT
@ UNUM_SIGN_COUNT
One more than the highest UNumberSignDisplay value.
Definition: unumberformatter.h:463
UNumberDecimalSeparatorDisplay
UNumberDecimalSeparatorDisplay
An enum declaring how to render the decimal separator.
Definition: unumberformatter.h:477
UNUM_DECIMAL_SEPARATOR_COUNT
@ UNUM_DECIMAL_SEPARATOR_COUNT
One more than the highest UNumberDecimalSeparatorDisplay value.
Definition: unumberformatter.h:500
UNumberTrailingZeroDisplay
UNumberTrailingZeroDisplay
An enum declaring how to render trailing zeros.
Definition: unumberformatter.h:512
UNUM_TRAILING_ZERO_AUTO
@ UNUM_TRAILING_ZERO_AUTO
Display trailing zeros according to the settings for minimum fraction and significant digits.
Definition: unumberformatter.h:518
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:247
UNumberGroupingStrategy
UNumberGroupingStrategy
An enum declaring the strategy for when and how to display grouping separators (i....
Definition: unumberformatter.h:276
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:719
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