Awali
Another Weighted Automata library
Public Member Functions | Protected Member Functions | Protected Attributes
awali::json::smart_printer_t Class Reference

#include <smart_printer.hh>

Inheritance diagram for awali::json::smart_printer_t:
awali::json::visitor_t

Public Member Functions

 smart_printer_t (std::ostream &o, unsigned m=80)
 
void run (json_ast_t tree) override
 
void run (node_t const *tree) override
 
- Public Member Functions inherited from awali::json::visitor_t
unsigned depth ()
 
bool is_stopped ()
 
json::path_t const & path ()
 
void step_stop ()
 
void stop (visit_t b=visit_t::IGNORE_UNVISITED)
 
visit_t stop_status ()
 

Protected Member Functions

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. More...
 
void before_child (array_t const *node, unsigned i, node_t const *child) override
 
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. More...
 
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. More...
 
void between_children (array_t const *node) override
 Function called between visiting two children, after the function with the same name and argument type node_t. More...
 
void between_children (object_t const *node) override
 Function called between visiting two children, after the function with the same name and argument type node_t. More...
 
void decr_indent ()
 
void enter (array_t const *node) override
 Function called when starting visiting an array_t, just after the kind-independent enter(node_t const*). More...
 
void enter (object_t const *node) override
 Function called when starting visiting an object_t, just after the kind-independent enter(node_t const*). More...
 
void incr_indent ()
 
void indent (int i=0)
 
bool is_last (node_t const *child)
 
void leaf (bool b) override
 Function called when visiting a bool_t, after enter(bool_t const*) but before leave(bool_t const*). More...
 
void leaf (double d) override
 Function called when visiting a float_t, after enter(float_t const*) but before leave(float_t const*). More...
 
void leaf (int i) override
 Function called when visiting a int_t, after enter(int_t const*) but before leave(int_t const*). More...
 
void leaf (std::nullptr_t) override
 Function called when visiting a null_t, after enter(null_t const*) but before leave(null_t const*). More...
 
void leaf (std::string const &str) override
 Function called when visiting a string_t, after enter(string_t const*) but before leave(string_t const*). More...
 
void leave (array_t const *node) override
 
void leave (node_t const *node) override
 This function is called for every node type. More...
 
void leave (object_t const *node) override
 
unsigned max ()
 
- Protected Member Functions inherited from awali::json::visitor_t
 visitor_t ()
 
virtual void after_child (array_t const *node, unsigned index, node_t const *child)
 
virtual void after_child (object_t const *node, std::string const &key, node_t const *child)
 
virtual void between_children (node_t const *node)
 Function called between visiting two children, before the function with the same name and specialized argument type. More...
 
virtual void enter (bool_t const *node)
 Function called when starting visiting a bool_t, just after the kind-independent enter(node_t const*), and just before leaf(bool). More...
 
virtual void enter (float_t const *node)
 Function called when starting visiting a float_t, just after the kind-independent enter(node_t const*), and just before leaf(double). More...
 
virtual void enter (int_t const *node)
 Function called when starting visiting a bool_t, just after the kind-independent enter(node_t const*), and just before leaf(int). More...
 
virtual void enter (node_t const *node)
 Very first function called when visiting a node. More...
 
virtual void enter (null_t const *node)
 Function called when starting visiting a null_t, just after the kind-independent enter(node_t const*), and just before leaf(std::nullptr_t). More...
 
virtual void enter (string_t const *node)
 Function called when starting visiting a string_t, just after the kind-independent enter(node_t const*), and just before leaf(std::string const&). More...
 
virtual void leave (bool_t const *node)
 
virtual void leave (float_t const *node)
 
virtual void leave (int_t const *node)
 
virtual void leave (null_t const *node)
 
virtual void leave (string_t const *node)
 
virtual void visit (array_t const *node)
 
virtual void visit (bool_t const *node)
 
virtual void visit (float_t const *node)
 
virtual void visit (int_t const *node)
 
virtual void visit (node_t const *node)
 
virtual void visit (null_t const *node)
 
virtual void visit (object_t const *node)
 
virtual void visit (string_t const *node)
 

Protected Attributes

unsigned _max
 
std::ostream & _out
 
int indent_amount
 
node_t const * inliner
 
std::vector< unsigned > max_vect
 
inline_sizer_t sizer
 

Constructor & Destructor Documentation

◆ smart_printer_t()

awali::json::smart_printer_t::smart_printer_t ( std::ostream &  o,
unsigned  m = 80 
)

Member Function Documentation

◆ after_child()

void awali::json::smart_printer_t::after_child ( node_t const *  node,
uint_or_string_t const &  uos,
node_t const *  child 
)
overrideprotectedvirtual

Function called just after the specialized version with the same name.

Reimplemented from awali::json::visitor_t.

◆ before_child() [1/3]

void awali::json::smart_printer_t::before_child ( array_t const *  node,
unsigned  i,
node_t const *  child 
)
overrideprotectedvirtual

