summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/i18n/number_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/icu-small/source/i18n/number_types.h')
-rw-r--r--deps/icu-small/source/i18n/number_types.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/deps/icu-small/source/i18n/number_types.h b/deps/icu-small/source/i18n/number_types.h
index 225d1e5775..d62aa6a66b 100644
--- a/deps/icu-small/source/i18n/number_types.h
+++ b/deps/icu-small/source/i18n/number_types.h
@@ -17,17 +17,16 @@
#include "unicode/platform.h"
#include "unicode/uniset.h"
#include "standardplural.h"
+#include "formatted_string_builder.h"
-U_NAMESPACE_BEGIN namespace number {
+U_NAMESPACE_BEGIN
+namespace number {
namespace impl {
-// Typedef several enums for brevity and for easier comparison to Java.
+// For convenience and historical reasons, import the Field typedef to the namespace.
+typedef FormattedStringBuilder::Field Field;
-// Convention: bottom 4 bits for field, top 4 bits for field category.
-// Field category 0 implies the number category so that the number field
-// literals can be directly passed as a Field type.
-// See the helper functions in "NumFieldUtils" in number_utils.h
-typedef uint8_t Field;
+// Typedef several enums for brevity and for easier comparison to Java.
typedef UNumberFormatRoundingMode RoundingMode;
@@ -49,7 +48,6 @@ static constexpr char16_t kFallbackPaddingString[] = u" ";
class Modifier;
class MutablePatternModifier;
class DecimalQuantity;
-class NumberStringBuilder;
class ModifierStore;
struct MicroProps;
@@ -93,6 +91,12 @@ enum CompactType {
TYPE_DECIMAL, TYPE_CURRENCY
};
+enum Signum {
+ SIGNUM_NEG = -1,
+ SIGNUM_ZERO = 0,
+ SIGNUM_POS = 1
+};
+
class U_I18N_API AffixPatternProvider {
public:
@@ -160,7 +164,7 @@ class U_I18N_API Modifier {
* formatted.
* @return The number of characters (UTF-16 code units) that were added to the string builder.
*/
- virtual int32_t apply(NumberStringBuilder& output, int leftIndex, int rightIndex,
+ virtual int32_t apply(FormattedStringBuilder& output, int leftIndex, int rightIndex,
UErrorCode& status) const = 0;
/**
@@ -196,11 +200,11 @@ class U_I18N_API Modifier {
*/
struct U_I18N_API Parameters {
const ModifierStore* obj = nullptr;
- int8_t signum;
+ Signum signum;
StandardPlural::Form plural;
Parameters();
- Parameters(const ModifierStore* _obj, int8_t _signum, StandardPlural::Form _plural);
+ Parameters(const ModifierStore* _obj, Signum _signum, StandardPlural::Form _plural);
};
/**
@@ -231,7 +235,7 @@ class U_I18N_API ModifierStore {
/**
* Returns a Modifier with the given parameters (best-effort).
*/
- virtual const Modifier* getModifier(int8_t signum, StandardPlural::Form plural) const = 0;
+ virtual const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const = 0;
};