ICU 76.1: icu::message2::data_model::Expression Class Reference

ICU 76.1 76.1

Data Structures | Public Member Functions | Friends
icu::message2::data_model::Expression Class Reference

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

`#include <messageformat2_data_model.h>`

Inheritance diagram for icu::message2::data_model::Expression:

## Data Structures
class | Builder
| The mutable `Expression::Builder` class allows the operator to be constructed incrementally. More...

## Public Member Functions
UBool | isStandaloneAnnotation () const
| Checks if this expression is an annotation with no operand.
UBool | isFunctionCall () const
| Checks if this expression has a function annotation (with or without an operand).
const Operator * | getOperator (UErrorCode &status) const
| Accesses the function annotating this expression.
const Operand & | getOperand () const
| Accesses the operand of this expression.
std::vector< Option > | getAttributes () const
| Gets the attributes of this expression.
| Expression (const Expression &other)
| Copy constructor.
Expression & | operator= (Expression) noexcept
| Assignment operator.
| Expression ()
| Default constructor.
virtual | ~Expression ()
| 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 | message2::Serializer
void | swap (Expression &e1, Expression &e2) noexcept
| Non-member swap function.

## Detailed Description

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

It represents either an operand with no annotation; an annotation with no operand; or an operand annotated with an annotation.

`Expression` 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 1265 of file messageformat2_data_model.h.

## Constructor & Destructor Documentation

## ◆ Expression() [1/2]

icu::message2::data_model::Expression::Expression | ( | const Expression & | other | ) |

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.

## ◆ Expression() [2/2]

icu::message2::data_model::Expression::Expression | ( |  | ) |

Default constructor.

Puts the Expression 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.

## ◆ ~Expression()

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

## ◆ getAttributes()

std::vector< Option > icu::message2::data_model::Expression::getAttributes | ( |  | ) | const
| inline

Gets the attributes of this expression.

Returns
  A vector of attributes

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

## ◆ getOperand()

const Operand & icu::message2::data_model::Expression::getOperand | ( |  | ) | const

Accesses the operand of this expression.

Returns
  A reference to the operand of this expression, which may be the null operand.

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

Deprecated
  This API is for technology preview only.

## ◆ getOperator()

const Operator * icu::message2::data_model::Expression::getOperator | ( | UErrorCode & | status | ) | const

Accesses the function annotating this expression.

If !(isFunctionCall()), sets `status` to U_INVALID_STATE_ERROR.

Parameters

  status | Input/output error code.

Returns
  A non-owned pointer to the operator of this expression, which does not outlive the expression.

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

Deprecated
  This API is for technology preview only.

## ◆ isFunctionCall()

UBool icu::message2::data_model::Expression::isFunctionCall | ( |  | ) | const

Checks if this expression has a function annotation (with or without an operand).

Returns
  True if and only if the expression has an annotation that is a function.

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

Deprecated
  This API is for technology preview only.

## ◆ isStandaloneAnnotation()

UBool icu::message2::data_model::Expression::isStandaloneAnnotation | ( |  | ) | const

Checks if this expression is an annotation with no operand.

Returns
  True if and only if the expression has an annotation and has no operand.

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

Deprecated
  This API is for technology preview only.

## ◆ operator=()

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

## Friends And Related Symbol Documentation

## ◆ message2::Serializer

friend class message2::Serializer
| friend

Definition at line 1458 of file messageformat2_data_model.h.

## ◆ swap

void swap | ( | Expression & | e1,
|  | Expression & | e2 )
| friend

Non-member swap function.

Parameters

  e1 | will get e2's contents
  e2 | will get e1'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 1421 of file messageformat2_data_model.h.

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

- i18n/unicode/messageformat2_data_model.h