ICU 76.1 76.1
Loading...
Searching...
No Matches
Public Member Functions
icu::message2::MFFunctionRegistry::Builder Class Reference

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>

Inheritance diagram for icu::message2::MFFunctionRegistry::Builder:
icu::UObject icu::UMemory

Public Member Functions

BuilderadoptFormatter (const data_model::FunctionName &formatterName, FormatterFactory *formatterFactory, UErrorCode &errorCode)
 Registers a formatter factory to a given formatter name.
 
BuildersetDefaultFormatterNameByType (const UnicodeString &type, const data_model::FunctionName &functionName, UErrorCode &errorCode)
 Registers a formatter factory to a given type tag.
 
BuilderadoptSelector (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.
 

Detailed Description

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.

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 174 of file messageformat2_function_registry.h.

Constructor & Destructor Documentation

◆ Builder()

icu::message2::MFFunctionRegistry::Builder::Builder ( UErrorCode errorCode)

Default constructor.

Returns a Builder with no functions registered.

Parameters
errorCodeInput/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::MFFunctionRegistry::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

◆ adoptFormatter()

Builder & icu::message2::MFFunctionRegistry::Builder::adoptFormatter ( const data_model::FunctionName formatterName,
FormatterFactory formatterFactory,
UErrorCode errorCode 
)

Registers a formatter factory to a given formatter name.

Parameters
formatterNameName of the formatter being registered.
formatterFactoryA pointer to a FormatterFactory object to use for creating formatterName formatters. This argument is adopted.
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.

◆ adoptSelector()

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.

Parameters
selectorNameName of the selector being registered.
selectorFactoryA SelectorFactory object to use for creating selectorName selectors.
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()

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.

Returns
The new MFFunctionRegistry
Internal:
Do not use. This API is for internal use only. ICU 75 technology preview
Deprecated:
This API is for technology preview only.

◆ setDefaultFormatterNameByType()

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.)

Parameters
typeTag for objects to be formatted with this formatter.
functionNameA reference to the name of the function to use for creating formatters for formatterType objects.
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.

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