ICU 78.3 78.3

Public Member Functions | Friends
icu::message2::data_model::Literal Class Reference

The `Literal` class corresponds to the `literal` nonterminal in the MessageFormat 2 grammar, https://github.com/unicode-org/message-format-wg/blob/main/spec/message.abnf and the `Literal` interface defined in // https://github.com/unicode-org/message-format-wg/blob/main/spec/data-model.md#expressions. More...

`#include <messageformat2_data_model.h>`

Inheritance diagram for icu::message2::data_model::Literal:

## Public Member Functions
UnicodeString | quoted () const
| Returns the quoted representation of this literal (enclosed in '|' characters) More...
const UnicodeString & | unquoted () const
| Returns the parsed string contents of this literal. More...
UBool | isQuoted () const
| Determines if this literal appeared as a quoted literal in the message. More...
| Literal (UBool q, const UnicodeString &s)
| Literal constructor. More...
| Literal (const Literal &other)
| Copy constructor. More...
Literal & | operator= (Literal) noexcept
| Assignment operator. More...
| Literal ()=default
| Default constructor. More...
bool | operator< (const Literal &other) const
| Less than operator. More...
bool | operator== (const Literal &other) const
| Equality operator. More...
virtual | ~Literal ()
| Destructor. More...
Public Member Functions inherited from icu::UObject
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 (Literal &l1, Literal &l2) noexcept
| Non-member swap function. More...

## Detailed Description

The `Literal` class corresponds to the `literal` nonterminal in the MessageFormat 2 grammar, https://github.com/unicode-org/message-format-wg/blob/main/spec/message.abnf and the `Literal` interface defined in // https://github.com/unicode-org/message-format-wg/blob/main/spec/data-model.md#expressions.

`Literal` 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 78 of file messageformat2_data_model.h.

## Constructor & Destructor Documentation

## ◆ Literal() [1/3]

icu::message2::data_model::Literal::Literal | ( | UBool | q,
|  | const UnicodeString & | s
| ) |  |
| inline

Literal constructor.

Parameters

  q | True if and only if this literal was parsed with the `quoted` nonterminal (appeared enclosed in '|' characters in the message text).
  s | The string contents of this literal; escape sequences are assumed to have been interpreted already.

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 119 of file messageformat2_data_model.h.

## ◆ Literal() [2/3]

icu::message2::data_model::Literal::Literal | ( | const Literal & | 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 126 of file messageformat2_data_model.h.

## ◆ Literal() [3/3]

icu::message2::data_model::Literal::Literal | ( |  | ) |
| default

Default constructor.

Puts the Literal into a valid but undefined state.

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

Deprecated:
  This API is for technology preview only.

## ◆ ~Literal()

virtual icu::message2::data_model::Literal::~Literal | ( |  | ) |
| 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.

## Member Function Documentation

## ◆ isQuoted()

UBool icu::message2::data_model::Literal::isQuoted | ( |  | ) | const
| inline

Determines if this literal appeared as a quoted literal in the message.

Returns
  true if and only if this literal appeared as a quoted literal in the message.

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 107 of file messageformat2_data_model.h.

## ◆ operator<()

bool icu::message2::data_model::Literal::operator< | ( | const Literal & | other | ) | const

Less than operator.

Compares `this.stringContents()` with `other.stringContents()`. 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 Literal to compare to this one.

Returns
  true if the parsed string corresponding to this `Literal` is less than the parsed string corresponding to the other `Literal` (according to `UnicodeString`'s less-than operator). 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.

## ◆ operator=()

Literal& icu::message2::data_model::Literal::operator= | ( | Literal |  | ) |
| 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.

## ◆ operator==()

bool icu::message2::data_model::Literal::operator== | ( | const Literal & | other | ) | const

Equality operator.

Compares `this.stringContents()` with `other.stringContents()`. 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 Literal to compare to this one.

Returns
  true if the parsed string corresponding to this `Literal` equals the parsed string corresponding to the other `Literal` (according to `UnicodeString`'s equality operator). 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.

## ◆ quoted()

UnicodeString icu::message2::data_model::Literal::quoted | ( |  | ) | const

Returns the quoted representation of this literal (enclosed in '|' characters)

Returns
  A string representation of the literal enclosed in quote characters.

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

Deprecated:
  This API is for technology preview only.

## ◆ unquoted()

const UnicodeString& icu::message2::data_model::Literal::unquoted | ( |  | ) | const

Returns the parsed string contents of this literal.

Returns
  A string representation of this literal.

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

Deprecated:
  This API is for technology preview only.

## Friends And Related Function Documentation

## ◆ swap

void swap | ( | Literal & | l1,
|  | Literal & | l2
| ) |  |
| friend

Non-member swap function.

Parameters

  l1 | will get l2's contents
  l2 | will get l1'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 135 of file messageformat2_data_model.h.

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

- i18n/unicode/messageformat2_data_model.h