ICU 67.1 67.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
85 U_NAMESPACE_BEGIN
86
87 // Forward declarations:
88 class IFixedDecimal;
89 class FieldPositionIteratorHandler;
90 class FormattedStringBuilder;
91
92 namespace numparse {
93 namespace impl {
94
95 // Forward declarations:
96 class NumberParserImpl;
97 class MultiplierParseHandler;
98
99 }
100 }
101
102 namespace number { // icu::number
103
104 // Forward declarations:
105 class UnlocalizedNumberFormatter;
106 class LocalizedNumberFormatter;
107 class FormattedNumber;
108 class Notation;
109 class ScientificNotation;
110 class Precision;
111 class FractionPrecision;
112 class CurrencyPrecision;
113 class IncrementPrecision;
114 class IntegerWidth;
115
116 namespace impl {
117
118 // can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes
124 typedef int16_t digits_t;
125
126 // can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization
133 static constexpr int32_t kInternalDefaultThreshold = 3;
134
135 // Forward declarations:
136 class Padder;
137 struct MacroProps;
138 struct MicroProps;
139 class DecimalQuantity;
140 class UFormattedNumberData;
141 class NumberFormatterImpl;
142 struct ParsedPatternInfo;
143 class ScientificModifier;
144 class MultiplierProducer;
145 class RoundingImpl;
146 class ScientificHandler;
147 class Modifier;
148 class AffixPatternProvider;
149 class NumberPropertyMapper;
150 struct DecimalFormatProperties;
151 class MultiplierFormatHandler;
152 class CurrencySymbols;
153 class GeneratorHelpers;
154 class DecNum;
155 class NumberRangeFormatterImpl;
156 struct RangeMacroProps;
157 struct UFormattedNumberImpl;
158 class MutablePatternModifier;
159 class ImmutablePatternModifier;
160
167 void touchRangeLocales(impl::RangeMacroProps& macros);
168
169 } // namespace impl
170
176 typedef Notation CompactNotation;
177
183 typedef Notation SimpleNotation;
184
190 class U_I18N_API Notation : public UMemory {
191 public:
216 static ScientificNotation scientific();
217
240 static ScientificNotation engineering();
241
283 static CompactNotation compactShort();
284
307 static CompactNotation compactLong();
308
333 static SimpleNotation simple();
334
335 private:
336 enum NotationType {
337 NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR
338 } fType;
339
340 union NotationUnion {
341 // For NTN_SCIENTIFIC
343 struct ScientificSettings {
345 int8_t fEngineeringInterval;
347 bool fRequireMinInt;
349 impl::digits_t fMinExponentDigits;
351 UNumberSignDisplay fExponentSignDisplay;
352 } scientific;
353
354 // For NTN_COMPACT
355 UNumberCompactStyle compactStyle;
356
357 // For NTN_ERROR
358 UErrorCode errorCode;
359 } fUnion;
360
361 typedef NotationUnion::ScientificSettings ScientificSettings;
362
363 Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {}
364
365 Notation(UErrorCode errorCode) : fType(NTN_ERROR) {
366 fUnion.errorCode = errorCode;
367 }
368
369 Notation() : fType(NTN_SIMPLE), fUnion() {}
370
371 UBool copyErrorTo(UErrorCode &status) const {
372 if (fType == NTN_ERROR) {
373 status = fUnion.errorCode;
374 return TRUE;
375 }
376 return FALSE;
377 }
378
379 // To allow MacroProps to initialize empty instances:
380 friend struct impl::MacroProps;
381 friend class ScientificNotation;
382
383 // To allow implementation to access internal types:
384 friend class impl::NumberFormatterImpl;
385 friend class impl::ScientificModifier;
386 friend class impl::ScientificHandler;
387
388 // To allow access to the skeleton generation code:
389 friend class impl::GeneratorHelpers;
390 };
391
400 class U_I18N_API ScientificNotation : public Notation {
401 public:
415 ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const;
416
430 ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const;
431
432 private:
433 // Inherit constructor
434 using Notation::Notation;
435
436 // Raw constructor for NumberPropertyMapper
437 ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, impl::digits_t fMinExponentDigits,
438 UNumberSignDisplay fExponentSignDisplay);
439
440 friend class Notation;
441
442 // So that NumberPropertyMapper can create instances
443 friend class impl::NumberPropertyMapper;
444 };
445
451 typedef Precision SignificantDigitsPrecision;
452
461 class U_I18N_API Precision : public UMemory {
462
463 public:
481 static Precision unlimited();
482
489 static FractionPrecision integer();
490
518 static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces);
519
533 static FractionPrecision minFraction(int32_t minFractionPlaces);
534
545 static FractionPrecision maxFraction(int32_t maxFractionPlaces);
546
560 static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces);
561
575 static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits);
576
589 static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits);
590
599 static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits);
600
612 static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits,
613 int32_t maxSignificantDigits);
614
634 static IncrementPrecision increment(double roundingIncrement);
635
653 static CurrencyPrecision currency(UCurrencyUsage currencyUsage);
654
655 private:
656 enum PrecisionType {
657 RND_BOGUS,
658 RND_NONE,
659 RND_FRACTION,
660 RND_SIGNIFICANT,
661 RND_FRACTION_SIGNIFICANT,
662
663 // Used for strange increments like 3.14.
664 RND_INCREMENT,
665
666 // Used for increments with 1 as the only digit. This is different than fraction
667 // rounding because it supports having additional trailing zeros. For example, this
668 // class is used to round with the increment 0.010.
669 RND_INCREMENT_ONE,
670
671 // Used for increments with 5 as the only digit (nickel rounding).
672 RND_INCREMENT_FIVE,
673
674 RND_CURRENCY,
675 RND_ERROR
676 } fType;
677
678 union PrecisionUnion {
680 struct FractionSignificantSettings {
681 // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT
683 impl::digits_t fMinFrac;
685 impl::digits_t fMaxFrac;
687 impl::digits_t fMinSig;
689 impl::digits_t fMaxSig;
690 } fracSig;
692 struct IncrementSettings {
693 // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE
695 double fIncrement;
697 impl::digits_t fMinFrac;
699 impl::digits_t fMaxFrac;
700 } increment;
701 UCurrencyUsage currencyUsage; // For RND_CURRENCY
702 UErrorCode errorCode; // For RND_ERROR
703 } fUnion;
704
705 typedef PrecisionUnion::FractionSignificantSettings FractionSignificantSettings;
706 typedef PrecisionUnion::IncrementSettings IncrementSettings;
707
709 UNumberFormatRoundingMode fRoundingMode;
710
711 Precision(const PrecisionType& type, const PrecisionUnion& union_,
712 UNumberFormatRoundingMode roundingMode)
713 : fType(type), fUnion(union_), fRoundingMode(roundingMode) {}
714
715 Precision(UErrorCode errorCode) : fType(RND_ERROR) {
716 fUnion.errorCode = errorCode;
717 }
718
719 Precision() : fType(RND_BOGUS) {}
720
721 bool isBogus() const {
722 return fType == RND_BOGUS;
723 }
724
725 UBool copyErrorTo(UErrorCode &status) const {
726 if (fType == RND_ERROR) {
727 status = fUnion.errorCode;
728 return TRUE;
729 }
730 return FALSE;
731 }
732
733 // On the parent type so that this method can be called internally on Precision instances.
734 Precision withCurrency(const CurrencyUnit &currency, UErrorCode &status) const;
735
736 static FractionPrecision constructFraction(int32_t minFrac, int32_t maxFrac);
737
738 static Precision constructSignificant(int32_t minSig, int32_t maxSig);
739
740 static Precision
741 constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig);
742
743 static IncrementPrecision constructIncrement(double increment, int32_t minFrac);
744
745 static CurrencyPrecision constructCurrency(UCurrencyUsage usage);
746
747 static Precision constructPassThrough();
748
749 // To allow MacroProps/MicroProps to initialize bogus instances:
750 friend struct impl::MacroProps;
751 friend struct impl::MicroProps;
752
753 // To allow NumberFormatterImpl to access isBogus() and other internal methods:
754 friend class impl::NumberFormatterImpl;
755
756 // To allow NumberPropertyMapper to create instances from DecimalFormatProperties:
757 friend class impl::NumberPropertyMapper;
758
759 // To allow access to the main implementation class:
760 friend class impl::RoundingImpl;
761
762 // To allow child classes to call private methods:
763 friend class FractionPrecision;
764 friend class CurrencyPrecision;
765 friend class IncrementPrecision;
766
767 // To allow access to the skeleton generation code:
768 friend class impl::GeneratorHelpers;
769 };
770
780 class U_I18N_API FractionPrecision : public Precision {
781 public:
798 Precision withMinDigits(int32_t minSignificantDigits) const;
799
817 Precision withMaxDigits(int32_t maxSignificantDigits) const;
818
819 private:
820 // Inherit constructor
821 using Precision::Precision;
822
823 // To allow parent class to call this class's constructor:
824 friend class Precision;
825 };
826
836 class U_I18N_API CurrencyPrecision : public Precision {
837 public:
855 Precision withCurrency(const CurrencyUnit &currency) const;
856
857 private:
858 // Inherit constructor
859 using Precision::Precision;
860
861 // To allow parent class to call this class's constructor:
862 friend class Precision;
863 };
864
874 class U_I18N_API IncrementPrecision : public Precision {
875 public:
891 Precision withMinFraction(int32_t minFrac) const;
892
893 private:
894 // Inherit constructor
895 using Precision::Precision;
896
897 // To allow parent class to call this class's constructor:
898 friend class Precision;
899 };
900
910 class U_I18N_API IntegerWidth : public UMemory {
911 public:
923 static IntegerWidth zeroFillTo(int32_t minInt);
924
936 IntegerWidth truncateAt(int32_t maxInt);
937
938 private:
939 union {
940 struct {
941 impl::digits_t fMinInt;
942 impl::digits_t fMaxInt;
943 bool fFormatFailIfMoreThanMaxDigits;
944 } minMaxInt;
945 UErrorCode errorCode;
946 } fUnion;
947 bool fHasError = false;
948
949 IntegerWidth(impl::digits_t minInt, impl::digits_t maxInt, bool formatFailIfMoreThanMaxDigits);
950
951 IntegerWidth(UErrorCode errorCode) { // NOLINT
952 fUnion.errorCode = errorCode;
953 fHasError = true;
954 }
955
956 IntegerWidth() { // NOLINT
957 fUnion.minMaxInt.fMinInt = -1;
958 }
959
961 static IntegerWidth standard() {
962 return IntegerWidth::zeroFillTo(1);
963 }
964
965 bool isBogus() const {
966 return !fHasError && fUnion.minMaxInt.fMinInt == -1;
967 }
968
969 UBool copyErrorTo(UErrorCode &status) const {
970 if (fHasError) {
971 status = fUnion.errorCode;
972 return TRUE;
973 }
974 return FALSE;
975 }
976
977 void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const;
978
979 bool operator==(const IntegerWidth& other) const;
980
981 // To allow MacroProps/MicroProps to initialize empty instances:
982 friend struct impl::MacroProps;
983 friend struct impl::MicroProps;
984
985 // To allow NumberFormatterImpl to access isBogus():
986 friend class impl::NumberFormatterImpl;
987
988 // To allow the use of this class when formatting:
989 friend class impl::MutablePatternModifier;
990 friend class impl::ImmutablePatternModifier;
991
992 // So that NumberPropertyMapper can create instances
993 friend class impl::NumberPropertyMapper;
994
995 // To allow access to the skeleton generation code:
996 friend class impl::GeneratorHelpers;
997 };
998
1007 class U_I18N_API Scale : public UMemory {
1008 public:
1015 static Scale none();
1016
1027 static Scale powerOfTen(int32_t power);
1028
1041 static Scale byDecimal(StringPiece multiplicand);
1042
1051 static Scale byDouble(double multiplicand);
1052
1059 static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power);
1060
1061 // We need a custom destructor for the DecNum, which means we need to declare
1062 // the copy/move constructor/assignment quartet.
1063
1065 Scale(const Scale& other);
1066
1068 Scale& operator=(const Scale& other);
1069
1071 Scale(Scale&& src) U_NOEXCEPT;
1072
1074 Scale& operator=(Scale&& src) U_NOEXCEPT;
1075
1077 ~Scale();
1078
1079 #ifndef U_HIDE_INTERNAL_API
1080
1081 Scale(int32_t magnitude, impl::DecNum* arbitraryToAdopt);
1082 #endif /* U_HIDE_INTERNAL_API */
1083
1084 private:
1085 int32_t fMagnitude;
1086 impl::DecNum* fArbitrary;
1087 UErrorCode fError;
1088
1089 Scale(UErrorCode error) : fMagnitude(0), fArbitrary(nullptr), fError(error) {}
1090
1091 Scale() : fMagnitude(0), fArbitrary(nullptr), fError(U_ZERO_ERROR) {}
1092
1093 bool isValid() const {
1094 return fMagnitude != 0 || fArbitrary != nullptr;
1095 }
1096
1097 UBool copyErrorTo(UErrorCode &status) const {
1098 if (fError != U_ZERO_ERROR) {
1099 status = fError;
1100 return TRUE;
1101 }
1102 return FALSE;
1103 }
1104
1105 void applyTo(impl::DecimalQuantity& quantity) const;
1106
1107 void applyReciprocalTo(impl::DecimalQuantity& quantity) const;
1108
1109 // To allow MacroProps/MicroProps to initialize empty instances:
1110 friend struct impl::MacroProps;
1111 friend struct impl::MicroProps;
1112
1113 // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1114 friend class impl::NumberFormatterImpl;
1115
1116 // To allow the helper class MultiplierFormatHandler access to private fields:
1117 friend class impl::MultiplierFormatHandler;
1118
1119 // To allow access to the skeleton generation code:
1120 friend class impl::GeneratorHelpers;
1121
1122 // To allow access to parsing code:
1123 friend class ::icu::numparse::impl::NumberParserImpl;
1124 friend class ::icu::numparse::impl::MultiplierParseHandler;
1125 };
1126
1127 namespace impl {
1128
1129 // Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1131 class U_I18N_API SymbolsWrapper : public UMemory {
1132 public:
1134 SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {}
1135
1137 SymbolsWrapper(const SymbolsWrapper &other);
1138
1140 SymbolsWrapper &operator=(const SymbolsWrapper &other);
1141
1143 SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT;
1144
1146 SymbolsWrapper &operator=(SymbolsWrapper&& src) U_NOEXCEPT;
1147
1149 ~SymbolsWrapper();
1150
1151 #ifndef U_HIDE_INTERNAL_API
1152
1157 void setTo(const DecimalFormatSymbols &dfs);
1158
1163 void setTo(const NumberingSystem *ns);
1164
1169 bool isDecimalFormatSymbols() const;
1170
1175 bool isNumberingSystem() const;
1176
1181 const DecimalFormatSymbols *getDecimalFormatSymbols() const;
1182
1187 const NumberingSystem *getNumberingSystem() const;
1188
1189 #endif // U_HIDE_INTERNAL_API
1190
1192 UBool copyErrorTo(UErrorCode &status) const {
1193 if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) {
1194 status = U_MEMORY_ALLOCATION_ERROR;
1195 return TRUE;
1196 } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) {
1197 status = U_MEMORY_ALLOCATION_ERROR;
1198 return TRUE;
1199 }
1200 return FALSE;
1201 }
1202
1203 private:
1204 enum SymbolsPointerType {
1205 SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS
1206 } fType;
1207
1208 union {
1209 const DecimalFormatSymbols *dfs;
1210 const NumberingSystem *ns;
1211 } fPtr;
1212
1213 void doCopyFrom(const SymbolsWrapper &other);
1214
1215 void doMoveFrom(SymbolsWrapper&& src);
1216
1217 void doCleanup();
1218 };
1219
1220 // Do not enclose entire Grouper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1222 class U_I18N_API Grouper : public UMemory {
1223 public:
1224 #ifndef U_HIDE_INTERNAL_API
1225
1226 static Grouper forStrategy(UNumberGroupingStrategy grouping);
1227
1232 static Grouper forProperties(const DecimalFormatProperties& properties);
1233
1234 // Future: static Grouper forProperties(DecimalFormatProperties& properties);
1235
1237 Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
1238 : fGrouping1(grouping1),
1239 fGrouping2(grouping2),
1240 fMinGrouping(minGrouping),
1241 fStrategy(strategy) {}
1242 #endif // U_HIDE_INTERNAL_API
1243
1245 int16_t getPrimary() const;
1246
1248 int16_t getSecondary() const;
1249
1250 private:
1259 int16_t fGrouping1;
1260 int16_t fGrouping2;
1261
1269 int16_t fMinGrouping;
1270
1275 UNumberGroupingStrategy fStrategy;
1276
1277 Grouper() : fGrouping1(-3) {}
1278
1279 bool isBogus() const {
1280 return fGrouping1 == -3;
1281 }
1282
1284 void setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale);
1285
1286 bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const;
1287
1288 // To allow MacroProps/MicroProps to initialize empty instances:
1289 friend struct MacroProps;
1290 friend struct MicroProps;
1291
1292 // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1293 friend class NumberFormatterImpl;
1294
1295 // To allow NumberParserImpl to perform setLocaleData():
1296 friend class ::icu::numparse::impl::NumberParserImpl;
1297
1298 // To allow access to the skeleton generation code:
1299 friend class impl::GeneratorHelpers;
1300 };
1301
1302 // Do not enclose entire Padder with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1304 class U_I18N_API Padder : public UMemory {
1305 public:
1306 #ifndef U_HIDE_INTERNAL_API
1307
1308 static Padder none();
1309
1311 static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position);
1312 #endif // U_HIDE_INTERNAL_API
1313
1315 static Padder forProperties(const DecimalFormatProperties& properties);
1316
1317 private:
1318 UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding
1319 union {
1320 struct {
1321 int32_t fCp;
1322 UNumberFormatPadPosition fPosition;
1323 } padding;
1324 UErrorCode errorCode;
1325 } fUnion;
1326
1327 Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position);
1328
1329 Padder(int32_t width);
1330
1331 Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT
1332 fUnion.errorCode = errorCode;
1333 }
1334
1335 Padder() : fWidth(-2) {} // NOLINT
1336
1337 bool isBogus() const {
1338 return fWidth == -2;
1339 }
1340
1341 UBool copyErrorTo(UErrorCode &status) const {
1342 if (fWidth == -3) {
1343 status = fUnion.errorCode;
1344 return TRUE;
1345 }
1346 return FALSE;
1347 }
1348
1349 bool isValid() const {
1350 return fWidth > 0;
1351 }
1352
1353 int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2,
1354 FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
1355 UErrorCode &status) const;
1356
1357 // To allow MacroProps/MicroProps to initialize empty instances:
1358 friend struct MacroProps;
1359 friend struct MicroProps;
1360
1361 // To allow NumberFormatterImpl to access isBogus() and perform other operations:
1362 friend class impl::NumberFormatterImpl;
1363
1364 // To allow access to the skeleton generation code:
1365 friend class impl::GeneratorHelpers;
1366 };
1367
1368 // Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field
1370 struct U_I18N_API MacroProps : public UMemory {
1372 Notation notation;
1373
1375 MeasureUnit unit; // = NoUnit::base();
1376
1378 MeasureUnit perUnit; // = NoUnit::base();
1379
1381 Precision precision; // = Precision(); (bogus)
1382
1384 UNumberFormatRoundingMode roundingMode = UNUM_ROUND_HALFEVEN;
1385
1387 Grouper grouper; // = Grouper(); (bogus)
1388
1390 Padder padder; // = Padder(); (bogus)
1391
1393 IntegerWidth integerWidth; // = IntegerWidth(); (bogus)
1394
1396 SymbolsWrapper symbols;
1397
1398 // UNUM_XYZ_COUNT denotes null (bogus) values.
1399
1401 UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_COUNT;
1402
1404 UNumberSignDisplay sign = UNUM_SIGN_COUNT;
1405
1407 UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT;
1408
1410 Scale scale; // = Scale(); (benign value)
1411
1413 const AffixPatternProvider* affixProvider = nullptr; // no ownership
1414
1416 const PluralRules* rules = nullptr; // no ownership
1417
1419 int32_t threshold = kInternalDefaultThreshold;
1420
1422 Locale locale;
1423
1424 // NOTE: Uses default copy and move constructors.
1425
1430 bool copyErrorTo(UErrorCode &status) const {
1431 return notation.copyErrorTo(status) || precision.copyErrorTo(status) ||
1432 padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) ||
1433 symbols.copyErrorTo(status) || scale.copyErrorTo(status);
1434 }
1435 };
1436
1437 } // namespace impl
1438
1439 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
1440 // Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method
1441 // is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation
1442 // inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is
1443 // fully defined. However, since each translation unit explicitly instantiates all the necessary template classes,
1444 // they will all be passed to the linker, and the linker will still find and export all the class members.
1445 #pragma warning(push)
1446 #pragma warning(disable: 4661)
1447 #endif
1448
1454 template<typename Derived>
1455 class U_I18N_API NumberFormatterSettings {
1456 public:
1485 Derived notation(const Notation &notation) const &;
1486
1496 Derived notation(const Notation &notation) &&;
1497
1541 Derived unit(const icu::MeasureUnit &unit) const &;
1542
1552 Derived unit(const icu::MeasureUnit &unit) &&;
1553
1567 Derived adoptUnit(icu::MeasureUnit *unit) const &;
1568
1578 Derived adoptUnit(icu::MeasureUnit *unit) &&;
1579
1602 Derived perUnit(const icu::MeasureUnit &perUnit) const &;
1603
1613 Derived perUnit(const icu::MeasureUnit &perUnit) &&;
1614
1628 Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &;
1629
1639 Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&;
1640
1671 Derived precision(const Precision& precision) const &;
1672
1682 Derived precision(const Precision& precision) &&;
1683
1702 Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &;
1703
1712 Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&;
1713
1741 Derived grouping(UNumberGroupingStrategy strategy) const &;
1742
1752 Derived grouping(UNumberGroupingStrategy strategy) &&;
1753
1778 Derived integerWidth(const IntegerWidth &style) const &;
1779
1789 Derived integerWidth(const IntegerWidth &style) &&;
1790
1831 Derived symbols(const DecimalFormatSymbols &symbols) const &;
1832
1842 Derived symbols(const DecimalFormatSymbols &symbols) &&;
1843
1877 Derived adoptSymbols(NumberingSystem *symbols) const &;
1878
1888 Derived adoptSymbols(NumberingSystem *symbols) &&;
1889
1915 Derived unitWidth(UNumberUnitWidth width) const &;
1916
1926 Derived unitWidth(UNumberUnitWidth width) &&;
1927
1953 Derived sign(UNumberSignDisplay style) const &;
1954
1964 Derived sign(UNumberSignDisplay style) &&;
1965
1991 Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
1992
2002 Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
2003
2028 Derived scale(const Scale &scale) const &;
2029
2039 Derived scale(const Scale &scale) &&;
2040
2041 #ifndef U_HIDE_INTERNAL_API
2042
2048 Derived padding(const impl::Padder &padder) const &;
2049
2051 Derived padding(const impl::Padder &padder) &&;
2052
2059 Derived threshold(int32_t threshold) const &;
2060
2062 Derived threshold(int32_t threshold) &&;
2063
2069 Derived macros(const impl::MacroProps& macros) const &;
2070
2072 Derived macros(const impl::MacroProps& macros) &&;
2073
2075 Derived macros(impl::MacroProps&& macros) const &;
2076
2078 Derived macros(impl::MacroProps&& macros) &&;
2079
2080 #endif /* U_HIDE_INTERNAL_API */
2081
2096 UnicodeString toSkeleton(UErrorCode& status) const;
2097
2109 LocalPointer<Derived> clone() const &;
2110
2118 LocalPointer<Derived> clone() &&;
2119
2126 UBool copyErrorTo(UErrorCode &outErrorCode) const {
2127 if (U_FAILURE(outErrorCode)) {
2128 // Do not overwrite the older error code
2129 return TRUE;
2130 }
2131 fMacros.copyErrorTo(outErrorCode);
2132 return U_FAILURE(outErrorCode);
2133 }
2134
2135 // NOTE: Uses default copy and move constructors.
2136
2137 private:
2138 impl::MacroProps fMacros;
2139
2140 // Don't construct me directly! Use (Un)LocalizedNumberFormatter.
2141 NumberFormatterSettings() = default;
2142
2143 friend class LocalizedNumberFormatter;
2144 friend class UnlocalizedNumberFormatter;
2145
2146 // Give NumberRangeFormatter access to the MacroProps
2147 friend void impl::touchRangeLocales(impl::RangeMacroProps& macros);
2148 friend class impl::NumberRangeFormatterImpl;
2149 };
2150
2159 class U_I18N_API UnlocalizedNumberFormatter
2160 : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory {
2161
2162 public:
2172 LocalizedNumberFormatter locale(const icu::Locale &locale) const &;
2173
2183 LocalizedNumberFormatter locale(const icu::Locale &locale) &&;
2184
2190 UnlocalizedNumberFormatter() = default;
2191
2196 UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other);
2197
2203 UnlocalizedNumberFormatter(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
2204
2209 UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other);
2210
2216 UnlocalizedNumberFormatter& operator=(UnlocalizedNumberFormatter&& src) U_NOEXCEPT;
2217
2218 private:
2219 explicit UnlocalizedNumberFormatter(const NumberFormatterSettings<UnlocalizedNumberFormatter>& other);
2220
2221 explicit UnlocalizedNumberFormatter(
2222 NumberFormatterSettings<UnlocalizedNumberFormatter>&& src) U_NOEXCEPT;
2223
2224 // To give the fluent setters access to this class's constructor:
2225 friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
2226
2227 // To give NumberFormatter::with() access to this class's constructor:
2228 friend class NumberFormatter;
2229 };
2230
2239 class U_I18N_API LocalizedNumberFormatter
2240 : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory {
2241 public:
2253 FormattedNumber formatInt(int64_t value, UErrorCode &status) const;
2254
2266 FormattedNumber formatDouble(double value, UErrorCode &status) const;
2267
2282 FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const;
2283
2284 #ifndef U_HIDE_INTERNAL_API
2285
2289 FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const;
2290
2294 void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const;
2295
2300 const impl::NumberFormatterImpl* getCompiled() const;
2301
2306 int32_t getCallCount() const;
2307
2308 #endif /* U_HIDE_INTERNAL_API */
2309
2323 Format* toFormat(UErrorCode& status) const;
2324
2330 LocalizedNumberFormatter() = default;
2331
2336 LocalizedNumberFormatter(const LocalizedNumberFormatter &other);
2337
2343 LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT;
2344
2349 LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other);
2350
2356 LocalizedNumberFormatter& operator=(LocalizedNumberFormatter&& src) U_NOEXCEPT;
2357
2358 #ifndef U_HIDE_INTERNAL_API
2359
2372 void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const;
2373
2374 #endif /* U_HIDE_INTERNAL_API */
2375
2380 ~LocalizedNumberFormatter();
2381
2382 private:
2383 // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal
2384 // header, and LocalPointer needs the full class definition in order to delete the instance.
2385 const impl::NumberFormatterImpl* fCompiled {nullptr};
2386 char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t
2387
2388 explicit LocalizedNumberFormatter(const NumberFormatterSettings<LocalizedNumberFormatter>& other);
2389
2390 explicit LocalizedNumberFormatter(NumberFormatterSettings<LocalizedNumberFormatter>&& src) U_NOEXCEPT;
2391
2392 LocalizedNumberFormatter(const impl::MacroProps &macros, const Locale &locale);
2393
2394 LocalizedNumberFormatter(impl::MacroProps &&macros, const Locale &locale);
2395
2396 void clear();
2397
2398 void lnfMoveHelper(LocalizedNumberFormatter&& src);
2399
2403 bool computeCompiled(UErrorCode& status) const;
2404
2405 // To give the fluent setters access to this class's constructor:
2406 friend class NumberFormatterSettings<UnlocalizedNumberFormatter>;
2407 friend class NumberFormatterSettings<LocalizedNumberFormatter>;
2408
2409 // To give UnlocalizedNumberFormatter::locale() access to this class's constructor:
2410 friend class UnlocalizedNumberFormatter;
2411 };
2412
2413 #if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER)
2414 // Warning 4661.
2415 #pragma warning(pop)
2416 #endif
2417
2426 class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
2427 public:
2428
2433 FormattedNumber()
2434 : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
2435
2440 FormattedNumber(FormattedNumber&& src) U_NOEXCEPT;
2441
2446 virtual ~FormattedNumber() U_OVERRIDE;
2447
2449 FormattedNumber(const FormattedNumber&) = delete;
2450
2452 FormattedNumber& operator=(const FormattedNumber&) = delete;
2453
2458 FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
2459
2460 // Copybrief: this method is older than the parent method
2468 UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
2469
2470 // Copydoc: this method is new in ICU 64
2472 UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
2473
2474 // Copybrief: this method is older than the parent method
2482 Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
2483
2484 // Copydoc: this method is new in ICU 64
2486 UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
2487
2488 #ifndef U_HIDE_DRAFT_API
2489
2507 template<typename StringClass>
2508 inline StringClass toDecimalNumber(UErrorCode& status) const;
2509 #endif // U_HIDE_DRAFT_API
2510
2511 #ifndef U_HIDE_INTERNAL_API
2512
2517 void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const;
2518
2523 void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
2524
2525 #endif /* U_HIDE_INTERNAL_API */
2526
2527 private:
2528 // Can't use LocalPointer because UFormattedNumberData is forward-declared
2529 const impl::UFormattedNumberData *fData;
2530
2531 // Error code for the terminal methods
2532 UErrorCode fErrorCode;
2533
2538 explicit FormattedNumber(impl::UFormattedNumberData *results)
2539 : fData(results), fErrorCode(U_ZERO_ERROR) {}
2540
2541 explicit FormattedNumber(UErrorCode errorCode)
2542 : fData(nullptr), fErrorCode(errorCode) {}
2543
2544 // TODO(ICU-20775): Propose this as API.
2545 void toDecimalNumber(ByteSink& sink, UErrorCode& status) const;
2546
2547 // To give LocalizedNumberFormatter format methods access to this class's constructor:
2548 friend class LocalizedNumberFormatter;
2549
2550 // To give C API access to internals
2551 friend struct impl::UFormattedNumberImpl;
2552 };
2553
2554 #ifndef U_HIDE_DRAFT_API
2555 // Note: This is draft ICU 65
2556 template<typename StringClass>
2557 StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const {
2558 StringClass result;
2559 StringByteSink<StringClass> sink(&result);
2560 toDecimalNumber(sink, status);
2561 return result;
2562 }
2563 #endif // U_HIDE_DRAFT_API
2564
2570 class U_I18N_API NumberFormatter final {
2571 public:
2579 static UnlocalizedNumberFormatter with();
2580
2590 static LocalizedNumberFormatter withLocale(const Locale &locale);
2591
2606 static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
2607
2625 static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
2626 UParseError& perror, UErrorCode& status);
2627
2631 NumberFormatter() = delete;
2632 };
2633
2634 } // namespace number
2635 U_NAMESPACE_END
2636
2637 #endif /* #if !UCONFIG_NO_FORMATTING */
2638
2639 #endif /* U_SHOW_CPLUSPLUS_API */
2640
2641 #endif // __NUMBERFORMATTER_H__
2642
formattedvalue.h
C++ API: Abstract operations for localized strings.
icu::number::impl::MacroProps::perUnit
MeasureUnit perUnit
Definition: numberformatter.h:1378
UNUM_SIGN_COUNT
One more than the highest UNumberSignDisplay value.
Definition: unumberformatter.h:359
icu::Format
Base class for all formats.
Definition: format.h:98
icu::number::Precision::PrecisionUnion::IncrementSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:699
icu::DecimalFormatSymbols
This class represents the set of symbols needed by DecimalFormat to format numbers.
Definition: dcfmtsym.h:86
U_OVERRIDE
#define U_OVERRIDE
Defined to the C++11 "override" keyword if available.
Definition: umachine.h:129
UNumberFormatRoundingMode
UNumberFormatRoundingMode
The possible number format rounding modes.
Definition: unum.h:279
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:237
currunit.h
C++ API: Currency Unit Information.
unumberformatter.h
C-compatible API for localized number formatting; not recommended for C++.
icu::number::impl::MacroProps::padder
Padder padder
Definition: numberformatter.h:1390
icu::number::NumberFormatter
See the main description in numberformatter.h for documentation and examples.
Definition: numberformatter.h:2570
U_FAILURE
#define U_FAILURE(x)
Does the error code indicate a failure?
Definition: utypes.h:709
icu::number::IntegerWidth
A class that defines the strategy for padding and truncating integers before the decimal separator...
Definition: numberformatter.h:910
fpositer.h
C++ API: FieldPosition Iterator.
icu::LocalPointer
"Smart pointer" class, deletes objects via the standard C++ delete operator.
Definition: localpointer.h:191
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::NumberingSystem
Defines numbering systems.
Definition: numsys.h:60
appendable.h
C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts).
nounit.h
C++ API: units for percent and permille.
U_ZERO_ERROR
No error, no warning.
Definition: utypes.h:449
plurrule.h
C++ API: PluralRules object.
icu::number::Precision::PrecisionUnion::FractionSignificantSettings
Definition: numberformatter.h:680
icu::number::IncrementPrecision
A class that defines a rounding precision parameterized by a rounding increment to be used when forma...
Definition: numberformatter.h:874
icu::number::Precision::PrecisionUnion::IncrementSettings::fIncrement
double fIncrement
Definition: numberformatter.h:695
icu::FormattedValue
An abstract formatted value: a string with associated field attributes.
Definition: formattedvalue.h:241
UNumberDecimalSeparatorDisplay
UNumberDecimalSeparatorDisplay
An enum declaring how to render the decimal separator.
Definition: unumberformatter.h:373
icu::ByteSink
A ByteSink can be filled with bytes.
Definition: bytestream.h:53
icu::PluralRules
Defines rules for mapping non-negative numeric values onto a small set of keywords.
Definition: plurrule.h:200
U_MEMORY_ALLOCATION_ERROR
Memory allocation error.
Definition: utypes.h:457
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinSig
impl::digits_t fMinSig
Definition: numberformatter.h:687
icu::number::Notation::NotationUnion::ScientificSettings::fExponentSignDisplay
UNumberSignDisplay fExponentSignDisplay
Definition: numberformatter.h:351
icu::number::Notation::NotationUnion::ScientificSettings
Definition: numberformatter.h:343
icu::number::impl::MacroProps
Definition: numberformatter.h:1370
icu::number::NumberFormatterSettings
An abstract base class for specifying settings related to number formatting.
Definition: numberformatter.h:1455
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
UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition: unum.h:288
fieldpos.h
C++ API: FieldPosition identifies the fields in a formatted output.
icu::number::impl::MacroProps::grouper
Grouper grouper
Definition: numberformatter.h:1387
icu::number::Notation
A class that defines the notation style to be used when formatting numbers in NumberFormatter.
Definition: numberformatter.h:190
icu::number::impl::RangeMacroProps
Definition: numberrangeformatter.h:210
icu::number::impl::touchRangeLocales
void touchRangeLocales(impl::RangeMacroProps &macros)
Used for NumberRangeFormatter and implemented in numrange_fluent.cpp.
icu::number::Notation::NotationUnion::ScientificSettings::fMinExponentDigits
impl::digits_t fMinExponentDigits
Definition: numberformatter.h:349
bytestream.h
C++ API: Interface for writing bytes, and implementation classes.
icu::number::impl::MacroProps::integerWidth
IntegerWidth integerWidth
Definition: numberformatter.h:1393
measunit.h
C++ API: A unit for measuring a quantity.
ucurr.h
C API: Encapsulates information about a currency.
icu::number::Precision::PrecisionUnion::IncrementSettings
Definition: numberformatter.h:692
UNumberSignDisplay
UNumberSignDisplay
An enum declaring how to denote positive and negative numbers.
Definition: unumberformatter.h:287
icu::number::FractionPrecision
A class that defines a rounding precision based on a number of fraction places and optionally signifi...
Definition: numberformatter.h:780
UNumberGroupingStrategy
UNumberGroupingStrategy
An enum declaring the strategy for when and how to display grouping separators (i.e., the separator, often a comma or period, after every 2-3 powers of ten).
Definition: unumberformatter.h:193
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:425
icu::number::NumberFormatterSettings::copyErrorTo
UBool copyErrorTo(UErrorCode &outErrorCode) const
Sets the UErrorCode if an error occurred in the fluent chain.
Definition: numberformatter.h:2126
icu::number::impl::MacroProps::locale
Locale locale
Definition: numberformatter.h:1422
icu::number::impl::SymbolsWrapper::SymbolsWrapper
SymbolsWrapper()
Definition: numberformatter.h:1134
icu::number::impl::MacroProps::notation
Notation notation
Definition: numberformatter.h:1372
icu::number::impl::MacroProps::symbols
SymbolsWrapper symbols
Definition: numberformatter.h:1396
icu::number::CurrencyPrecision
A class that defines a rounding precision parameterized by a currency to be used when formatting numb...
Definition: numberformatter.h:836
TRUE
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:265
icu::CurrencyUnit
A unit of currency, such as USD (U.S.
Definition: currunit.h:39
UNumberFormatPadPosition
UNumberFormatPadPosition
The possible number format pad positions.
Definition: unum.h:308
icu::number::impl::MacroProps::unit
MeasureUnit unit
Definition: numberformatter.h:1375
uobject.h
C++ API: Common ICU base class UObject.
icu::ConstrainedFieldPosition
Represents a span of a string containing a given field.
Definition: formattedvalue.h:41
U_NOEXCEPT
#define U_NOEXCEPT
"noexcept" if supported, otherwise empty.
Definition: platform.h:529
icu::number::UnlocalizedNumberFormatter
A NumberFormatter that does not yet have a locale.
Definition: numberformatter.h:2159
UNumberCompactStyle
UNumberCompactStyle
Constants for specifying short or long format.
Definition: unum.h:319
parseerr.h
C API: Parse Error Information.
icu::number::LocalizedNumberFormatter
A NumberFormatter that has a locale associated with it; this means .format() methods are available...
Definition: numberformatter.h:2239
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:683
icu::number::Notation::NotationUnion::ScientificSettings::fRequireMinInt
bool fRequireMinInt
Definition: numberformatter.h:347
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxFrac
impl::digits_t fMaxFrac
Definition: numberformatter.h:685
icu::number::Scale
A class that defines a quantity by which a number should be multiplied when formatting.
Definition: numberformatter.h:1007
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::number::impl::MacroProps::scale
Scale scale
Definition: numberformatter.h:1410
icu::number::impl::SymbolsWrapper
Definition: numberformatter.h:1131
icu::number::impl::MacroProps::precision
Precision precision
Definition: numberformatter.h:1381
dcfmtsym.h
C++ API: Symbols for formatting numbers.
icu::number::ScientificNotation
A class that defines the scientific notation style to be used when formatting numbers in NumberFormat...
Definition: numberformatter.h:400
UNumberUnitWidth
UNumberUnitWidth
An enum declaring how to render units, including currencies.
Definition: unumberformatter.h:98
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::StringByteSink
Implementation of ByteSink that writes to a "string".
Definition: bytestream.h:269
icu::number::impl::Padder
Definition: numberformatter.h:1304
FALSE
#define FALSE
The FALSE value of a UBool.
Definition: umachine.h:269
icu::number::impl::digits_t
int16_t digits_t
Datatype for minimum/maximum fraction digits.
Definition: numberformatter.h:124
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:294
icu::number::FormattedNumber
The result of a number formatting operation.
Definition: numberformatter.h:2426
icu::number::impl::Grouper::Grouper
Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy)
Definition: numberformatter.h:1237
icu::number::Precision::PrecisionUnion::FractionSignificantSettings::fMaxSig
impl::digits_t fMaxSig
Definition: numberformatter.h:689
icu::number::impl::Grouper
Definition: numberformatter.h:1222
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::number::Precision
A class that defines the rounding precision to be used when formatting numbers in NumberFormatter...
Definition: numberformatter.h:461
UNUM_DECIMAL_SEPARATOR_COUNT
One more than the highest UNumberDecimalSeparatorDisplay value.
Definition: unumberformatter.h:394
U_INVALID_STATE_ERROR
Requested operation can not be completed with ICU in its current state.
Definition: utypes.h:478
UNUM_UNIT_WIDTH_COUNT
One more than the highest UNumberUnitWidth value.
Definition: unumberformatter.h:164
icu::number::FormattedNumber::FormattedNumber
FormattedNumber()
Default constructor; makes an empty FormattedNumber.
Definition: numberformatter.h:2433
icu::number::Notation::NotationUnion::ScientificSettings::fEngineeringInterval
int8_t fEngineeringInterval
Definition: numberformatter.h:345
icu::number::impl::MacroProps::copyErrorTo
bool copyErrorTo(UErrorCode &status) const
Check all members for errors.
Definition: numberformatter.h:1430
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261
icu::Appendable
Base class for objects to which Unicode characters and strings can be appended.
Definition: appendable.h:54
unum.h
C API: Compatibility APIs for number formatting.
icu::number::Precision::PrecisionUnion::IncrementSettings::fMinFrac
impl::digits_t fMinFrac
Definition: numberformatter.h:697
icu::number::impl::SymbolsWrapper::copyErrorTo
UBool copyErrorTo(UErrorCode &status) const
Definition: numberformatter.h:1192
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195