ICU 76.1 76.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. | |
Public Member Functions | |
MessageFormatter & | operator= (MessageFormatter &&) noexcept |
Move assignment operator: The source MessageFormatter will be left in a valid but undefined state. | |
virtual | ~MessageFormatter () |
Destructor. | |
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. | |
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. | |
const Locale & | getLocale () const |
Accesses the locale that this MessageFormatter object was created with. | |
UnicodeString | getPattern () const |
Serializes the data model as a string in MessageFormat 2.0 syntax. | |
const MFDataModel & | getDataModel () const |
Accesses the data model referred to by this MessageFormatter object. | |
const UnicodeString & | getNormalizedPattern () const |
Returns a string consisting of the input with optional spaces removed. | |
Public Member Functions inherited from icu::UObject | |
virtual | ~UObject () |
Destructor. | |
virtual UClassID | getDynamicClassID () const |
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. | |
Friends | |
class | Builder |
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 51 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 149 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 102 of file messageformat2.h.
References U_SUCCESS, and U_UNSUPPORTED_ERROR.
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. |
const MFDataModel & icu::message2::MessageFormatter::getDataModel | ( | ) | const |
Accesses the data model referred to by this MessageFormatter
object.
Accesses the locale that this MessageFormatter
object was created with.
Definition at line 118 of file messageformat2.h.
|
inline |
Returns a string consisting of the input with optional spaces removed.
Definition at line 324 of file messageformat2.h.
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.
Definition at line 327 of file messageformat2.h.
Definition at line 328 of file messageformat2.h.