1#ifndef C4_YML_EVENT_HANDLER_STACK_HPP_
2#define C4_YML_EVENT_HANDLER_STACK_HPP_
4#ifndef C4_YML_DETAIL_STACK_HPP_
5#include "c4/yml/detail/stack.hpp"
8#ifndef C4_YML_NODE_TYPE_HPP_
12#ifndef C4_YML_DETAIL_DBGPRINT_HPP_
13#include "c4/yml/detail/dbgprint.hpp"
16#ifndef C4_YML_PARSER_STATE_HPP_
21#ifndef C4_YML_DETAIL_PRINT_HPP_
22#include "c4/yml/detail/print.hpp"
36template<
class HandlerImpl,
class HandlerState>
39 static_assert(std::is_base_of<ParserState, HandlerState>::value,
40 "ParserState must be a base of HandlerState");
60 RYML_ASSERT_BASIC_CB_(
m_stack.m_callbacks,
m_curr !=
nullptr);
93 m_curr->reset_after_push();
106 _c4dbgpf(
"popped! top is now node={} (parent={})",
m_curr->node_id,
m_parent->node_id);
108 _c4dbgpf(
"popped! top is now node={} @ ROOT",
m_curr->node_id);
115 #define ryml_has_any_(bits) (static_cast<HandlerImpl const* C4_RESTRICT>(this)->template has_any_<bits>())
123 const bool is_root = (
m_stack.size() == 1u);
129 const bool is_root = (
m_stack.size() == 1u);
#define ryml_has_any_(bits)
@ MAP
a map: a parent of KEYVAL/KEYSEQ/KEYMAP nodes
@ VAL
a scalar: has a scalar (ie string) value, possibly empty. must be a leaf node, and cannot be MAP or S...
@ SEQ
a seq: a parent of VAL/SEQ/MAP nodes
basic_substring< char > substr
a mutable string view
A c-style callbacks class to customize behavior on errors or allocation.
void _stack_finish_parse()
void _stack_reset_non_root()
state * m_curr
current stack level: top of the stack. cached here for easier access.
bool _stack_should_push_on_begin_doc() const
EventHandlerStack(Callbacks const &cb)
void _stack_start_parse(const char *filename, substr ymlsrc)
detail::stack< state > m_stack
state * m_parent
parent of the current stack level.
bool _stack_should_pop_on_end_doc() const