6#ifndef MESSAGEFORMAT2_FUNCTION_REGISTRY_H
7#define MESSAGEFORMAT2_FUNCTION_REGISTRY_H
9#if U_SHOW_CPLUSPLUS_API
11#if !UCONFIG_NO_FORMATTING
15#include "unicode/messageformat2_data_model_names.h"
16#include "unicode/messageformat2_formattable.h"
18#ifndef U_HIDE_DEPRECATED_API
29 using namespace data_model;
177 FormatterMap* formatters;
178 SelectorMap* selectors;
301 friend class MessageContext;
314 void checkFormatter(
const char*)
const;
315 void checkSelector(
const char*)
const;
316 void checkStandard()
const;
323 FormatterMap* formatters =
nullptr;
324 SelectorMap* selectors =
nullptr;
"Smart pointer" base class; do not use directly: use LocalPointer etc.
A Locale object represents a specific geographical, political, or cultural region.
UObject is the common ICU "boilerplate" class.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Structure encapsulating named options passed to a custom selector or formatter.
The mutable Builder class allows each formatter and selector factory to be initialized separately; ca...
Builder(UErrorCode &errorCode)
Default constructor.
MFFunctionRegistry build()
Creates an immutable MFFunctionRegistry object with the selectors and formatters that were previously...
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.
virtual ~Builder()
Destructor.
Builder & adoptSelector(const data_model::FunctionName &selectorName, SelectorFactory *selectorFactory, UErrorCode &errorCode)
Registers a selector factory to a given selector name.
Defines mappings from names of formatters and selectors to functions implementing them.
virtual ~MFFunctionRegistry()
Destructor.
const SelectorFactory * getSelector(const FunctionName &selectorName) const
Looks up a selector factory by the name of the selector.
MFFunctionRegistry & operator=(MFFunctionRegistry &&) noexcept
Move assignment operator: The source MFFunctionRegistry will be left in a valid but undefined state.
UBool getDefaultFormatterNameByType(const UnicodeString &formatterType, FunctionName &name) const
Looks up a formatter factory by a type tag.
FormatterFactory * getFormatter(const FunctionName &formatterName) const
Looks up a formatter factory by the name of the formatter.
Interface that factory classes for creating selectors must implement.
virtual Selector * createSelector(const Locale &locale, UErrorCode &status) const =0
Constructs a new selector object.
virtual ~SelectorFactory()
Destructor.
SelectorFactory & operator=(const SelectorFactory &)=delete
Copy constructor.
Interface that selector classes must implement.
virtual void selectKey(FormattedPlaceholder &&toFormat, FunctionOptions &&options, const UnicodeString *keys, int32_t keysLen, UnicodeString *prefs, int32_t &prefsLen, UErrorCode &status) const =0
Compares the input to an array of keys, and returns an array of matching keys sorted by preference.
virtual ~Selector()
Destructor.
int8_t UBool
The ICU boolean type, a signed-byte integer.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.