Loading...
Searching...
No Matches
icu::message2::data_model::Key Class Reference

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>`

Inheritance diagram for icu::message2::data_model::Key:

## Public Member Functions

U_I18N_API UBool | isWildcard () const
| Determines if this is a wildcard key.
U_I18N_API const Literal & | asLiteral () const
| Returns the contents of this key as a literal.
U_I18N_API | Key (const Key &other)
| Copy constructor.
U_I18N_API | Key ()
| Wildcard constructor; constructs a Key representing the catchall or wildcard key, '*'.
U_I18N_API | Key (const Literal &lit)
| Literal key constructor.
U_I18N_API Key & | operator= (Key) noexcept
| Assignment operator.
U_I18N_API bool | operator< (const Key &other) const
| Less than operator.
U_I18N_API bool | operator== (const Key &other) const
| Equality operator.
virtual U_I18N_API | ~Key ()
| Destructor.
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

U_I18N_API friend void | swap (Key &k1, Key &k2) noexcept
| Non-member swap function.

## Detailed Description

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.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 346 of file messageformat2_data_model.h.

## Constructor & Destructor Documentation

## Key() [1/3]

U_I18N_API icu::message2::data_model::Key::Key | ( | const Key & | other | ) |

inline

Copy constructor.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 373 of file messageformat2_data_model.h.

References Key(), and U_I18N_API.

Referenced by Key(), operator<(), operator=(), operator==(), and swap.

## Key() [2/3]

U_I18N_API icu::message2::data_model::Key::Key | ( |  | ) |

inline

Wildcard constructor; constructs a Key representing the catchall or wildcard key, '*'.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 381 of file messageformat2_data_model.h.

References U_I18N_API.

## Key() [3/3]

U_I18N_API icu::message2::data_model::Key::Key | ( | const Literal & | lit | ) |

inline explicit

Literal key constructor.

Parameters

  lit | A Literal to use for this key. The result matches the literal lit.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 391 of file messageformat2_data_model.h.

References U_I18N_API.

## ~Key()

virtual U_I18N_API icu::message2::data_model::Key::~Key | ( |  | ) |

virtual

Destructor.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References U_I18N_API.

## Member Function Documentation

## asLiteral()

U_I18N_API const Literal & icu::message2::data_model::Key::asLiteral | ( |  | ) | const

Returns the contents of this key as a literal.

Precondition: !isWildcard()

Returns
  The literal contents of the key

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References U_I18N_API.

## isWildcard()

U_I18N_API UBool icu::message2::data_model::Key::isWildcard | ( |  | ) | const

inline

Determines if this is a wildcard key.

Returns
  True if and only if this is the wildcard key

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 356 of file messageformat2_data_model.h.

References U_I18N_API.

## operator<()

U_I18N_API 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.

Parameters

  other | The Key to compare to this one.

Returns
  true if the two Keys are not wildcards and if this.asLiteral() < other.asLiteral(). Returns false otherwise.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References Key(), and U_I18N_API.

## operator=()

U_I18N_API Key & icu::message2::data_model::Key::operator= | ( | Key |  | ) |

noexcept

Assignment operator.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References Key(), and U_I18N_API.

## operator==()

U_I18N_API 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.

Parameters

  other | The Key to compare to this one.

Returns
  true if either both Keys are wildcards, or this.asLiteral() == other.asLiteral(). Returns false otherwise.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References Key(), and U_I18N_API.

## Friends And Related Symbol Documentation

## swap

U_I18N_API friend void swap | ( | Key & | k1,
|  | Key & | k2 )

friend

Non-member swap function.

Parameters

  k1 | will get k2's contents
  k2 | will get k1's contents

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 400 of file messageformat2_data_model.h.

References Key(), swap, and U_I18N_API.

Referenced by swap.

The documentation for this class was generated from the following file:

- i18n/unicode/messageformat2_data_model.h