MIRA
Classes | Namespaces | Typedefs | Functions
JSON.h File Reference

Wrappers for JSON. More...

#include <iostream>
#include <json_spirit_value.h>
#include <error/Exceptions.h>
#include <serialization/IsAtomicSerializable.h>
#include <utils/Singleton.h>
#include <stream/BinaryStream.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  JSONDefaultPrecision
 JSONDefaultPrecision is a singleton that provides a mechanism to control the default precision for output of floating-point JSON values. More...
 
struct  QueryValueResult
 A struct used for return value of getElementIfExists() More...
 
struct  QueryNumberResult
 A struct used for return value of getNumberElementIfExists() More...
 
class  IsAtomicSerializable< JSONValue >
 

Namespaces

 mira
 specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
 
 mira::json
 
 json_spirit
 

Typedefs

typedef json_spirit::mValue Value
 A value is an abstract description of data in JSON (underlying data can either be one of the JSON base data types (int, double, string) or an json::Object, json::Array or null. More...
 
typedef json_spirit::mObject Object
 A representation of an object (class, struct) in JSON. More...
 
typedef json_spirit::mArray Array
 A representation of an array (vector) in JSON. More...
 
typedef json::Value JSONValue
 Imports the json::Value type into mira namespace. More...
 
typedef json::Object JSONObject
 Imports the json::Object type into mira namespace. More...
 
typedef json::Array JSONArray
 Imports the json::Array type into mira namespace. More...
 

Functions

MIRA_BASE_EXPORT void write (const Value &value, std::ostream &ioStream, bool formatted=false, int precision=-1)
 Writes a json::Value into a given stream using the JSON format. More...
 
MIRA_BASE_EXPORT std::string write (const Value &value, bool formatted=false, int precision=-1)
 Writes a json::Value into a string using the JSON format. More...
 
MIRA_BASE_EXPORT void read (const std::string &s, Value &oValue)
 Read a json::Value from a string that contains JSON format. More...
 
MIRA_BASE_EXPORT void read (std::istream &ioStream, Value &oValue)
 Read a json::Value from a stream that contains JSON format. More...
 
MIRA_BASE_EXPORT void read (std::string::const_iterator &begin, std::string::const_iterator &end, Value &oValue)
 Read a json::Value from a string iterator range that contains JSON format. More...
 
MIRA_BASE_EXPORT Value getElement (const Value &iValue, const std::string &elementName)
 Get a json::Value element/member from a json::Value Syntax: More...
 
MIRA_BASE_EXPORT bool hasElement (const Value &iValue, const std::string &element)
 Query existence of element/member in a json::Value Use this variant to only query whether the element exists, avoiding exceptions. More...
 
MIRA_BASE_EXPORT QueryValueResult getElementIfExists (const Value &iValue, const std::string &elementName)
 Get a json::Value element/member from a json::Value if it exists, otherwise the returned result will contain the error string. More...
 
MIRA_BASE_EXPORT double getNumberElement (const Value &iValue, const std::string &elementName)
 Get a number element/member from a json::Value See getElement() for basic syntax. More...
 
MIRA_BASE_EXPORT bool hasNumberElement (const Value &iValue, const std::string &element)
 Query existence of number element/member in a json::Value Use this variant to only query whether the element exists and is a number, avoiding exceptions. More...
 
MIRA_BASE_EXPORT QueryNumberResult getNumberElementIfExists (const Value &iValue, const std::string &elementName)
 Get a number element/member from a json::Value if it exists, otherwise the returned result will contain the error string. More...
 
template<typename OStream >
OStream & operator<< (OStream &os, const mira::JSONValue &value)
 
mira::BinaryStlOstreamoperator<< (mira::BinaryStlOstream &os, const mira::JSONValue &value)
 
mira::BinaryBufferOstreamoperator<< (mira::BinaryBufferOstream &os, const mira::JSONValue &value)
 
template<typename IStream >
IStream & operator>> (IStream &is, mira::JSONValue &value)
 
template<typename CharT >
std::basic_stringstream< CharT > & operator>> (std::basic_stringstream< CharT > &is, mira::JSONValue &value)
 

Detailed Description

Wrappers for JSON.

Author
Tim Langner
Date
2011/06/21