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

Abstract class that helps implement a visitor of json tree or subtree. More...

#include <visitor.hh>

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

Public Member Functions

unsigned depth ()
 
bool is_stopped ()
 
json::path_t const & path ()
 
virtual void run (json_ast_t tree)
 
virtual void run (node_t const *node)
 
void step_stop ()
 
void stop (visit_t b=visit_t::IGNORE_UNVISITED)
 
visit_t stop_status ()
 

Protected Member Functions

 visitor_t ()
 
virtual void after_child (array_t const *node, unsigned index, node_t const *child)
 
virtual void after_child (node_t const *node, uint_or_string_t const &uos, node_t const *child)
 Function called just after the specialized version with the same name. More...
 
virtual void after_child (object_t const *node, std::string const &key, node_t const *child)
 
virtual void before_child (array_t const *node, unsigned index, node_t const *child)
 
virtual void before_child (node_t const *node, uint_or_string_t const &uos, node_t const *child)
 Function called just before the specialized version with the same name. More...
 
virtual void before_child (object_t const *node, std::string const &key, node_t const *child)
 Function called just before and just after visiting a child node. More...
 
virtual void between_children (array_t const *node)
 Function called between visiting two children, after the function with the same name and argument type node_t. More...
 
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 between_children (object_t const *node)
 Function called between visiting two children, after the function with the same name and argument type node_t. More...
 
virtual void enter (array_t const *node)
 Function called when starting visiting an array_t, just after the kind-independent enter(node_t const*). 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 (object_t const *node)
 Function called when starting visiting an object_t, just after the kind-independent enter(node_t const*). 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 leaf (bool b)
 Function called when visiting a bool_t, after enter(bool_t const*) but before leave(bool_t const*). More...
 
virtual void leaf (double x)
 Function called when visiting a float_t, after enter(float_t const*) but before leave(float_t const*). More...
 
virtual void leaf (int i)
 Function called when visiting a int_t, after enter(int_t const*) but before leave(int_t const*). More...
 
virtual void leaf (std::nullptr_t ptr)
 Function called when visiting a null_t, after enter(null_t const*) but before leave(null_t const*). More...
 
virtual void leaf (std::string const &s)
 Function called when visiting a string_t, after enter(string_t const*) but before leave(string_t const*). More...
 
virtual void leave (array_t const *node)
 
virtual void leave (bool_t const *node)
 
virtual void leave (float_t const *node)
 
virtual void leave (int_t const *node)
 
virtual void leave (node_t const *node)
 This function is called for every node type. More...
 
virtual void leave (null_t const *node)
 
virtual void leave (object_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)
 

Detailed Description

Abstract class that helps implement a visitor of json tree or subtree.

Usually some of the following method are overriden:

The visit functions may be overriden at your own risk.

The function visitor_t::stop() can be called from anywhere to stop the visit.

Here is a short description of the order in which functions are called:

Constructor & Destructor Documentation

◆ visitor_t()

awali::json::visitor_t::visitor_t ( )
protected

Member Function Documentation

◆ after_child() [1/3]

virtual void awali::json::visitor_t::after_child ( array_t const *  node,
unsigned  index,
node_t const *  child 
)
protectedvirtual

Reimplemented in awali::json::inline_sizer_t.

◆ after_child() [2/3]

virtual void awali::json::visitor_t::after_child ( node_t const *  node,
uint_or_string_t const &  uos,
node_t const *  child 
)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t, and awali::json::heighter_t.

◆ after_child() [3/3]

virtual void awali::json::visitor_t::after_child ( object_t const *  node,
std::string const &  key,
node_t const *  child 
)
protectedvirtual

Reimplemented in awali::json::inline_sizer_t.

◆ before_child() [1/3]

virtual void awali::json::visitor_t::before_child ( array_t const *  node,
unsigned  index,
node_t const *  child 
)
protectedvirtual

Reimplemented in awali::json::smart_printer_t.

◆ before_child() [2/3]

virtual void awali::json::visitor_t::before_child ( node_t const *  node,
uint_or_string_t const &  uos,
node_t const *  child 
)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t.

◆ before_child() [3/3]

virtual void awali::json::visitor_t::before_child ( object_t const *  node,
std::string const &  key,
node_t const *  child 
)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t.

◆ between_children() [1/3]

virtual void awali::json::visitor_t::between_children ( array_t const *  node)
protectedvirtual

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 in awali::json::smart_printer_t, and awali::json::inline_sizer_t.

◆ between_children() [2/3]

virtual void awali::json::visitor_t::between_children ( node_t const *  node)
protectedvirtual

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

If node has only one children, this will never be called.

◆ between_children() [3/3]

virtual void awali::json::visitor_t::between_children ( object_t const *  node)
protectedvirtual

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 in awali::json::smart_printer_t, and awali::json::inline_sizer_t.

◆ depth()

unsigned awali::json::visitor_t::depth ( )

◆ enter() [1/8]

virtual void awali::json::visitor_t::enter ( array_t const * node  )
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t, and awali::json::inline_sizer_t.

◆ enter() [2/8]

virtual void awali::json::visitor_t::enter ( bool_t const * node  )
protectedvirtual

