cprover
jsont Class Reference

#include <json.h>

+ Inheritance diagram for jsont:
+ Collaboration diagram for jsont:

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
 
void output_rec (std::ostream &, unsigned indent) const
 Recursive printing of the json object. More...
 

Static Public Member Functions

static jsont json_boolean (bool value)
 
static void output_object (std::ostream &out, const objectt &object, unsigned indent)
 Basic handling of the printing of a JSON object. More...
 
static void output_key (std::ostream &out, const std::string &key)
 

Public Attributes

kindt kind
 
arrayt array
 
objectt object
 
std::string value
 

Static Public Attributes

static const jsont null_json_object
 

Protected Member Functions

 jsont (kindt _kind)
 
 jsont (kindt _kind, std::string _value)
 

Static Protected Member Functions

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

Detailed Description

Definition at line 23 of file json.h.

Member Typedef Documentation

◆ arrayt

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

Definition at line 128 of file json.h.

◆ objectt

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

Definition at line 131 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 26 of file json.h.

Constructor & Destructor Documentation

◆ jsont() [1/3]

jsont::jsont ( )
inline

Definition at line 74 of file json.h.

◆ jsont() [2/3]

jsont::jsont ( kindt  _kind)
inlineexplicitprotected

Definition at line 118 of file json.h.

◆ jsont() [3/3]

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

Definition at line 122 of file json.h.

Member Function Documentation

◆ clear()

void jsont::clear ( void  )
inline

Definition at line 90 of file json.h.

◆ escape_string()

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

Definition at line 15 of file json.cpp.

◆ is_array()

bool jsont::is_array ( ) const
inline

Definition at line 54 of file json.h.

◆ is_false()

bool jsont::is_false ( ) const
inline

Definition at line 64 of file json.h.

◆ is_null()

bool jsont::is_null ( ) const
inline

Definition at line 69 of file json.h.

◆ is_number()

bool jsont::is_number ( ) const
inline

Definition at line 44 of file json.h.

◆ is_object()

bool jsont::is_object ( ) const
inline

Definition at line 49 of file json.h.

◆ is_string()

bool jsont::is_string ( ) const
inline

Definition at line 39 of file json.h.

◆ is_true()

bool jsont::is_true ( ) const
inline

Definition at line 59 of file json.h.

◆ json_boolean()

static jsont jsont::json_boolean ( bool  value)
inlinestatic

Definition at line 85 of file json.h.

◆ make_array()

json_arrayt & jsont::make_array ( )
inline

Definition at line 284 of file json.h.

◆ make_object()

json_objectt & jsont::make_object ( )
inline

Definition at line 290 of file json.h.

◆ operator[]()

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

Definition at line 102 of file json.h.

◆ output()

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

Definition at line 78 of file json.h.

◆ output_key()

void jsont::output_key ( std::ostream &  out,
const std::string &  key 
)
static

Definition at line 151 of file json.cpp.

◆ output_object()

void jsont::output_object ( std::ostream &  out,
const objectt object,
unsigned  indent 
)
static

Basic handling of the printing of a JSON object.

Dispatches to output_rec for most of the hard work.

Parameters
outThe stream that the JSON object is to be printed to.
objectThe JSON object.
indentThe indentation level.

Definition at line 129 of file json.cpp.

◆ output_rec()

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

Recursive printing of the json object.

Parameters
outThe stream object to have the json printed to.
indentThe indentation level.

Definition at line 56 of file json.cpp.

◆ swap()

void jsont::swap ( jsont other)

Definition at line 158 of file json.cpp.

Member Data Documentation

◆ array

arrayt jsont::array

Definition at line 129 of file json.h.

◆ kind

kindt jsont::kind

Definition at line 37 of file json.h.

◆ null_json_object

const jsont jsont::null_json_object
static

Definition at line 113 of file json.h.

◆ object

objectt jsont::object

Definition at line 132 of file json.h.

◆ value

std::string jsont::value

Definition at line 137 of file json.h.


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