ICU 76.1 76.1
|
The mutable Builder class allows each formatter and selector factory to be initialized separately; calling its build()
method yields an immutable MFFunctionRegistry object.
More...
#include <messageformat2_function_registry.h>
Public Member Functions | |
Builder & | adoptFormatter (const data_model::FunctionName &formatterName, FormatterFactory *formatterFactory, UErrorCode &errorCode) |
Registers a formatter factory to a given formatter name. | |
Builder & | setDefaultFormatterNameByType (const UnicodeString &type, const data_model::FunctionName &functionName, UErrorCode &errorCode) |
Registers a formatter factory to a given type tag. | |
Builder & | adoptSelector (const data_model::FunctionName &selectorName, SelectorFactory *selectorFactory, UErrorCode &errorCode) |
Registers a selector factory to a given selector name. | |
MFFunctionRegistry | build () |
Creates an immutable MFFunctionRegistry object with the selectors and formatters that were previously registered. | |
Builder (UErrorCode &errorCode) | |
Default constructor. | |
virtual | ~Builder () |
Destructor. | |
Public Member Functions inherited from icu::UObject | |
virtual | ~UObject () |
Destructor. | |
virtual UClassID | getDynamicClassID () const |
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. | |
The mutable Builder class allows each formatter and selector factory to be initialized separately; calling its build()
method yields an immutable MFFunctionRegistry object.
Builder is not copyable or movable.
Definition at line 174 of file messageformat2_function_registry.h.
icu::message2::MFFunctionRegistry::Builder::Builder | ( | UErrorCode & | errorCode | ) |
Default constructor.
Returns a Builder with no functions registered.
errorCode | Input/output error code |
|
virtual |
Destructor.
Builder & icu::message2::MFFunctionRegistry::Builder::adoptFormatter | ( | const data_model::FunctionName & | formatterName, |
FormatterFactory * | formatterFactory, | ||
UErrorCode & | errorCode | ||
) |
Registers a formatter factory to a given formatter name.
formatterName | Name of the formatter being registered. |
formatterFactory | A pointer to a FormatterFactory object to use for creating formatterName formatters. This argument is adopted. |
errorCode | Input/output error code |
Builder & icu::message2::MFFunctionRegistry::Builder::adoptSelector | ( | const data_model::FunctionName & | selectorName, |
SelectorFactory * | selectorFactory, | ||
UErrorCode & | errorCode | ||
) |
Registers a selector factory to a given selector name.
Adopts selectorFactory
.
selectorName | Name of the selector being registered. |
selectorFactory | A SelectorFactory object to use for creating selectorName selectors. |
errorCode | Input/output error code |
MFFunctionRegistry icu::message2::MFFunctionRegistry::Builder::build | ( | ) |
Creates an immutable MFFunctionRegistry
object with the selectors and formatters that were previously registered.
The builder cannot be used after this call. The build()
method is destructive to avoid the need for a deep copy of the FormatterFactory
and SelectorFactory
objects (this would be necessary because FormatterFactory
can have mutable state), which in turn would require implementors of those interfaces to implement a clone()
method.
Builder & icu::message2::MFFunctionRegistry::Builder::setDefaultFormatterNameByType | ( | const UnicodeString & | type, |
const data_model::FunctionName & | functionName, | ||
UErrorCode & | errorCode | ||
) |
Registers a formatter factory to a given type tag.
(See FormattableObject
for details on type tags.)
type | Tag for objects to be formatted with this formatter. |
functionName | A reference to the name of the function to use for creating formatters for formatterType objects. |
errorCode | Input/output error code |