17 #ifndef COMMON_JSON_VISITOR_HH
18 #define COMMON_JSON_VISITOR_HH
75 template<
typename L>
inline void visit_leaf(L* node)
94 inline unsigned depth() {
return _path_from_root.size(); }
157 virtual void leaf(std::string
const&) {}
172 virtual void leaf(std::nullptr_t) {}
230 inline virtual void visit(
int_t const* node) {visit_leaf(node);}
Abstract class that helps implement a visitor of json tree or subtree.
Definition: visitor.hh:71
bool is_stopped()
Definition: visitor.hh:91
visit_t stop_status()
Definition: visitor.hh:92
virtual void visit(object_t const *node)
virtual void leave(bool_t const *)
Definition: visitor.hh:220
virtual void leave(null_t const *)
Definition: visitor.hh:226
virtual void enter(int_t const *)
Function called when starting visiting a bool_t, just after the kind-independent (node_t const*),...
Definition: visitor.hh:128
virtual ~visitor_t()=default
virtual void run(json_ast_t tree)
Definition: visitor.hh:241
virtual void enter(string_t const *)
Function called when starting visiting a string_t, just after the kind-independent (node_t const*),...
Definition: visitor.hh:134
virtual void enter(bool_t const *)
Function called when starting visiting a bool_t, just after the kind-independent (node_t const*),...
Definition: visitor.hh:111
virtual void enter(array_t const *)
Function called when starting visiting an array_t, just after the kind-independent (node_t const*).
Definition: visitor.hh:122
unsigned depth()
Definition: visitor.hh:94
virtual void enter(null_t const *)
Function called when starting visiting a null_t, just after the kind-independent (node_t const*),...
Definition: visitor.hh:146
virtual void visit(int_t const *node)
Definition: visitor.hh:230
virtual void between_children(array_t const *)
Function called between visiting two children, after the function with the same name and argument typ...
Definition: visitor.hh:215
virtual void between_children(node_t const *)
Function called between visiting two children, before the function with the same name and specialized...
Definition: visitor.hh:203
void stop(visit_t b=visit_t::IGNORE_UNVISITED)
Definition: visitor.hh:79
virtual void visit(bool_t const *node)
Definition: visitor.hh:229
virtual void leaf(double)
Function called when visiting a float_t, after (float_t const*) but before leave(float_t const*).
Definition: visitor.hh:162
virtual void leave(object_t const *)
Definition: visitor.hh:221
virtual void before_child(object_t const *, std::string const &, node_t const *)
Function called just before and just after visiting a child node.
Definition: visitor.hh:176
virtual void leave(int_t const *)
Definition: visitor.hh:223
visitor_t()
Definition: visitor.hh:97
virtual void leave(array_t const *)
Definition: visitor.hh:222
void step_stop()
Definition: visitor.hh:80
virtual void run(node_t const *node)
Definition: visitor.hh:242
virtual void leaf(std::string const &)
Function called when visiting a string_t, after (string_t const*) but before leave(string_t const*).
Definition: visitor.hh:157
virtual void after_child(object_t const *, std::string const &, node_t const *)
Definition: visitor.hh:179
json::path_t const & path()
Definition: visitor.hh:93
virtual void leave(float_t const *)
Definition: visitor.hh:225
virtual void visit(node_t const *node)
virtual void enter(object_t const *)
Function called when starting visiting an object_t, just after the kind-independent (node_t const*).
Definition: visitor.hh:117
virtual void visit(null_t const *node)
Definition: visitor.hh:233
virtual void leaf(std::nullptr_t)
Function called when visiting a null_t, after (null_t const*) but before leave(null_t const*).
Definition: visitor.hh:172
virtual void leave(node_t const *)
This function is called for every node type.
Definition: visitor.hh:218
virtual void after_child(array_t const *, unsigned, node_t const *)
Definition: visitor.hh:186
virtual void between_children(object_t const *)
Function called between visiting two children, after the function with the same name and argument typ...
Definition: visitor.hh:209
virtual void before_child(array_t const *, unsigned, node_t const *)
Definition: visitor.hh:183
virtual void leave(string_t const *)
Definition: visitor.hh:224
virtual void leaf(bool)
Function called when visiting a bool_t, after (bool_t const*) but before leave(bool_t const*).
Definition: visitor.hh:167
virtual void visit(array_t const *node)
virtual void leaf(int)
Function called when visiting a int_t, after (int_t const*) but before leave(int_t const*).
Definition: visitor.hh:152
virtual void enter(float_t const *)
Function called when starting visiting a float_t, just after the kind-independent (node_t const*),...
Definition: visitor.hh:140
virtual void visit(string_t const *node)
Definition: visitor.hh:231
virtual void before_child(node_t const *, uint_or_string_t const &, node_t const *)
Function called just before the specialized version with the same name.
Definition: visitor.hh:190
virtual void enter(node_t const *)
Very first function called when visiting a node.
Definition: visitor.hh:104
virtual void after_child(node_t const *, uint_or_string_t const &, node_t const *)
Function called just after the specialized version with the same name.
Definition: visitor.hh:194
virtual void visit(float_t const *node)
Definition: visitor.hh:232
std::ostream & json(automaton_t aut, std::ostream &out)
std::vector< uint_or_string_t > path_t
Definition: node.hh:85
visit_t
Definition: visitor.hh:28
@ IGNORE_UNVISITED_CHILDREN_AND_SIBLINGS
@ IGNORE_UNVISITED_CHILDREN
Main namespace of Awali.
Definition: ato.hh:22
std::shared_ptr< json::object_t > json_ast_t
Definition: json_ast.hh:27