• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 
4 #include "unicode/utypes.h"
5 
6 #if !UCONFIG_NO_FORMATTING && !UPRV_INCOMPLETE_CPP11_SUPPORT
7 
8 #include "number_decimfmtprops.h"
9 
10 using namespace icu;
11 using namespace icu::number;
12 using namespace icu::number::impl;
13 
DecimalFormatProperties()14 DecimalFormatProperties::DecimalFormatProperties() {
15     clear();
16 }
17 
clear()18 void DecimalFormatProperties::clear() {
19     compactStyle.nullify();
20     currency.nullify();
21     currencyPluralInfo.fPtr.adoptInstead(nullptr);
22     currencyUsage.nullify();
23     decimalPatternMatchRequired = false;
24     decimalSeparatorAlwaysShown = false;
25     exponentSignAlwaysShown = false;
26     formatWidth = -1;
27     groupingSize = -1;
28     magnitudeMultiplier = 0;
29     maximumFractionDigits = -1;
30     maximumIntegerDigits = -1;
31     maximumSignificantDigits = -1;
32     minimumExponentDigits = -1;
33     minimumFractionDigits = -1;
34     minimumGroupingDigits = -1;
35     minimumIntegerDigits = -1;
36     minimumSignificantDigits = -1;
37     multiplier = 0;
38     negativePrefix.setToBogus();
39     negativePrefixPattern.setToBogus();
40     negativeSuffix.setToBogus();
41     negativeSuffixPattern.setToBogus();
42     padPosition.nullify();
43     padString.setToBogus();
44     parseCaseSensitive = false;
45     parseIntegerOnly = false;
46     parseLenient = false;
47     parseNoExponent = false;
48     parseToBigDecimal = false;
49     positivePrefix.setToBogus();
50     positivePrefixPattern.setToBogus();
51     positiveSuffix.setToBogus();
52     positiveSuffixPattern.setToBogus();
53     roundingIncrement = 0.0;
54     roundingMode.nullify();
55     secondaryGroupingSize = -1;
56     signAlwaysShown = false;
57 }
58 
operator ==(const DecimalFormatProperties & other) const59 bool DecimalFormatProperties::operator==(const DecimalFormatProperties &other) const {
60     bool eq = true;
61     eq = eq && compactStyle == other.compactStyle;
62     eq = eq && currency == other.currency;
63     eq = eq && currencyPluralInfo.fPtr.getAlias() == other.currencyPluralInfo.fPtr.getAlias();
64     eq = eq && currencyUsage == other.currencyUsage;
65     eq = eq && decimalPatternMatchRequired == other.decimalPatternMatchRequired;
66     eq = eq && decimalSeparatorAlwaysShown == other.decimalSeparatorAlwaysShown;
67     eq = eq && exponentSignAlwaysShown == other.exponentSignAlwaysShown;
68     eq = eq && formatWidth == other.formatWidth;
69     eq = eq && groupingSize == other.groupingSize;
70     eq = eq && magnitudeMultiplier == other.magnitudeMultiplier;
71     eq = eq && maximumFractionDigits == other.maximumFractionDigits;
72     eq = eq && maximumIntegerDigits == other.maximumIntegerDigits;
73     eq = eq && maximumSignificantDigits == other.maximumSignificantDigits;
74     eq = eq && minimumExponentDigits == other.minimumExponentDigits;
75     eq = eq && minimumFractionDigits == other.minimumFractionDigits;
76     eq = eq && minimumGroupingDigits == other.minimumGroupingDigits;
77     eq = eq && minimumIntegerDigits == other.minimumIntegerDigits;
78     eq = eq && minimumSignificantDigits == other.minimumSignificantDigits;
79     eq = eq && multiplier == other.multiplier;
80     eq = eq && negativePrefix == other.negativePrefix;
81     eq = eq && negativePrefixPattern == other.negativePrefixPattern;
82     eq = eq && negativeSuffix == other.negativeSuffix;
83     eq = eq && negativeSuffixPattern == other.negativeSuffixPattern;
84     eq = eq && padPosition == other.padPosition;
85     eq = eq && padString == other.padString;
86     eq = eq && parseCaseSensitive == other.parseCaseSensitive;
87     eq = eq && parseIntegerOnly == other.parseIntegerOnly;
88     eq = eq && parseLenient == other.parseLenient;
89     eq = eq && parseNoExponent == other.parseNoExponent;
90     eq = eq && parseToBigDecimal == other.parseToBigDecimal;
91     eq = eq && positivePrefix == other.positivePrefix;
92     eq = eq && positivePrefixPattern == other.positivePrefixPattern;
93     eq = eq && positiveSuffix == other.positiveSuffix;
94     eq = eq && positiveSuffixPattern == other.positiveSuffixPattern;
95     eq = eq && roundingIncrement == other.roundingIncrement;
96     eq = eq && roundingMode == other.roundingMode;
97     eq = eq && secondaryGroupingSize == other.secondaryGroupingSize;
98     eq = eq && signAlwaysShown == other.signAlwaysShown;
99     return eq;
100 }
101 
102 #endif /* #if !UCONFIG_NO_FORMATTING */
103