ICU 76.1 76.1
|
The mutable MFDataModel::Builder
class allows the data model to be constructed incrementally.
More...
#include <messageformat2_data_model.h>
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 (Expression &&selector, UErrorCode &errorCode) noexcept |
Adds a selector expression. | |
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 |
The mutable MFDataModel::Builder
class allows the data model to be constructed incrementally.
Builder is not copyable or movable.
Definition at line 2437 of file messageformat2_data_model.h.
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.
status | Input/output error code. |
|
virtual |
Destructor.
Builder & icu::message2::MFDataModel::Builder::addBinding | ( | Binding && | b, |
UErrorCode & | status | ||
) |
Adds a binding, There must not already be a binding with the same name.
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 . |
|
noexcept |
Adds a selector expression.
Copies expression
. If a pattern was previously set, clears the pattern.
selector | Expression to add as a selector. Passed by move. |
errorCode | Input/output error code |
|
noexcept |
Adds a single variant.
If a pattern was previously set using setPattern()
, clears the pattern.
keys | Keys for the variant. Passed by move. |
pattern | Pattern for the variant. Passed by move. |
errorCode | Input/output error code |
|
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()
.
status | Input/output error code. |
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.
pattern | Pattern to represent the body of the message. Passed by move. |
Definition at line 2439 of file messageformat2_data_model.h.