ICU 75.1 75.1
Loading...
Searching...
No Matches
Public Member Functions | Friends
icu::message2::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::MFDataModel::Builder:
icu::UMemory

Public Member Functions

BuilderaddBinding (Binding &&b, UErrorCode &status)
 Adds a binding, There must not already be a binding with the same name.
 
BuilderaddUnsupportedStatement (UnsupportedStatement &&s, UErrorCode &status)
 Adds an unsupported statement.
 
BuilderaddSelector (Expression &&selector, UErrorCode &errorCode) noexcept
 Adds a selector expression.
 
BuilderaddVariant (SelectorKeys &&keys, Pattern &&pattern, UErrorCode &errorCode) noexcept
 Adds a single variant.
 
BuildersetPattern (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
 
Builderoperator= (const Builder &)=delete
 
 Builder (Builder &&)=delete
 
Builderoperator= (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 2908 of file messageformat2_data_model.h.

Constructor & Destructor Documentation

◆ Builder()

icu::message2::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
statusInput/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.

◆ ~Builder()

virtual icu::message2::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.

Member Function Documentation

◆ addBinding()

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

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

Parameters
bThe binding. Passed by move.
statusInput/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.

◆ addSelector()

Builder & icu::message2::MFDataModel::Builder::addSelector ( Expression &&  selector,
UErrorCode errorCode 
)
noexcept

Adds a selector expression.

Copies expression. If a pattern was previously set, clears the pattern.

Parameters
selectorExpression to add as a selector. Passed by move.
errorCodeInput/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.

◆ addUnsupportedStatement()

Builder & icu::message2::MFDataModel::Builder::addUnsupportedStatement ( UnsupportedStatement &&  s,
UErrorCode status 
)

Adds an unsupported statement.

Parameters
sThe statement. Passed by move.
statusInput/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.

◆ addVariant()

Builder & icu::message2::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
keysKeys for the variant. Passed by move.
patternPattern for the variant. Passed by move.
errorCodeInput/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.

◆ build()

MFDataModel icu::message2::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
statusInput/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::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
patternPattern 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.

Friends And Related Symbol Documentation

◆ MFDataModel

friend class MFDataModel
friend

Definition at line 2910 of file messageformat2_data_model.h.


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