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
;
36 // Note: This struct has no direct ownership of the following pointers.
37 const DecimalFormatSymbols
* symbols
;
38 const Modifier
* modOuter
;
39 const Modifier
* modMiddle
;
40 const Modifier
* modInner
;
42 // The following "helper" fields may optionally be used during the MicroPropsGenerator.
43 // They live here to retain memory.
45 ScientificModifier scientificModifier
;
46 EmptyModifier emptyWeakModifier
{false};
47 EmptyModifier emptyStrongModifier
{true};
48 MultiplierFormatHandler multiplier
;
52 MicroProps() = default;
54 MicroProps(const MicroProps
& other
) = default;
56 MicroProps
& operator=(const MicroProps
& other
) = default;
58 void processQuantity(DecimalQuantity
&, MicroProps
& micros
, UErrorCode
& status
) const U_OVERRIDE
{
60 if (this == µs
) {
61 // Unsafe path: no need to perform a copy.
63 micros
.exhausted
= true;
66 // Safe path: copy self into the output micros.
73 bool exhausted
= false;
80 #endif // __NUMBER_MICROPROPS_H__
82 #endif /* #if !UCONFIG_NO_FORMATTING */