Loading...
Searching...
No Matches
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_NORMALIZATION
#if !UCONFIG_NO_FORMATTING
#if !UCONFIG_NO_MF2
#include "unicode/chariter.h"
#include "unicode/numberformatter.h"
#include "unicode/messageformat2_data_model_names.h"
#include "unicode/smpdtfmt.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
struct U_I18N_API DateInfo {
UDate date;
UnicodeString zoneId;
};
class U_I18N_API_CLASS Formattable : public UObject {
public:
U_I18N_API UFormattableType getType() const;
U_I18N_API 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;
}
U_I18N_API 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;
}
U_I18N_API 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;
}
U_I18N_API int64_t getInt64(UErrorCode& status) const;
U_I18N_API 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;
}
U_I18N_API const DateInfo* getDate(UErrorCode& status) const {
if (U_SUCCESS(status)) {
if (isDate()) {
return std::get_if<DateInfo>(&contents);
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return nullptr;
}
U_I18N_API UBool isNumeric() const { return (getType() == UFMT_DOUBLE || getType() == UFMT_LONG || getType() == UFMT_INT64); }
U_I18N_API const Formattable* getArray(int32_t& count, UErrorCode& status) const;
U_I18N_API 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;
}
U_I18N_API friend inline void swap(Formattable& f1, Formattable& f2) noexcept {
using std::swap;
swap(f1.contents, f2.contents);
}
U_I18N_API Formattable(const Formattable&);
U_I18N_API Formattable& operator=(Formattable) noexcept;
U_I18N_API Formattable() : contents(0.0) {}
U_I18N_API Formattable(const UnicodeString& s) : contents(s) {}
U_I18N_API Formattable(double d) : contents(d) {}
U_I18N_API Formattable(int64_t i) : contents(i) {}
U_I18N_API Formattable(DateInfo&& d) : contents(std::move(d)) {}
U_I18N_API static Formattable forDecimal(std::string_view number, UErrorCode& status);
U_I18N_API Formattable(const Formattable* arr, int32_t len) : contents(std::pair(arr, len)) {}
U_I18N_API Formattable(const FormattableObject* obj) : contents(obj) {}
U_I18N_API virtual ~Formattable();
U_I18N_API icu::Formattable asICUFormattable(UErrorCode& status) const;
private:
std::variant<double,
int64_t,
UnicodeString,
icu::Formattable, // represents a Decimal
DateInfo,
const FormattableObject*,
std::pair<const Formattable*, int32_t>> contents;
UnicodeString bogusString; // :((((
UBool isDecimal() const {
return std::holds_alternative<icu::Formattable>(contents);
}
UBool isDate() const {
return std::holds_alternative<DateInfo>(contents);
}
}; // class Formattable
#ifndef U_IN_DOXYGEN
class U_I18N_API_CLASS ResolvedFunctionOption : public UObject {
private:
/* const */ UnicodeString name;
/* const */ Formattable value;
// True iff this option was represented in the syntax by a literal value.
// This is necessary in order to implement the spec for the `select` option
// of `:number` and `:integer`.
/* const */ bool sourceIsLiteral;
public:
U_I18N_API const UnicodeString& getName() const { return name; }
U_I18N_API const Formattable& getValue() const { return value; }
U_I18N_API bool isLiteral() const { return sourceIsLiteral; }
U_I18N_API ResolvedFunctionOption(const UnicodeString& n, const Formattable& f, bool s)
: name(n), value(f), sourceIsLiteral(s) {}
U_I18N_API ResolvedFunctionOption() {}
U_I18N_API ResolvedFunctionOption(ResolvedFunctionOption&&);
U_I18N_API ResolvedFunctionOption& operator=(ResolvedFunctionOption&& other) noexcept {
name = std::move(other.name);
value = std::move(other.value);
sourceIsLiteral = other.sourceIsLiteral;
return *this;
}
U_I18N_API 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 InternalValue;
friend class MessageFormatter;
friend class StandardFunctions;
explicit FunctionOptions(UVector&&, UErrorCode&);
const ResolvedFunctionOption* getResolvedFunctionOptions(int32_t& len) const;
UBool getFunctionOption(std::u16string_view, Formattable&) const;
UBool wasSetFromLiteral(const UnicodeString&) const;
// Returns empty string if option doesn't exist
UnicodeString getStringFunctionOption(std::u16string_view) 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;
FunctionOptions mergeOptions(FunctionOptions&& other, UErrorCode&);
}; // class FunctionOptions
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_CLASS FormattedPlaceholder : public UObject {
public:
U_I18N_API explicit FormattedPlaceholder(const UnicodeString& s) : fallback(s), type(kFallback) {}
U_I18N_API FormattedPlaceholder(const FormattedPlaceholder& input, FormattedValue&& output)
: fallback(input.fallback), source(input.source),
formatted(std::move(output)), previousOptions(FunctionOptions()), type(kEvaluated) {}
U_I18N_API FormattedPlaceholder(const FormattedPlaceholder& input, FunctionOptions&& opts, FormattedValue&& output)
: fallback(input.fallback), source(input.source),
formatted(std::move(output)), previousOptions(std::move(opts)), type(kEvaluated) {}
U_I18N_API FormattedPlaceholder(const Formattable& input, const UnicodeString& fb)
: fallback(fb), source(input), type(kUnevaluated) {}
U_I18N_API FormattedPlaceholder() : type(kNull) {}
U_I18N_API const message2::Formattable& asFormattable() const;
U_I18N_API bool isFallback() const { return type == kFallback; }
U_I18N_API bool isNullOperand() const { return type == kNull; }
U_I18N_API bool isEvaluated() const { return (type == kEvaluated); }
U_I18N_API bool canFormat() const { return !(isFallback() || isNullOperand()); }
U_I18N_API const UnicodeString& getFallback() const { return fallback; }
U_I18N_API const FunctionOptions& options() const { return previousOptions; }
U_I18N_API const FormattedValue& output() const { return formatted; }
U_I18N_API FormattedPlaceholder& operator=(FormattedPlaceholder&&) noexcept;
U_I18N_API FormattedPlaceholder(FormattedPlaceholder&& other) { *this = std::move(other); }
U_I18N_API 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 /* #if !UCONFIG_NO_NORMALIZATION */
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // MESSAGEFORMAT2_FORMATTABLE_H
// eof
chariter.h
C++ API: Character Iterator.
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::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:198
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:222
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:303
icu::message2::FormattableObject
FormattableObject is an abstract class that can be implemented in order to define an arbitrary class ...
Definition messageformat2_formattable.h:49
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:113
icu::message2::Formattable::swap
U_I18N_API friend void swap(Formattable &f1, Formattable &f2) noexcept
Non-member swap function.
Definition messageformat2_formattable.h:297
icu::message2::Formattable::Formattable
U_I18N_API Formattable(const UnicodeString &s)
String constructor.
Definition messageformat2_formattable.h:332
icu::message2::Formattable::getInt64
U_I18N_API int64_t getInt64(UErrorCode &status) const
Gets the int64 value of this object.
icu::message2::Formattable::getLong
U_I18N_API int32_t getLong(UErrorCode &status) const
Gets the long value of this object.
Definition messageformat2_formattable.h:155
icu::message2::Formattable::asICUFormattable
U_I18N_API icu::Formattable asICUFormattable(UErrorCode &status) const
Converts the Formattable object to an ICU Formattable object.
icu::message2::Formattable::getDate
U_I18N_API const DateInfo * getDate(UErrorCode &status) const
Gets the struct representing the date value of this object.
Definition messageformat2_formattable.h:236
icu::message2::Formattable::isNumeric
U_I18N_API UBool isNumeric() const
Returns true if the data type of this Formattable object is kDouble.
Definition messageformat2_formattable.h:253
icu::message2::Formattable::Formattable
U_I18N_API Formattable(const FormattableObject *obj)
Object constructor.
Definition messageformat2_formattable.h:394
icu::message2::Formattable::Formattable
U_I18N_API Formattable(double d)
Double constructor.
Definition messageformat2_formattable.h:341
icu::message2::Formattable::forDecimal
static U_I18N_API 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::Formattable
U_I18N_API Formattable()
Default constructor.
Definition messageformat2_formattable.h:323
icu::message2::Formattable::getArray
U_I18N_API const Formattable * getArray(int32_t &count, UErrorCode &status) const
Gets the array value and count of this object.
icu::message2::Formattable::Formattable
U_I18N_API Formattable(const Formattable *arr, int32_t len)
Array constructor.
Definition messageformat2_formattable.h:385
icu::message2::Formattable::getDouble
U_I18N_API double getDouble(UErrorCode &status) const
Gets the double value of this object.
Definition messageformat2_formattable.h:133
icu::message2::Formattable::getType
U_I18N_API UFormattableType getType() const
Gets the data type of this Formattable object.
icu::message2::Formattable::Formattable
U_I18N_API Formattable(int64_t i)
Int64 constructor.
Definition messageformat2_formattable.h:350
icu::message2::Formattable::getInt64Value
U_I18N_API int64_t getInt64Value(UErrorCode &status) const
Gets the int64 value of this object.
Definition messageformat2_formattable.h:178
icu::message2::Formattable::getObject
U_I18N_API 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:277
icu::message2::Formattable::Formattable
U_I18N_API Formattable(DateInfo &&d)
Date constructor.
Definition messageformat2_formattable.h:360
icu::message2::Formattable::Formattable
U_I18N_API Formattable(const Formattable &)
Copy constructor.
icu::message2::Formattable::~Formattable
virtual U_I18N_API ~Formattable()
Destructor.
icu::message2::Formattable::getString
U_I18N_API const UnicodeString & getString(UErrorCode &status) const
Gets the string value of this object.
Definition messageformat2_formattable.h:215
icu::message2::Formattable::operator=
U_I18N_API Formattable & operator=(Formattable) noexcept
Assignment operator.
icu::message2::FormattedMessage::nextPosition
UBool nextPosition(ConstrainedFieldPosition &cfpos, UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:979
icu::message2::FormattedMessage::subSequence
StringPiece subSequence(int32_t start, int32_t end, UErrorCode &status) const
Not yet implemented.
Definition messageformat2_formattable.h:929
icu::message2::FormattedMessage::length
int32_t length(UErrorCode &status) const
Not yet implemented.
Definition messageformat2_formattable.h:904
icu::message2::FormattedMessage::toTempString
UnicodeString toTempString(UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:955
icu::message2::FormattedMessage::FormattedMessage
FormattedMessage(UErrorCode &status)
Not yet implemented.
Definition messageformat2_formattable.h:893
icu::message2::FormattedMessage::toString
UnicodeString toString(UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:943
icu::message2::FormattedMessage::~FormattedMessage
virtual ~FormattedMessage()
Destructor.
icu::message2::FormattedMessage::toCharacterIterator
CharacterIterator * toCharacterIterator(UErrorCode &status)
Not yet implemented.
Definition messageformat2_formattable.h:992
icu::message2::FormattedMessage::charAt
char16_t charAt(int32_t index, UErrorCode &status) const
Not yet implemented.
Definition messageformat2_formattable.h:916
icu::message2::FormattedMessage::appendTo
Appendable & appendTo(Appendable &appendable, UErrorCode &status) const override
Not yet implemented.
Definition messageformat2_formattable.h:967
icu::message2::FormattedPlaceholder::FormattedPlaceholder
U_I18N_API FormattedPlaceholder(const FormattedPlaceholder &input, FunctionOptions &&opts, FormattedValue &&output)
Constructor for fully formatted placeholders with options.
Definition messageformat2_formattable.h:730
icu::message2::FormattedPlaceholder::FormattedPlaceholder
U_I18N_API FormattedPlaceholder(const UnicodeString &s)
Fallback constructor.
Definition messageformat2_formattable.h:703
icu::message2::FormattedPlaceholder::formatToString
U_I18N_API UnicodeString formatToString(const Locale &locale, UErrorCode &status) const
Formats this as a string, using defaults.
icu::message2::FormattedPlaceholder::operator=
U_I18N_API FormattedPlaceholder & operator=(FormattedPlaceholder &&) noexcept
Move assignment operator: The source FormattedPlaceholder will be left in a valid but undefined state...
icu::message2::FormattedPlaceholder::asFormattable
U_I18N_API const message2::Formattable & asFormattable() const
Returns the source Formattable value for this placeholder.
icu::message2::FormattedPlaceholder::isFallback
U_I18N_API bool isFallback() const
Returns true iff this is a fallback placeholder.
Definition messageformat2_formattable.h:771
icu::message2::FormattedPlaceholder::output
U_I18N_API const FormattedValue & output() const
Returns the formatted output of this placeholder.
Definition messageformat2_formattable.h:824
icu::message2::FormattedPlaceholder::isEvaluated
U_I18N_API bool isEvaluated() const
Returns true iff this has formatting output.
Definition messageformat2_formattable.h:791
icu::message2::FormattedPlaceholder::FormattedPlaceholder
U_I18N_API FormattedPlaceholder(const Formattable &input, const UnicodeString &fb)
Constructor for unformatted placeholders.
Definition messageformat2_formattable.h:742
icu::message2::FormattedPlaceholder::options
U_I18N_API const FunctionOptions & options() const
Returns the options of this placeholder.
Definition messageformat2_formattable.h:817
icu::message2::FormattedPlaceholder::FormattedPlaceholder
U_I18N_API FormattedPlaceholder(const FormattedPlaceholder &input, FormattedValue &&output)
Constructor for fully formatted placeholders.
Definition messageformat2_formattable.h:715
icu::message2::FormattedPlaceholder::getFallback
U_I18N_API 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:808
icu::message2::FormattedPlaceholder::canFormat
U_I18N_API bool canFormat() const
Returns true iff this represents a valid argument to the formatter.
Definition messageformat2_formattable.h:800
icu::message2::FormattedPlaceholder::isNullOperand
U_I18N_API bool isNullOperand() const
Returns true iff this is a null placeholder.
Definition messageformat2_formattable.h:781
icu::message2::FormattedPlaceholder::FormattedPlaceholder
U_I18N_API FormattedPlaceholder()
Default constructor.
Definition messageformat2_formattable.h:751
icu::message2::FormattedValue
A FormattedValue represents the result of formatting a message2::Formattable.
Definition messageformat2_formattable.h:591
icu::message2::FormattedValue::FormattedValue
FormattedValue()
Default constructor.
Definition messageformat2_formattable.h:611
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:629
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:645
icu::message2::FormattedValue::getString
const UnicodeString & getString() const
Gets the string contents of this value.
Definition messageformat2_formattable.h:637
icu::message2::FormattedValue::isString
bool isString() const
Returns true iff this is a formatted string.
Definition messageformat2_formattable.h:620
icu::message2::FunctionOptions
Structure encapsulating named options passed to a custom selector or formatter.
Definition messageformat2_formattable.h:490
icu::message2::FunctionOptions::FunctionOptions
FunctionOptions()
Default constructor.
Definition messageformat2_formattable.h:522
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:505
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.
smpdtfmt.h
C++ API: Format and parse dates in a language-independent manner.
icu::message2::DateInfo
The DateInfo struct represents all the information needed to format a date with a time zone.
Definition messageformat2_formattable.h:78
icu::message2::DateInfo::date
UDate date
Date in UTC.
Definition messageformat2_formattable.h:85
icu::message2::DateInfo::zoneId
UnicodeString zoneId
IANA time zone name; "UTC" if UTC; empty string if value is floating The time zone is required in ord...
Definition messageformat2_formattable.h:95
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:269
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:509
U_ILLEGAL_ARGUMENT_ERROR
@ U_ILLEGAL_ARGUMENT_ERROR
Start of codes indicating failure.
Definition utypes.h:546
U_UNSUPPORTED_ERROR
@ U_UNSUPPORTED_ERROR
Requested operation not supported in current context.
Definition utypes.h:561
U_SUCCESS
#define U_SUCCESS(x)
Does the error code indicate success?
Definition utypes.h:822
U_I18N_API_CLASS
#define U_I18N_API_CLASS
Set to export library symbols from inside the i18n library, and to import them from outside,...
Definition utypes.h:457
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