ICU 78.1
78.1
|
#include <messageformat2.h>
Data Structures | |
class | Builder |
The mutable Builder class allows each part of the MessageFormatter to be initialized separately; calling its build() method yields an immutable MessageFormatter. More... | |
Public Types | |
enum | UMFErrorHandlingBehavior { U_MF_BEST_EFFORT = 0 , U_MF_STRICT } |
Used in conjunction with the MessageFormatter::Builder::setErrorHandlingBehavior() method. More... | |
typedef enum icu::message2::MessageFormatter::UMFErrorHandlingBehavior | UMFErrorHandlingBehavior |
Used in conjunction with the MessageFormatter::Builder::setErrorHandlingBehavior() method. More... | |
Public Member Functions | |
U_I18N_API MessageFormatter & | operator= (MessageFormatter &&) noexcept |
Move assignment operator: The source MessageFormatter will be left in a valid but undefined state. More... | |
virtual U_I18N_API | ~MessageFormatter () |
Destructor. More... | |
U_I18N_API UnicodeString | formatToString (const MessageArguments &arguments, UErrorCode &status) |
Formats the message to a string, using the data model that was previously set or parsed, and the given arguments object. More... | |
U_I18N_API FormattedMessage | format (const MessageArguments &arguments, UErrorCode &status) const |
Not yet implemented; formats the message to a FormattedMessage object, using the data model that was previously set or parsed, and the given arguments object. More... | |
U_I18N_API const Locale & | getLocale () const |
Accesses the locale that this MessageFormatter object was created with. More... | |
U_I18N_API UnicodeString | getPattern () const |
Serializes the data model as a string in MessageFormat 2.0 syntax. More... | |
U_I18N_API const MFDataModel & | getDataModel () const |
Accesses the data model referred to by this MessageFormatter object. More... | |
U_I18N_API const UnicodeString & | getNormalizedPattern () const |
Returns a string consisting of the input with optional spaces removed. More... | |
![]() | |
virtual | ~UObject () |
Destructor. More... | |
virtual UClassID | getDynamicClassID () const |
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More... | |
Friends | |
class | Builder |
class | Checker |
class | MessageArguments |
class | MessageContext |
MessageFormatter is a Technical Preview API implementing MessageFormat 2.0.
See the description of the syntax with examples and use cases and the corresponding ABNF grammar.
The MessageFormatter class is mutable and movable. It is not copyable. (It is mutable because if it has a custom function registry, the registry may include FormatterFactory
objects implementing custom formatters, which are allowed to contain mutable state.)
Definition at line 54 of file messageformat2.h.
typedef enum icu::message2::MessageFormatter::UMFErrorHandlingBehavior icu::message2::MessageFormatter::UMFErrorHandlingBehavior |
Used in conjunction with the MessageFormatter::Builder::setErrorHandlingBehavior() method.
Used in conjunction with the MessageFormatter::Builder::setErrorHandlingBehavior() method.
Enumerator | |
---|---|
U_MF_BEST_EFFORT | Suppress errors and return best-effort output.
|
U_MF_STRICT | Signal all MessageFormat errors using the UErrorCode argument.
|
Definition at line 152 of file messageformat2.h.
|
virtual |
Destructor.
|
inline |
Not yet implemented; formats the message to a FormattedMessage
object, using the data model that was previously set or parsed, and the given arguments
object.
arguments | Reference to message arguments |
status | Input/output error code used to indicate syntax errors, data model errors, resolution errors, formatting errors, selection errors, as well as other errors (such as memory allocation failures). Partial output is still provided in the presence of most error types. |
FormattedMessage
representing the formatted message.Definition at line 105 of file messageformat2.h.
References U_SUCCESS, and U_UNSUPPORTED_ERROR.
U_I18N_API UnicodeString icu::message2::MessageFormatter::formatToString | ( | const MessageArguments & | arguments, |
UErrorCode & | status | ||
) |
Formats the message to a string, using the data model that was previously set or parsed, and the given arguments
object.
arguments | Reference to message arguments |
status | Input/output error code used to indicate syntax errors, data model errors, resolution errors, formatting errors, selection errors, as well as other errors (such as memory allocation failures). Partial output is still provided in the presence of most error types. |
U_I18N_API const MFDataModel& icu::message2::MessageFormatter::getDataModel | ( | ) | const |
Accesses the data model referred to by this MessageFormatter
object.
|
inline |
Accesses the locale that this MessageFormatter
object was created with.
Definition at line 121 of file messageformat2.h.
|
inline |
Returns a string consisting of the input with optional spaces removed.
Definition at line 329 of file messageformat2.h.
U_I18N_API UnicodeString icu::message2::MessageFormatter::getPattern | ( | ) | const |
Serializes the data model as a string in MessageFormat 2.0 syntax.
|
noexcept |
Move assignment operator: The source MessageFormatter will be left in a valid but undefined state.