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
33 class ResolvedSelector;
156 U_MF_BEST_EFFORT = 0,
165 } UMFErrorHandlingBehavior;
179 bool hasPattern =
false;
180 bool hasDataModel =
false;
184 MFDataModel dataModel;
195 bool signalErrors =
false;
327 friend class Builder;
328 friend class MessageContext;
360 MessageContext& context,
366 MessageContext& context,
378 bool hasCustomMFFunctionRegistry()
const {
379 return (customMFFunctionRegistry !=
nullptr);
385 const MFFunctionRegistry& getCustomMFFunctionRegistry()
const;
387 bool isCustomFormatter(
const FunctionName&)
const;
388 FormatterFactory* lookupFormatterFactory(
const FunctionName&,
UErrorCode&
status)
const;
389 bool isBuiltInSelector(
const FunctionName&)
const;
390 bool isBuiltInFormatter(
const FunctionName&)
const;
391 bool isCustomSelector(
const FunctionName&)
const;
392 const SelectorFactory* lookupSelectorFactory(MessageContext&,
const FunctionName&,
UErrorCode&)
const;
393 bool isSelector(
const FunctionName&
fn)
const {
return isBuiltInSelector(
fn) || isCustomSelector(
fn); }
394 bool isFormatter(
const FunctionName& fn)
const {
return isBuiltInFormatter(fn) || isCustomFormatter(fn); }
395 const Formatter* lookupFormatter(
const FunctionName&,
UErrorCode&)
const;
397 Selector* getSelector(MessageContext&,
const FunctionName&,
UErrorCode&)
const;
398 Formatter* getFormatter(
const FunctionName&,
UErrorCode&)
const;
399 bool getDefaultFormatterNameByType(
const UnicodeString&, FunctionName&)
const;
402 void checkDeclarations(MessageContext&, Environment*&,
UErrorCode&)
const;
403 void check(MessageContext&,
const Environment&,
const data_model::Expression&,
UErrorCode&)
const;
404 void check(MessageContext&,
const Environment&,
const data_model::Operand&,
UErrorCode&)
const;
405 void check(MessageContext&,
const Environment&,
const OptionMap&,
UErrorCode&)
const;
408 void clearErrors()
const;
409 void cleanup() noexcept;
415 MFFunctionRegistry standardMFFunctionRegistry;
426 const MFFunctionRegistry* customMFFunctionRegistry;
429 MFDataModel dataModel;
432 UnicodeString normalizedInput;
439 StaticErrors* errors =
nullptr;
447 bool signalErrors = false;
"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.