17 std::string m_invokation_name_or_value;
18 std::vector<Arg> m_invokation_arguments;
21 m_is_invokation(false),
22 m_invokation_name_or_value(
"") {}
23 inline Value(std::string&& value):
24 m_is_invokation(false),
25 m_invokation_name_or_value(
std::move(value)) {}
26 inline Value(std::string&& name, std::vector<Arg>&& args):
27 m_is_invokation(true),
28 m_invokation_name_or_value(
std::move(name)),
29 m_invokation_arguments(
std::move(args)) {}
31 inline bool is_invokation()
const {
32 return m_is_invokation;
35 inline const std::string& invokation_name()
const {
36 CHECK(is_invokation());
37 return m_invokation_name_or_value;
39 inline std::string& invokation_name() {
40 CHECK(is_invokation());
41 return m_invokation_name_or_value;
44 inline const std::vector<Arg>& invokation_arguments()
const {
45 CHECK(is_invokation());
46 return m_invokation_arguments;
48 inline std::vector<Arg>& invokation_arguments() {
49 CHECK(is_invokation());
50 return m_invokation_arguments;
53 inline const std::string& string_value()
const {
54 CHECK(!is_invokation());
55 return m_invokation_name_or_value;
57 inline std::string& string_value() {
58 CHECK(!is_invokation());
59 return m_invokation_name_or_value;
64 inline bool is_empty()
const {
65 return m_invokation_name_or_value ==
"";
68 friend inline bool operator==(
const Value &lhs,
const Value &rhs);
73 bool m_type_is_static;
75 std::string m_keyword;
78 inline Arg(Value&& value):
81 m_type_is_static(false),
82 m_value(
std::move(value)) {}
83 inline Arg(
View keyword, Value&& value):
86 m_type_is_static(false),
87 m_value(
std::move(value)),
90 inline Arg(
View keyword,
bool is_static,
View type, Value&& value):
93 m_type_is_static(is_static),
94 m_value(
std::move(value)),
98 inline Arg(
bool is_static,
View type, Value&& value):
101 m_type_is_static(is_static),
102 m_value(
std::move(value)),
106 inline bool has_keyword()
const {
107 return m_has_keyword;
109 inline bool has_type()
const {
112 inline bool type_is_static()
const {
113 return m_type_is_static;
115 inline const std::string& keyword()
const {
118 inline std::string& keyword() {
122 inline const std::string& type()
const {
125 inline std::string& type() {
129 inline const Value& value()
const {
132 inline Value& value() {
138 friend inline bool operator==(
const Arg &lhs,
const Arg &rhs);
141 inline std::ostream&
operator<<(std::ostream& os,
146 inline std::ostream&
operator<<(std::ostream& os,
152 inline bool operator==(
const Arg &lhs,
const Arg &rhs);
153 inline bool operator==(
const Value &lhs,
const Value &rhs);
155 inline bool operator!=(
const Arg &lhs,
const Arg &rhs) {
156 return !(lhs == rhs);
158 inline bool operator!=(
const Value &lhs,
const Value &rhs) {
159 return !(lhs == rhs);
162 inline bool operator==(
const Arg &lhs,
const Arg &rhs) {
163 if (lhs.m_has_keyword != rhs.m_has_keyword)
return false;
164 if (lhs.m_has_type != rhs.m_has_type)
return false;
165 if (lhs.m_type_is_static != rhs.m_type_is_static)
return false;
166 if (lhs.m_keyword != rhs.m_keyword)
return false;
167 if (lhs.m_type != rhs.m_type)
return false;
168 if (lhs.m_value != rhs.m_value)
return false;
172 inline bool operator==(
const Value &lhs,
const Value &rhs) {
173 if (lhs.m_is_invokation != rhs.m_is_invokation)
return false;
174 if (lhs.m_invokation_name_or_value != rhs.m_invokation_name_or_value)
return false;
175 if (lhs.m_invokation_arguments != rhs.m_invokation_arguments)
return false;
180 std::stringstream ss;
181 if (is_invokation()) {
182 ss << invokation_name();
183 if (invokation_arguments().size() > 0) {
186 for (
auto& a: invokation_arguments()) {
196 ss <<
"\"" << string_value() <<
"\"";
202 std::stringstream ss;
210 if (type_is_static()) {
bool operator!=(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
Contains the text compression and encoding framework.
std::ostream & operator<<(std::ostream &os, const uint_impl_t< N > &v)
bool operator==(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
std::string to_string(tdc::uint_impl_t< N > value)