17 #ifndef COMMON_JSON_SMART_PRINTER_HH
18 #define COMMON_JSON_SMART_PRINTER_HH
20 #include <unordered_map>
32 std::unordered_map<node_t const*,unsigned>
map;
37 node_t const* child)
override;
50 std::unordered_map<node_t const*,unsigned>
map;
63 node_t const* child)
override;
94 void leaf(
double d)
override;
95 void leaf(std::string
const& str)
override;
97 void leaf(std::nullptr_t)
override;
98 void leaf(
bool b)
override;
110 node_t const* child)
override;
113 node_t const* child)
override;
116 node_t const* child)
override;
119 node_t const* child)
override;
312 std::ostream&
put(std::ostream& out,
node_t const* node);
Definition: smart_printer.hh:30
heighter_t(json_ast_t ast)
Definition: smart_printer.hh:41
void after_child(node_t const *node, uint_or_string_t const &uos, node_t const *child) override
Function called just after the specialized version with the same name.
heighter_t()
Definition: smart_printer.hh:43
std::unordered_map< node_t const *, unsigned > map
Definition: smart_printer.hh:32
unsigned operator[](node_t const *node)
heighter_t(node_t const *node)
Definition: smart_printer.hh:42
void enter(node_t const *node) override
Very first function called when visiting a node.
Definition: smart_printer.hh:48
void after_child(object_t const *node, std::string const &key, node_t const *child) override
void leave(string_t const *node) override
void between_children(array_t const *node) override
Function called between visiting two children, after the function with the same name and argument typ...
std::unordered_map< node_t const *, unsigned > left_weight
Definition: smart_printer.hh:51
std::unordered_map< node_t const *, unsigned > map
Definition: smart_printer.hh:50
void enter(object_t const *node) override
Function called when starting visiting an object_t, just after the kind-independent (node_t const*).
void leave(null_t const *node) override
void between_children(object_t const *node) override
Function called between visiting two children, after the function with the same name and argument typ...
unsigned operator[](node_t const *node)
inline_sizer_t()
Definition: smart_printer.hh:74
void leave(int_t const *node) override
heighter_t heighter
Definition: smart_printer.hh:52
void leave(bool_t const *node) override
void after_child(array_t const *node, unsigned i, node_t const *child) override
inline_sizer_t(node_t const *node)
Definition: smart_printer.hh:73
inline_sizer_t(json_ast_t ast)
Definition: smart_printer.hh:72
void enter(array_t const *node) override
Function called when starting visiting an array_t, just after the kind-independent (node_t const*).
unsigned height_of(node_t const *node)
void leave(float_t const *node) override
Definition: smart_printer.hh:79
node_t const * inliner
Definition: smart_printer.hh:86
void before_child(node_t const *node, uint_or_string_t const &uos, node_t const *child) override
Function called just before the specialized version with the same name.
void leaf(bool b) override
Function called when visiting a bool_t, after (bool_t const*) but before leave(bool_t const*).
void leaf(double d) override
Function called when visiting a float_t, after (float_t const*) but before leave(float_t const*).
unsigned _max
Definition: smart_printer.hh:87
std::ostream & _out
Definition: smart_printer.hh:82
void run(json_ast_t tree) override
void enter(array_t const *node) override
Function called when starting visiting an array_t, just after the kind-independent (node_t const*).
void run(node_t const *tree) override
void leave(array_t const *node) override
int indent_amount
Definition: smart_printer.hh:83
bool is_last(node_t const *child)
smart_printer_t(std::ostream &o, unsigned m=80)
void enter(object_t const *node) override
Function called when starting visiting an object_t, just after the kind-independent (node_t const*).
std::vector< unsigned > max_vect
Definition: smart_printer.hh:88
void after_child(node_t const *node, uint_or_string_t const &uos, node_t const *child) override
Function called just after the specialized version with the same name.
void before_child(array_t const *node, unsigned i, node_t const *child) override
unsigned columns
Definition: smart_printer.hh:85
void leaf(std::string const &str) override
Function called when visiting a string_t, after (string_t const*) but before leave(string_t const*).
void leaf(int i) override
Function called when visiting a int_t, after (int_t const*) but before leave(int_t const*).
void leave(node_t const *node) override
This function is called for every node type.
void leaf(std::nullptr_t) override
Function called when visiting a null_t, after (null_t const*) but before leave(null_t const*).
inline_sizer_t sizer
Definition: smart_printer.hh:81
void between_children(array_t const *node) override
Function called between visiting two children, after the function with the same name and argument typ...
void between_children(object_t const *node) override
Function called between visiting two children, after the function with the same name and argument typ...
void leave(object_t const *node) override
void before_child(object_t const *node, std::string const &key, node_t const *child) override
Function called just before and just after visiting a child node.
Abstract class that helps implement a visitor of json tree or subtree.
Definition: visitor.hh:71
virtual void run(json_ast_t tree)
Definition: visitor.hh:241
std::ostream & json(automaton_t aut, std::ostream &out)
std::ostream & put(std::ostream &out, node_t const *node)
std::ostream & put_inline(std::ostream &out, node_t const *node)
Main namespace of Awali.
Definition: ato.hh:22
std::shared_ptr< json::object_t > json_ast_t
Definition: json_ast.hh:27