ICU 75.1 75.1

Data Structures | Public Member Functions | Friends
icu::message2::MFFunctionRegistry Class Reference

Defines mappings from names of formatters and selectors to functions implementing them. More...

`#include <messageformat2_function_registry.h>`

Inheritance diagram for icu::message2::MFFunctionRegistry:

## Data Structures
class | Builder
| The mutable Builder class allows each formatter and selector factory to be initialized separately; calling its `build()` method yields an immutable MFFunctionRegistry object. More...

## Public Member Functions
FormatterFactory * | getFormatter (const FunctionName &formatterName) const
| Looks up a formatter factory by the name of the formatter. More...
const SelectorFactory * | getSelector (const FunctionName &selectorName) const
| Looks up a selector factory by the name of the selector. More...
UBool | getDefaultFormatterNameByType (const UnicodeString &formatterType, FunctionName &name) const
| Looks up a formatter factory by a type tag. More...
MFFunctionRegistry & | operator= (MFFunctionRegistry &&) noexcept
| Move assignment operator: The source MFFunctionRegistry will be left in a valid but undefined state. More...
| MFFunctionRegistry (MFFunctionRegistry &&other)
| Move constructor: The source MFFunctionRegistry will be left in a valid but undefined state. More...
virtual | ~MFFunctionRegistry ()
| Destructor. More...
Public Member Functions inherited from icu::UObject
virtual | ~UObject ()
| Destructor. More...
virtual UClassID | getDynamicClassID () const
| ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More...

## Friends
class | MessageContext
class | MessageFormatter

## Detailed Description

Defines mappings from names of formatters and selectors to functions implementing them.

The required set of formatter and selector functions is defined in the spec. Users can also define custom formatter and selector functions.

`MFFunctionRegistry` is immutable and movable. It is not copyable.

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

## Constructor & Destructor Documentation

## ◆ MFFunctionRegistry()

icu::message2::MFFunctionRegistry::MFFunctionRegistry | ( | MFFunctionRegistry && | other | ) |
| inline

Move constructor: The source MFFunctionRegistry will be left in a valid but undefined state.

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

## ◆ ~MFFunctionRegistry()

virtual icu::message2::MFFunctionRegistry::~MFFunctionRegistry | ( |  | ) |
| 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

## ◆ getDefaultFormatterNameByType()

UBool icu::message2::MFFunctionRegistry::getDefaultFormatterNameByType | ( | const UnicodeString & | formatterType,
|  | FunctionName & | name
| ) |  | const

Looks up a formatter factory by a type tag.

This method gets the name of the default formatter registered for that type. If no formatter was explicitly registered for this type, it returns false.

Parameters

  formatterType | Type tag for the desired `FormattableObject` type to be formatted.
  name | Output parameter; initialized to the name of the default formatter for `formatterType` if one has been registered. Its value is undefined otherwise.

Returns
  True if and only if the function registry contains a default formatter for `formatterType`. If the return value is false, then the value of `name` is undefined.

Internal:
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated:
  This API is for technology preview only.

## ◆ getFormatter()

FormatterFactory* icu::message2::MFFunctionRegistry::getFormatter | ( | const FunctionName & | formatterName | ) | const

Looks up a formatter factory by the name of the formatter.

The result is non-const, since formatter factories may have local state. Returns the result by pointer rather than by reference since it can fail.

Parameters

  formatterName | Name of the desired formatter.

Returns
  A pointer to the `FormatterFactory` registered under `formatterName`, or null if no formatter was registered under that name. The pointer is not owned by the caller.

Internal:
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated:
  This API is for technology preview only.

## ◆ getSelector()

const SelectorFactory* icu::message2::MFFunctionRegistry::getSelector | ( | const FunctionName & | selectorName | ) | const

Looks up a selector factory by the name of the selector.

(This returns the result by pointer rather than by reference since `FormatterFactory` is an abstract class.)

Parameters

  selectorName | Name of the desired selector.

Returns
  A pointer to the `SelectorFactory` registered under `selectorName`, or null if no formatter was registered under that name.

Internal:
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated:
  This API is for technology preview only.

## ◆ operator=()

MFFunctionRegistry& icu::message2::MFFunctionRegistry::operator= | ( | MFFunctionRegistry && |  | ) |
| noexcept

Move assignment operator: The source MFFunctionRegistry will be left in a valid but undefined state.

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:

- i18n/unicode/messageformat2_function_registry.h