CBMC
json.h File Reference
#include <vector>
#include <map>
#include <iosfwd>
#include <string>
#include "irep.h"
#include "range.h"
+ Include dependency graph for json.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  jsont
 
class  json_arrayt
 
class  json_stringt
 
class  json_numbert
 
class  json_objectt
 
class  json_truet
 
class  json_falset
 
class  json_nullt
 

Functions

std::ostream & operator<< (std::ostream &out, const jsont &src)
 
json_arraytto_json_array (jsont &json)
 
const json_arraytto_json_array (const jsont &json)
 
json_objecttto_json_object (jsont &json)
 
const json_objecttto_json_object (const jsont &json)
 
json_stringtto_json_string (jsont &json)
 
const json_stringtto_json_string (const jsont &json)
 
bool operator== (const jsont &left, const jsont &right)
 
jsont to_json (const structured_datat &data)
 Convert the structured_datat into an json object. More...
 

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const jsont src 
)
inline

Definition at line 158 of file json.h.

◆ operator==()

bool operator== ( const jsont left,
const jsont right 
)

Definition at line 169 of file json.cpp.

◆ to_json()

jsont to_json ( const structured_datat data)

Convert the structured_datat into an json object.

For example, the structured data: structured_datat data{ {{labelt{{"my", "data"}}, structured_data_entryt::entry( {{labelt{{"my", "number"}}, structured_data_entryt::data_node(json_numbert("10"))}, {labelt{{"my", "string"}}, structured_data_entryt::data_node(json_stringt("hi"))}})}}};

Will produce:

{
"myData": {
"myNumber": 10
"myString": "hi"
}
}
Parameters
dataThe structured data to convert.
Returns
The json object as specified.

Definition at line 225 of file json.cpp.

◆ to_json_array() [1/2]

const json_arrayt& to_json_array ( const jsont json)
inline

Definition at line 430 of file json.h.

◆ to_json_array() [2/2]

json_arrayt& to_json_array ( jsont json)
inline

Definition at line 424 of file json.h.

◆ to_json_object() [1/2]

const json_objectt& to_json_object ( const jsont json)
inline

Definition at line 448 of file json.h.

◆ to_json_object() [2/2]

json_objectt& to_json_object ( jsont json)
inline

Definition at line 442 of file json.h.

◆ to_json_string() [1/2]

const json_stringt& to_json_string ( const jsont json)
inline

Definition at line 460 of file json.h.

◆ to_json_string() [2/2]

json_stringt& to_json_string ( jsont json)
inline

Definition at line 454 of file json.h.