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

A Variant pairs a list of keys with a pattern It corresponds to the Variant interface defined in https://github.com/unicode-org/message-format-wg/tree/main/spec/data-model. More...

#include <messageformat2_data_model.h>

Inheritance diagram for icu::message2::data_model::Variant:
icu::UObject icu::UMemory

Public Member Functions

const PatterngetPattern () const
 Accesses the pattern of the variant.
 
const SelectorKeysgetKeys () const
 Accesses the keys of the variant.
 
 Variant (const SelectorKeys &keys, Pattern &&pattern)
 Constructor.
 
Variantoperator= (Variant other) noexcept
 Assignment operator.
 
 Variant ()=default
 Default constructor.
 
 Variant (const Variant &)
 Copy constructor.
 
virtual ~Variant ()
 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

void swap (Variant &v1, Variant &v2) noexcept
 Non-member swap function.
 

Detailed Description

A Variant pairs a list of keys with a pattern It corresponds to the Variant interface defined in https://github.com/unicode-org/message-format-wg/tree/main/spec/data-model.

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

Constructor & Destructor Documentation

◆ Variant() [1/3]

icu::message2::data_model::Variant::Variant ( const SelectorKeys & keys,
Pattern && pattern )
inline

Constructor.

Returns a variant that formats to pattern when keys match the selector expressions in the enclosing match construct.

Parameters
keysA reference to a SelectorKeys.
patternA pattern (passed by move)
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 1973 of file messageformat2_data_model.h.

◆ Variant() [2/3]

icu::message2::data_model::Variant::Variant ( )
default

Default constructor.

Returns a Variant in 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.

◆ Variant() [3/3]

icu::message2::data_model::Variant::Variant ( const Variant & )

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.

◆ ~Variant()

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

◆ getKeys()

const SelectorKeys & icu::message2::data_model::Variant::getKeys ( ) const
inline

Accesses the keys of the variant.

Returns
A reference to the keys.
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 1961 of file messageformat2_data_model.h.

◆ getPattern()

const Pattern & icu::message2::data_model::Variant::getPattern ( ) const
inline

Accesses the pattern of the variant.

Returns
A reference to the pattern.
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 1952 of file messageformat2_data_model.h.

◆ operator=()

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

◆ swap

void swap ( Variant & v1,
Variant & v2 )
friend

Non-member swap function.

Parameters
v1will get v2's contents
v2will get v1'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 1982 of file messageformat2_data_model.h.


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