|
ICU4C 79
|
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 & | adoptFunction (const data_model::FunctionName &functionName, Function *function, UErrorCode &errorCode) |
| Registers a function to a given name. | |
| Builder & | setDefaultFormatterNameByType (const UnicodeString &type, const data_model::FunctionName &functionName, UErrorCode &errorCode) |
| Registers a formatter factory to a given type tag. | |
| 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 89 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::adoptFunction | ( | const data_model::FunctionName & | functionName, |
| Function * | function, | ||
| UErrorCode & | errorCode ) |
Registers a function to a given name.
| functionName | Name of the formatter being registered. |
| function | A pointer to a Function object. This argument is adopted. Functions with the same name as standard functions will override the standard functions. |
| 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.
References icu::message2::MFFunctionRegistry::MFFunctionRegistry().
| 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 |