// © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #ifndef __NUMBER_TYPES_H__ #define __NUMBER_TYPES_H__ #include <cstdint> #include "unicode/decimfmt.h" #include "unicode/unum.h" #include "unicode/numsys.h" #include "unicode/numberformatter.h" #include "unicode/utf16.h" #include "uassert.h" #include "unicode/platform.h" #include "unicode/uniset.h" #include "standardplural.h" #include "formatted_string_builder.h" U_NAMESPACE_BEGIN namespace number { namespace impl { // For convenience and historical reasons, import the Field typedef to the namespace. Field; // Typedef several enums for brevity and for easier comparison to Java. RoundingMode; PadPosition; CompactStyle; // ICU4J Equivalent: RoundingUtils.MAX_INT_FRAC_SIG static constexpr int32_t kMaxIntFracSig = …; // ICU4J Equivalent: RoundingUtils.DEFAULT_ROUNDING_MODE static constexpr RoundingMode kDefaultMode = …; // ICU4J Equivalent: Padder.FALLBACK_PADDING_STRING static constexpr char16_t kFallbackPaddingString[] = …; // Forward declarations: class Modifier; class MutablePatternModifier; class DecimalQuantity; class ModifierStore; struct MicroProps; enum AffixPatternType { … }; enum CompactType { … }; enum Signum { … }; class U_I18N_API AffixPatternProvider { … }; /** * A Modifier is an object that can be passed through the formatting pipeline until it is finally applied to the string * builder. A Modifier usually contains a prefix and a suffix that are applied, but it could contain something else, * like a {@link com.ibm.icu.text.SimpleFormatter} pattern. * * A Modifier is usually immutable, except in cases such as {@link MutablePatternModifier}, which are mutable for performance * reasons. * * Exported as U_I18N_API because it is a base class for other exported types */ class U_I18N_API Modifier { … }; /** * This is *not* a modifier; rather, it is an object that can return modifiers * based on given parameters. * * Exported as U_I18N_API because it is a base class for other exported types. */ class U_I18N_API ModifierStore { … }; /** * This interface is used when all number formatting settings, including the locale, are known, except for the quantity * itself. The {@link #processQuantity} method performs the final step in the number processing pipeline: it uses the * quantity to generate a finalized {@link MicroProps}, which can be used to render the number to output. * * In other words, this interface is used for the parts of number processing that are <em>quantity-dependent</em>. * * In order to allow for multiple different objects to all mutate the same MicroProps, a "chain" of MicroPropsGenerators * are linked together, and each one is responsible for manipulating a certain quantity-dependent part of the * MicroProps. At the tail of the linked list is a base instance of {@link MicroProps} with properties that are not * quantity-dependent. Each element in the linked list calls {@link #processQuantity} on its "parent", then does its * work, and then returns the result. * * This chain of MicroPropsGenerators is typically constructed by NumberFormatterImpl::macrosToMicroGenerator() when * constructing a NumberFormatter. * * Exported as U_I18N_API because it is a base class for other exported types * */ class U_I18N_API MicroPropsGenerator { … }; /** * An interface used by compact notation and scientific notation to choose a multiplier while rounding. */ class MultiplierProducer { … }; // Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties template<typename T> class U_I18N_API NullableValue { … }; } // namespace impl } // namespace number U_NAMESPACE_END #endif //__NUMBER_TYPES_H__ #endif /* #if !UCONFIG_NO_FORMATTING */