The mutable MFDataModel::Builder
class allows the data model to be constructed incrementally.
More...
#include <messageformat2_data_model.h>
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.0 technology preview
- Deprecated:
- This API is for technology preview only.
Definition at line 2913 of file messageformat2_data_model.h.
◆ 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
-
status | Input/output error code. |
- Internal:
- Do not use. This API is for internal use only. ICU 75.0 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.0 technology preview
- Deprecated:
- This API is for technology preview only.
◆ 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
-
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.0 technology preview
- Deprecated:
- This API is for technology preview only.
◆ addSelector()
Adds a selector expression.
Copies expression
. If a pattern was previously set, clears the pattern.
- Parameters
-
selector | Expression 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.0 technology preview
- Deprecated:
- This API is for technology preview only.
◆ addUnsupportedStatement()
Adds an unsupported statement.
- Parameters
-
s | The statement. Passed by move. |
status | Input/output error code. |
- Internal:
- Do not use. This API is for internal use only. ICU 75.0 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
-
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.0 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
-
status | Input/output error code. |
- Returns
- The new MFDataModel
- Internal:
- Do not use. This API is for internal use only. ICU 75.0 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
-
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.0 technology preview
- Deprecated:
- This API is for technology preview only.
◆ MFDataModel
The documentation for this class was generated from the following file: