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

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.
U_I18N_API UBool isFunctionCall () const
 Checks if this expression has a function annotation (with or without an operand).
U_I18N_API const OperatorgetOperator (UErrorCode &status) const
 Accesses the function annotating this expression.
U_I18N_API const OperandgetOperand () const
 Accesses the operand of this expression.
U_I18N_API std::vector< OptiongetAttributes () const
 Gets the attributes of this expression.
U_I18N_API Expression (const Expression &other)
 Copy constructor.
U_I18N_API Expressionoperator= (Expression) noexcept
 Assignment operator.
U_I18N_API Expression ()
 Default constructor.
virtual U_I18N_API ~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
U_I18N_API friend 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 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.

References Expression(), and U_I18N_API.

Referenced by Expression(), operator=(), swap, and ~Expression().

◆ 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.

References U_I18N_API.

◆ ~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.

References Expression(), and U_I18N_API.

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.

References U_I18N_API.

◆ 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.

References U_I18N_API.

◆ 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
statusInput/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.

References U_I18N_API.

◆ 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.

References U_I18N_API.

◆ 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.

References U_I18N_API.

◆ 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.

References Expression(), and U_I18N_API.

◆ message2::Serializer

friend class message2::Serializer
friend

Definition at line 1354 of file messageformat2_data_model.h.

◆ swap

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

Non-member swap function.

Parameters
e1will get e2's contents
e2will 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.

References Expression(), swap, and U_I18N_API.

Referenced by swap.


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