Loading...
Searching...
No Matches
icu::message2::data_model::MFDataModel::Builder Class Reference

The mutable MFDataModel::Builder class allows the data model to be constructed incrementally. More...

`#include <messageformat2_data_model.h>`

Inheritance diagram for icu::message2::data_model::MFDataModel::Builder:

## Public Member Functions

Builder & | addBinding (Binding &&b, UErrorCode &status)
| Adds a binding, There must not already be a binding with the same name.
Builder & | addSelector (VariableName &&selector, UErrorCode &errorCode)
| Adds a selector variable.
Builder & | addVariant (SelectorKeys &&keys, Pattern &&pattern, UErrorCode &errorCode) noexcept
| Adds a single variant.
Builder & | setPattern (Pattern &&pattern)
| Sets the body of the message as a pattern.
MFDataModel | build (UErrorCode &status) const noexcept
| Constructs a new immutable data model.
| Builder (UErrorCode &status)
| Default constructor.
virtual | ~Builder ()
| Destructor.
| Builder (const Builder &)=delete
Builder & | operator= (const Builder &)=delete
| Builder (Builder &&)=delete
Builder & | operator= (Builder &&)=delete

## Friends

class | MFDataModel

## Detailed Description

The mutable MFDataModel::Builder class allows the data model to be constructed incrementally.

Builder is not copyable or 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 2258 of file messageformat2_data_model.h.

## Constructor & Destructor Documentation

## Builder()

icu::message2::data_model::MFDataModel::Builder::Builder | ( | UErrorCode & | status | ) |

Default constructor.

Returns a Builder with no pattern or selectors set. Either setPattern() or both addSelector() and addVariant() must be called before calling build() on the resulting builder.

Parameters

  status | Input/output error code.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Referenced by addBinding(), addSelector(), addVariant(), setPattern(), and ~Builder().

## ~Builder()

virtual icu::message2::data_model::MFDataModel::Builder::~Builder | ( |  | ) |

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 Builder().

## Member Function Documentation

## addBinding()

Builder & icu::message2::data_model::MFDataModel::Builder::addBinding | ( | Binding && | b,
|  | UErrorCode & | status )

Adds a binding, There must not already be a binding with the same name.

Parameters

  b | The binding. Passed by move.
  status | Input/output error code. Set to U_DUPLICATE_DECLARATION_ERROR if addBinding() was previously called with a binding with the same variable name as b.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References Builder().

## addSelector()

Builder & icu::message2::data_model::MFDataModel::Builder::addSelector | ( | VariableName && | selector,
|  | UErrorCode & | errorCode )

Adds a selector variable.

If a pattern was previously set, clears the pattern.

Parameters

  selector | Variable to add as a selector. Passed by move.
  errorCode | Input/output error code

Returns
  A reference to the builder.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References Builder().

## addVariant()

Builder & icu::message2::data_model::MFDataModel::Builder::addVariant | ( | SelectorKeys && | keys,
|  | Pattern && | pattern,
|  | UErrorCode & | errorCode )

noexcept

Adds a single variant.

If a pattern was previously set using setPattern(), clears the pattern.

Parameters

  keys | Keys for the variant. Passed by move.
  pattern | Pattern for the variant. Passed by move.
  errorCode | Input/output error code

Returns
  A reference to the builder.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References Builder().

## build()

MFDataModel icu::message2::data_model::MFDataModel::Builder::build | ( | UErrorCode & | status | ) | const

noexcept

Constructs a new immutable data model.

If setPattern() has not been called and if addSelector() and addVariant() were not each called at least once, status is set to U_INVALID_STATE_ERROR. If addSelector() was called and addVariant() was never called, or vice versa, then status is set to U_INVALID_STATE_ERROR. Otherwise, either a Pattern or Selectors message is constructed based on the pattern that was previously set, or selectors and variants that were previously set.

The builder object (this) can still be used after calling build().

Parameters

  status | Input/output error code.

Returns
  The new MFDataModel

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## setPattern()

Builder & icu::message2::data_model::MFDataModel::Builder::setPattern | ( | Pattern && | pattern | ) |

Sets the body of the message as a pattern.

If selectors and/or variants were previously set, clears them.

Parameters

  pattern | Pattern to represent the body of the message. Passed by move.

Returns
  A reference to the builder.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

References Builder().

## Friends And Related Symbol Documentation

## MFDataModel

friend class MFDataModel

friend

Definition at line 2260 of file messageformat2_data_model.h.

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

- i18n/unicode/messageformat2_data_model.h