Honeycomb  0.1
Component-Model Framework
Classes | Typedefs | Enumerations | Functions | Variables
honey::json Namespace Reference

Json string serialization format methods. More...

Classes

struct  Config
 Configuration for json value variant. More...
 
struct  null_t
 Json null value type. More...
 
class  Value_
 Json value variant. Provide a Config to customize the variant's bounded types. More...
 
struct  ValueError
 

Typedefs

typedef Value_< Config<> > Value
 Json value with default config. More...
 

Enumerations

enum  ValueType {
  ValueType::Null, ValueType::Int, ValueType::Real, ValueType::Bool,
  ValueType::String, ValueType::Array, ValueType::Object
}
 Json value type, corresponds to Value::Variant bounded type id. More...
 

Functions

template<class Config >
istream & operator>> (istream &is, Value_< Config > &val)
 Convert a string to a json value tree. Returns either a tree with val as the root array/object, or null if string is empty. More...
 
template istream & operator>> (istream &is, Value_< Config< true >> &val)
 
template istream & operator>> (istream &is, Value_< Config< false >> &val)
 
template<class Config >
ostream & operator<< (ostream &os, const Value_< Config > &val)
 Convert a json value tree to a string. Throws ValueError on write failure. More...
 
template ostream & operator<< (ostream &os, const Value_< Config< true >> &val)
 
template ostream & operator<< (ostream &os, const Value_< Config< false >> &val)
 
ostream & beautify (ostream &os)
 Output easily readable json with line breaks and indentation. More...
 
ostream & escapeSlash (ostream &os)
 Escape forward slash characters in json output so it is suitable for embedding in HTML. More...
 

Variables

static null_t null
 Json null value. More...
 

Detailed Description

Json string serialization format methods.

Typedef Documentation

Json value with default config.

Enumeration Type Documentation

Json value type, corresponds to Value::Variant bounded type id.

Enumerator
Null 
Int 
Real 
Bool 
String 
Array 
Object 

Function Documentation

ostream& honey::json::beautify ( ostream &  os)
inline

Output easily readable json with line breaks and indentation.

ostream& honey::json::escapeSlash ( ostream &  os)
inline

Escape forward slash characters in json output so it is suitable for embedding in HTML.

template<class Config >
ostream & honey::json::operator<< ( ostream &  os,
const Value_< Config > &  val 
)

Convert a json value tree to a string. Throws ValueError on write failure.

template ostream& honey::json::operator<< ( ostream &  os,
const Value_< Config< true >> &  val 
)
template ostream& honey::json::operator<< ( ostream &  os,
const Value_< Config< false >> &  val 
)
template<class Config >
istream & honey::json::operator>> ( istream &  is,
Value_< Config > &  val 
)

Convert a string to a json value tree. Returns either a tree with val as the root array/object, or null if string is empty.

All whitespace before the root json value (if any) is consumed. After parsing the stream position will be just after the root json array end ']' or object end '}'. Throws ValueError on parse failure.

template istream& honey::json::operator>> ( istream &  is,
Value_< Config< true >> &  val 
)
template istream& honey::json::operator>> ( istream &  is,
Value_< Config< false >> &  val 
)

Variable Documentation

null_t honey::json::null
static

Json null value.