ICU 78.2 78.2

Public Member Functions | Friends
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:

## Public Member Functions
const Pattern & | getPattern () const
| Accesses the pattern of the variant. More...
const SelectorKeys & | getKeys () const
| Accesses the keys of the variant. More...
| Variant (const SelectorKeys &keys, Pattern &&pattern)
| Constructor. More...
Variant & | operator= (Variant other) noexcept
| Assignment operator. More...
| Variant ()=default
| Default constructor. More...
| Variant (const Variant &)
| Copy constructor. More...
virtual | ~Variant ()
| 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
void | swap (Variant &v1, Variant &v2) noexcept
| Non-member swap function. More...

## 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 1807 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

  keys | A reference to a `SelectorKeys`.
  pattern | A 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 1838 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 1826 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 1817 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 Function Documentation

## ◆ swap

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

Non-member swap function.

Parameters

  v1 | will get v2's contents
  v2 | will 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 1847 of file messageformat2_data_model.h.

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

- i18n/unicode/messageformat2_data_model.h