ICU 77.1
77.1
|
The Key
class corresponds to the key
nonterminal in the MessageFormat 2 grammar, https://github.com/unicode-org/message-format-wg/blob/main/spec/message.abnf .
More...
#include <messageformat2_data_model.h>
Public Member Functions | |
UBool | isWildcard () const |
Determines if this is a wildcard key. More... | |
const Literal & | asLiteral () const |
Returns the contents of this key as a literal. More... | |
Key (const Key &other) | |
Copy constructor. More... | |
Key () | |
Wildcard constructor; constructs a Key representing the catchall or wildcard key, '*'. More... | |
Key (const Literal &lit) | |
Literal key constructor. More... | |
Key & | operator= (Key) noexcept |
Assignment operator. More... | |
bool | operator< (const Key &other) const |
Less than operator. More... | |
bool | operator== (const Key &other) const |
Equality operator. More... | |
virtual | ~Key () |
Destructor. More... | |
![]() | |
virtual | ~UObject () |
Destructor. More... | |
virtual UClassID | getDynamicClassID () const |
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More... | |
Friends | |
void | swap (Key &k1, Key &k2) noexcept |
Non-member swap function. More... | |
The Key
class corresponds to the key
nonterminal in the MessageFormat 2 grammar, https://github.com/unicode-org/message-format-wg/blob/main/spec/message.abnf .
It also corresponds to the Literal | CatchallKey
that is the element type of the keys
array in the Variant
interface defined in https://github.com/unicode-org/message-format-wg/blob/main/spec/data-model.md#messages
A key is either a literal or the wildcard symbol (represented in messages as '*')
Key
is immutable, copyable and movable.
Definition at line 387 of file messageformat2_data_model.h.
|
inline |
Copy constructor.
Definition at line 414 of file messageformat2_data_model.h.
|
inline |
Wildcard constructor; constructs a Key representing the catchall or wildcard key, '*'.
Definition at line 422 of file messageformat2_data_model.h.
|
inlineexplicit |
Literal key constructor.
lit | A Literal to use for this key. The result matches the literal lit . |
Definition at line 432 of file messageformat2_data_model.h.
|
virtual |
Destructor.
const Literal& icu::message2::data_model::Key::asLiteral | ( | ) | const |
Returns the contents of this key as a literal.
Precondition: !isWildcard()
|
inline |
Determines if this is a wildcard key.
Definition at line 397 of file messageformat2_data_model.h.
bool icu::message2::data_model::Key::operator< | ( | const Key & | other | ) | const |
Less than operator.
Compares the literal of this
with the literal of other
. This method is used in representing the mapping from key lists to patterns in a message with variants, and is not expected to be useful otherwise.
other | The Key to compare to this one. |
Key
s are not wildcards and if this.asLiteral()
< other.asLiteral()
. Returns false otherwise.Assignment operator.
bool icu::message2::data_model::Key::operator== | ( | const Key & | other | ) | const |
Equality operator.
Compares the literal of this
with the literal of other
. This method is used in representing the mapping from key lists to patterns in a message with variants, and is not expected to be useful otherwise.
other | The Key to compare to this one. |
Key
s are wildcards, or this.asLiteral()
== other.asLiteral()
. Returns false otherwise.Non-member swap function.
k1 | will get k2's contents |
k2 | will get k1's contents |
Definition at line 441 of file messageformat2_data_model.h.