Awali
Another Weighted Automata library
Public Member Functions | Data Fields | Protected Member Functions
awali::json::node_t Class Referenceabstract

#include <node.hh>

Inheritance diagram for awali::json::node_t:
awali::json::array_t awali::json::bool_t awali::json::float_t awali::json::int_t awali::json::null_t awali::json::object_t awali::json::string_t

Public Member Functions

virtual ~node_t ()
 
virtual unsigned arity () const
 
virtual array_tarray ()
 Casts this node to array_t. More...
 
virtual array_t const * array () const
 Casts this node to array_t. More...
 
node_tat (path_t const &path, unsigned i=0)
 
node_t const * at (path_t const &path, unsigned i=0) const
 
virtual node_tat (std::string const &key)
 
virtual node_t const * at (std::string const &key) const
 
virtual node_tat (unsigned i)
 
virtual node_t const * at (unsigned i) const
 
virtual bool_tboolean ()
 Casts this node to bool_t. More...
 
virtual bool_t const * boolean () const
 Casts this node to bool_t. More...
 
virtual node_tcopy () const =0
 
virtual float_tfloating ()
 Casts this not to float_t. More...
 
virtual float_t const * floating () const
 Casts this not to float_t. More...
 
virtual bool has_child (std::string const &) const
 
virtual bool has_child (unsigned i) const
 
bool has_path (json::path_t const &path) const
 
virtual unsigned height () const
 
virtual int_tinteger ()
 Casts this node to int_t. More...
 
virtual int_t const * integer () const
 Casts this node to int_t. More...
 
bool is (node_kind_t k) const
 
bool is (std::vector< node_kind_t >const &v) const
 
bool is_leaf () const
 
virtual null_tnull ()
 Casts this node to null_t. More...
 
virtual null_t const * null () const
 Casts this node to null_t. More...
 
virtual object_tobject ()
 Casts this node to object_t. More...
 
virtual object_t const * object () const
 Casts this node to object_t. More...
 
path_t path_to_root () const
 
virtual string_tstring ()
 Casts this node to string_t. More...
 
virtual string_t const * string () const
 Casts this node to string_t. More...
 
virtual bool to_bool () const
 Coerces this node_t to bool. More...
 
virtual double to_double () const
 Coerces this node_t to a double More...
 
virtual int to_int () const
 Coerces this node_t to int. More...
 
virtual std::string to_string () const
 Coerces this node_t to an std::string. More...
 

Data Fields

const node_kind_t kind
 
node_t const * parent
 

Protected Member Functions

 node_t (node_kind_t k)
 

Constructor & Destructor Documentation

◆ ~node_t()

virtual awali::json::node_t::~node_t ( )
virtual

◆ node_t()

awali::json::node_t::node_t ( node_kind_t  k)
protected

Member Function Documentation

◆ arity()

virtual unsigned awali::json::node_t::arity ( ) const
virtual

◆ array() [1/2]

virtual array_t* awali::json::node_t::array ( )
virtual

Casts this node to array_t.

Reimplemented in awali::json::array_t.

◆ array() [2/2]

virtual array_t const* awali::json::node_t::array ( ) const
virtual

Casts this node to array_t.

Reimplemented in awali::json::array_t.

◆ at() [1/6]

node_t* awali::json::node_t::at ( path_t const &  path,
unsigned  i = 0 
)

◆ at() [2/6]

node_t const* awali::json::node_t::at ( path_t const &  path,
unsigned  i = 0 
) const

◆ at() [3/6]

virtual node_t* awali::json::node_t::at ( std::string const &  key)
virtual

Reimplemented in awali::json::object_t.

◆ at() [4/6]

virtual node_t const* awali::json::node_t::at ( std::string const &  key) const
virtual

Reimplemented in awali::json::object_t.

◆ at() [5/6]

virtual node_t* awali::json::node_t::at ( unsigned  i)
virtual

Reimplemented in awali::json::array_t.

◆ at() [6/6]

virtual node_t const* awali::json::node_t::at ( unsigned  i) const
virtual

Reimplemented in awali::json::array_t.

◆ boolean() [1/2]

virtual bool_t* awali::json::node_t::boolean ( )
virtual

Casts this node to bool_t.

Reimplemented in awali::json::bool_t.

◆ boolean() [2/2]

virtual bool_t const* awali::json::node_t::boolean ( ) const
virtual

Casts this node to bool_t.

Reimplemented in awali::json::bool_t.

