cprover
jsont Class Reference

#include <json.h>

Inheritance diagram for jsont:
[legend]
Collaboration diagram for jsont:
[legend]

Public Types

enum  kindt {
  kindt::J_STRING, kindt::J_NUMBER, kindt::J_OBJECT, kindt::J_ARRAY,
  kindt::J_TRUE, kindt::J_FALSE, kindt::J_NULL
}
 
typedef std::vector< jsontarrayt
 
typedef std::map< std::string, jsontobjectt
 

Public Member Functions

bool is_string () const
 
bool is_number () const
 
bool is_object () const
 
bool is_array () const
 
bool is_true () const
 
bool is_false () const
 
bool is_null () const
 
 jsont ()
 
void output (std::ostream &out) const
 
void swap (jsont &other)
 
void clear ()
 
json_arraytmake_array ()
 
json_objecttmake_object ()
 
const jsontoperator[] (const std::string &key) const
 

Static Public Member Functions

static jsont json_boolean (bool value)
 

Public Attributes

kindt kind
 
arrayt array
 
objectt object
 
std::string value
 

Protected Member Functions

void output_rec (std::ostream &, unsigned indent) const
 
 jsont (kindt _kind)
 
 jsont (kindt _kind, const std::string &_value)
 

Static Protected Member Functions

static void escape_string (const std::string &, std::ostream &)
 

Static Protected Attributes

static const jsont null_json_object
 

Detailed Description

Definition at line 21 of file json.h.

Member Typedef Documentation

◆ arrayt

typedef std::vector<jsont> jsont::arrayt

Definition at line 125 of file json.h.

◆ objectt

typedef std::map<std::string, jsont> jsont::objectt

Definition at line 128 of file json.h.

Member Enumeration Documentation

◆ kindt

enum jsont::kindt
strong
Enumerator
J_STRING 
J_NUMBER 
J_OBJECT 
J_ARRAY 
J_TRUE 
J_FALSE 
J_NULL 

Definition at line 24 of file json.h.

Constructor & Destructor Documentation

◆ jsont() [1/3]

jsont::jsont ( )
inline

Definition at line 72 of file json.h.

Referenced by json_boolean(), and json_arrayt::push_back().

◆ jsont() [2/3]

jsont::jsont ( kindt  _kind)
inlineexplicitprotected

Definition at line 115 of file json.h.

◆ jsont() [3/3]

jsont::jsont ( kindt  _kind,
const std::string &  _value 
)
inlineprotected

Definition at line 119 of file json.h.

Member Function Documentation

◆ clear()

void jsont::clear ( void  )
inline

Definition at line 88 of file json.h.

References array, J_NULL, kind, and value.

◆ escape_string()

void jsont::escape_string ( const std::string &  src,
std::ostream &  out 
)
staticprotected

Definition at line 15 of file json.cpp.

Referenced by output_rec().

◆ is_array()

bool jsont::is_array ( ) const
inline

◆ is_false()

bool jsont::is_false ( ) const
inline

Definition at line 62 of file json.h.

References J_FALSE, and kind.

◆ is_null()

bool jsont::is_null ( ) const
inline

Definition at line 67 of file json.h.

References J_NULL, and kind.

Referenced by convert(), and java_class_loader_limitt::setup_class_load_limit().

◆ is_number()

bool jsont::is_number ( ) const
inline

Definition at line 42 of file json.h.

References J_NUMBER, and kind.

◆ is_object()

bool jsont::is_object ( ) const
inline

Definition at line 47 of file json.h.

References J_OBJECT, and kind.

Referenced by java_bytecode_languaget::get_language_options().

◆ is_string()

bool jsont::is_string ( ) const
inline

◆ is_true()

bool jsont::is_true ( ) const
inline

Definition at line 57 of file json.h.

References J_TRUE, and kind.

◆ json_boolean()

static jsont jsont::json_boolean ( bool  value)
inlinestatic

Definition at line 83 of file json.h.

References J_FALSE, J_TRUE, jsont(), and value.

Referenced by convert(), show_goto_functions_jsont::convert(), and json().

◆ make_array()

◆ make_object()

◆ operator[]()

const jsont& jsont::operator[] ( const std::string &  key) const
inline

Definition at line 100 of file json.h.

References null_json_object.

◆ output()

void jsont::output ( std::ostream &  out) const
inline

Definition at line 76 of file json.h.

References output_rec().

Referenced by operator<<().

◆ output_rec()

void jsont::output_rec ( std::ostream &  out,
unsigned  indent 
) const
protected

Definition at line 53 of file json.cpp.

References array, escape_string(), J_ARRAY, J_FALSE, J_NULL, J_NUMBER, J_OBJECT, J_STRING, J_TRUE, kind, and value.

Referenced by output().

◆ swap()

void jsont::swap ( jsont other)

Definition at line 136 of file json.cpp.

References array, kind, object, and value.

Referenced by parse_json(), and json_parsert::pop().

Member Data Documentation

◆ array

◆ kind

◆ null_json_object

const jsont jsont::null_json_object
staticprotected

Definition at line 113 of file json.h.

Referenced by operator[](), and json_objectt::operator[]().

◆ object

objectt jsont::object

Definition at line 129 of file json.h.

Referenced by json_irept::convert_from_json(), swap(), and yyjsonparse().

◆ value


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