6#ifndef MESSAGEFORMAT2_H
7#define MESSAGEFORMAT2_H
9#if U_SHOW_CPLUSPLUS_API
11#if !UCONFIG_NO_FORMATTING
21#include "unicode/messageformat2_data_model.h"
22#include "unicode/messageformat2_function_registry.h"
25#ifndef U_HIDE_DEPRECATED_API
31 class CachedFormatters;
34 class ResolvedSelector;
155 bool hasPattern =
false;
156 bool hasDataModel =
false;
160 MFDataModel dataModel;
270 friend class Builder;
271 friend class MessageContext;
303 MessageContext& context,
309 MessageContext& context,
321 bool hasCustomMFFunctionRegistry()
const {
322 return (customMFFunctionRegistry !=
nullptr);
328 const MFFunctionRegistry& getCustomMFFunctionRegistry()
const;
330 bool isCustomFormatter(
const FunctionName&)
const;
331 FormatterFactory* lookupFormatterFactory(MessageContext&,
const FunctionName&,
UErrorCode&
status)
const;
332 bool isBuiltInSelector(
const FunctionName&)
const;
333 bool isBuiltInFormatter(
const FunctionName&)
const;
334 bool isCustomSelector(
const FunctionName&)
const;
335 const SelectorFactory* lookupSelectorFactory(MessageContext&,
const FunctionName&,
UErrorCode&)
const;
336 bool isSelector(
const FunctionName&
fn)
const {
return isBuiltInSelector(
fn) || isCustomSelector(
fn); }
337 bool isFormatter(
const FunctionName& fn)
const {
return isBuiltInFormatter(fn) || isCustomFormatter(fn); }
338 const Formatter* maybeCachedFormatter(MessageContext&,
const FunctionName&,
UErrorCode&)
const;
340 Selector* getSelector(MessageContext&,
const FunctionName&,
UErrorCode&)
const;
341 const Formatter& getFormatter(MessageContext&,
const FunctionName&,
UErrorCode&)
const;
342 bool getDefaultFormatterNameByType(
const UnicodeString&, FunctionName&)
const;
345 void checkDeclarations(MessageContext&, Environment*&,
UErrorCode&)
const;
346 void check(MessageContext&,
const Environment&,
const data_model::Expression&,
UErrorCode&)
const;
347 void check(MessageContext&,
const Environment&,
const data_model::Operand&,
UErrorCode&)
const;
348 void check(MessageContext&,
const Environment&,
const OptionMap&,
UErrorCode&)
const;
351 void clearErrors()
const;
352 void cleanup() noexcept;
358 MFFunctionRegistry standardMFFunctionRegistry;
369 const MFFunctionRegistry* customMFFunctionRegistry;
372 MFDataModel dataModel;
375 UnicodeString normalizedInput;
385 CachedFormatters* cachedFormatters;
392 StaticErrors* errors;
"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.
Defines mappings from names of formatters and selectors to functions implementing them.
The MessageArguments class represents the named arguments to a message.
The Expression class corresponds to the expression nonterminal in the MessageFormat 2 grammar and the...
The Literal class corresponds to the literal nonterminal in the MessageFormat 2 grammar,...
A UParseError struct is used to returned detailed information about parsing errors.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
@ U_UNSUPPORTED_ERROR
Requested operation not supported in current context.
#define U_SUCCESS(x)
Does the error code indicate success?
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.