DLPrimitives
Classes | Typedefs | Enumerations | Functions
dlprim::json Namespace Reference

This namespace includes all JSON parsing and formatting related classes and functions. More...

Classes

class  bad_value_cast
 The error that is thrown in case of bad conversion of json::value to ordinary value. More...
 
class  copy_ptr
 a smart pointer similar to std::unique_ptr but it copies underlying object on pointer copy instead of moving its ownership. More...
 
struct  null
 Special object that is convertible to null json value. More...
 
class  string_key
 This is a special object that may hold an std::string or alternatively reference to external (unowned) chunk of text. More...
 
struct  traits
 
struct  undefined
 Special object that is convertible to undefined json value. More...
 
class  value
 This class is central representation of json objects. More...
 

Typedefs

typedef std::vector< valuearray
 The json::array - std::vector of json::value's.
 
typedef std::map< string_key, valueobject
 The json::object - std::map of json::value's.
 

Enumerations

enum  json_type {
  is_undefined, is_null, is_boolean, is_number,
  is_string, is_object, is_array
}
 The type of json value. More...
 
enum  { compact = 0, readable = 1 }
 

Functions

std::ostream & operator<< (std::ostream &out, string_key const &s)
 Write the string to the stream.
 
bool operator== (string_key const &l, char const *r)
 Compare two strings.
 
bool operator== (char const *l, string_key const &r)
 Compare two strings.
 
bool operator== (string_key const &l, std::string const &r)
 Compare two strings.
 
bool operator== (std::string const &l, string_key const &r)
 Compare two strings.
 
bool operator!= (string_key const &l, char const *r)
 Compare two strings.
 
bool operator!= (char const *l, string_key const &r)
 Compare two strings.
 
bool operator!= (string_key const &l, std::string const &r)
 Compare two strings.
 
bool operator!= (std::string const &l, string_key const &r)
 Compare two strings.
 
bool operator<= (string_key const &l, char const *r)
 Compare two strings.
 
bool operator<= (char const *l, string_key const &r)
 Compare two strings.
 
bool operator<= (string_key const &l, std::string const &r)
 Compare two strings.
 
bool operator<= (std::string const &l, string_key const &r)
 Compare two strings.
 
bool operator>= (string_key const &l, char const *r)
 Compare two strings.
 
bool operator>= (char const *l, string_key const &r)
 Compare two strings.
 
bool operator>= (string_key const &l, std::string const &r)
 Compare two strings.
 
bool operator>= (std::string const &l, string_key const &r)
 Compare two strings.
 
bool operator< (string_key const &l, char const *r)
 Compare two strings.
 
bool operator< (char const *l, string_key const &r)
 Compare two strings.
 
bool operator< (string_key const &l, std::string const &r)
 Compare two strings.
 
bool operator< (std::string const &l, string_key const &r)
 Compare two strings.
 
bool operator> (string_key const &l, char const *r)
 Compare two strings.
 
bool operator> (char const *l, string_key const &r)
 Compare two strings.
 
bool operator> (string_key const &l, std::string const &r)
 Compare two strings.
 
bool operator> (std::string const &l, string_key const &r)
 Compare two strings.
 
bool operator== (undefined const &, undefined const &)
 
bool operator!= (undefined const &, undefined const &)
 
bool operator== (null const &, null const &)
 
bool operator!= (null const &, null const &)
 
std::istream DLPRIM_API & operator>> (std::istream &in, value &v)
 Read json object from input stream.
 
std::ostream DLPRIM_API & operator<< (std::ostream &out, value const &v)
 Write json object to output stream.
 
std::ostream DLPRIM_API & operator<< (std::ostream &out, json_type)
 Write human readable representation of json_type.
 
std::string DLPRIM_API to_json (std::string const &utf)
 Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz".
 
std::string DLPRIM_API to_json (char const *begin, char const *end)
 Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz".
 
void DLPRIM_API to_json (char const *begin, char const *end, std::ostream &out)
 Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz".
 
void DLPRIM_API to_json (std::string const &str, std::ostream &out)
 Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz".
 

Detailed Description

This namespace includes all JSON parsing and formatting related classes and functions.

Enumeration Type Documentation

anonymous enum
Enumerator
compact 

Print JSON values in most compact format.

readable 

Print JSON values in human readable format (with identention)

The type of json value.

Enumerator
is_undefined 

Undefined value.

is_null 

null value

is_boolean 

boolean value

is_number 

numeric value

is_string 

string value

is_object 

object value

is_array 

array value