◆ copy()

virtual node_t* awali::json::node_t::copy ( ) const
pure virtual

◆ floating() [1/2]

virtual float_t* awali::json::node_t::floating ( )
virtual

Casts this not to float_t.

Reimplemented in awali::json::float_t.

◆ floating() [2/2]

virtual float_t const* awali::json::node_t::floating ( ) const
virtual

Casts this not to float_t.

Reimplemented in awali::json::float_t.

◆ has_child() [1/2]

virtual bool awali::json::node_t::has_child ( std::string const &  ) const
virtual

Reimplemented in awali::json::object_t.

◆ has_child() [2/2]

virtual bool awali::json::node_t::has_child ( unsigned  i) const
virtual

Reimplemented in awali::json::array_t.

◆ has_path()

bool awali::json::node_t::has_path ( json::path_t const &  path) const

◆ height()

virtual unsigned awali::json::node_t::height ( ) const
virtual

◆ integer() [1/2]

virtual int_t* awali::json::node_t::integer ( )
virtual

Casts this node to int_t.

Reimplemented in awali::json::int_t.

◆ integer() [2/2]

virtual int_t const* awali::json::node_t::integer ( ) const
virtual

Casts this node to int_t.

Reimplemented in awali::json::int_t.

◆ is() [1/2]

bool awali::json::node_t::is ( node_kind_t  k) const

◆ is() [2/2]

bool awali::json::node_t::is ( std::vector< node_kind_t >const &  v) const

◆ is_leaf()

bool awali::json::node_t::is_leaf ( ) const

◆ null() [1/2]

virtual null_t* awali::json::node_t::null ( )
virtual

Casts this node to null_t.

Reimplemented in awali::json::null_t.

◆ null() [2/2]

virtual null_t const* awali::json::node_t::null ( ) const
virtual

Casts this node to null_t.

Reimplemented in awali::json::null_t.

◆ object() [1/2]

virtual object_t* awali::json::node_t::object ( )
virtual

Casts this node to object_t.

Reimplemented in awali::json::object_t.

◆ object() [2/2]

virtual object_t const* awali::json::node_t::object ( ) const
virtual

Casts this node to object_t.

Reimplemented in awali::json::object_t.

◆ path_to_root()

path_t awali::json::node_t::path_to_root ( ) const

◆ string() [1/2]

virtual string_t* awali::json::node_t::string ( )
virtual

Casts this node to string_t.

Reimplemented in awali::json::string_t.

◆ string() [2/2]

virtual string_t const* awali::json::node_t::string ( ) const
virtual

Casts this node to string_t.

Reimplemented in awali::json::string_t.

◆ to_bool()

virtual bool awali::json::node_t::to_bool ( ) const
virtual

Coerces this node_t to bool.

Exceptions
type_missmatchif this node_t is not a bool_t, an int_t, a {float_t} or a string_t
coercion_exceptionif this node_t is an int_t and held value is not 0 or 1; or if it is a string_t and held value is one of {"0", "1", "true", "false", "True", "False"}.

Reimplemented in awali::json::bool_t, awali::json::string_t, awali::json::float_t, and awali::json::int_t.

◆ to_double()

virtual double awali::json::node_t::to_double ( ) const
virtual

Coerces this node_t to a double

Exceptions
type_missmatchif this node_t is not a bool_t, an int_t, a float_t, or a string_t.
coercion_exceptionif this node_t is a string_t the value of which is not the string-representation of a double.

Reimplemented in awali::json::bool_t, awali::json::string_t, awali::json::float_t, and awali::json::int_t.

◆ to_int()

virtual int awali::json::node_t::to_int ( ) const
virtual

Coerces this node_t to int.

Exceptions
type_missmatchif this node_t is not a bool_t, an int_t, a float_t, or a string_t.
coercion_exceptionif this node_t is a string_t the value of which is not the string-representation of an integer; or if this node_t is a float_t the held value of which is not an integer.

Reimplemented in awali::json::bool_t, awali::json::string_t, awali::json::float_t, and awali::json::int_t.

◆ to_string()

virtual std::string awali::json::node_t::to_string ( ) const
virtual

Coerces this node_t to an std::string.

Exceptions
type_missmatchif this node_t is not a string_t.

Reimplemented in awali::json::string_t.

Field Documentation

◆ kind

const node_kind_t awali::json::node_t::kind

◆ parent

node_t const* awali::json::node_t::parent

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