ICU 75.1 75.1
Loading...
Searching...
No Matches
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:
icu::UObject icu::UMemory

Public Member Functions

UnicodeString quoted () const
 Returns the quoted representation of this literal (enclosed in '|' characters)
 
const UnicodeStringunquoted () const
 Returns the parsed string contents of this literal.
 
UBool isQuoted () const
 Determines if this literal appeared as a quoted literal in the message.
 
 Literal (UBool q, const UnicodeString &s)
 Literal constructor.
 
 Literal (const Literal &other)
 Copy constructor.
 
Literaloperator= (Literal) noexcept
 Assignment operator.
 
 Literal ()=default
 Default constructor.
 
bool operator< (const Literal &other) const
 Less than operator.
 
bool operator== (const Literal &other) const
 Equality operator.
 
virtual ~Literal ()
 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

class Reserved::Builder
 
void swap (Literal &l1, Literal &l2) noexcept
 Non-member swap function.
 

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.0 technology preview
Deprecated:
This API is for technology preview only.

Definition at line 241 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
qTrue if and only if this literal was parsed with the quoted nonterminal (appeared enclosed in '|' characters in the message text).
sThe 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.0 technology preview
Deprecated:
This API is for technology preview only.

Definition at line 282 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.0 technology preview
Deprecated:
This API is for technology preview only.

Definition at line 289 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.0 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.0 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.0 technology preview
Deprecated:
This API is for technology preview only.

Definition at line 270 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
otherThe 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.0 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.0 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
otherThe 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.0 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.0 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.0 technology preview
Deprecated:
This API is for technology preview only.

Friends And Related Symbol Documentation

◆ Reserved::Builder

Definition at line 360 of file messageformat2_data_model.h.

◆ swap

void swap ( Literal l1,
Literal l2 
)
friend

Non-member swap function.

Parameters
l1will get l2's contents
l2will get l1's contents
Internal:
Do not use. This API is for internal use only. ICU 75.0 technology preview
Deprecated:
This API is for technology preview only.

Definition at line 298 of file messageformat2_data_model.h.


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