ICU 77.1 77.1

Public Member Functions
icu::message2::Selector Class Referenceabstract

Interface that selector classes must implement. More...

`#include <messageformat2_function_registry.h>`

Inheritance diagram for icu::message2::Selector:

## Public Member Functions
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. More...
virtual | ~Selector ()
| 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...

## Detailed Description

Interface that selector classes must implement.

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

## Constructor & Destructor Documentation

## ◆ ~Selector()

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

## ◆ selectKey()

virtual void icu::message2::Selector::selectKey | ( | FormattedPlaceholder && | toFormat,
|  | FunctionOptions && | options,
|  | const UnicodeString * | keys,
|  | int32_t | keysLen,
|  | UnicodeString * | prefs,
|  | int32_t & | prefsLen,
|  | UErrorCode & | status
| ) |  | const
| pure virtual

Compares the input to an array of keys, and returns an array of matching keys sorted by preference.

Parameters

  toFormat | The unnamed function argument; passed by move.
  options | A reference to the named function options.
  keys | An array of strings that are compared to the input (`context.getFormattableInput()`) in an implementation-specific way.
  keysLen | The length of `keys`.
  prefs | An array of strings with length `keysLen`. The contents of the array is undefined. `selectKey()` should set the contents of `prefs` to a subset of `keys`, with the best match placed at the lowest index.
  prefsLen | A reference that `selectKey()` should set to the length of `prefs`, which must be less than or equal to `keysLen`.
  status | Input/output error code. Should not be set directly by the custom selector, which should use `FormattingContext::setSelectorError()` to signal errors. The custom selector may pass `status` to other ICU functions that can signal errors using this mechanism.

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