6 #ifndef MESSAGEFORMAT_DATA_MODEL_H
7 #define MESSAGEFORMAT_DATA_MODEL_H
9 #if U_SHOW_CPLUSPLUS_API
11 #if !UCONFIG_NO_FORMATTING
16 #include "unicode/messageformat2_data_model_names.h"
18 #ifndef U_HIDE_DEPRECATED_API
37 static inline std::vector<T> toStdVector(
const T* arr, int32_t len) {
38 std::vector<T> result;
39 for (int32_t i = 0; i < len; i++) {
40 result.push_back(arr[i]);
45 #if defined(U_REAL_MSVC)
49 #pragma warning(disable: 4251)
55 class MessageFormatter;
60 namespace data_model {
170 swap(r1.bogus, r2.bogus);
171 swap(r1.parts, r2.parts);
172 swap(r1.len, r2.len);
281 Literal(
const Literal& other) : thisIsQuoted(other.thisIsQuoted), contents(other.contents) {}
293 swap(l1.thisIsQuoted, l2.thisIsQuoted);
294 swap(l1.contents, l2.contents);
354 bool thisIsQuoted =
false;
366 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
370 #if defined(U_REAL_MSVC)
383 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
384 #if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION)
385 struct U_I18N_API std::_Nontrivial_dummy_type;
386 template class U_I18N_API std::_Variant_storage_<false, icu::UnicodeString, icu::message2::data_model::Literal>;
388 template class U_I18N_API std::variant<icu::UnicodeString, icu::message2::data_model::Literal>;
389 template class U_I18N_API std::optional<std::variant<icu::UnicodeString, icu::message2::data_model::Literal>>;
390 template class U_I18N_API std::optional<icu::message2::data_model::Literal>;
397 namespace data_model {
502 swap(o1.contents, o2.contents);
526 std::optional<std::variant<VariableName, Literal>> contents;
571 Key(
const Key& other) : contents(other.contents) {}
579 Key() : contents(std::nullopt) {}
601 swap(k1.contents, k2.contents);
646 std::optional<Literal> contents;
657 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
664 namespace data_model {
688 return toStdVector<Key>(keys.getAlias(), len);
786 swap(s1.len, s2.len);
787 swap(s1.keys, s2.keys);
812 friend class message2::Checker;
814 friend class message2::Serializer;
819 const Key* getKeysInternal()
const;
827 namespace data_model {
888 swap(o1.name, o2.name);
889 swap(o1.rand, o2.rand);
925 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
932 namespace data_model {
939 int32_t size()
const;
941 const Option& getOption(int32_t,
UErrorCode&)
const;
942 friend inline void swap(OptionMap& m1, OptionMap& m2) noexcept {
945 swap(m1.bogus, m2.bogus);
946 swap(m1.options, m2.options);
947 swap(m1.len, m2.len);
949 OptionMap() : len(0) {}
950 OptionMap(
const OptionMap&);
951 OptionMap& operator=(OptionMap);
952 std::vector<Option> getOptions()
const {
953 return toStdVector<Option>(options.getAlias(), len);
956 OptionMap(Option*, int32_t);
957 virtual ~OptionMap();
962 bool checkDuplicates =
true;
969 friend inline void swap(Builder& m1, Builder& m2) noexcept {
972 swap(m1.options, m2.options);
973 swap(m1.checkDuplicates, m2.checkDuplicates);
976 Builder(
const Builder&) =
delete;
977 Builder& operator=(Builder) noexcept;
981 friend class message2::Serializer;
984 LocalArray<Option> options;
993 friend inline void swap(Callable& c1, Callable& c2) noexcept {
996 swap(c1.name, c2.name);
997 swap(c1.options, c2.options);
999 const FunctionName& getName()
const {
return name; }
1000 const OptionMap& getOptions()
const {
return options; }
1001 Callable(
const FunctionName& f,
const OptionMap& opts) : name(f), options(opts) {}
1002 Callable& operator=(Callable) noexcept;
1003 Callable(
const Callable&);
1004 Callable() =
default;
1005 virtual ~Callable();
1022 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
1023 #if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION)
1024 template class U_I18N_API std::_Variant_storage_<false, icu::message2::data_model::Reserved,icu::message2::data_model::Callable>;
1026 template class U_I18N_API std::variant<icu::message2::data_model::Reserved,icu::message2::data_model::Callable>;
1032 namespace message2 {
1033 namespace data_model {
1090 const Callable* f = std::get_if<Callable>(&contents);
1092 if (f ==
nullptr) {
return {}; }
1093 const OptionMap& opts = f->getOptions();
1094 return opts.getOptions();
1108 bool isReservedSequence =
false;
1109 bool hasFunctionName =
false;
1110 bool hasOptions =
false;
1113 OptionMap::Builder options;
1212 swap(o1.contents, o2.contents);
1239 friend class message2::Checker;
1241 friend class message2::Serializer;
1248 const OptionMap& getOptionsInternal()
const;
1250 std::variant<Reserved, Callable> contents;
1263 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
1264 template class U_I18N_API std::optional<icu::message2::data_model::Operator>;
1265 template class U_I18N_API std::optional<icu::message2::data_model::Reserved>;
1271 namespace message2 {
1272 namespace data_model {
1274 typedef enum UMarkupType {
1337 std::vector<Option>
getOptions()
const {
return options.getOptions(); }
1376 OptionMap::Builder options;
1377 OptionMap::Builder attributes;
1378 UMarkupType type = UMARKUP_COUNT;
1484 friend class message2::Serializer;
1489 OptionMap attributes;
1490 const OptionMap& getOptionsInternal()
const {
return options; }
1491 const OptionMap& getAttributesInternal()
const {
return attributes; }
1590 bool hasOperand =
false;
1591 bool hasOperator =
false;
1594 OptionMap::Builder attributes;
1679 swap(e1.rator, e2.rator);
1680 swap(e1.rand, e2.rand);
1681 swap(e1.attributes, e2.attributes);
1713 friend class message2::Serializer;
1729 Expression(
const Operator &rAtor,
const Operand &rAnd,
const OptionMap& attrs) : rator(rAtor), rand(rAnd), attributes(attrs) {}
1730 Expression(
const Operand &rAnd,
const OptionMap& attrs) : rator(std::nullopt), rand(
Operand(rAnd)), attributes(attrs) {}
1731 Expression(
const Operator &rAtor,
const OptionMap& attrs) : rator(rAtor), rand(), attributes(attrs) {}
1732 std::optional<Operator> rator;
1734 OptionMap attributes;
1735 const OptionMap& getAttributesInternal()
const {
return attributes; }
1746 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
1747 template class U_I18N_API LocalPointerBase<message2::data_model::Expression>;
1748 template class U_I18N_API LocalArray<message2::data_model::Expression>;
1752 namespace message2 {
1753 namespace data_model {
1799 if (expressionsLen <= 0 || !expressions.isValid()) {
1803 return toStdVector<Expression>(expressions.getAlias(), expressionsLen);
1817 friend class message2::Parser;
1820 std::optional<Reserved> body;
1821 UVector* expressions;
1905 swap(s1.keyword, s2.keyword);
1906 swap(s1.body, s2.body);
1907 swap(s1.expressions, s2.expressions);
1908 swap(s1.expressionsLen, s2.expressionsLen);
1940 friend class message2::Serializer;
1943 std::optional<Reserved> body;
1945 int32_t expressionsLen = 0;
1975 UBool isText()
const {
return std::holds_alternative<UnicodeString>(piece); }
2035 swap(p1.piece, p2.piece);
2099 std::variant<UnicodeString, Expression, Markup> piece;
2110 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
2118 namespace message2 {
2119 namespace data_model {
2264 swap(p1.bogus, p2.bogus);
2265 swap(p1.len, p2.len);
2266 swap(p1.parts, p2.parts);
2301 using iterator_category = std::forward_iterator_tag;
2302 using difference_type = std::ptrdiff_t;
2303 using value_type = std::variant<UnicodeString, Expression, Markup>;
2304 using pointer = value_type*;
2305 using reference =
const value_type&;
2323 return patternContents(part);
2342 friend class Builder;
2344 friend class message2::Serializer;
2367 int32_t numParts()
const;
2382 static const std::variant<UnicodeString, Expression, Markup>&
2383 patternContents(
const PatternPart& p) {
return p.piece; }
2477 namespace data_model {
2552 swap(b1.var, b2.var);
2553 swap(b1.expr, b2.expr);
2554 swap(b1.local, b2.local);
2555 b1.updateAnnotation();
2556 b2.updateAnnotation();
2588 friend class message2::Checker;
2590 friend class message2::Parser;
2591 friend class message2::Serializer;
2602 const Callable* annotation =
nullptr;
2604 const OptionMap& getOptionsInternal()
const;
2606 bool hasAnnotation()
const {
return !local && (annotation !=
nullptr); }
2607 void updateAnnotation();
2618 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
2619 template class U_I18N_API LocalPointerBase<message2::data_model::Variant>;
2620 template class U_I18N_API LocalPointerBase<message2::data_model::Binding>;
2621 template class U_I18N_API LocalArray<message2::data_model::Variant>;
2622 template class U_I18N_API LocalArray<message2::data_model::Binding>;
2626 namespace message2 {
2627 using namespace data_model;
2634 #ifndef U_IN_DOXYGEN
2635 class Matcher :
public UObject {
2637 Matcher& operator=(Matcher);
2638 Matcher(
const Matcher&);
2647 friend inline void swap(Matcher& m1, Matcher& m2) noexcept {
2658 swap(m1.selectors, m2.selectors);
2659 swap(m1.numSelectors, m2.numSelectors);
2660 swap(m1.variants, m2.variants);
2661 swap(m1.numVariants, m2.numVariants);
2666 friend class MFDataModel;
2668 Matcher(Expression* ss, int32_t ns, Variant* vs, int32_t nv);
2677 LocalArray<Expression> selectors;
2679 int32_t numSelectors = 0;
2681 LocalArray<Variant> variants;
2683 int32_t numVariants = 0;
2696 #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
2697 #if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION)
2698 template class U_I18N_API std::_Variant_storage_<false, icu::message2::Matcher,icu::message2::data_model::Pattern>;
2700 template class U_I18N_API std::variant<icu::message2::Matcher,icu::message2::data_model::Pattern>;
2706 namespace message2 {
2771 std::vector<Binding> result;
2773 return toStdVector<Binding>(bindings.getAlias(), bindingsLen);
2786 if (std::holds_alternative<Pattern>(body)) {
2789 const Matcher* match = std::get_if<Matcher>(&body);
2791 return toStdVector<Expression>(match->selectors.getAlias(), match->numSelectors);
2803 if (std::holds_alternative<Pattern>(body)) {
2806 const Matcher* match = std::get_if<Matcher>(&body);
2808 return toStdVector<Variant>(match->variants.getAlias(), match->numVariants);
2820 std::vector<UnsupportedStatement> result;
2822 return toStdVector<UnsupportedStatement>(unsupportedStatements.getAlias(), unsupportedStatementsLen);
2873 swap(m1.body, m2.body);
2874 swap(m1.bindings, m2.bindings);
2875 swap(m1.bindingsLen, m2.bindingsLen);
2876 swap(m1.unsupportedStatements, m2.unsupportedStatements);
2877 swap(m1.unsupportedStatementsLen, m2.unsupportedStatementsLen);
2914 bool hasPattern =
true;
2915 bool hasSelectors =
false;
2918 UVector* selectors =
nullptr;
2919 UVector* variants =
nullptr;
2920 UVector* bindings =
nullptr;
2921 UVector* unsupportedStatements =
nullptr;
3031 friend class Checker;
3033 friend class Serializer;
3037 bool hasPattern()
const {
return std::holds_alternative<Pattern>(body); }
3043 std::variant<Matcher, Pattern> body;
3047 int32_t bindingsLen = 0;
3053 int32_t unsupportedStatementsLen = 0;
3055 const Binding* getLocalVariablesInternal()
const;
3056 const Expression* getSelectorsInternal()
const;
3057 const Variant* getVariantsInternal()
const;
3060 int32_t numSelectors()
const {
3061 const Matcher* matcher = std::get_if<Matcher>(&body);
3062 return (matcher ==
nullptr ? 0 : matcher->numSelectors);
3064 int32_t numVariants()
const {
3065 const Matcher* matcher = std::get_if<Matcher>(&body);
3066 return (matcher ==
nullptr ? 0 : matcher->numVariants);
3070 void initBindings(
const Binding*);
3072 MFDataModel(
const Builder& builder,
UErrorCode&) noexcept;
"Smart pointer" class, deletes objects via the C++ array delete[] operator.
"Smart pointer" base class; do not use directly: use LocalPointer etc.
T * getAlias() const
Access without ownership change.
UMemory is the common ICU base class.
UObject is the common ICU "boilerplate" class.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
The mutable MFDataModel::Builder class allows the data model to be constructed incrementally.
Builder(UErrorCode &status)
Default constructor.
Builder & setPattern(Pattern &&pattern)
Sets the body of the message as a pattern.
Builder & addVariant(SelectorKeys &&keys, Pattern &&pattern, UErrorCode &errorCode) noexcept
Adds a single variant.
Builder & addSelector(Expression &&selector, UErrorCode &errorCode) noexcept
Adds a selector expression.
MFDataModel build(UErrorCode &status) const noexcept
Constructs a new immutable data model.
Builder & addUnsupportedStatement(UnsupportedStatement &&s, UErrorCode &status)
Adds an unsupported statement.
virtual ~Builder()
Destructor.
Builder & addBinding(Binding &&b, UErrorCode &status)
Adds a binding, There must not already be a binding with the same name.
The MFDataModel class describes a parsed representation of the text of a message.
virtual ~MFDataModel()
Destructor.
std::vector< Variant > getVariants() const
Accesses the variants.
const std::vector< Expression > getSelectors() const
Accesses the selectors.
MFDataModel & operator=(MFDataModel) noexcept
Assignment operator.
MFDataModel()
Default constructor.
std::vector< UnsupportedStatement > getUnsupportedStatements() const
Accesses the unsupported statements for this data model.
friend void swap(MFDataModel &m1, MFDataModel &m2) noexcept
Non-member swap function.
std::vector< Binding > getLocalVariables() const
Accesses the local variable declarations for this data model.
MFDataModel(const MFDataModel &other)
Copy constructor.
A Binding pairs a variable name with an expression.
Binding & operator=(Binding) noexcept
Copy assignment operator.
UBool isLocal() const
Returns true if and only if this binding represents a local declaration.
Binding(const Binding &other)
Copy constructor.
const Expression & getValue() const
Accesses the right-hand side of a binding.
const VariableName & getVariable() const
Accesses the left-hand side of the binding.
Binding()
Default constructor.
static Binding input(UnicodeString &&variableName, Expression &&rhs, UErrorCode &errorCode)
Constructor for input binding.
Binding(const VariableName &v, Expression &&e)
Constructor.
virtual ~Binding()
Destructor.
friend void swap(Binding &b1, Binding &b2) noexcept
Non-member swap function.
The mutable Expression::Builder class allows the operator to be constructed incrementally.
Expression build(UErrorCode &status)
Constructs a new immutable Expression using the operand and operator that were previously set.
virtual ~Builder()
Destructor.
Builder & addAttribute(const UnicodeString &key, Operand &&value, UErrorCode &status)
Adds a single attribute.
Builder & setOperator(Operator &&rAtor)
Sets the operator of this expression.
Builder & setOperand(Operand &&rAnd)
Sets the operand of this expression.
Builder(UErrorCode &status)
Default constructor.
The Expression class corresponds to the expression nonterminal in the MessageFormat 2 grammar and the...
Expression & operator=(Expression) noexcept
Assignment operator.
const Operator * getOperator(UErrorCode &status) const
Accesses the function or reserved sequence annotating this expression.
UBool isFunctionCall() const
Checks if this expression has a function annotation (with or without an operand).
std::vector< Option > getAttributes() const
Gets the attributes of this expression.
UBool isStandaloneAnnotation() const
Checks if this expression is an annotation with no operand.
UBool isReserved() const
Returns true if and only if this expression is annotated with a reserved sequence.
const Operand & getOperand() const
Accesses the operand of this expression.
virtual ~Expression()
Destructor.
Expression()
Default constructor.
Expression(const Expression &other)
Copy constructor.
friend void swap(Expression &e1, Expression &e2) noexcept
Non-member swap function.
The Key class corresponds to the key nonterminal in the MessageFormat 2 grammar, https://github....
Key(const Key &other)
Copy constructor.
UBool isWildcard() const
Determines if this is a wildcard key.
Key & operator=(Key) noexcept
Assignment operator.
const Literal & asLiteral() const
Returns the contents of this key as a literal.
virtual ~Key()
Destructor.
Key(const Literal &lit)
Literal key constructor.
Key()
Wildcard constructor; constructs a Key representing the catchall or wildcard key, '*'.
bool operator<(const Key &other) const
Less than operator.
bool operator==(const Key &other) const
Equality operator.
friend void swap(Key &k1, Key &k2) noexcept
Non-member swap function.
The Literal class corresponds to the literal nonterminal in the MessageFormat 2 grammar,...
UBool isQuoted() const
Determines if this literal appeared as a quoted literal in the message.
friend void swap(Literal &l1, Literal &l2) noexcept
Non-member swap function.
Literal(UBool q, const UnicodeString &s)
Literal constructor.
const UnicodeString & unquoted() const
Returns the parsed string contents of this literal.
UnicodeString quoted() const
Returns the quoted representation of this literal (enclosed in '|' characters)
Literal()=default
Default constructor.
bool operator<(const Literal &other) const
Less than operator.
Literal & operator=(Literal) noexcept
Assignment operator.
Literal(const Literal &other)
Copy constructor.
bool operator==(const Literal &other) const
Equality operator.
virtual ~Literal()
Destructor.
The mutable Markup::Builder class allows the markup to be constructed incrementally.
Builder & setName(const UnicodeString &n)
Sets the name of this markup.
Builder & setStandalone()
Sets this to be a standalone markup.
Builder(UErrorCode &status)
Default constructor.
Builder & setOpen()
Sets this to be an opening markup.
Builder & addOption(const UnicodeString &key, Operand &&value, UErrorCode &status)
Adds a single option.
virtual ~Builder()
Destructor.
Builder & setClose()
Sets this to be an closing markup.
Markup build(UErrorCode &status)
Constructs a new immutable Markup using the name and type and (optionally) options and attributes tha...
Builder & addAttribute(const UnicodeString &key, Operand &&value, UErrorCode &status)
Adds a single attribute.
The Markup class corresponds to the markup nonterminal in the MessageFormat 2 grammar and the markup ...
Markup()
Default constructor.
std::vector< Option > getAttributes() const
Gets the attributes of this markup.
UBool isOpen() const
Checks if this markup is an opening tag.
UBool isClose() const
Checks if this markup is an closing tag.
virtual ~Markup()
Destructor.
std::vector< Option > getOptions() const
Gets the options of this markup.
const UnicodeString & getName() const
Gets the name of this markup.
UBool isStandalone() const
Checks if this markup is an standalone tag.
The Operand class corresponds to the operand nonterminal in the MessageFormat 2 grammar,...
virtual UBool isNull() const
Determines if this operand is the null operand.
const UnicodeString & asVariable() const
Returns a reference to this operand's variable name.
const Literal & asLiteral() const
Returns a reference to this operand's literal contents.
friend void swap(Operand &o1, Operand &o2) noexcept
Non-member swap function.
Operand(const Literal &l)
Literal operand constructor.
UBool isVariable() const
Determines if this operand represents a variable.
UBool isLiteral() const
Determines if this operand represents a literal.
Operand(const UnicodeString &v)
Variable operand constructor.
Operand(const Operand &)
Copy constructor.
Operand()
Default constructor.
virtual ~Operand()
Destructor.
virtual Operand & operator=(Operand) noexcept
Assignment operator.
The mutable Operator::Builder class allows the operator to be constructed incrementally.
Builder & setReserved(Reserved &&reserved)
Sets this operator to be a reserved sequence.
Operator build(UErrorCode &status)
Constructs a new immutable Operator using the reserved annotation or the function name and options th...
Builder & setFunctionName(FunctionName &&func)
Sets this operator to be a function annotation and sets its name to func.
Builder & addOption(const UnicodeString &key, Operand &&value, UErrorCode &status) noexcept
Sets this operator to be a function annotation and adds a single option.
Builder(UErrorCode &status)
Default constructor.
virtual ~Builder()
Destructor.
The Operator class corresponds to the FunctionRef | Reserved type in the Expression interface defined...
Operator(const Operator &other) noexcept
Copy constructor.
UBool isReserved() const
Determines if this operator is a reserved annotation.
Operator & operator=(Operator) noexcept
Assignment operator.
virtual ~Operator()
Destructor.
Operator()
Default constructor.
friend void swap(Operator &o1, Operator &o2) noexcept
Non-member swap function.
const FunctionName & getFunctionName() const
Accesses the function name.
std::vector< Option > getOptions() const
Accesses function options.
const Reserved & asReserved() const
Accesses the underlying reserved sequence.
An Option pairs an option name with an Operand.
const UnicodeString & getName() const
Accesses the left-hand side of the option.
Option & operator=(Option other) noexcept
Assignment operator.
const Operand & getValue() const
Accesses the right-hand side of the option.
Option(const Option &other)
Copy constructor.
virtual ~Option()
Destructor.
Option()
Default constructor.
Option(const UnicodeString &n, Operand &&r)
Constructor.
friend void swap(Option &o1, Option &o2) noexcept
Non-member swap function.
A PatternPart is a single element (text or expression) in a Pattern.
UBool isExpression() const
Checks if the part is an expression part.
PatternPart(const UnicodeString &t)
Text part constructor.
PatternPart(Expression &&e)
Expression part constructor.
PatternPart & operator=(PatternPart) noexcept
Assignment operator.
PatternPart()=default
Default constructor.
PatternPart(Markup &&m)
Markup part constructor.
UBool isMarkup() const
Checks if the part is a markup part.
UBool isText() const
Checks if the part is a text part.
const Markup & asMarkup() const
Accesses the expression of the part.
const Expression & contents() const
Accesses the expression of the part.
const UnicodeString & asText() const
Accesses the text contents of the part.
PatternPart(const PatternPart &other)
Copy constructor.
friend void swap(PatternPart &p1, PatternPart &p2) noexcept
Non-member swap function.
virtual ~PatternPart()
Destructor.
The mutable Pattern::Builder class allows the pattern to be constructed one part at a time.
virtual ~Builder()
Destructor.
Pattern build(UErrorCode &status) const noexcept
Constructs a new immutable Pattern using the list of parts set with previous add() calls.
Builder(UErrorCode &status)
Default constructor.
Builder & add(UnicodeString &&part, UErrorCode &status) noexcept
Adds a single text part to the pattern.
Builder & add(Expression &&part, UErrorCode &status) noexcept
Adds a single expression part to the pattern.
Builder & add(Markup &&part, UErrorCode &status) noexcept
Adds a single markup part to the pattern.
A Pattern is a sequence of formattable parts.
Iterator end() const
Returns a special value to mark the end of iteration.
Pattern & operator=(Pattern) noexcept
Assignment operator.
virtual ~Pattern()
Destructor.
Pattern(const Pattern &other)
Copy constructor.
Pattern()
Default constructor.
friend void swap(Pattern &p1, Pattern &p2) noexcept
Non-member swap function.
Iterator begin() const
Returns the parts of this pattern.
The mutable Reserved::Builder class allows the reserved sequence to be constructed one part at a time...
Reserved build(UErrorCode &status) const noexcept
Constructs a new immutable Reserved using the list of parts set with previous add() calls.
virtual ~Builder()
Destructor.
Builder & add(Literal &&part, UErrorCode &status) noexcept
Adds a single literal to the reserved sequence.
Builder(UErrorCode &status)
Default constructor.
The Reserved class represents a reserved annotation, as in the reserved nonterminal in the MessageFor...
Reserved & operator=(Reserved) noexcept
Assignment operator.
virtual ~Reserved()
Destructor.
const Literal & getPart(int32_t i) const
Indexes into the sequence.
int32_t numParts() const
A Reserved is a sequence of literals.
Reserved(const Reserved &other)
Copy constructor.
friend void swap(Reserved &r1, Reserved &r2) noexcept
Non-member swap function.
Reserved()
Default constructor.
The mutable SelectorKeys::Builder class allows the key list to be constructed one key at a time.
Builder & add(Key &&key, UErrorCode &status) noexcept
Adds a single key to the list.
virtual ~Builder()
Destructor.
Builder(UErrorCode &status)
Default constructor.
SelectorKeys build(UErrorCode &status) const
Constructs a new immutable SelectorKeys using the list of keys set with previous add() calls.
The SelectorKeys class represents the key list for a single variant.
friend void swap(SelectorKeys &s1, SelectorKeys &s2) noexcept
Non-member swap function.
SelectorKeys & operator=(SelectorKeys other) noexcept
Assignment operator.
bool operator<(const SelectorKeys &other) const
Less than operator.
virtual ~SelectorKeys()
Destructor.
SelectorKeys()
Default constructor.
std::vector< Key > getKeys() const
Returns the underlying list of keys.
SelectorKeys(const SelectorKeys &other)
Copy constructor.
The mutable UnsupportedStatement::Builder class allows the statement to be constructed incrementally.
Builder(UErrorCode &status)
Default constructor.
Builder & setKeyword(const UnicodeString &k)
Sets the keyword of this statement.
Builder & setBody(Reserved &&r)
Sets the body of this statement.
Builder & addExpression(Expression &&e, UErrorCode &status)
Adds an expression to this statement.
virtual ~Builder()
Destructor.
UnsupportedStatement build(UErrorCode &status) const
Constructs a new immutable UnsupportedStatement using the keyword, body and (if applicable) expressio...
The UnsupportedStatement class corresponds to the reserved-statement nonterminal in the MessageFormat...
std::vector< Expression > getExpressions() const
Accesses the expressions of this statement.
const Reserved * getBody(UErrorCode &status) const
Accesses the reserved-body of this statement.
virtual ~UnsupportedStatement()
Destructor.
const UnicodeString & getKeyword() const
Accesses the keyword of this statement.
UnsupportedStatement & operator=(UnsupportedStatement) noexcept
Assignment operator.
friend void swap(UnsupportedStatement &s1, UnsupportedStatement &s2) noexcept
Non-member swap function.
UnsupportedStatement()
Default constructor.
UnsupportedStatement(const UnsupportedStatement &other)
Copy constructor.
A Variant pairs a list of keys with a pattern It corresponds to the Variant interface defined in http...
Variant(const Variant &)
Copy constructor.
Variant(const SelectorKeys &keys, Pattern &&pattern)
Constructor.
virtual ~Variant()
Destructor.
friend void swap(Variant &v1, Variant &v2) noexcept
Non-member swap function.
Variant & operator=(Variant other) noexcept
Assignment operator.
const SelectorKeys & getKeys() const
Accesses the keys of the variant.
Variant()=default
Default constructor.
const Pattern & getPattern() const
Accesses the pattern of the variant.
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
The Pattern::Iterator class provides an iterator over the formattable parts of a pattern.
reference operator*() const
Dereference operator (gets the element at the current iterator position)
Iterator operator++()
Increment operator (advances to the next iterator position)
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.