Reimplemented from awali::json::visitor_t.

◆ before_child() [2/3]

void awali::json::smart_printer_t::before_child ( node_t const *  node,
uint_or_string_t const &  uos,
node_t const *  child 
)
overrideprotectedvirtual

Function called just before the specialized version with the same name.

Reimplemented from awali::json::visitor_t.

◆ before_child() [3/3]

void awali::json::smart_printer_t::before_child ( object_t const *  node,
std::string const &  key,
node_t const *  child 
)
overrideprotectedvirtual

Function called just before and just after visiting a child node.

Reimplemented from awali::json::visitor_t.

◆ between_children() [1/2]

void awali::json::smart_printer_t::between_children ( array_t const *  node)
overrideprotectedvirtual

Function called between visiting two children, after the function with the same name and argument type node_t.

If node has only one children, this function is not called.

Reimplemented from awali::json::visitor_t.

◆ between_children() [2/2]

void awali::json::smart_printer_t::between_children ( object_t const *  node)
overrideprotectedvirtual

Function called between visiting two children, after the function with the same name and argument type node_t.

If node has only one children, this function is not called.

Reimplemented from awali::json::visitor_t.

◆ decr_indent()

void awali::json::smart_printer_t::decr_indent ( )
protected

◆ enter() [1/2]

void awali::json::smart_printer_t::enter ( array_t const *  node)
overrideprotectedvirtual

Function called when starting visiting an array_t, just after the kind-independent enter(node_t const*).

Reimplemented from awali::json::visitor_t.

◆ enter() [2/2]

void awali::json::smart_printer_t::enter ( object_t const *  node)
overrideprotectedvirtual

Function called when starting visiting an object_t, just after the kind-independent enter(node_t const*).

Reimplemented from awali::json::visitor_t.

◆ incr_indent()

void awali::json::smart_printer_t::incr_indent ( )
protected

◆ indent()

void awali::json::smart_printer_t::indent ( int  i = 0)
protected

◆ is_last()

bool awali::json::smart_printer_t::is_last ( node_t const *  child)
protected

◆ leaf() [1/5]

void awali::json::smart_printer_t::leaf ( bool  b)
overrideprotectedvirtual

Function called when visiting a bool_t, after enter(bool_t const*) but before leave(bool_t const*).

Reimplemented from awali::json::visitor_t.

◆ leaf() [2/5]

void awali::json::smart_printer_t::leaf ( double  x)
overrideprotectedvirtual

Function called when visiting a float_t, after enter(float_t const*) but before leave(float_t const*).

Reimplemented from awali::json::visitor_t.

◆ leaf() [3/5]

void awali::json::smart_printer_t::leaf ( int  i)
overrideprotectedvirtual

Function called when visiting a int_t, after enter(int_t const*) but before leave(int_t const*).

Reimplemented from awali::json::visitor_t.

◆ leaf() [4/5]

void awali::json::smart_printer_t::leaf ( std::nullptr_t  ptr)
overrideprotectedvirtual

Function called when visiting a null_t, after enter(null_t const*) but before leave(null_t const*).

Reimplemented from awali::json::visitor_t.

◆ leaf() [5/5]

void awali::json::smart_printer_t::leaf ( std::string const &  s)
overrideprotectedvirtual

Function called when visiting a string_t, after enter(string_t const*) but before leave(string_t const*).

Reimplemented from awali::json::visitor_t.

◆ leave() [1/3]

void awali::json::smart_printer_t::leave ( array_t const *  node)
overrideprotectedvirtual

Reimplemented from awali::json::visitor_t.

◆ leave() [2/3]

void awali::json::smart_printer_t::leave ( node_t const *  node)
overrideprotectedvirtual

This function is called for every node type.

Reimplemented from awali::json::visitor_t.

◆ leave() [3/3]

void awali::json::smart_printer_t::leave ( object_t const *  node)
overrideprotectedvirtual

Reimplemented from awali::json::visitor_t.

◆ max()

unsigned awali::json::smart_printer_t::max ( )
protected

◆ run() [1/2]

void awali::json::smart_printer_t::run ( json_ast_t  tree)
overridevirtual

Reimplemented from awali::json::visitor_t.

◆ run() [2/2]

void awali::json::smart_printer_t::run ( node_t const *  tree)
overridevirtual

Reimplemented from awali::json::visitor_t.

Field Documentation

◆ _max

unsigned awali::json::smart_printer_t::_max
protected

◆ _out

std::ostream& awali::json::smart_printer_t::_out
protected

◆ indent_amount

int awali::json::smart_printer_t::indent_amount
protected

◆ inliner

node_t const* awali::json::smart_printer_t::inliner
protected

◆ max_vect

std::vector<unsigned> awali::json::smart_printer_t::max_vect
protected

◆ sizer

inline_sizer_t awali::json::smart_printer_t::sizer
protected

The documentation for this class was generated from the following file: