6#ifndef MESSAGEFORMAT2_H
7#define MESSAGEFORMAT2_H
9#if U_SHOW_CPLUSPLUS_API
11#if !UCONFIG_NO_NORMALIZATION
13#if !UCONFIG_NO_FORMATTING
23#include "unicode/messageformat2_data_model.h"
24#include "unicode/messageformat2_function_registry.h"
28#ifndef U_HIDE_DEPRECATED_API
174 } UMFErrorHandlingBehavior;
216 friend class MessageFormatter;
220 bool hasPattern =
false;
221 bool hasDataModel =
false;
231 StaticErrors* errors;
236 bool signalErrors =
false;
432 friend class Builder;
433 friend class Checker;
435 friend class MessageContext;
447 void resolveSelectors(MessageContext&, Environment& env,
UErrorCode&, UVector&)
const;
449 void filterVariants(
const UVector&, UVector&,
UErrorCode&)
const;
451 void sortVariants(
const UVector&, UVector&,
UErrorCode&)
const;
453 void matchSelectorKeys(
const UVector&, MessageContext&, InternalValue&& rv, UVector&,
UErrorCode&)
const;
456 void resolvePreferences(MessageContext&, UVector&, UVector&,
UErrorCode&)
const;
465 [[nodiscard]] InternalValue& apply(Environment&,
const FunctionName&, InternalValue&,
FunctionOptions&&,
471 void validateUOptionsOnMarkup(MessageContext&, Environment&,
const Markup&,
UErrorCode&)
const;
472 [[nodiscard]] InternalValue& evalVariableReference(
const UnicodeString&, Environment&,
const data_model::VariableName&, MessageContext&,
UErrorCode&)
const;
473 [[nodiscard]] InternalValue evalArgument(
const UnicodeString&,
const data_model::VariableName&, MessageContext&,
UErrorCode&)
const;
474 void formatSelectors(MessageContext& context, Environment& env,
UErrorCode &status,
UnicodeString& result)
const;
477 bool hasCustomMFFunctionRegistry()
const {
478 return (customMFFunctionRegistry !=
nullptr);
484 const MFFunctionRegistry& getCustomMFFunctionRegistry()
const;
486 bool isCustomFunction(
const FunctionName&)
const;
487 bool isBuiltInFunction(
const FunctionName&)
const;
488 bool isFunction(
const FunctionName& fn)
const {
return isBuiltInFunction(fn) || isCustomFunction(fn); }
489 void setNotSelectableError(MessageContext&,
const InternalValue&,
UErrorCode&)
const;
490 const Function* lookupFunction(
const FunctionName&,
UErrorCode&)
const;
491 bool getDefaultFormatterNameByType(
const UnicodeString&, FunctionName&)
const;
494 void checkDeclarations(MessageContext&, Environment*&,
UErrorCode&)
const;
495 void check(MessageContext&,
const Environment&,
const data_model::Expression&,
UErrorCode&)
const;
496 void check(MessageContext&,
const Environment&,
const data_model::Operand&,
UErrorCode&)
const;
497 void check(MessageContext&,
const Environment&,
const OptionMap&,
UErrorCode&)
const;
500 void clearErrors()
const;
501 void cleanup() noexcept;
507 const MFFunctionRegistry *standardMFFunctionRegistry;
518 const MFFunctionRegistry* customMFFunctionRegistry;
521 MFDataModel dataModel;
524 UnicodeString normalizedInput;
531 StaticErrors* errors =
nullptr;
539 bool signalErrors = false;
542 UMFBidiIsolationStrategy bidiIsolationStrategy = U_MF_BIDI_DEFAULT;
546 UMFDirectionality msgdir = U_MF_DIRECTIONALITY_DEFAULT;
549 UMFBidiIsolationStyle bidiIsolationStyle = U_MF_BIDI_STYLE_DEFAULT;
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...
Class implementing data from contextual options.
Structure encapsulating named options passed to a custom selector or formatter.
Type representing argument and return values for custom functions.
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,...
The MFDataModel class describes a parsed representation of the text of a message.
The Markup class corresponds to the markup nonterminal in the MessageFormat 2 grammar and the markup ...
The Operand class corresponds to the operand nonterminal in the MessageFormat 2 grammar,...
A Pattern is a sequence of formattable parts.
UMFBidiIsolationStrategy
Used in conjunction with the MessageFormatter::Builder::setBidiIsolationStrategy() method.
UMFBidiIsolationStyle
Used in conjunction with the MessageFormatter::Builder::setBidiIsolationStyle() method.
UMFBidiOption
Used to denote the directionality of the input to a function.
UMFDirectionality
Used to represent the directionality of a message, where the AUTO setting has been resolved based on ...
C++ API: New API for Unicode Normalization.
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_CLASS
Set to export library symbols from inside the i18n library, and to import them from outside,...
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.