messageformat2_formattable.h
// © 2024 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include "unicode/utypes.h"
#ifndef MESSAGEFORMAT2_FORMATTABLE_H
#define MESSAGEFORMAT2_FORMATTABLE_H
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#if !UCONFIG_NO_MF2
#include "unicode/chariter.h"
#include "unicode/numberformatter.h"
#include "unicode/messageformat2_data_model_names.h"
#ifndef U_HIDE_DEPRECATED_API
#include <map>
#include <variant>
U_NAMESPACE_BEGIN
class Hashtable;
class UVector;
namespace message2 {
class Formatter;
class MessageContext;
class Selector;
// Formattable
// ----------
class U_I18N_API FormattableObject : public UObject {
public:
virtual const UnicodeString& tag() const = 0;
virtual ~FormattableObject();
}; // class FormattableObject
class Formattable;
} // namespace message2
U_NAMESPACE_END
// Export an explicit template instantiation of the std::variant that is used
// to represent the message2::Formattable class.
// (When building DLLs for Windows this is required.)
// (See measunit_impl.h, datefmt.h, collationiterator.h, erarules.h and others
// for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
#if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION)
template class U_I18N_API std::_Variant_storage_<false,
double,
int64_t,
icu::UnicodeString,
icu::Formattable,
const icu::message2::FormattableObject *,
std::pair<const icu::message2::Formattable *,int32_t>>;
#endif
typedef std::pair<const icu::message2::Formattable*, int32_t> P;
template class U_I18N_API std::variant<double,
int64_t,
icu::UnicodeString,
icu::Formattable,
const icu::message2::FormattableObject*,
P>;
#endif
U_NAMESPACE_BEGIN
namespace message2 {
class U_I18N_API Formattable : public UObject {
public:
UFormattableType getType() const;
double getDouble(UErrorCode& status) const {
if (U_SUCCESS(status)) {
if (isDecimal() && getType() == UFMT_DOUBLE) {
return (std::get_if<icu::Formattable>(&contents))->getDouble();
}
if (std::holds_alternative<double>(contents)) {
return *(std::get_if<double>(&contents));
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return 0;
}
int32_t getLong(UErrorCode& status) const {
if (U_SUCCESS(status)) {
if (isDecimal() && getType() == UFMT_LONG) {
return std::get_if<icu::Formattable>(&contents)->getLong();
}
if (std::holds_alternative<int64_t>(contents)) {
return static_cast<int32_t>(*(std::get_if<int64_t>(&contents)));
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return 0;
}
int64_t getInt64Value(UErrorCode& status) const {
if (U_SUCCESS(status)) {
if (isDecimal() && getType() == UFMT_INT64) {
return std::get_if<icu::Formattable>(&contents)->getInt64();
}
if (std::holds_alternative<int64_t>(contents)) {
return *(std::get_if<int64_t>(&contents));
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return 0;
}
int64_t getInt64(UErrorCode& status) const;
const UnicodeString& getString(UErrorCode& status) const {
if (U_SUCCESS(status)) {
if (std::holds_alternative<UnicodeString>(contents)) {
return *std::get_if<UnicodeString>(&contents);
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return bogusString;
}
UDate getDate(UErrorCode& status) const {
if (U_SUCCESS(status)) {
if (isDate()) {
return *std::get_if<double>(&contents);
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return 0;
}
UBool isNumeric() const { return (getType() == UFMT_DOUBLE || getType() == UFMT_LONG || getType() == UFMT_INT64); }
const Formattable* getArray(int32_t& count, UErrorCode& status) const;
const FormattableObject* getObject(UErrorCode& status) const {
if (U_SUCCESS(status)) {
// Can't return a reference since FormattableObject
// is an abstract class
if (getType() == UFMT_OBJECT) {
return *std::get_if<const FormattableObject*>(&contents);
// TODO: should assert that if type is object, object is non-null
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return nullptr;
}
friend inline void swap(Formattable& f1, Formattable& f2) noexcept {
using std::swap;
swap(f1.contents, f2.contents);
swap(f1.holdsDate, f2.holdsDate);
}
Formattable(const Formattable&);
Formattable& operator=(Formattable) noexcept;
Formattable() : contents(0.0) {}
Formattable(const UnicodeString& s) : contents(s) {}
Formattable(double d) : contents(d) {}
Formattable(int64_t i) : contents(i) {}
static Formattable forDate(UDate d) {
Formattable f;
f.contents = d;
f.holdsDate = true;
return f;
}
static Formattable forDecimal(std::string_view number, UErrorCode& status);
Formattable(const Formattable* arr, int32_t len) : contents(std::pair(arr, len)) {}
Formattable(const FormattableObject* obj) : contents(obj) {}
virtual ~Formattable();
icu::Formattable asICUFormattable(UErrorCode& status) const;
private:
std::variant<double,
int64_t,
UnicodeString,
icu::Formattable, // represents a Decimal
const FormattableObject*,
std::pair<const Formattable*, int32_t>> contents;
bool holdsDate = false; // otherwise, we get type errors about UDate being a duplicate type
UnicodeString bogusString; // :((((
UBool isDecimal() const {
return std::holds_alternative<icu::Formattable>(contents);
}
UBool isDate() const {
return std::holds_alternative<double>(contents) && holdsDate;
}
}; // class Formattable
#ifndef U_IN_DOXYGEN
class U_I18N_API ResolvedFunctionOption : public UObject {
private:
/* const */ UnicodeString name;
/* const */ Formattable value;
public:
const UnicodeString& getName() const { return name; }
const Formattable& getValue() const { return value; }
ResolvedFunctionOption(const UnicodeString& n, const Formattable& f) : name(n), value(f) {}
ResolvedFunctionOption() {}
ResolvedFunctionOption(ResolvedFunctionOption&&);
ResolvedFunctionOption& operator=(ResolvedFunctionOption&& other) noexcept {
name = std::move(other.name);
value = std::move(other.value);
return *this;
}
virtual ~ResolvedFunctionOption();
}; // class ResolvedFunctionOption
#endif
using FunctionOptionsMap = std::map<UnicodeString, message2::Formattable>;
class U_I18N_API FunctionOptions : public UObject {
public:
FunctionOptionsMap getOptions() const {
int32_t len;
const ResolvedFunctionOption* resolvedOptions = getResolvedFunctionOptions(len);
FunctionOptionsMap result;
for (int32_t i = 0; i < len; i++) {
const ResolvedFunctionOption& opt = resolvedOptions[i];
result[opt.getName()] = opt.getValue();
}
return result;
}
FunctionOptions() { options = nullptr; }
virtual ~FunctionOptions();
FunctionOptions& operator=(FunctionOptions&&) noexcept;
FunctionOptions(FunctionOptions&&);
FunctionOptions& operator=(const FunctionOptions&) = delete;
private:
friend class MessageFormatter;
friend class StandardFunctions;
explicit FunctionOptions(UVector&&, UErrorCode&);
const ResolvedFunctionOption* getResolvedFunctionOptions(int32_t& len) const;
UBool getFunctionOption(const UnicodeString&, Formattable&) const;
// Returns empty string if option doesn't exist
UnicodeString getStringFunctionOption(const UnicodeString&) const;
int32_t optionsCount() const { return functionOptionsLen; }
// Named options passed to functions
// This is not a Hashtable in order to make it possible for code in a public header file
// to construct a std::map from it, on-the-fly. Otherwise, it would be impossible to put
// that code in the header because it would have to call internal Hashtable methods.
ResolvedFunctionOption* options;
int32_t functionOptionsLen = 0;
}; // class FunctionOptions
// TODO doc comments
// Encapsulates either a formatted string or formatted number;
// more output types could be added in the future.
class U_I18N_API FormattedValue : public UObject {
public:
explicit FormattedValue(const UnicodeString&);
explicit FormattedValue(number::FormattedNumber&&);
FormattedValue() : type(kString) {}
bool isString() const { return type == kString; }
bool isNumber() const { return type == kNumber; }
const UnicodeString& getString() const { return stringOutput; }
const number::FormattedNumber& getNumber() const { return numberOutput; }
FormattedValue& operator=(FormattedValue&&) noexcept;
FormattedValue(FormattedValue&& other) { *this = std::move(other); }
virtual ~FormattedValue();
private:
enum Type {
kString,
kNumber
};
Type type;
UnicodeString stringOutput;
number::FormattedNumber numberOutput;
}; // class FormattedValue
class U_I18N_API FormattedPlaceholder : public UObject {
public:
explicit FormattedPlaceholder(const UnicodeString& s) : fallback(s), type(kFallback) {}
FormattedPlaceholder(const FormattedPlaceholder& input, FormattedValue&& output)
: fallback(input.fallback), source(input.source),
formatted(std::move(output)), previousOptions(FunctionOptions()), type(kEvaluated) {}
FormattedPlaceholder(const FormattedPlaceholder& input, FunctionOptions&& opts, FormattedValue&& output)
: fallback(input.fallback), source(input.source),
formatted(std::move(output)), previousOptions(std::move(opts)), type(kEvaluated) {}
FormattedPlaceholder(const Formattable& input, const UnicodeString& fb)
: fallback(fb), source(input), type(kUnevaluated) {}
FormattedPlaceholder() : type(kNull) {}
const message2::Formattable& asFormattable() const;
bool isFallback() const { return type == kFallback; }
bool isNullOperand() const { return type == kNull; }
bool isEvaluated() const { return (type == kEvaluated); }
bool canFormat() const { return !(isFallback() || isNullOperand()); }
const UnicodeString& getFallback() const { return fallback; }
const FunctionOptions& options() const { return previousOptions; }
const FormattedValue& output() const { return formatted; }
FormattedPlaceholder& operator=(FormattedPlaceholder&&) noexcept;
FormattedPlaceholder(FormattedPlaceholder&& other) { *this = std::move(other); }
UnicodeString formatToString(const Locale& locale,
UErrorCode& status) const;
private:
friend class MessageFormatter;
enum Type {
kFallback, // Represents the result of formatting that encountered an error
kNull, // Represents the absence of both an output and an input (not necessarily an error)
kUnevaluated, // `source` should be valid, but there's no result yet
kEvaluated, // `formatted` exists
};
UnicodeString fallback;
Formattable source;
FormattedValue formatted;
FunctionOptions previousOptions; // Ignored unless type is kEvaluated
Type type;
}; // class FormattedPlaceholder
class U_I18N_API FormattedMessage : public icu::FormattedValue {
public:
FormattedMessage(UErrorCode& status) {
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
}
int32_t length(UErrorCode& status) const {
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return -1;
}
char16_t charAt(int32_t index, UErrorCode& status) const {
(void) index;
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return 0;
}
StringPiece subSequence(int32_t start, int32_t end, UErrorCode& status) const {
(void) start;
(void) end;
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return "";
}
UnicodeString toString(UErrorCode& status) const override {
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return {};
}
UnicodeString toTempString(UErrorCode& status) const override {
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return {};
}
Appendable& appendTo(Appendable& appendable, UErrorCode& status) const override {
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return appendable;
}
UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const override {
(void) cfpos;
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return false;
}
CharacterIterator* toCharacterIterator(UErrorCode& status) {
if (U_SUCCESS(status)) {
status = U_UNSUPPORTED_ERROR;
}
return nullptr;
}
virtual ~FormattedMessage();
}; // class FormattedMessage
} // namespace message2
U_NAMESPACE_END
#endif // U_HIDE_DEPRECATED_API
#endif /* #if !UCONFIG_NO_MF2 */
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // MESSAGEFORMAT2_FORMATTABLE_H
// eof
chariter.h
C++ API: Character Iterator.
icu::Appendable
Base class for objects to which Unicode characters and strings can be appended.
Definition appendable.h:54
icu::CharacterIterator
Abstract class that defines an API for iteration on text objects.
Definition chariter.h:361
icu::ConstrainedFieldPosition
Represents a span of a string containing a given field.
Definition formattedvalue.h:41
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition fmtable.h:63
icu::FormattedValue
An abstract formatted value: a string with associated field attributes.
Definition formattedvalue.h:241
icu::LocalPointerBase
"Smart pointer" base class; do not use directly: use LocalPointer etc.
Definition localpointer.h:68
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:195
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition stringpiece.h:61
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition uobject.h:223
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:296
icu::message2::FormattableObject
FormattableObject is an abstract class that can be implemented in order to define an arbitrary class ...
Definition messageformat2_formattable.h:46
icu::message2::FormattableObject::~FormattableObject
virtual ~FormattableObject()
Destructor.
icu::message2::FormattableObject::tag
virtual const UnicodeString & tag() const =0
Returns an arbitrary string representing the type of this object.
icu::message2::Formattable
The Formattable class represents a typed value that can be formatted, originating either from a messa...
Definition messageformat2_formattable.h:116
icu::message2::Formattable::Formattable
Formattable(const FormattableObject *obj)
Object constructor.
Definition messageformat2_formattable.h:399
icu::message2::Formattable::Formattable
Formattable(const UnicodeString &s)
String constructor.
Definition messageformat2_formattable.h:334
icu::message2::Formattable::Formattable
Formattable(const Formattable *arr, int32_t len)
Array constructor.
Definition messageformat2_formattable.h:390
icu::message2::Formattable::Formattable
Formattable(int64_t i)
Int64 constructor.
Definition messageformat2_formattable.h:352
icu::message2::Formattable::Formattable
Formattable()
Default constructor.
Definition messageformat2_formattable.h:325
icu::message2::Formattable::forDecimal
static Formattable forDecimal(std::string_view number, UErrorCode &status)
Creates a Formattable object of an appropriate numeric type from a a decimal number in string form.
icu::message2::Formattable::getObject
const FormattableObject * getObject(UErrorCode &status) const
Returns a pointer to the FormattableObject contained within this formattable, or if this object does ...
Definition messageformat2_formattable.h:278
icu::message2::Formattable::getDouble
double getDouble(UErrorCode &status) const
Gets the double value of this object.
Definition messageformat2_formattable.h:136
icu::message2::Formattable::asICUFormattable
icu::Formattable asICUFormattable(UErrorCode &status) const
Converts the Formattable object to an ICU Formattable object.
icu::message2::Formattable::~Formattable
virtual ~Formattable()
Destructor.
icu::message2::Formattable::getInt64
int64_t getInt64(UErrorCode &status) const
Gets the int64 value of this object.
icu::message2::Formattable::getString
const UnicodeString & getString(UErrorCode &status) const
Gets the string value of this object.
Definition messageformat2_formattable.h:218
icu::message2::Formattable::operator=
Formattable & operator=(Formattable) noexcept
Assignment operator.
icu::message2::Formattable::getLong
int32_t getLong(UErrorCode &status) const
Gets the long value of this object.
Definition messageformat2_formattable.h:158
icu::message2::Formattable::getArray
const Formattable * getArray(int32_t &count, UErrorCode &status) const
Gets the array value and count of this object.
icu::message2::Formattable::getInt64Value
int64_t getInt64Value(UErrorCode &status) const
Gets the int64 value of this object.
Definition messageformat2_formattable.h:181
icu::message2::Formattable::isNumeric
UBool isNumeric() const
Returns true if the data type of this Formattable object is kDouble.
Definition messageformat2_formattable.h:254
icu::message2::Formattable::forDate
static Formattable forDate(UDate d)
Date factory method.
Definition messageformat2_formattable.h:360
icu::message2::Formattable::Formattable
Formattable(double d)
Double constructor.
Definition messageformat2_formattable.h:343
icu::message2::Formattable::swap
friend void swap(Formattable &f1, Formattable &f2) noexcept
Non-member swap function.
Definition messageformat2_formattable.h:298
icu::message2::Formattable::Formattable
Formattable(const Formattable &)
Copy constructor.
icu::message2::Formattable::getType
UFormattableType getType() const
Gets the data type of this Formattable object.
icu::message2::Formattable::getDate
UDate getDate(UErrorCode &status) const
Gets the Date value of this object.
Definition messageformat2_formattable.h:237
icu::message2::FormattedMessage
Not yet implemented: The result of a message formatting operation.
Definition messageformat2_formattable.h:881
icu::message2::FormattedMessage::nextPosition
UBool nextPosition(ConstrainedFieldPosition &cfpos, UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:975
icu::message2::FormattedMessage::subSequence
StringPiece subSequence(int32_t start, int32_t end, UErrorCode &status) const
Not yet implemented.
Definition messageformat2_formattable.h:925
icu::message2::FormattedMessage::length
int32_t length(UErrorCode &status) const
Not yet implemented.
Definition messageformat2_formattable.h:900
icu::message2::FormattedMessage::toTempString
UnicodeString toTempString(UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:951
icu::message2::FormattedMessage::FormattedMessage
FormattedMessage(UErrorCode &status)
Not yet implemented.
Definition messageformat2_formattable.h:889
icu::message2::FormattedMessage::toString
UnicodeString toString(UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:939
icu::message2::FormattedMessage::~FormattedMessage
virtual ~FormattedMessage()
Destructor.
icu::message2::FormattedMessage::toCharacterIterator
CharacterIterator * toCharacterIterator(UErrorCode &status)
Not yet implemented.
Definition messageformat2_formattable.h:988
icu::message2::FormattedMessage::charAt
char16_t charAt(int32_t index, UErrorCode &status) const
Not yet implemented.
Definition messageformat2_formattable.h:912
icu::message2::FormattedMessage::appendTo
Appendable & appendTo(Appendable &appendable, UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:963
icu::message2::FormattedPlaceholder
A FormattablePlaceholder encapsulates an input value (a message2::Formattable) together with an optio...
Definition messageformat2_formattable.h:686
icu::message2::FormattedPlaceholder::FormattedPlaceholder
FormattedPlaceholder(const UnicodeString &s)
Fallback constructor.
Definition messageformat2_formattable.h:698
icu::message2::FormattedPlaceholder::asFormattable
const message2::Formattable & asFormattable() const
Returns the source Formattable value for this placeholder.
icu::message2::FormattedPlaceholder::formatToString
UnicodeString formatToString(const Locale &locale, UErrorCode &status) const
Formats this as a string, using defaults.
icu::message2::FormattedPlaceholder::FormattedPlaceholder
FormattedPlaceholder()
Default constructor.
Definition messageformat2_formattable.h:746
icu::message2::FormattedPlaceholder::operator=
FormattedPlaceholder & operator=(FormattedPlaceholder &&) noexcept
Move assignment operator: The source FormattedPlaceholder will be left in a valid but undefined state...
icu::message2::FormattedPlaceholder::isEvaluated
bool isEvaluated() const
Returns true iff this has formatting output.
Definition messageformat2_formattable.h:786
icu::message2::FormattedPlaceholder::isNullOperand
bool isNullOperand() const
Returns true iff this is a null placeholder.
Definition messageformat2_formattable.h:776
icu::message2::FormattedPlaceholder::getFallback
const UnicodeString & getFallback() const
Gets the fallback value of this placeholder, to be used in its place if an error occurs while formatt...
Definition messageformat2_formattable.h:803
icu::message2::FormattedPlaceholder::FormattedPlaceholder
FormattedPlaceholder(const FormattedPlaceholder &input, FormattedValue &&output)
Constructor for fully formatted placeholders.
Definition messageformat2_formattable.h:710
icu::message2::FormattedPlaceholder::isFallback
bool isFallback() const
Returns true iff this is a fallback placeholder.
Definition messageformat2_formattable.h:766
icu::message2::FormattedPlaceholder::options
const FunctionOptions & options() const
Returns the options of this placeholder.
Definition messageformat2_formattable.h:812
icu::message2::FormattedPlaceholder::FormattedPlaceholder
FormattedPlaceholder(const Formattable &input, const UnicodeString &fb)
Constructor for unformatted placeholders.
Definition messageformat2_formattable.h:737
icu::message2::FormattedPlaceholder::output
const FormattedValue & output() const
Returns the formatted output of this placeholder.
Definition messageformat2_formattable.h:820
icu::message2::FormattedPlaceholder::canFormat
bool canFormat() const
Returns true iff this represents a valid argument to the formatter.
Definition messageformat2_formattable.h:795
icu::message2::FormattedPlaceholder::FormattedPlaceholder
FormattedPlaceholder(const FormattedPlaceholder &input, FunctionOptions &&opts, FormattedValue &&output)
Constructor for fully formatted placeholders with options.
Definition messageformat2_formattable.h:725
icu::message2::FormattedValue
A FormattedValue represents the result of formatting a message2::Formattable.
Definition messageformat2_formattable.h:586
icu::message2::FormattedValue::FormattedValue
FormattedValue()
Default constructor.
Definition messageformat2_formattable.h:606
icu::message2::FormattedValue::operator=
FormattedValue & operator=(FormattedValue &&) noexcept
Move assignment operator: The source FormattedValue will be left in a valid but undefined state.
icu::message2::FormattedValue::~FormattedValue
virtual ~FormattedValue()
Destructor.
icu::message2::FormattedValue::FormattedValue
FormattedValue(number::FormattedNumber &&)
Formatted number constructor.
icu::message2::FormattedValue::isNumber
bool isNumber() const
Returns true iff this is a formatted number.
Definition messageformat2_formattable.h:624
icu::message2::FormattedValue::FormattedValue
FormattedValue(const UnicodeString &)
Formatted string constructor.
icu::message2::FormattedValue::getNumber
const number::FormattedNumber & getNumber() const
Gets the number contents of this value.
Definition messageformat2_formattable.h:640
icu::message2::FormattedValue::getString
const UnicodeString & getString() const
Gets the string contents of this value.
Definition messageformat2_formattable.h:632
icu::message2::FormattedValue::isString
bool isString() const
Returns true iff this is a formatted string.
Definition messageformat2_formattable.h:615
icu::message2::FunctionOptions
Structure encapsulating named options passed to a custom selector or formatter.
Definition messageformat2_formattable.h:488
icu::message2::FunctionOptions::FunctionOptions
FunctionOptions()
Default constructor.
Definition messageformat2_formattable.h:520
icu::message2::FunctionOptions::operator=
FunctionOptions & operator=(FunctionOptions &&) noexcept
Move assignment operator: The source FunctionOptions will be left in a valid but undefined state.
icu::message2::FunctionOptions::~FunctionOptions
virtual ~FunctionOptions()
Destructor.
icu::message2::FunctionOptions::getOptions
FunctionOptionsMap getOptions() const
Returns a map of all name-value pairs provided as options to this function.
Definition messageformat2_formattable.h:503
icu::message2::MessageFormatter
Definition messageformat2.h:51
icu::number::FormattedNumber
The result of a number formatting operation.
Definition formattednumber.h:48
numberformatter.h
C++ API: All-in-one formatter for localized numbers, currencies, and units.
UFormattableType
UFormattableType
Enum designating the type of a UFormattable instance.
Definition uformattable.h:48
UFMT_LONG
@ UFMT_LONG
ufmt_getLong() will return without conversion.
Definition uformattable.h:51
UFMT_OBJECT
@ UFMT_OBJECT
ufmt_getObject() will return without conversion.
Definition uformattable.h:55
UFMT_DOUBLE
@ UFMT_DOUBLE
ufmt_getDouble() will return without conversion.
Definition uformattable.h:50
UFMT_INT64
@ UFMT_INT64
ufmt_getInt64() will return without conversion.
Definition uformattable.h:54
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition umachine.h:247
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:430
U_ILLEGAL_ARGUMENT_ERROR
@ U_ILLEGAL_ARGUMENT_ERROR
Start of codes indicating failure.
Definition utypes.h:467
U_UNSUPPORTED_ERROR
@ U_UNSUPPORTED_ERROR
Requested operation not supported in current context.
Definition utypes.h:482
U_SUCCESS
#define U_SUCCESS(x)
Does the error code indicate success?
Definition utypes.h:742
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:316
UDate
double UDate
Date and Time data type.
Definition utypes.h:218