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
37static 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]);
47 namespace data_model {
60#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
64#pragma warning(disable: 4661)
66template class U_I18N_API LocalPointerBase<message2::data_model::Literal>;
67template class U_I18N_API LocalArray<message2::data_model::Literal>;
77 class MessageFormatter;
82 namespace data_model {
184 swap(
r1.parts,
r2.parts);
185 swap(
r1.len,
r2.len);
218 friend class Operator;
301 swap(
l1.thisIsQuoted,
l2.thisIsQuoted);
302 swap(
l1.contents,
l2.contents);
362 bool thisIsQuoted =
false;
376#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
379template class U_I18N_API std::_Variant_storage_<false, icu::UnicodeString, icu::message2::data_model::Literal>;
381template class U_I18N_API std::variant<icu::UnicodeString, icu::message2::data_model::Literal>;
382template class U_I18N_API std::optional<std::variant<icu::UnicodeString, icu::message2::data_model::Literal>>;
383template class U_I18N_API std::optional<icu::message2::data_model::Literal>;
390 namespace data_model {
416 UBool isVariable()
const;
425 UBool isLiteral()
const;
434 virtual UBool isNull()
const;
454 const Literal& asLiteral()
const;
472 explicit Operand(
const UnicodeString& v) : contents(VariableName(v)) {}
482 explicit Operand(
const Literal& l) : contents(l) {}
491 friend inline void swap(Operand& o1, Operand& o2)
noexcept {
495 swap(o1.contents, o2.contents);
503 virtual Operand& operator=(Operand)
noexcept;
510 Operand(
const Operand&);
519 std::optional<std::variant<VariableName, Literal>> contents;
547 UBool isWildcard()
const {
return !contents.has_value(); }
557 const Literal& asLiteral()
const;
564 Key(
const Key& other) : contents(other.contents) {}
572 Key() : contents(std::nullopt) {}
582 explicit Key(
const Literal& lit) : contents(lit) {}
591 friend inline void swap(Key& k1, Key& k2)
noexcept {
594 swap(k1.contents, k2.contents);
602 Key& operator=(Key)
noexcept;
616 bool operator<(
const Key& other)
const;
639 std::optional<Literal> contents;
650#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
654#pragma warning(disable: 4661)
656template class U_I18N_API LocalPointerBase<message2::data_model::Key>;
657template class U_I18N_API LocalArray<message2::data_model::Key>;
665 namespace data_model {
676 class U_I18N_API SelectorKeys :
public UObject {
688 std::vector<Key> getKeys()
const {
689 return toStdVector<Key>(keys.getAlias(), len);
702 friend class SelectorKeys;
771 SelectorKeys() : len(0) {}
780 friend inline void swap(SelectorKeys&
s1, SelectorKeys&
s2)
noexcept {
783 swap(
s1.len,
s2.len);
784 swap(
s1.keys,
s2.keys);
792 SelectorKeys(
const SelectorKeys&
other);
799 SelectorKeys& operator=(SelectorKeys
other)
noexcept;
806 virtual ~SelectorKeys();
809 friend class Builder;
810 friend class message2::Checker;
812 friend class message2::Serializer;
817 const Key* getKeysInternal()
const;
825 namespace data_model {
886 swap(
o1.name,
o2.name);
887 swap(
o1.rand,
o2.rand);
923#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
927#pragma warning(disable: 4661)
938 namespace data_model {
951 swap(
m1.bogus,
m2.bogus);
952 swap(
m1.options,
m2.options);
953 swap(
m1.len,
m2.len);
955 OptionMap() : len(0) {}
956 OptionMap(
const OptionMap&);
957 OptionMap& operator=(OptionMap);
958 std::vector<Option> getOptions()
const {
959 return toStdVector<Option>(options.getAlias(), len);
962 OptionMap(Option*, int32_t);
963 virtual ~OptionMap();
965 friend class message2::Serializer;
968 LocalArray<Option> options;
977 friend inline void swap(Callable& c1, Callable& c2)
noexcept {
980 swap(c1.name, c2.name);
981 swap(c1.options, c2.options);
983 const FunctionName& getName()
const {
return name; }
984 const OptionMap& getOptions()
const {
return options; }
985 Callable(
const FunctionName& f,
const OptionMap& opts) : name(f), options(opts) {}
986 Callable& operator=(Callable)
noexcept;
987 Callable(
const Callable&);
988 Callable() =
default;
1006#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
1007#if defined(_MSC_VER)
1008template class U_I18N_API std::_Variant_storage_<false, icu::message2::data_model::Reserved,icu::message2::data_model::Callable>;
1010template class U_I18N_API std::variant<icu::message2::data_model::Reserved,icu::message2::data_model::Callable>;
1017 namespace data_model {
1043 UBool isReserved()
const {
return std::holds_alternative<Reserved>(contents); }
1053 const FunctionName& getFunctionName()
const;
1063 const Reserved& asReserved()
const;
1073 std::vector<Option> getOptions()
const {
1074 const Callable* f = std::get_if<Callable>(&contents);
1076 if (f ==
nullptr) {
return {}; }
1077 const OptionMap& opts = f->getOptions();
1078 return opts.getOptions();
1091 friend class Operator;
1092 bool isReservedSequence =
false;
1093 bool hasFunctionName =
false;
1094 bool hasOptions =
false;
1186 Operator(
const Operator&
other)
noexcept;
1195 friend inline void swap(Operator&
o1, Operator&
o2)
noexcept {
1198 swap(
o1.contents,
o2.contents);
1206 Operator& operator=(Operator)
noexcept;
1214 Operator() : contents(
Reserved()) {}
1221 virtual ~Operator();
1223 friend class Binding;
1224 friend class Builder;
1225 friend class message2::Checker;
1227 friend class message2::Parser;
1228 friend class message2::Serializer;
1233 Operator(
const Reserved& r) : contents(r) {}
1235 const OptionMap& getOptionsInternal()
const;
1236 Operator(
const FunctionName&,
const OptionMap&);
1237 std::variant<Reserved, Callable> contents;
1250#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
1251template class U_I18N_API std::optional<icu::message2::data_model::Operator>;
1252template class U_I18N_API std::optional<icu::message2::data_model::Reserved>;
1259 namespace data_model {
1261 typedef enum UMarkupType {
1324 std::vector<Option>
getOptions()
const {
return options.getOptions(); }
1361 friend class message2::Parser;
1372 UMarkupType type = UMARKUP_COUNT;
1480 friend class message2::Serializer;
1486 const OptionMap& getOptionsInternal()
const {
return options; }
1487 const OptionMap& getAttributesInternal()
const {
return attributes; }
1585 friend class message2::Parser;
1587 bool hasOperand =
false;
1588 bool hasOperator =
false;
1680 swap(
e1.rator,
e2.rator);
1681 swap(
e1.rand,
e2.rand);
1682 swap(
e1.attributes,
e2.attributes);
1714 friend class message2::Serializer;
1733 std::optional<Operator> rator;
1736 const OptionMap& getAttributesInternal()
const {
return attributes; }
1747#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
1748#if defined(_MSC_VER)
1750#pragma warning(push)
1751#pragma warning(disable: 4661)
1753template class U_I18N_API LocalPointerBase<message2::data_model::Expression>;
1754template class U_I18N_API LocalArray<message2::data_model::Expression>;
1755#if defined(_MSC_VER)
1762 namespace data_model {
1808 if (expressionsLen <= 0 || !expressions.isValid()) {
1826 friend class message2::Parser;
1829 std::optional<Reserved> body;
1910 swap(
s1.keyword,
s2.keyword);
1911 swap(
s1.body,
s2.body);
1912 swap(
s1.expressions,
s2.expressions);
1913 swap(
s1.expressionsLen,
s2.expressionsLen);
1945 friend class message2::Serializer;
1948 std::optional<Reserved> body;
1980 UBool isText()
const {
return std::holds_alternative<UnicodeString>(piece); }
2040 swap(
p1.piece,
p2.piece);
2102 friend class Pattern;
2104 std::variant<UnicodeString, Expression, Markup> piece;
2115#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
2116#if defined(_MSC_VER)
2118#pragma warning(push)
2119#pragma warning(disable: 4661)
2125#if defined(_MSC_VER)
2132 namespace data_model {
2145 friend class PatternPart;
2158 Iterator begin()
const {
2159 return Iterator(
this, 0);
2170 Iterator end()
const {
2171 return Iterator(
this, len);
2184 friend class Pattern;
2270 friend inline void swap(Pattern&
p1, Pattern&
p2)
noexcept {
2273 swap(
p1.len,
p2.len);
2274 swap(
p1.parts,
p2.parts);
2282 Pattern(
const Pattern&
other)
noexcept;
2289 Pattern& operator=(Pattern)
noexcept;
2309 using iterator_category = std::forward_iterator_tag;
2310 using difference_type = std::ptrdiff_t;
2311 using value_type = std::variant<UnicodeString, Expression, Markup>;
2312 using pointer = value_type*;
2313 using reference =
const value_type&;
2315 friend class Pattern;
2331 return patternContents(
part);
2350 friend class Builder;
2352 friend class message2::Serializer;
2360 static void initParts(Pattern&,
const Pattern&);
2370 int32_t numParts()
const {
return len; }
2385 static const std::variant<UnicodeString, Expression, Markup>& patternContents(
const PatternPart& p) {
2411 const Pattern& getPattern()
const {
return p; }
2420 const SelectorKeys& getKeys()
const {
return k; }
2432 Variant(
const SelectorKeys& keys, Pattern&& pattern) : k(keys), p(std::move(pattern)) {}
2441 friend inline void swap(Variant& v1, Variant& v2)
noexcept {
2453 Variant& operator=(Variant other)
noexcept;
2461 Variant() =
default;
2468 Variant(
const Variant&);
2482 namespace data_model {
2503 const Expression& getValue()
const;
2512 const VariableName& getVariable()
const {
return var; }
2527 static Binding input(UnicodeString&& variableName, Expression&& rhs,
UErrorCode& errorCode);
2535 UBool isLocal()
const {
return local; }
2545 Binding(
const VariableName& v, Expression&& e) : var(v), expr(std::move(e)), local(true), annotation(nullptr) {}
2554 friend inline void swap(Binding& b1, Binding& b2)
noexcept {
2557 swap(b1.var, b2.var);
2558 swap(b1.expr, b2.expr);
2559 swap(b1.local, b2.local);
2560 b1.updateAnnotation();
2561 b2.updateAnnotation();
2569 Binding(
const Binding& other);
2576 Binding& operator=(Binding)
noexcept;
2584 Binding() : local(true) {}
2593 friend class message2::Checker;
2594 friend class message2::MessageFormatter;
2595 friend class message2::Parser;
2596 friend class message2::Serializer;
2607 const Callable* annotation =
nullptr;
2609 const OptionMap& getOptionsInternal()
const;
2611 bool hasAnnotation()
const {
return !local && (annotation !=
nullptr); }
2612 void updateAnnotation();
2623#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
2624#if defined(_MSC_VER)
2626#pragma warning(push)
2627#pragma warning(disable: 4661)
2629template class U_I18N_API LocalPointerBase<message2::data_model::Variant>;
2630template class U_I18N_API LocalPointerBase<message2::data_model::Binding>;
2631template class U_I18N_API LocalArray<message2::data_model::Variant>;
2632template class U_I18N_API LocalArray<message2::data_model::Binding>;
2633#if defined(_MSC_VER)
2640 using namespace data_model;
2647 #ifndef U_IN_DOXYGEN
2650 Matcher& operator=(Matcher);
2651 Matcher(
const Matcher&);
2660 friend inline void swap(Matcher& m1, Matcher& m2)
noexcept {
2663 swap(m1.selectors, m2.selectors);
2664 swap(m1.numSelectors, m2.numSelectors);
2665 swap(m1.variants, m2.variants);
2666 swap(m1.numVariants, m2.numVariants);
2670 friend class MFDataModel;
2672 Matcher(Expression* ss, int32_t ns, Variant* vs, int32_t nv) : selectors(ss), numSelectors(ns), variants(vs), numVariants(nv) {
2673 if (selectors ==
nullptr) {
2676 if (variants ==
nullptr) {
2682 LocalArray<Expression> selectors;
2684 int32_t numSelectors = 0;
2686 LocalArray<Variant> variants;
2688 int32_t numVariants = 0;
2701#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
2702#if defined(_MSC_VER)
2703template class U_I18N_API std::_Variant_storage_<false, icu::message2::Matcher,icu::message2::data_model::Pattern>;
2705template class U_I18N_API std::variant<icu::message2::Matcher,icu::message2::data_model::Pattern>;
2731 class U_I18N_API MFDataModel :
public UMemory {
2775 std::vector<Binding> getLocalVariables()
const {
2776 std::vector<Binding> result;
2778 return toStdVector<Binding>(bindings.getAlias(), bindingsLen);
2790 const std::vector<Expression> getSelectors()
const {
2791 if (std::holds_alternative<Pattern>(body)) {
2794 const Matcher* match = std::get_if<Matcher>(&body);
2796 return toStdVector<Expression>(match->selectors.getAlias(), match->numSelectors);
2806 std::vector<Variant> getVariants()
const {
2808 if (std::holds_alternative<Pattern>(body)) {
2811 const Matcher* match = std::get_if<Matcher>(&body);
2813 return toStdVector<Variant>(match->variants.getAlias(), match->numVariants);
2824 std::vector<UnsupportedStatement> getUnsupportedStatements()
const {
2825 std::vector<UnsupportedStatement> result;
2827 return toStdVector<UnsupportedStatement>(unsupportedStatements.getAlias(), unsupportedStatementsLen);
2840 const Pattern& getPattern()
const;
2867 friend inline void swap(MFDataModel& m1, MFDataModel& m2)
noexcept {
2878 swap(m1.body, m2.body);
2879 swap(m1.bindings, m2.bindings);
2880 swap(m1.bindingsLen, m2.bindingsLen);
2881 swap(m1.unsupportedStatements, m2.unsupportedStatements);
2882 swap(m1.unsupportedStatementsLen, m2.unsupportedStatementsLen);
2890 MFDataModel& operator=(MFDataModel)
noexcept;
2897 MFDataModel(
const MFDataModel& other);
2904 virtual ~MFDataModel();
2915 friend class MFDataModel;
2919 bool hasPattern =
true;
2920 bool hasSelectors =
false;
2926 UVector* unsupportedStatements =
nullptr;
3032 friend class Checker;
3034 friend class Serializer;
3038 bool hasPattern()
const {
return std::holds_alternative<Pattern>(body); }
3044 std::variant<Matcher, Pattern> body;
3054 int32_t unsupportedStatementsLen = 0;
3056 const Binding* getLocalVariablesInternal()
const;
3057 const Expression* getSelectorsInternal()
const;
3058 const Variant* getVariantsInternal()
const;
3061 int32_t numSelectors()
const {
3062 const Matcher* matcher = std::get_if<Matcher>(&body);
3063 return (matcher ==
nullptr ? 0 : matcher->numSelectors);
3066 const Matcher* matcher = std::get_if<Matcher>(&body);
3067 return (matcher ==
nullptr ? 0 : matcher->numVariants);
3071 void initBindings(
const Binding*);
3073 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 & addUnsupportedStatement(UnsupportedStatement &&s, UErrorCode &status)
Adds an unsupported statement.
Builder & addBinding(Binding &&b, UErrorCode &status)
Adds a binding, There must not already be a binding with the same name.
MFDataModel build(UErrorCode &status) const noexcept
Constructs a new immutable data model.
Builder & addVariant(SelectorKeys &&keys, Pattern &&pattern, UErrorCode &errorCode) noexcept
Adds a single variant.
Builder & addSelector(Expression &&selector, UErrorCode &errorCode) noexcept
Adds a selector expression.
Builder & setPattern(Pattern &&pattern)
Sets the body of the message as a pattern.
virtual ~Builder()
Destructor.
The mutable Expression::Builder class allows the operator to be constructed incrementally.
Builder & addAttribute(const UnicodeString &key, Operand &&value, UErrorCode &status)
Adds a single attribute.
Expression build(UErrorCode &status)
Constructs a new immutable Expression using the operand and operator that were previously set.
Builder & setOperand(Operand &&rAnd)
Sets the operand of this expression.
virtual ~Builder()
Destructor.
Builder & setOperator(Operator &&rAtor)
Sets the operator of this expression.
Builder(UErrorCode &status)
Default constructor.
The Expression class corresponds to the expression nonterminal in the MessageFormat 2 grammar and the...
const Operand & getOperand() const
Accesses the operand of this expression.
UBool isFunctionCall() const
Checks if this expression has a function annotation (with or without an operand).
Expression & operator=(Expression) noexcept
Assignment operator.
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.
std::vector< Option > getAttributes() const
Gets the attributes of this expression.
virtual ~Expression()
Destructor.
Expression()
Default constructor.
Expression(const Expression &other)
Copy constructor.
const Operator * getOperator(UErrorCode &status) const
Accesses the function or reserved sequence annotating this expression.
friend void swap(Expression &e1, Expression &e2) 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.
const UnicodeString & unquoted() const
Returns the parsed string contents of this literal.
friend void swap(Literal &l1, Literal &l2) noexcept
Non-member swap function.
Literal(UBool q, const UnicodeString &s)
Literal constructor.
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(const Literal &other)
Copy constructor.
Literal & operator=(Literal) noexcept
Assignment operator.
bool operator==(const Literal &other) const
Equality operator.
virtual ~Literal()
Destructor.
The mutable Markup::Builder class allows the markup to be constructed incrementally.
Builder & setStandalone()
Sets this to be a standalone markup.
Builder(UErrorCode &status)
Default constructor.
Builder & addOption(const UnicodeString &key, Operand &&value, UErrorCode &status) noexcept
Adds a single option.
Builder & setClose()
Sets this to be an closing markup.
virtual ~Builder()
Destructor.
Builder & setName(const UnicodeString &n)
Sets the name of this markup.
Builder & addAttribute(const UnicodeString &key, Operand &&value, UErrorCode &status) noexcept
Adds a single attribute.
Markup build(UErrorCode &status)
Constructs a new immutable Markup using the name and type and (optionally) options and attributes tha...
Builder & setOpen()
Sets this to be an opening markup.
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.
std::vector< Option > getOptions() const
Gets the options of this markup.
UBool isClose() const
Checks if this markup is an closing tag.
virtual ~Markup()
Destructor.
const UnicodeString & getName() const
Gets the name of this markup.
UBool isStandalone() const
Checks if this markup is an standalone tag.
The mutable Operator::Builder class allows the operator to be constructed incrementally.
Builder & setFunctionName(FunctionName &&func)
Sets this operator to be a function annotation and sets its name to func.
Operator build(UErrorCode &status)
Constructs a new immutable Operator using the reserved annotation or the function name and options th...
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.
Builder & setReserved(Reserved &&reserved)
Sets this operator to be a reserved sequence.
virtual ~Builder()
Destructor.
An Option pairs an option name with an Operand.
Option(const Option &other)
Copy constructor.
virtual ~Option()
Destructor.
Option()
Default constructor.
Option & operator=(Option other) noexcept
Assignment operator.
Option(const UnicodeString &n, Operand &&r)
Constructor.
const UnicodeString & getName() const
Accesses the left-hand side of the option.
const Operand & getValue() const
Accesses the right-hand side of the option.
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.
const Expression & contents() const
Accesses the expression of the part.
PatternPart(Expression &&e)
Expression part constructor.
const UnicodeString & asText() const
Accesses the text contents of the part.
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.
PatternPart(const PatternPart &other)
Copy constructor.
PatternPart & operator=(PatternPart) noexcept
Assignment operator.
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.
Builder & add(UnicodeString &&part, UErrorCode &status) noexcept
Adds a single text part to the pattern.
virtual ~Builder()
Destructor.
Builder & add(Markup &&part, UErrorCode &status) noexcept
Adds a single markup part to the pattern.
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(Expression &&part, UErrorCode &status) noexcept
Adds a single expression part to the 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.
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.
const Literal & getPart(int32_t i) const
Indexes into the sequence.
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 mutable UnsupportedStatement::Builder class allows the statement to be constructed incrementally.
Builder & setKeyword(const UnicodeString &k)
Sets the keyword of this statement.
Builder(UErrorCode &status)
Default constructor.
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...
Builder & setBody(Reserved &&r)
Sets the body of this statement.
The UnsupportedStatement class corresponds to the reserved-statement nonterminal in the MessageFormat...
virtual ~UnsupportedStatement()
Destructor.
UnsupportedStatement & operator=(UnsupportedStatement) noexcept
Assignment operator.
const UnicodeString & getKeyword() const
Accesses the keyword of this statement.
const Reserved * getBody(UErrorCode &status) const
Accesses the reserved-body of this statement.
std::vector< Expression > getExpressions() const
Accesses the expressions of this statement.
friend void swap(UnsupportedStatement &s1, UnsupportedStatement &s2) noexcept
Non-member swap function.
UnsupportedStatement()
Default constructor.
UnsupportedStatement(const UnsupportedStatement &other)
Copy constructor.
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.
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.