rapidyaml  0.9.0
parse and emit YAML, and do it fast
node_type.hpp
Go to the documentation of this file.
1 #ifndef C4_YML_NODE_TYPE_HPP_
2 #define C4_YML_NODE_TYPE_HPP_
3 
4 #ifndef _C4_YML_COMMON_HPP_
5 #include "c4/yml/common.hpp"
6 #endif
7 
8 C4_SUPPRESS_WARNING_MSVC_PUSH
9 C4_SUPPRESS_WARNING_GCC_CLANG_PUSH
10 C4_SUPPRESS_WARNING_GCC_CLANG("-Wold-style-cast")
11 
12 namespace c4 {
13 namespace yml {
14 
15 /** @addtogroup doc_node_type
16  *
17  * @{
18  */
19 
20 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
23 
24 
25 /** the integral type necessary to cover all the bits for NodeType_e */
26 using type_bits = uint32_t;
27 
28 
29 /** a bit mask for marking node types and styles */
30 typedef enum : type_bits {
31  #define __(v) (type_bits(1) << v) // a convenience define, undefined below // NOLINT
32  NOTYPE = 0, ///< no node type or style is set
33  KEY = __(0), ///< is member of a map
34  VAL = __(1), ///< a scalar: has a scalar (ie string) value, possibly empty. must be a leaf node, and cannot be MAP or SEQ
35  MAP = __(2), ///< a map: a parent of KEYVAL/KEYSEQ/KEYMAP nodes
36  SEQ = __(3), ///< a seq: a parent of VAL/SEQ/MAP nodes
37  DOC = __(4), ///< a document
38  STREAM = __(5)|SEQ, ///< a stream: a seq of docs
39  KEYREF = __(6), ///< a *reference: the key references an &anchor
40  VALREF = __(7), ///< a *reference: the val references an &anchor
41  KEYANCH = __(8), ///< the key has an &anchor
42  VALANCH = __(9), ///< the val has an &anchor
43  KEYTAG = __(10), ///< the key has a tag
44  VALTAG = __(11), ///< the val has a tag
45  KEYNIL = __(12), ///< the key is null (eg `{ : b}` results in a null key)
46  VALNIL = __(13), ///< the val is null (eg `{a : }` results in a null val)
47  _TYMASK = __(14)-1, ///< all the bits up to here
48  //
49  // unfiltered flags:
50  //
51  KEY_UNFILT = __(14), ///< the key scalar was left unfiltered; the parser was set not to filter. @see ParserOptions
52  VAL_UNFILT = __(15), ///< the val scalar was left unfiltered; the parser was set not to filter. @see ParserOptions
53  //
54  // style flags:
55  //
56  FLOW_SL = __(16), ///< mark container with single-line flow style (seqs as '[val1,val2], maps as '{key: val,key2: val2}')
57  FLOW_ML = __(17), ///< (NOT IMPLEMENTED, work in progress) mark container with multi-line flow style (seqs as '[\n val1,\n val2\n], maps as '{\n key: val,\n key2: val2\n}')
58  BLOCK = __(18), ///< mark container with block style (seqs as '- val\n', maps as 'key: val')
59  KEY_LITERAL = __(19), ///< mark key scalar as multiline, block literal |
60  VAL_LITERAL = __(20), ///< mark val scalar as multiline, block literal |
61  KEY_FOLDED = __(21), ///< mark key scalar as multiline, block folded >
62  VAL_FOLDED = __(22), ///< mark val scalar as multiline, block folded >
63  KEY_SQUO = __(23), ///< mark key scalar as single quoted '
64  VAL_SQUO = __(24), ///< mark val scalar as single quoted '
65  KEY_DQUO = __(25), ///< mark key scalar as double quoted "
66  VAL_DQUO = __(26), ///< mark val scalar as double quoted "
67  KEY_PLAIN = __(27), ///< mark key scalar as plain scalar (unquoted, even when multiline)
68  VAL_PLAIN = __(28), ///< mark val scalar as plain scalar (unquoted, even when multiline)
69  //
70  // type combination masks:
71  //
78  //
79  // style combination masks:
80  //
86  KEYQUO = KEY_SQUO|KEY_DQUO|KEY_FOLDED|KEY_LITERAL, ///< key style is one of ', ", > or |
87  VALQUO = VAL_SQUO|VAL_DQUO|VAL_FOLDED|VAL_LITERAL, ///< val style is one of ', ", > or |
88  KEY_STYLE = KEY_LITERAL|KEY_FOLDED|KEY_SQUO|KEY_DQUO|KEY_PLAIN, ///< mask of all the scalar styles for key (not container styles!)
89  VAL_STYLE = VAL_LITERAL|VAL_FOLDED|VAL_SQUO|VAL_DQUO|VAL_PLAIN, ///< mask of all the scalar styles for val (not container styles!)
95  //
96  // mixed masks
99  #undef __
100 } NodeType_e;
101 
102 constexpr C4_ALWAYS_INLINE C4_CONST NodeType_e operator| (NodeType_e lhs, NodeType_e rhs) noexcept { return (NodeType_e)(((type_bits)lhs) | ((type_bits)rhs)); }
103 constexpr C4_ALWAYS_INLINE C4_CONST NodeType_e operator& (NodeType_e lhs, NodeType_e rhs) noexcept { return (NodeType_e)(((type_bits)lhs) & ((type_bits)rhs)); }
104 constexpr C4_ALWAYS_INLINE C4_CONST NodeType_e operator>> (NodeType_e bits, uint32_t n) noexcept { return (NodeType_e)(((type_bits)bits) >> n); }
105 constexpr C4_ALWAYS_INLINE C4_CONST NodeType_e operator<< (NodeType_e bits, uint32_t n) noexcept { return (NodeType_e)(((type_bits)bits) << n); }
106 constexpr C4_ALWAYS_INLINE C4_CONST NodeType_e operator~ (NodeType_e bits) noexcept { return (NodeType_e)(~(type_bits)bits); }
107 C4_ALWAYS_INLINE NodeType_e& operator&= (NodeType_e &subject, NodeType_e bits) noexcept { subject = (NodeType_e)((type_bits)subject & (type_bits)bits); return subject; }
108 C4_ALWAYS_INLINE NodeType_e& operator|= (NodeType_e &subject, NodeType_e bits) noexcept { subject = (NodeType_e)((type_bits)subject | (type_bits)bits); return subject; }
109 
110 
111 //-----------------------------------------------------------------------------
112 //-----------------------------------------------------------------------------
113 //-----------------------------------------------------------------------------
114 
115 /** wraps a NodeType_e element with some syntactic sugar and predicates */
117 {
118 public:
119 
121 
122 public:
123 
124  C4_ALWAYS_INLINE NodeType() noexcept : type(NOTYPE) {}
125  C4_ALWAYS_INLINE NodeType(NodeType_e t) noexcept : type(t) {}
126  C4_ALWAYS_INLINE NodeType(type_bits t) noexcept : type((NodeType_e)t) {}
127 
128  C4_ALWAYS_INLINE bool has_any(NodeType_e t) const noexcept { return (type & t) != 0u; }
129  C4_ALWAYS_INLINE bool has_all(NodeType_e t) const noexcept { return (type & t) == t; }
130  C4_ALWAYS_INLINE bool has_none(NodeType_e t) const noexcept { return (type & t) == 0; }
131 
132  C4_ALWAYS_INLINE void set(NodeType_e t) noexcept { type = t; }
133  C4_ALWAYS_INLINE void add(NodeType_e t) noexcept { type = (type|t); }
134  C4_ALWAYS_INLINE void rem(NodeType_e t) noexcept { type = (type & ~t); }
135  C4_ALWAYS_INLINE void addrem(NodeType_e bits_to_add, NodeType_e bits_to_remove) noexcept { type |= bits_to_add; type &= ~bits_to_remove; }
136 
137  C4_ALWAYS_INLINE void clear() noexcept { type = NOTYPE; }
138 
139 public:
140 
141  C4_ALWAYS_INLINE operator NodeType_e & C4_RESTRICT () noexcept { return type; }
142  C4_ALWAYS_INLINE operator NodeType_e const& C4_RESTRICT () const noexcept { return type; }
143 
144 public:
145 
146  /** @name node type queries
147  * @{ */
148 
149  /** return a preset string based on the node type */
150  C4_ALWAYS_INLINE const char *type_str() const noexcept { return type_str(type); }
151  /** return a preset string based on the node type */
152  static const char* type_str(NodeType_e t) noexcept;
153 
154  /** fill a string with the node type flags. If the string is small, returns {null, len} */
155  C4_ALWAYS_INLINE csubstr type_str(substr buf) const noexcept { return type_str(buf, type); }
156  /** fill a string with the node type flags. If the string is small, returns {null, len} */
157  static csubstr type_str(substr buf, NodeType_e t) noexcept;
158 
159 public:
160 
161  /** @name node type queries
162  * @{ */
163 
164  C4_ALWAYS_INLINE bool is_notype() const noexcept { return type == NOTYPE; }
165  C4_ALWAYS_INLINE bool is_stream() const noexcept { return ((type & STREAM) == STREAM) != 0; }
166  C4_ALWAYS_INLINE bool is_doc() const noexcept { return (type & DOC) != 0; }
167  C4_ALWAYS_INLINE bool is_container() const noexcept { return (type & (MAP|SEQ|STREAM)) != 0; }
168  C4_ALWAYS_INLINE bool is_map() const noexcept { return (type & MAP) != 0; }
169  C4_ALWAYS_INLINE bool is_seq() const noexcept { return (type & SEQ) != 0; }
170  C4_ALWAYS_INLINE bool has_key() const noexcept { return (type & KEY) != 0; }
171  C4_ALWAYS_INLINE bool has_val() const noexcept { return (type & VAL) != 0; }
172  C4_ALWAYS_INLINE bool is_val() const noexcept { return (type & KEYVAL) == VAL; }
173  C4_ALWAYS_INLINE bool is_keyval() const noexcept { return (type & KEYVAL) == KEYVAL; }
174  C4_ALWAYS_INLINE bool key_is_null() const noexcept { return (type & KEYNIL) != 0; }
175  C4_ALWAYS_INLINE bool val_is_null() const noexcept { return (type & VALNIL) != 0; }
176  C4_ALWAYS_INLINE bool has_key_tag() const noexcept { return (type & KEYTAG) != 0; }
177  C4_ALWAYS_INLINE bool has_val_tag() const noexcept { return (type & VALTAG) != 0; }
178  C4_ALWAYS_INLINE bool has_key_anchor() const noexcept { return (type & KEYANCH) != 0; }
179  C4_ALWAYS_INLINE bool has_val_anchor() const noexcept { return (type & VALANCH) != 0; }
180  C4_ALWAYS_INLINE bool has_anchor() const noexcept { return (type & (KEYANCH|VALANCH)) != 0; }
181  C4_ALWAYS_INLINE bool is_key_ref() const noexcept { return (type & KEYREF) != 0; }
182  C4_ALWAYS_INLINE bool is_val_ref() const noexcept { return (type & VALREF) != 0; }
183  C4_ALWAYS_INLINE bool is_ref() const noexcept { return (type & (KEYREF|VALREF)) != 0; }
184 
185  C4_ALWAYS_INLINE bool is_key_unfiltered() const noexcept { return (type & (KEY_UNFILT)) != 0; }
186  C4_ALWAYS_INLINE bool is_val_unfiltered() const noexcept { return (type & (VAL_UNFILT)) != 0; }
187 
188  RYML_DEPRECATED("use has_key_anchor()") bool is_key_anchor() const noexcept { return has_key_anchor(); }
189  RYML_DEPRECATED("use has_val_anchor()") bool is_val_anchor() const noexcept { return has_val_anchor(); }
190  RYML_DEPRECATED("use has_anchor()") bool is_anchor() const noexcept { return has_anchor(); }
191  RYML_DEPRECATED("use has_anchor() || is_ref()") bool is_anchor_or_ref() const noexcept { return has_anchor() || is_ref(); }
192  /** @} */
193 
194 public:
195 
196  /** @name container+scalar style queries
197  * @{ */
198 
199  C4_ALWAYS_INLINE bool is_container_styled() const noexcept { return (type & (CONTAINER_STYLE)) != 0; }
200  C4_ALWAYS_INLINE bool is_block() const noexcept { return (type & (BLOCK)) != 0; }
201  C4_ALWAYS_INLINE bool is_flow_sl() const noexcept { return (type & (FLOW_SL)) != 0; }
202  C4_ALWAYS_INLINE bool is_flow_ml() const noexcept { return (type & (FLOW_ML)) != 0; }
203  C4_ALWAYS_INLINE bool is_flow() const noexcept { return (type & (FLOW_ML|FLOW_SL)) != 0; }
204 
205  C4_ALWAYS_INLINE bool is_key_styled() const noexcept { return (type & (KEY_STYLE)) != 0; }
206  C4_ALWAYS_INLINE bool is_val_styled() const noexcept { return (type & (VAL_STYLE)) != 0; }
207  C4_ALWAYS_INLINE bool is_key_literal() const noexcept { return (type & (KEY_LITERAL)) != 0; }
208  C4_ALWAYS_INLINE bool is_val_literal() const noexcept { return (type & (VAL_LITERAL)) != 0; }
209  C4_ALWAYS_INLINE bool is_key_folded() const noexcept { return (type & (KEY_FOLDED)) != 0; }
210  C4_ALWAYS_INLINE bool is_val_folded() const noexcept { return (type & (VAL_FOLDED)) != 0; }
211  C4_ALWAYS_INLINE bool is_key_squo() const noexcept { return (type & (KEY_SQUO)) != 0; }
212  C4_ALWAYS_INLINE bool is_val_squo() const noexcept { return (type & (VAL_SQUO)) != 0; }
213  C4_ALWAYS_INLINE bool is_key_dquo() const noexcept { return (type & (KEY_DQUO)) != 0; }
214  C4_ALWAYS_INLINE bool is_val_dquo() const noexcept { return (type & (VAL_DQUO)) != 0; }
215  C4_ALWAYS_INLINE bool is_key_plain() const noexcept { return (type & (KEY_PLAIN)) != 0; }
216  C4_ALWAYS_INLINE bool is_val_plain() const noexcept { return (type & (VAL_PLAIN)) != 0; }
217  C4_ALWAYS_INLINE bool is_key_quoted() const noexcept { return (type & KEYQUO) != 0; }
218  C4_ALWAYS_INLINE bool is_val_quoted() const noexcept { return (type & VALQUO) != 0; }
219  C4_ALWAYS_INLINE bool is_quoted() const noexcept { return (type & (KEYQUO|VALQUO)) != 0; }
220 
221  C4_ALWAYS_INLINE void set_container_style(NodeType_e style) noexcept { type = ((style & CONTAINER_STYLE) | (type & ~CONTAINER_STYLE)); }
222  C4_ALWAYS_INLINE void set_key_style(NodeType_e style) noexcept { type = ((style & KEY_STYLE) | (type & ~KEY_STYLE)); }
223  C4_ALWAYS_INLINE void set_val_style(NodeType_e style) noexcept { type = ((style & VAL_STYLE) | (type & ~VAL_STYLE)); }
224 
225  /** @} */
226 
227 };
228 
229 
230 //-----------------------------------------------------------------------------
231 //-----------------------------------------------------------------------------
232 //-----------------------------------------------------------------------------
233 
234 /** @name scalar style helpers
235  * @{ */
236 
237 /** choose a YAML emitting style based on the scalar's contents */
238 RYML_EXPORT NodeType_e scalar_style_choose(csubstr scalar) noexcept;
239 
240 /** choose a json style based on the scalar's contents */
241 RYML_EXPORT NodeType_e scalar_style_json_choose(csubstr scalar) noexcept;
242 
243 /** query whether a scalar can be encoded using single quotes.
244  * It may not be possible, notably when there is leading
245  * whitespace after a newline. */
246 RYML_EXPORT bool scalar_style_query_squo(csubstr s) noexcept;
247 
248 /** query whether a scalar can be encoded using plain style (no
249  * quotes, not a literal/folded block scalar). */
250 RYML_EXPORT bool scalar_style_query_plain(csubstr s) noexcept;
251 
252 /** YAML-sense query of nullity. returns true if the scalar points
253  * to `nullptr` or is otherwise equal to one of the strings
254  * `"~"`,`"null"`,`"Null"`,`"NULL"` */
255 RYML_EXPORT inline C4_NO_INLINE bool scalar_is_null(csubstr s) noexcept
256 {
257  return s.str == nullptr ||
258  s == "~" ||
259  s == "null" ||
260  s == "Null" ||
261  s == "NULL";
262 }
263 
264 /** @} */
265 
266 
267 /** @} */
268 
269 } // namespace yml
270 } // namespace c4
271 
272 C4_SUPPRESS_WARNING_MSVC_POP
273 C4_SUPPRESS_WARNING_GCC_CLANG_POP
274 
275 #endif /* C4_YML_NODE_TYPE_HPP_ */
Common utilities and infrastructure used by ryml.
#define RYML_EXPORT
Definition: export.hpp:15
constexpr C4_CONST NodeType_e operator&(NodeType_e lhs, NodeType_e rhs) noexcept
Definition: node_type.hpp:103
constexpr C4_CONST NodeType_e operator|(NodeType_e lhs, NodeType_e rhs) noexcept
Definition: node_type.hpp:102
bool scalar_is_null(csubstr s) noexcept
YAML-sense query of nullity.
Definition: node_type.hpp:255
NodeType_e & operator|=(NodeType_e &subject, NodeType_e bits) noexcept
Definition: node_type.hpp:108
constexpr C4_CONST NodeType_e operator>>(NodeType_e bits, uint32_t n) noexcept
Definition: node_type.hpp:104
NodeType_e scalar_style_json_choose(csubstr s) noexcept
choose a json style based on the scalar's contents
Definition: node_type.cpp:191
bool scalar_style_query_squo(csubstr s) noexcept
query whether a scalar can be encoded using single quotes.
Definition: node_type.cpp:143
bool scalar_style_query_plain(csubstr s) noexcept
query whether a scalar can be encoded using plain style (no quotes, not a literal/folded block scalar...
Definition: node_type.cpp:149
NodeType_e scalar_style_choose(csubstr s) noexcept
choose a YAML emitting style based on the scalar's contents
Definition: node_type.cpp:171
constexpr C4_CONST NodeType_e operator<<(NodeType_e bits, uint32_t n) noexcept
Definition: node_type.hpp:105
uint32_t type_bits
the integral type necessary to cover all the bits for NodeType_e
Definition: node_type.hpp:26
NodeType_e & operator&=(NodeType_e &subject, NodeType_e bits) noexcept
Definition: node_type.hpp:107
constexpr C4_CONST NodeType_e operator~(NodeType_e bits) noexcept
Definition: node_type.hpp:106
NodeType_e
a bit mask for marking node types and styles
Definition: node_type.hpp:30
@ VALANCH
the val has an &anchor
Definition: node_type.hpp:42
@ NOTYPE
no node type or style is set
Definition: node_type.hpp:32
@ SCALAR_FOLDED
Definition: node_type.hpp:82
@ KEY_DQUO
mark key scalar as double quoted "
Definition: node_type.hpp:65
@ VALREF
a *reference: the val references an &anchor
Definition: node_type.hpp:40
@ VALNIL
the val is null (eg {a : } results in a null val)
Definition: node_type.hpp:46
@ MAP
a map: a parent of KEYVAL/KEYSEQ/KEYMAP nodes
Definition: node_type.hpp:35
@ STREAM
a stream: a seq of docs
Definition: node_type.hpp:38
@ KEY
is member of a map
Definition: node_type.hpp:33
@ KEYQUO
key style is one of ', ", > or |
Definition: node_type.hpp:86
@ VAL_FOLDED
mark val scalar as multiline, block folded >
Definition: node_type.hpp:62
@ CONTAINER_STYLE_BLOCK
Definition: node_type.hpp:92
@ _KEYMASK
Definition: node_type.hpp:97
@ VAL_STYLE
mask of all the scalar styles for val (not container styles!)
Definition: node_type.hpp:89
@ KEYTAG
the key has a tag
Definition: node_type.hpp:43
@ CONTAINER_STYLE_FLOW
Definition: node_type.hpp:91
@ SCALAR_SQUO
Definition: node_type.hpp:83
@ FLOW_SL
mark container with single-line flow style (seqs as '[val1,val2], maps as '{key: val,...
Definition: node_type.hpp:56
@ FLOW_ML
(NOT IMPLEMENTED, work in progress) mark container with multi-line flow style (seqs as '[ val1,...
Definition: node_type.hpp:57
@ VAL_UNFILT
the val scalar was left unfiltered; the parser was set not to filter.
Definition: node_type.hpp:52
@ VAL
a scalar: has a scalar (ie string) value, possibly empty. must be a leaf node, and cannot be MAP or S...
Definition: node_type.hpp:34
@ VALTAG
the val has a tag
Definition: node_type.hpp:44
@ SCALAR_STYLE
Definition: node_type.hpp:90
@ _TYMASK
all the bits up to here
Definition: node_type.hpp:47
@ SCALAR_LITERAL
Definition: node_type.hpp:81
@ SEQ
a seq: a parent of VAL/SEQ/MAP nodes
Definition: node_type.hpp:36
@ SCALAR_DQUO
Definition: node_type.hpp:84
@ VAL_SQUO
mark val scalar as single quoted '
Definition: node_type.hpp:64
@ KEY_STYLE
mask of all the scalar styles for key (not container styles!)
Definition: node_type.hpp:88
@ VAL_PLAIN
mark val scalar as plain scalar (unquoted, even when multiline)
Definition: node_type.hpp:68
@ KEYREF
a *reference: the key references an &anchor
Definition: node_type.hpp:39
@ BLOCK
mark container with block style (seqs as '- val ', maps as 'key: val')
Definition: node_type.hpp:58
@ KEYANCH
the key has an &anchor
Definition: node_type.hpp:41
@ VALQUO
val style is one of ', ", > or |
Definition: node_type.hpp:87
@ VAL_DQUO
mark val scalar as double quoted "
Definition: node_type.hpp:66
@ CONTAINER_STYLE
Definition: node_type.hpp:93
@ KEY_UNFILT
the key scalar was left unfiltered; the parser was set not to filter.
Definition: node_type.hpp:51
@ KEY_SQUO
mark key scalar as single quoted '
Definition: node_type.hpp:63
@ VAL_LITERAL
mark val scalar as multiline, block literal |
Definition: node_type.hpp:60
@ KEY_LITERAL
mark key scalar as multiline, block literal |
Definition: node_type.hpp:59
@ KEY_PLAIN
mark key scalar as plain scalar (unquoted, even when multiline)
Definition: node_type.hpp:67
@ SCALAR_PLAIN
Definition: node_type.hpp:85
@ _VALMASK
Definition: node_type.hpp:98
@ KEY_FOLDED
mark key scalar as multiline, block folded >
Definition: node_type.hpp:61
@ KEYNIL
the key is null (eg { : b} results in a null key)
Definition: node_type.hpp:45
@ DOC
a document
Definition: node_type.hpp:37
Definition: common.cpp:12
#define __(v)
Definition: node_type.hpp:31
wraps a NodeType_e element with some syntactic sugar and predicates
Definition: node_type.hpp:117
bool has_all(NodeType_e t) const noexcept
Definition: node_type.hpp:129
bool is_val_squo() const noexcept
Definition: node_type.hpp:212
bool is_key_plain() const noexcept
Definition: node_type.hpp:215
bool has_key() const noexcept
Definition: node_type.hpp:170
bool is_quoted() const noexcept
Definition: node_type.hpp:219
bool is_val_folded() const noexcept
Definition: node_type.hpp:210
bool has_none(NodeType_e t) const noexcept
Definition: node_type.hpp:130
bool has_key_tag() const noexcept
Definition: node_type.hpp:176
bool is_ref() const noexcept
Definition: node_type.hpp:183
NodeType(NodeType_e t) noexcept
Definition: node_type.hpp:125
void set_container_style(NodeType_e style) noexcept
Definition: node_type.hpp:221
bool is_key_ref() const noexcept
Definition: node_type.hpp:181
void set_key_style(NodeType_e style) noexcept
Definition: node_type.hpp:222
bool key_is_null() const noexcept
Definition: node_type.hpp:174
bool has_any(NodeType_e t) const noexcept
Definition: node_type.hpp:128
bool is_key_dquo() const noexcept
Definition: node_type.hpp:213
bool is_doc() const noexcept
Definition: node_type.hpp:166
bool is_seq() const noexcept
Definition: node_type.hpp:169
bool is_val_plain() const noexcept
Definition: node_type.hpp:216
bool is_notype() const noexcept
Definition: node_type.hpp:164
bool is_key_quoted() const noexcept
Definition: node_type.hpp:217
bool is_flow_ml() const noexcept
Definition: node_type.hpp:202
void rem(NodeType_e t) noexcept
Definition: node_type.hpp:134
const char * type_str() const noexcept
return a preset string based on the node type
Definition: node_type.hpp:150
bool has_val_anchor() const noexcept
Definition: node_type.hpp:179
bool is_key_unfiltered() const noexcept
Definition: node_type.hpp:185
bool has_val_tag() const noexcept
Definition: node_type.hpp:177
bool is_key_literal() const noexcept
Definition: node_type.hpp:207
bool is_key_squo() const noexcept
Definition: node_type.hpp:211
bool has_anchor() const noexcept
Definition: node_type.hpp:180
NodeType(type_bits t) noexcept
Definition: node_type.hpp:126
bool has_key_anchor() const noexcept
Definition: node_type.hpp:178
bool has_val() const noexcept
Definition: node_type.hpp:171
void clear() noexcept
Definition: node_type.hpp:137
bool is_val_unfiltered() const noexcept
Definition: node_type.hpp:186
bool is_flow_sl() const noexcept
Definition: node_type.hpp:201
bool is_map() const noexcept
Definition: node_type.hpp:168
bool is_val_styled() const noexcept
Definition: node_type.hpp:206
bool is_key_folded() const noexcept
Definition: node_type.hpp:209
bool is_container() const noexcept
Definition: node_type.hpp:167
bool is_container_styled() const noexcept
Definition: node_type.hpp:199
bool is_val_literal() const noexcept
Definition: node_type.hpp:208
bool is_key_styled() const noexcept
Definition: node_type.hpp:205
NodeType_e type
Definition: node_type.hpp:120
bool is_block() const noexcept
Definition: node_type.hpp:200
bool val_is_null() const noexcept
Definition: node_type.hpp:175
void set_val_style(NodeType_e style) noexcept
Definition: node_type.hpp:223
void addrem(NodeType_e bits_to_add, NodeType_e bits_to_remove) noexcept
Definition: node_type.hpp:135
void add(NodeType_e t) noexcept
Definition: node_type.hpp:133
csubstr type_str(substr buf) const noexcept
fill a string with the node type flags.
Definition: node_type.hpp:155
void set(NodeType_e t) noexcept
Definition: node_type.hpp:132
bool is_keyval() const noexcept
Definition: node_type.hpp:173
bool is_val() const noexcept
Definition: node_type.hpp:172
bool is_val_ref() const noexcept
Definition: node_type.hpp:182
bool is_val_quoted() const noexcept
Definition: node_type.hpp:218
bool is_val_dquo() const noexcept
Definition: node_type.hpp:214
bool is_stream() const noexcept
Definition: node_type.hpp:165
NodeType() noexcept
Definition: node_type.hpp:124
bool is_flow() const noexcept
Definition: node_type.hpp:203