rapidyaml 0.15.2
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
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
8C4_SUPPRESS_WARNING_MSVC_PUSH
9C4_SUPPRESS_WARNING_GCC_CLANG_PUSH
10C4_SUPPRESS_WARNING_GCC_CLANG("-Wold-style-cast")
11#if defined(__GNUC__) && __GNUC__ >= 6
12C4_SUPPRESS_WARNING_GCC("-Wnull-dereference")
13#endif
14// NOLINTBEGIN(modernize-avoid-c-style-cast)
15
16namespace c4 {
17namespace yml {
18
19/** @addtogroup doc_node_type
20 *
21 * @{
22 */
23
24
25/** the integral type necessary to cover all the bits for NodeType_e */
26using type_bits = uint32_t;
27
28
29/** a bit mask for marking node types and styles */
30typedef enum : type_bits { // NOLINT
31 #define b_(v) (type_bits(1) << v) // a convenience define, undefined below // NOLINT
32 NOTYPE = 0, ///< no node type or style is set
33 KEY = b_(0), ///< the scalar to the left of `:` in a map's member
34 VAL = b_(1), ///< a scalar: has a scalar (ie string) value, possibly empty. must be a leaf node, and cannot be MAP or SEQ
35 MAP = b_(2), ///< a map: a parent of KEYVAL/KEYSEQ/KEYMAP nodes
36 SEQ = b_(3), ///< a seq: a parent of VAL/SEQ/MAP nodes
37 DOC = b_(4), ///< a document
38 STREAM = b_(5)|SEQ, ///< a stream: a seq of docs
39 KEYREF = b_(6), ///< a *reference: the key references an &anchor
40 VALREF = b_(7), ///< a *reference: the val references an &anchor
41 KEYANCH = b_(8), ///< the key has an &anchor
42 VALANCH = b_(9), ///< the val has an &anchor
43 KEYTAG = b_(10), ///< the key has a tag
44 VALTAG = b_(11), ///< the val has a tag
45 KEYNIL = b_(12), ///< the key is null (eg `{ : b}` results in a null key)
46 VALNIL = b_(13), ///< the val is null (eg `{a : }` results in a null val)
47 TYMASK_ = b_(14)-1, ///< all the bits up to here
48 //
49 // unfiltered flags:
50 //
51 KEY_UNFILT = b_(14), ///< the key scalar was left unfiltered; the parser was set not to filter. @see @ref ParserOptions::scalar_filtering()
52 VAL_UNFILT = b_(15), ///< the val scalar was left unfiltered; the parser was set not to filter. @see @ref ParserOptions::scalar_filtering()
53 //
54 // style flags:
55 //
56 FLOW_SL = b_(16), ///< mark container with single-line flow style
57 ///< - seqs as
58 ///< @code{yaml}
59 ///< [val1,val2]
60 ///< @endcode
61 ///< when @ref FLOW_SPC is not set, or
62 ///< @code{yaml}
63 ///< [val1, val2]
64 ///< @endcode
65 ///< when @ref FLOW_SPC is set (or @ref EmitOptions::force_flow_spc() is set)
66 ///< - maps as
67 ///< @code{yaml}
68 ///< {key1: val1,key2: val2}
69 ///< @endcode
70 ///< when @ref FLOW_SPC is not set, or
71 ///< @code{yaml}
72 ///< {key1: val1, key2: val2}
73 ///< @endcode
74 ///< when @ref FLOW_SPC is set (or @ref EmitOptions::force_flow_spc() is set)
75 FLOW_ML1 = b_(17), ///< mark container with multi-line flow style, 1 element per line
76 ///< - seqs as
77 ///< @code{yaml}
78 ///< [
79 ///< val1,
80 ///< val2
81 ///< ]
82 ///< @endcode
83 ///< - maps as
84 ///< @code{yaml}
85 ///< {
86 ///< key: val,
87 ///< key2: val2
88 ///< }
89 ///< @endcode
90 FLOW_MLN = b_(18), ///< mark container with multi-line flow style, n elements per line,
91 ///< wrapped (as set by @ref EmitOptions::max_cols()):
92 ///< - seqs as
93 ///< @code{yaml}
94 ///< [
95 ///< val,val,...
96 ///< val,val,...
97 ///< val,val,...
98 ///< ...
99 ///< val
100 ///< ]
101 ///< @endcode
102 ///< when @ref FLOW_SPC is not set, or
103 ///< @code{yaml}
104 ///< [
105 ///< val, val,...
106 ///< val, val,...
107 ///< val, val,...
108 ///< ...
109 ///< val
110 ///< ]
111 ///< @endcode
112 ///< when @ref FLOW_SPC is set (or @ref EmitOptions::force_flow_spc() is set)
113 ///< - maps as
114 ///< @code{yaml}
115 ///< {
116 ///< key: val,key: val,...
117 ///< key: val,key: val,...
118 ///< ...
119 ///< key: val
120 ///< }
121 ///< @endcode
122 ///< when @ref FLOW_SPC is not set, or
123 ///< @code{yaml}
124 ///< {
125 ///< key: val, key: val,...
126 ///< key: val, key: val,...
127 ///< ...
128 ///< key: val
129 ///< }
130 ///< @endcode
131 ///< when @ref FLOW_SPC is set (or @ref EmitOptions::force_flow_spc() is set)
132 FLOW_SPC = b_(19), ///< mark container with spaces after comma when in flow mode.
133 ///< Applies to both @ref FLOW_SL and @ref FLOW_MLN (but not
134 ///< to @ref FLOW_ML1), and can be overriden globally by
135 ///< @ref EmitOptions::force_flow_spc().
136 BLOCK = b_(20), ///< mark container with block style
137 ///< - seqs as
138 ///< @code{yaml}
139 ///< - val1
140 ///< - val2
141 ///< @endcode
142 ///< - maps as
143 ///< @code{yaml}
144 ///< key1: val1
145 ///< key2: val2
146 ///< @endcode
147 KEY_LITERAL = b_(21), ///< mark key scalar as multiline, block literal |
148 VAL_LITERAL = b_(22), ///< mark val scalar as multiline, block literal |
149 KEY_FOLDED = b_(23), ///< mark key scalar as multiline, block folded >
150 VAL_FOLDED = b_(24), ///< mark val scalar as multiline, block folded >
151 KEY_SQUO = b_(25), ///< mark key scalar as single quoted '
152 VAL_SQUO = b_(26), ///< mark val scalar as single quoted '
153 KEY_DQUO = b_(27), ///< mark key scalar as double quoted "
154 VAL_DQUO = b_(28), ///< mark val scalar as double quoted "
155 KEY_PLAIN = b_(29), ///< mark key scalar as plain scalar (unquoted, even when multiline)
156 VAL_PLAIN = b_(30), ///< mark val scalar as plain scalar (unquoted, even when multiline)
157 //
158 // type combination masks:
159 //
160 KEYVAL = KEY|VAL, ///< mask of @ref KEY|@ref VAL
161 KEYSEQ = KEY|SEQ, ///< mask of @ref KEY|@ref SEQ
162 KEYMAP = KEY|MAP, ///< mask of @ref KEY|@ref MAP
163 DOCMAP = DOC|MAP, ///< mask of @ref DOC|@ref MAP
164 DOCSEQ = DOC|SEQ, ///< mask of @ref DOC|@ref SEQ
165 DOCVAL = DOC|VAL, ///< mask of @ref DOC|@ref VAL
166 //
167 // style combination masks:
168 //
169 SCALAR_LITERAL = KEY_LITERAL|VAL_LITERAL, ///< mask of @ref KEY_LITERAL|@ref VAL_LITERAL,
170 SCALAR_FOLDED = KEY_FOLDED|VAL_FOLDED, ///< mask of @ref KEY_FOLDED|@ref VAL_FOLDED,
171 SCALAR_SQUO = KEY_SQUO|VAL_SQUO, ///< mask of @ref KEY_SQUO|@ref VAL_SQUO,
172 SCALAR_DQUO = KEY_DQUO|VAL_DQUO, ///< mask of @ref KEY_DQUO|@ref VAL_DQUO,
173 SCALAR_PLAIN = KEY_PLAIN|VAL_PLAIN, ///< mask of @ref KEY_PLAIN|@ref VAL_PLAIN,
174 KEYQUO = KEY_SQUO|KEY_DQUO|KEY_FOLDED|KEY_LITERAL, ///< key style is one of `'">|`. mask of @ref KEY_SQUO|@ref KEY_DQUO|@ref KEY_FOLDED|@ref KEY_LITERAL
175 VALQUO = VAL_SQUO|VAL_DQUO|VAL_FOLDED|VAL_LITERAL, ///< val style is one of `'">|`. mask of @ref VAL_SQUO|@ref VAL_DQUO|@ref VAL_FOLDED|@ref VAL_LITERAL
176 KEY_STYLE = KEYQUO|KEY_PLAIN, ///< mask of @ref KEYQUO|@ref KEY_PLAIN : all the key scalar styles for key (not container styles!)
177 VAL_STYLE = VALQUO|VAL_PLAIN, ///< mask of @ref VALQUO|@ref VAL_PLAIN : all the val scalar styles for val (not container styles!)
178 SCALAR_STYLE = KEY_STYLE|VAL_STYLE, ///< mask of @ref KEY_STYLE|@ref VAL_STYLE : all the key+val scalar styles
179 FLOW_MLX = FLOW_ML1|FLOW_MLN, ///< mask of @ref FLOW_ML1|@ref FLOW_MLN : all the flow multiline styles
180 CONTAINER_STYLE_FLOW = FLOW_SL|FLOW_MLX|FLOW_SPC, ///< mask of @ref FLOW_SL|@ref FLOW_MLX|@ref FLOW_SPC : all flow flags
181 CONTAINER_STYLE_BLOCK = BLOCK, ///< alias to @ref BLOCK
182 CONTAINER_STYLE = CONTAINER_STYLE_FLOW|CONTAINER_STYLE_BLOCK, ///< mask of @ref CONTAINER_STYLE_FLOW|@ref CONTAINER_STYLE_BLOCK : all container style flags
183 STYLE = SCALAR_STYLE | CONTAINER_STYLE, ///< mask of @ref SCALAR_STYLE | @ref CONTAINER_STYLE : all style flags
184 //
185 // mixed masks
186 /** @cond dev */
187 KEYMASK_ = KEY | KEYQUO | KEYANCH | KEYREF | KEYTAG,
188 VALMASK_ = VAL | VALQUO | VALANCH | VALREF | VALTAG,
189 #undef b_
190 #ifdef RYML_HAS_DEPRECATED_ENUMS_
191 FLOW_ML RYML_DEPRECATED("use one of FLOW_ML{1,N,X}") = FLOW_ML1,
192 #endif
193 /** @endcond */
195
196/** @cond dev */
197using NodeType_e RYML_DEPRECATED("use NodeTypeBits") = NodeTypeBits;
198#ifndef RYML_HAS_DEPRECATED_ENUMS_
199// defined here because the current c++ standard / compiler cannot
200// handle deprecated enums
201RYML_DEPRECATED("use one of FLOW_ML{1,N,X}")
202constexpr const type_bits FLOW_ML = FLOW_ML1;
203#endif
204/** @endcond */
205
206
207//-----------------------------------------------------------------------------
208//-----------------------------------------------------------------------------
209//-----------------------------------------------------------------------------
210
211/** Wraps a @ref type_bits mask of @ref NodeTypeBits flags with some
212 * syntactic sugar and predicates. */
214{
215public:
216
218
219public:
220
221 /** @name auto convert to type_bits
222 * @{ */
223
224 C4_ALWAYS_INLINE operator type_bits & () noexcept { return m_bits; }
225 C4_ALWAYS_INLINE operator type_bits const& () const noexcept { return m_bits; }
226
227 /** @} */
228
229public:
230
231 /** @name ctor
232 * @{ */
233
234 C4_ALWAYS_INLINE NodeType() noexcept : m_bits(NOTYPE) {}
235 C4_ALWAYS_INLINE NodeType(type_bits t) noexcept : m_bits(t) {}
236
237 /** @} */
238
239public:
240
241 /** @name query / set
242 * @{ */
243
244 C4_ALWAYS_INLINE bool has_any(type_bits t) const noexcept { return (m_bits & t) != 0u; }
245 C4_ALWAYS_INLINE bool has_all(type_bits t) const noexcept { return (m_bits & t) == t; }
246 C4_ALWAYS_INLINE bool has_none(type_bits t) const noexcept { return (m_bits & t) == 0; }
247
248 C4_ALWAYS_INLINE void set(type_bits t) noexcept { m_bits = t; }
249 C4_ALWAYS_INLINE void add(type_bits t) noexcept { m_bits |= t; }
250 C4_ALWAYS_INLINE void rem(type_bits t) noexcept { m_bits &= ~t; }
251 C4_ALWAYS_INLINE void addrem(type_bits bits_to_add, type_bits bits_to_remove) noexcept { m_bits |= bits_to_add; m_bits &= ~bits_to_remove; }
252
253 C4_ALWAYS_INLINE void clear() noexcept { m_bits = NOTYPE; }
254
255 /** @} */
256
257public:
258
259 /** @name convert to string
260 * @{ */
261
262 /** return a preset string based on the node type */
263 C4_ALWAYS_INLINE const char *type_str() const noexcept { return type_str(m_bits); }
264 /** return a preset string based on the node type */
265 static const char* type_str(type_bits t) noexcept;
266
267 /** fill a string with the node type flags. */
268 C4_ALWAYS_INLINE size_t type_str(substr buf) const noexcept { return type_str(buf, m_bits); }
269 /** fill a string with the node type flags. */
270 static size_t type_str(substr buf, type_bits t) noexcept;
271
272 /** fill a string with the node type flags. If the string is small, returns {null, len} */
273 C4_ALWAYS_INLINE csubstr type_str_sub(substr buf) const noexcept { return type_str_sub(buf, m_bits); }
274 /** fill a string with the node type flags. If the string is small, returns {null, len} */
275 static csubstr type_str_sub(substr buf, type_bits t) noexcept
276 {
277 csubstr ret;
278 ret.len = type_str(buf, t);
279 ret.str = ret.len < buf.len ? buf.str : nullptr;
280 return ret;
281 }
282
283 /** @} */
284
285public:
286
287 /** @name node type predicates
288 * @{ */
289
290 C4_ALWAYS_INLINE bool is_notype() const noexcept { return m_bits == NOTYPE; }
291 C4_ALWAYS_INLINE bool is_stream() const noexcept { return ((m_bits & STREAM) == STREAM) != 0; }
292 C4_ALWAYS_INLINE bool is_doc() const noexcept { return (m_bits & DOC) != 0; }
293 C4_ALWAYS_INLINE bool is_container() const noexcept { return (m_bits & (MAP|SEQ|STREAM)) != 0; }
294 C4_ALWAYS_INLINE bool is_map() const noexcept { return (m_bits & MAP) != 0; }
295 C4_ALWAYS_INLINE bool is_seq() const noexcept { return (m_bits & SEQ) != 0; }
296 C4_ALWAYS_INLINE bool has_key() const noexcept { return (m_bits & KEY) != 0; }
297 C4_ALWAYS_INLINE bool has_val() const noexcept { return (m_bits & VAL) != 0; }
298 C4_ALWAYS_INLINE bool is_val() const noexcept { return (m_bits & KEYVAL) == VAL; }
299 C4_ALWAYS_INLINE bool is_keyval() const noexcept { return (m_bits & KEYVAL) == KEYVAL; }
300 C4_ALWAYS_INLINE bool key_is_null() const noexcept { return (m_bits & KEYNIL) != 0; }
301 C4_ALWAYS_INLINE bool val_is_null() const noexcept { return (m_bits & VALNIL) != 0; }
302 C4_ALWAYS_INLINE bool has_key_tag() const noexcept { return (m_bits & KEYTAG) != 0; }
303 C4_ALWAYS_INLINE bool has_val_tag() const noexcept { return (m_bits & VALTAG) != 0; }
304 C4_ALWAYS_INLINE bool has_key_anchor() const noexcept { return (m_bits & KEYANCH) != 0; }
305 C4_ALWAYS_INLINE bool has_val_anchor() const noexcept { return (m_bits & VALANCH) != 0; }
306 C4_ALWAYS_INLINE bool has_anchor() const noexcept { return (m_bits & (KEYANCH|VALANCH)) != 0; }
307 C4_ALWAYS_INLINE bool is_key_ref() const noexcept { return (m_bits & KEYREF) != 0; }
308 C4_ALWAYS_INLINE bool is_val_ref() const noexcept { return (m_bits & VALREF) != 0; }
309 C4_ALWAYS_INLINE bool is_ref() const noexcept { return (m_bits & (KEYREF|VALREF)) != 0; }
310
311 C4_ALWAYS_INLINE bool is_key_unfiltered() const noexcept { return (m_bits & (KEY_UNFILT)) != 0; }
312 C4_ALWAYS_INLINE bool is_val_unfiltered() const noexcept { return (m_bits & (VAL_UNFILT)) != 0; }
313
314 /** @} */
315
316public:
317
318 /** @name node style predicates
319 * @{ */
320
321 C4_ALWAYS_INLINE bool is_container_styled() const noexcept { return (m_bits & (CONTAINER_STYLE)) != 0; }
322 C4_ALWAYS_INLINE bool is_block() const noexcept { return (m_bits & (BLOCK)) != 0; }
323 C4_ALWAYS_INLINE bool is_flow_sl() const noexcept { return (m_bits & (FLOW_SL)) != 0; }
324 C4_ALWAYS_INLINE bool is_flow_ml1() const noexcept { return (m_bits & (FLOW_ML1)) != 0; }
325 C4_ALWAYS_INLINE bool is_flow_mln() const noexcept { return (m_bits & (FLOW_MLN)) != 0; }
326 C4_ALWAYS_INLINE bool is_flow_mlx() const noexcept { return (m_bits & (FLOW_ML1|FLOW_MLN)) != 0; }
327 C4_ALWAYS_INLINE bool is_flow() const noexcept { return (m_bits & (FLOW_ML1|FLOW_MLN|FLOW_SL)) != 0; }
328 C4_ALWAYS_INLINE bool has_flow_space() const noexcept { return (m_bits & (FLOW_SPC)) != 0; }
329
330 C4_ALWAYS_INLINE bool is_key_styled() const noexcept { return (m_bits & (KEY_STYLE)) != 0; }
331 C4_ALWAYS_INLINE bool is_val_styled() const noexcept { return (m_bits & (VAL_STYLE)) != 0; }
332 C4_ALWAYS_INLINE bool is_key_literal() const noexcept { return (m_bits & (KEY_LITERAL)) != 0; }
333 C4_ALWAYS_INLINE bool is_val_literal() const noexcept { return (m_bits & (VAL_LITERAL)) != 0; }
334 C4_ALWAYS_INLINE bool is_key_folded() const noexcept { return (m_bits & (KEY_FOLDED)) != 0; }
335 C4_ALWAYS_INLINE bool is_val_folded() const noexcept { return (m_bits & (VAL_FOLDED)) != 0; }
336 C4_ALWAYS_INLINE bool is_key_squo() const noexcept { return (m_bits & (KEY_SQUO)) != 0; }
337 C4_ALWAYS_INLINE bool is_val_squo() const noexcept { return (m_bits & (VAL_SQUO)) != 0; }
338 C4_ALWAYS_INLINE bool is_key_dquo() const noexcept { return (m_bits & (KEY_DQUO)) != 0; }
339 C4_ALWAYS_INLINE bool is_val_dquo() const noexcept { return (m_bits & (VAL_DQUO)) != 0; }
340 C4_ALWAYS_INLINE bool is_key_plain() const noexcept { return (m_bits & (KEY_PLAIN)) != 0; }
341 C4_ALWAYS_INLINE bool is_val_plain() const noexcept { return (m_bits & (VAL_PLAIN)) != 0; }
342 C4_ALWAYS_INLINE bool is_key_quoted() const noexcept { return (m_bits & KEYQUO) != 0; }
343 C4_ALWAYS_INLINE bool is_val_quoted() const noexcept { return (m_bits & VALQUO) != 0; }
344 C4_ALWAYS_INLINE bool is_quoted() const noexcept { return (m_bits & (KEYQUO|VALQUO)) != 0; }
345
346 C4_ALWAYS_INLINE NodeType key_style() const noexcept { return (m_bits & (KEY_STYLE)); }
347 C4_ALWAYS_INLINE NodeType val_style() const noexcept { return (m_bits & (VAL_STYLE)); }
348
349 C4_ALWAYS_INLINE void set_container_style(type_bits style) noexcept { m_bits = ((style & CONTAINER_STYLE) | (m_bits & ~CONTAINER_STYLE)); }
350 C4_ALWAYS_INLINE void set_key_style(type_bits style) noexcept { m_bits = ((style & KEY_STYLE) | (m_bits & ~KEY_STYLE)); }
351 C4_ALWAYS_INLINE void set_val_style(type_bits style) noexcept { m_bits = ((style & VAL_STYLE) | (m_bits & ~VAL_STYLE)); }
352 C4_ALWAYS_INLINE void clear_style() noexcept { m_bits &= ~STYLE; }
353
354 /** @} */
355
356public: // deprecated methods
357
358 /** @cond dev */ // LCOV_EXCL_START
359 RYML_DEPRECATED("use has_key_anchor()") bool is_key_anchor() const noexcept { return has_key_anchor(); }
360 RYML_DEPRECATED("use has_val_anchor()") bool is_val_anchor() const noexcept { return has_val_anchor(); }
361 RYML_DEPRECATED("use has_anchor()") bool is_anchor() const noexcept { return has_anchor(); }
362 RYML_DEPRECATED("use has_anchor() || is_ref()") bool is_anchor_or_ref() const noexcept { return has_anchor() || is_ref(); }
363 RYML_DEPRECATED("use one of .is_flow_ml{1,n,x}()") bool is_flow_ml() const noexcept { return (m_bits & (FLOW_ML1)) != 0; }
364 /** @endcond */ // LCOV_EXCL_STOP
365};
366
367/** @} */
368
369} // namespace yml
370} // namespace c4
371
372// NOLINTEND(modernize-avoid-c-style-cast)
373C4_SUPPRESS_WARNING_MSVC_POP
374C4_SUPPRESS_WARNING_GCC_CLANG_POP
375
376#endif /* C4_YML_NODE_TYPE_HPP_ */
Common utilities and infrastructure used by ryml.
#define RYML_EXPORT
Definition export.hpp:18
NodeTypeBits
a bit mask for marking node types and styles
Definition node_type.hpp:30
uint32_t type_bits
the integral type necessary to cover all the bits for NodeType_e
Definition node_type.hpp:26
@ 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
mask of KEY_FOLDED|VAL_FOLDED,
@ TYMASK_
all the bits up to here
Definition node_type.hpp:47
@ KEY_DQUO
mark key scalar as double quoted "
@ 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
@ FLOW_MLX
mask of FLOW_ML1|FLOW_MLN : all the flow multiline styles
@ STREAM
a stream: a seq of docs
Definition node_type.hpp:38
@ KEY
the scalar to the left of : in a map's member
Definition node_type.hpp:33
@ KEYQUO
key style is one of '">|. mask of KEY_SQUO|KEY_DQUO|KEY_FOLDED|KEY_LITERAL
@ FLOW_ML1
mark container with multi-line flow style, 1 element per line
Definition node_type.hpp:75
@ VAL_FOLDED
mark val scalar as multiline, block folded >
@ CONTAINER_STYLE_BLOCK
alias to BLOCK
@ VAL_STYLE
mask of VALQUO|VAL_PLAIN : all the val scalar styles for val (not container styles!...
@ KEYTAG
the key has a tag
Definition node_type.hpp:43
@ CONTAINER_STYLE_FLOW
mask of FLOW_SL|FLOW_MLX|FLOW_SPC : all flow flags
@ SCALAR_SQUO
mask of KEY_SQUO|VAL_SQUO,
@ FLOW_SL
mark container with single-line flow style
Definition node_type.hpp:56
@ 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
@ KEYMAP
mask of KEY|MAP
@ VALTAG
the val has a tag
Definition node_type.hpp:44
@ SCALAR_STYLE
mask of KEY_STYLE|VAL_STYLE : all the key+val scalar styles
@ KEYSEQ
mask of KEY|SEQ
@ FLOW_MLN
mark container with multi-line flow style, n elements per line, wrapped (as set by EmitOptions::max_c...
Definition node_type.hpp:90
@ SCALAR_LITERAL
mask of KEY_LITERAL|VAL_LITERAL,
@ SEQ
a seq: a parent of VAL/SEQ/MAP nodes
Definition node_type.hpp:36
@ SCALAR_DQUO
mask of KEY_DQUO|VAL_DQUO,
@ VAL_SQUO
mark val scalar as single quoted '
@ DOCSEQ
mask of DOC|SEQ
@ KEY_STYLE
mask of KEYQUO|KEY_PLAIN : all the key scalar styles for key (not container styles!...
@ VAL_PLAIN
mark val scalar as plain scalar (unquoted, even when multiline)
@ KEYREF
a *reference: the key references an &anchor
Definition node_type.hpp:39
@ DOCMAP
mask of DOC|MAP
@ BLOCK
mark container with block style
@ FLOW_SPC
mark container with spaces after comma when in flow mode. Applies to both FLOW_SL and FLOW_MLN (but n...
@ DOCVAL
mask of DOC|VAL
@ STYLE
mask of SCALAR_STYLE | CONTAINER_STYLE : all style flags
@ KEYVAL
mask of KEY|VAL
@ KEYANCH
the key has an &anchor
Definition node_type.hpp:41
@ VALQUO
val style is one of '">|. mask of VAL_SQUO|VAL_DQUO|VAL_FOLDED|VAL_LITERAL
@ VAL_DQUO
mark val scalar as double quoted "
@ CONTAINER_STYLE
mask of CONTAINER_STYLE_FLOW|CONTAINER_STYLE_BLOCK : all container style flags
@ 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 '
@ VAL_LITERAL
mark val scalar as multiline, block literal |
@ KEY_LITERAL
mark key scalar as multiline, block literal |
@ KEY_PLAIN
mark key scalar as plain scalar (unquoted, even when multiline)
@ SCALAR_PLAIN
mask of KEY_PLAIN|VAL_PLAIN,
@ KEY_FOLDED
mark key scalar as multiline, block folded >
@ 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
basic_substring< char > substr
a mutable string view
Definition substr.hpp:2355
basic_substring< const char > csubstr
an immutable string view
Definition substr.hpp:2356
#define b_(v)
Definition node_type.hpp:31
size_t len
the length of the substring
Definition substr.hpp:218
C * str
a restricted pointer to the first character of the substring
Definition substr.hpp:216
bool is_val_squo() const noexcept
bool is_key_plain() const noexcept
bool is_flow_mln() const noexcept
bool has_key() const noexcept
bool is_quoted() const noexcept
bool is_val_folded() const noexcept
bool has_key_tag() const noexcept
static csubstr type_str_sub(substr buf, type_bits t) noexcept
fill a string with the node type flags.
bool is_ref() const noexcept
bool has_flow_space() const noexcept
bool is_key_ref() const noexcept
bool key_is_null() const noexcept
bool is_key_dquo() const noexcept
bool is_doc() const noexcept
bool is_seq() const noexcept
bool is_val_plain() const noexcept
bool is_notype() const noexcept
bool is_key_quoted() const noexcept
bool is_flow_mlx() const noexcept
void set_key_style(type_bits style) noexcept
void set_val_style(type_bits style) noexcept
bool has_val_anchor() const noexcept
bool is_key_unfiltered() const noexcept
bool has_val_tag() const noexcept
bool is_key_literal() const noexcept
bool is_key_squo() const noexcept
bool has_all(type_bits t) const noexcept
bool has_anchor() const noexcept
void rem(type_bits t) noexcept
NodeType(type_bits t) noexcept
bool has_key_anchor() const noexcept
bool has_none(type_bits t) const noexcept
bool has_val() const noexcept
void set(type_bits t) noexcept
void clear() noexcept
bool is_val_unfiltered() const noexcept
bool is_flow_ml1() const noexcept
bool is_flow_sl() const noexcept
const char * type_str() const noexcept
return a preset string based on the node type
bool is_map() const noexcept
bool is_val_styled() const noexcept
bool is_key_folded() const noexcept
bool is_container() const noexcept
bool is_container_styled() const noexcept
bool is_val_literal() const noexcept
void add(type_bits t) noexcept
bool is_key_styled() const noexcept
void addrem(type_bits bits_to_add, type_bits bits_to_remove) noexcept
bool is_block() const noexcept
NodeType val_style() const noexcept
bool val_is_null() const noexcept
void set_container_style(type_bits style) noexcept
size_t type_str(substr buf) const noexcept
fill a string with the node type flags.
bool is_keyval() const noexcept
bool is_val() const noexcept
void clear_style() noexcept
bool is_val_ref() const noexcept
bool is_val_quoted() const noexcept
bool is_val_dquo() const noexcept
NodeType key_style() const noexcept
bool is_stream() const noexcept
NodeType() noexcept
bool has_any(type_bits t) const noexcept
bool is_flow() const noexcept
csubstr type_str_sub(substr buf) const noexcept
fill a string with the node type flags.