dxjson  1.0
JSON library for C++
Classes | Enumerations | Functions
dx Namespace Reference

Classes

class  Array
 
class  Boolean
 
class  Integer
 
class  JSON
 
class  JSONException
 
class  Null
 
class  Object
 
class  Real
 
class  String
 
class  Value
 

Enumerations

enum  JSONValue {
  JSON_UNDEFINED = 0, JSON_OBJECT = 1, JSON_HASH = 1, JSON_ARRAY = 2,
  JSON_INTEGER = 3, JSON_REAL = 4, JSON_STRING = 5, JSON_BOOLEAN = 6,
  JSON_NULL = 7
}
 

Functions

template<typename T >
void assertValidityOfNumericType (const T &value)
 
template<>
std::string JSON::get< std::string > () const
 

Detailed Description

This is the namespace which contain the JSON and JSONException class

Enumeration Type Documentation

Enum for storing type of a particular JSON object. See http://json.org/ for possible JSON values.

  • JSON_UNDEFINED: Default type of an unintialized JSON object
  • JSON_HASH: A key/value pair hash.
  • JSON_OBJECT: Synonym for JSON_HASH (has same numerical value)
  • JSON_ARRAY: A JSON array
  • JSON_INTEGER: An integral numeric value. (internally: int64_t)
  • JSON_REAL: A floating point numeric value. (internally: double)
  • JSON_STRING: A JSON string.
  • JSON_BOOLEAN: Either true/false JSON value.
  • JSON_NULL: The JSON value: "null"

To know which type of value a JSON object holds, use the function JSON::type()

Note
  • JSON_OBJECT and JSON_HASH are synonyms, and we use them interchangebly throughout the documentation and elsewhere.
  • We treat Integer and Real values differently, which is not in strict accordance with JSON rfc (which just have a single "number" type).

Definition at line 100 of file dxjson.h.

Function Documentation

template<>
std::string dx::JSON::get< std::string > ( ) const
inline

Return back the string stored inside JSON_STRING object

Note
The returned string is in C++ style, and not escaped like it would be if printed using toString() or write() method. For example: a newline will be present at ASCII 10, and not "\n" inside string. Also it will not contain enclosing quotes.
Returns
The C++ style string for contents of JSON_STRING object

Definition at line 828 of file dxjson.h.