ICU 78.2 78.2

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
U_I18N_API UBool | isStandaloneAnnotation () const
| Checks if this expression is an annotation with no operand. More...
U_I18N_API UBool | isFunctionCall () const
| Checks if this expression has a function annotation (with or without an operand). More...
U_I18N_API const Operator * | getOperator (UErrorCode &status) const
| Accesses the function annotating this expression. More...
U_I18N_API const Operand & | getOperand () const
| Accesses the operand of this expression. More...
U_I18N_API std::vector< Option > | getAttributes () const
| Gets the attributes of this expression. More...
U_I18N_API | Expression (const Expression &other)
| Copy constructor. More...
U_I18N_API Expression & | operator= (Expression) noexcept
| Assignment operator. More...
U_I18N_API | Expression ()
| Default constructor. More...
virtual U_I18N_API | ~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
U_I18N_API friend 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 1161 of file messageformat2_data_model.h.

## Constructor & Destructor Documentation

## ◆ Expression() [1/2]

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

U_I18N_API 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 U_I18N_API 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()

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

## ◆ getOperand()

U_I18N_API 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()

U_I18N_API 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()

U_I18N_API 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()

U_I18N_API 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=()

U_I18N_API 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

U_I18N_API friend 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 1317 of file messageformat2_data_model.h.

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

- i18n/unicode/messageformat2_data_model.h