| 1 |
. |
| 2 |
|
| 3 |
|
| 4 |
#include "unicode/utypes.h" |
| 5 |
|
| 6 |
#if !UCONFIG_NO_FORMATTING |
| 7 |
#ifndef __NUMBER_DECIMFMTPROPS_H__ |
| 8 |
#define __NUMBER_DECIMFMTPROPS_H__ |
| 9 |
|
| 10 |
#include "unicode/unistr.h" |
| 11 |
#include <cstdint> |
| 12 |
#include "unicode/plurrule.h" |
| 13 |
#include "unicode/currpinf.h" |
| 14 |
#include "unicode/unum.h" |
| 15 |
#include "unicode/localpointer.h" |
| 16 |
#include "number_types.h" |
| 17 |
|
| 18 |
U_NAMESPACE_BEGIN |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN |
| 24 |
template class U_I18N_API LocalPointerBase<CurrencyPluralInfo>; |
| 25 |
template class U_I18N_API LocalPointer<CurrencyPluralInfo>; |
| 26 |
#endif |
| 27 |
|
| 28 |
namespace number::impl { |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
class U_I18N_API CurrencyPluralInfoWrapper { |
| 34 |
public: |
| 35 |
LocalPointer<CurrencyPluralInfo> fPtr; |
| 36 |
|
| 37 |
CurrencyPluralInfoWrapper() = default; |
| 38 |
|
| 39 |
CurrencyPluralInfoWrapper(const CurrencyPluralInfoWrapper& other) { |
| 40 |
if (!other.fPtr.isNull()) { |
| 41 |
fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr)); |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
CurrencyPluralInfoWrapper& operator=(const CurrencyPluralInfoWrapper& other) { |
| 46 |
if (this != &other && |
| 47 |
!other.fPtr.isNull()) { |
| 48 |
fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr)); |
| 49 |
} |
| 50 |
return *this; |
| 51 |
} |
| 52 |
}; |
| 53 |
|
| 54 |
|
| 55 |
enum ParseMode { |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
PARSE_MODE_LENIENT, |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
d |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
PARSE_MODE_STRICT, |
| 86 |
}; |
| 87 |
|
| 88 |
|
| 89 |
struct U_I18N_API DecimalFormatProperties : public UMemory { |
| 90 |
|
| 91 |
public: |
| 92 |
NullableValue<UNumberCompactStyle> compactStyle; |
| 93 |
NullableValue<CurrencyUnit> currency; |
| 94 |
CurrencyPluralInfoWrapper currencyPluralInfo; |
| 95 |
NullableValue<UCurrencyUsage> currencyUsage; |
| 96 |
bool decimalPatternMatchRequired; |
| 97 |
bool decimalSeparatorAlwaysShown; |
| 98 |
bool exponentSignAlwaysShown; |
| 99 |
bool currencyAsDecimal; |
| 100 |
bool formatFailIfMoreThanMaxDigits; |
| 101 |
int32_t formatWidth; |
| 102 |
int32_t groupingSize; |
| 103 |
bool groupingUsed; |
| 104 |
int32_t magnitudeMultiplier; |
| 105 |
int32_t maximumFractionDigits; |
| 106 |
int32_t maximumIntegerDigits; |
| 107 |
int32_t maximumSignificantDigits; |
| 108 |
int32_t minimumExponentDigits; |
| 109 |
int32_t minimumFractionDigits; |
| 110 |
int32_t minimumGroupingDigits; |
| 111 |
int32_t minimumIntegerDigits; |
| 112 |
int32_t minimumSignificantDigits; |
| 113 |
int32_t multiplier; |
| 114 |
int32_t multiplierScale; |
| 115 |
UnicodeString negativePrefix; |
| 116 |
UnicodeString negativePrefixPattern; |
| 117 |
UnicodeString negativeSuffix; |
| 118 |
UnicodeString negativeSuffixPattern; |
| 119 |
NullableValue<PadPosition> padPosition; |
| 120 |
UnicodeString padString; |
| 121 |
bool parseCaseSensitive; |
| 122 |
bool parseIntegerOnly; |
| 123 |
NullableValue<ParseMode> parseMode; |
| 124 |
bool parseNoExponent; |
| 125 |
bool parseToBigDecimal; |
| 126 |
UNumberFormatAttributeValue parseAllInput; |
| 127 |
|
| 128 |
UnicodeString positivePrefix; |
| 129 |
UnicodeString positivePrefixPattern; |
| 130 |
UnicodeString positiveSuffix; |
| 131 |
UnicodeString positiveSuffixPattern; |
| 132 |
double roundingIncrement; |
| 133 |
NullableValue<RoundingMode> roundingMode; |
| 134 |
int32_t secondaryGroupingSize; |
| 135 |
bool signAlwaysShown; |
| 136 |
|
| 137 |
DecimalFormatProperties(); |
| 138 |
|
| 139 |
inline bool operator==(const DecimalFormatProperties& other) const { |
| 140 |
return _equals(other, false); |
| 141 |
} |
| 142 |
|
| 143 |
void clear(); |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
bool equalsDefaultExceptFastFormat() const; |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
static const DecimalFormatProperties& getDefault(); |
| 155 |
|
| 156 |
private: |
| 157 |
bool _equals(const DecimalFormatProperties& other, bool ignoreForFastFormat) const; |
| 158 |
}; |
| 159 |
|
| 160 |
} |
| 161 |
|
| 162 |
U_NAMESPACE_END |
| 163 |
|
| 164 |
|
| 165 |
#endif |
| 166 |
|
| 167 |
#endif |