Function called when starting visiting a bool_t, just after the kind-independent enter(node_t const*), and just before leaf(bool).

◆ enter() [3/8]

virtual void awali::json::visitor_t::enter ( float_t const * node  )
protectedvirtual

Function called when starting visiting a float_t, just after the kind-independent enter(node_t const*), and just before leaf(double).

◆ enter() [4/8]

virtual void awali::json::visitor_t::enter ( int_t const * node  )
protectedvirtual

Function called when starting visiting a bool_t, just after the kind-independent enter(node_t const*), and just before leaf(int).

◆ enter() [5/8]

virtual void awali::json::visitor_t::enter ( node_t const * node  )
protectedvirtual

Very first function called when visiting a node.

Called for every node kind.

Reimplemented in awali::json::heighter_t.

◆ enter() [6/8]

virtual void awali::json::visitor_t::enter ( null_t const * node  )
protectedvirtual

Function called when starting visiting a null_t, just after the kind-independent enter(node_t const*), and just before leaf(std::nullptr_t).

◆ enter() [7/8]

virtual void awali::json::visitor_t::enter ( object_t const * node  )
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t, and awali::json::inline_sizer_t.

◆ enter() [8/8]

virtual void awali::json::visitor_t::enter ( string_t const * node  )
protectedvirtual

Function called when starting visiting a string_t, just after the kind-independent enter(node_t const*), and just before leaf(std::string const&).

◆ is_stopped()

bool awali::json::visitor_t::is_stopped ( )

◆ leaf() [1/5]

virtual void awali::json::visitor_t::leaf ( bool  b)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t.

◆ leaf() [2/5]

virtual void awali::json::visitor_t::leaf ( double  x)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t.

◆ leaf() [3/5]

virtual void awali::json::visitor_t::leaf ( int  i)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t.

◆ leaf() [4/5]

virtual void awali::json::visitor_t::leaf ( std::nullptr_t  ptr)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t.

◆ leaf() [5/5]

virtual void awali::json::visitor_t::leaf ( std::string const &  s)
protectedvirtual

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

Reimplemented in awali::json::smart_printer_t.

◆ leave() [1/8]

virtual void awali::json::visitor_t::leave ( array_t const *  node)
protectedvirtual

Reimplemented in awali::json::smart_printer_t.

◆ leave() [2/8]

virtual void awali::json::visitor_t::leave ( bool_t const *  node)
protectedvirtual

Reimplemented in awali::json::inline_sizer_t.

◆ leave() [3/8]

virtual void awali::json::visitor_t::leave ( float_t const *  node)
protectedvirtual

Reimplemented in awali::json::inline_sizer_t.

◆ leave() [4/8]

virtual void awali::json::visitor_t::leave ( int_t const *  node)
protectedvirtual

Reimplemented in awali::json::inline_sizer_t.

◆ leave() [5/8]

virtual void awali::json::visitor_t::leave ( node_t const *  node)
protectedvirtual

This function is called for every node type.

Reimplemented in awali::json::smart_printer_t.

◆ leave() [6/8]

virtual void awali::json::visitor_t::leave ( null_t const *  node)
protectedvirtual

Reimplemented in awali::json::inline_sizer_t.

◆ leave() [7/8]

virtual void awali::json::visitor_t::leave ( object_t const *  node)
protectedvirtual

Reimplemented in awali::json::smart_printer_t.

◆ leave() [8/8]

virtual void awali::json::visitor_t::leave ( string_t const *  node)
protectedvirtual

Reimplemented in awali::json::inline_sizer_t.

◆ path()

json::path_t const& awali::json::visitor_t::path ( )

◆ run() [1/2]

virtual void awali::json::visitor_t::run ( json_ast_t  tree)
virtual

Reimplemented in awali::json::smart_printer_t.

◆ run() [2/2]

virtual void awali::json::visitor_t::run ( node_t const *  node)
virtual

Reimplemented in awali::json::smart_printer_t.

◆ step_stop()

void awali::json::visitor_t::step_stop ( )

◆ stop()

void awali::json::visitor_t::stop ( visit_t  b = visit_t::IGNORE_UNVISITED)

◆ stop_status()

visit_t awali::json::visitor_t::stop_status ( )

◆ visit() [1/8]

virtual void awali::json::visitor_t::visit ( array_t const *  node)
protectedvirtual

◆ visit() [2/8]

virtual void awali::json::visitor_t::visit ( bool_t const *  node)
protectedvirtual

◆ visit() [3/8]

virtual void awali::json::visitor_t::visit ( float_t const *  node)
protectedvirtual

◆ visit() [4/8]

virtual void awali::json::visitor_t::visit ( int_t const *  node)
protectedvirtual

◆ visit() [5/8]

virtual void awali::json::visitor_t::visit ( node_t const *  node)
protectedvirtual

◆ visit() [6/8]

virtual void awali::json::visitor_t::visit ( null_t const *  node)
protectedvirtual

◆ visit() [7/8]

virtual void awali::json::visitor_t::visit ( object_t const *  node)
protectedvirtual

◆ visit() [8/8]

virtual void awali::json::visitor_t::visit ( string_t const *  node)
protectedvirtual

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