1#ifndef C4_YML_NODE_TYPE_HPP_
2#define C4_YML_NODE_TYPE_HPP_
4#ifndef C4_YML_COMMON_HPP_
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")
31 #define b_(v) (type_bits(1) << v)
190 #ifdef RYML_HAS_DEPRECATED_ENUMS_
191 FLOW_ML RYML_DEPRECATED(
"use one of FLOW_ML{1,N,X}") =
FLOW_ML1,
197using NodeType_e RYML_DEPRECATED(
"use NodeTypeBits") =
NodeTypeBits;
198#ifndef RYML_HAS_DEPRECATED_ENUMS_
201RYML_DEPRECATED(
"use one of FLOW_ML{1,N,X}")
265 static const char* type_str(
type_bits t)
noexcept;
279 ret.
str = ret.
len < buf.len ? buf.str :
nullptr;
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; }
373C4_SUPPRESS_WARNING_MSVC_POP
374C4_SUPPRESS_WARNING_GCC_CLANG_POP
Common utilities and infrastructure used by ryml.
NodeTypeBits
a bit mask for marking node types and styles
uint32_t type_bits
the integral type necessary to cover all the bits for NodeType_e
@ VALANCH
the val has an &anchor
@ NOTYPE
no node type or style is set
@ SCALAR_FOLDED
mask of KEY_FOLDED|VAL_FOLDED,
@ TYMASK_
all the bits up to here
@ KEY_DQUO
mark key scalar as double quoted "
@ VALREF
a *reference: the val references an &anchor
@ VALNIL
the val is null (eg {a : } results in a null val)
@ MAP
a map: a parent of KEYVAL/KEYSEQ/KEYMAP nodes
@ FLOW_MLX
mask of FLOW_ML1|FLOW_MLN : all the flow multiline styles
@ STREAM
a stream: a seq of docs
@ KEY
the scalar to the left of : in a map's member
@ 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
@ 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
@ 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
@ VAL_UNFILT
the val scalar was left unfiltered; the parser was set not to filter.
@ VAL
a scalar: has a scalar (ie string) value, possibly empty. must be a leaf node, and cannot be MAP or S...
@ VALTAG
the val has a tag
@ SCALAR_STYLE
mask of KEY_STYLE|VAL_STYLE : all the key+val scalar styles
@ FLOW_MLN
mark container with multi-line flow style, n elements per line, wrapped (as set by EmitOptions::max_c...
@ SCALAR_LITERAL
mask of KEY_LITERAL|VAL_LITERAL,
@ SEQ
a seq: a parent of VAL/SEQ/MAP nodes
@ SCALAR_DQUO
mask of KEY_DQUO|VAL_DQUO,
@ VAL_SQUO
mark val scalar as single quoted '
@ 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
@ 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...
@ STYLE
mask of SCALAR_STYLE | CONTAINER_STYLE : all style flags
@ KEYANCH
the key has an &anchor
@ 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.
@ 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)
basic_substring< char > substr
a mutable string view
basic_substring< const char > csubstr
an immutable string view
size_t len
the length of the substring
C * str
a restricted pointer to the first character of the substring
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
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
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.