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. More...
UBool | isFunctionCall () const
| Checks if this expression has a function annotation (with or without an operand). More...
UBool | isReserved () const
| Returns true if and only if this expression is annotated with a reserved sequence. More...
const Operator * | getOperator (UErrorCode &status) const
| Accesses the function or reserved sequence annotating this expression. More...
const Operand & | getOperand () const
| Accesses the operand of this expression. More...
std::vector< Option > | getAttributes () const
| Gets the attributes of this expression. More...
| Expression (const Expression &other)
| Copy constructor. More...
Expression & | operator= (Expression) noexcept
| Assignment operator. More...
| Expression ()
| Default constructor. More...
virtual | ~Expression ()
| 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

class | message2::Serializer
void | swap (Expression &e1, Expression &e2) noexcept
| Non-member swap function. More...

## 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 1508 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 1576 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 or reserved sequence annotating this expression.

If !(isFunctionCall() || isReserved()), 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).

A reserved sequence is not a function annotation.

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.

## isReserved()

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

Returns true if and only if this expression is annotated with a reserved sequence.

Returns
  True if and only if the expression has an annotation that is a reserved sequence,

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 Function Documentation

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

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

- i18n/unicode/messageformat2_data_model.h