1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 #include "unicode/utypes.h"
6 #if !UCONFIG_NO_FORMATTING
7 #ifndef __NUMBER_MICROPROPS_H__
8 #define __NUMBER_MICROPROPS_H__
10 // TODO: minimize includes
11 #include "unicode/numberformatter.h"
12 #include "number_types.h"
13 #include "number_decimalquantity.h"
14 #include "number_scientific.h"
15 #include "number_patternstring.h"
16 #include "number_modifiers.h"
17 #include "number_multiplier.h"
18 #include "number_roundingutils.h"
19 #include "decNumber.h"
22 U_NAMESPACE_BEGIN
namespace number
{
25 struct MicroProps
: public MicroPropsGenerator
{
27 // NOTE: All of these fields are properly initialized in NumberFormatterImpl.
31 IntegerWidth integerWidth
;
32 UNumberSignDisplay sign
;
33 UNumberDecimalSeparatorDisplay decimal
;
37 // Note: This struct has no direct ownership of the following pointers.
38 const DecimalFormatSymbols
* symbols
;
39 const Modifier
* modOuter
;
40 const Modifier
* modMiddle
;
41 const Modifier
* modInner
;
43 // The following "helper" fields may optionally be used during the MicroPropsGenerator.
44 // They live here to retain memory.
46 ScientificModifier scientificModifier
;
47 EmptyModifier emptyWeakModifier
{false};
48 EmptyModifier emptyStrongModifier
{true};
49 MultiplierFormatHandler multiplier
;
53 MicroProps() = default;
55 MicroProps(const MicroProps
& other
) = default;
57 MicroProps
& operator=(const MicroProps
& other
) = default;
59 void processQuantity(DecimalQuantity
&, MicroProps
& micros
, UErrorCode
& status
) const U_OVERRIDE
{
61 if (this == µs
) {
62 // Unsafe path: no need to perform a copy.
64 micros
.exhausted
= true;
67 // Safe path: copy self into the output micros.
74 bool exhausted
= false;
81 #endif // __NUMBER_MICROPROPS_H__
83 #endif /* #if !UCONFIG_NO_FORMATTING */