|
enum | Type {
Null,
Boolean,
String,
Number,
Array,
Object
} |
|
typedef std::list< JSON > | ArrayType |
|
typedef std::list< std::pair< std::string, JSON > > | ObjectType |
|
- Note
- Number value is internally stored and parsed exactly the same like in original JSON string. Parser only validate it against JSON requirements, as there is not precisely specified range, precision and other parameters of Number value in JSON standards. Because of that we belive it's better to not force any C++ POD(double, int etc.) or data structure(GMP BigNumbers) here - you will probably better know how to convert these numbers or meybe you even don't need this conversion at all.
- Warning
- You should ensure that data that you are assigning as Number is in valid JSON number format.
- Note
- String JSON value and Object JSON value keys are parsed as utf-8 encoded string
- Warning
- You should ensure that data that you are assigning as String or Object key is valid utf-8 encoded.
ArrayType is type used to store json Arrays.
ObjectType is type used to store json Objects.
The Type enum used to deduce specialized type of JSON node.
Value default constructor initializes Value as.
rili::JSON::JSON |
( |
std::string const & |
json, |
|
|
size_t |
maxDepth = 100 |
|
) |
| |
|
inline |
JSON constructs root node from json string.
- Parameters
-
json | input JSON formated utf-8 encoded string |
maxDepth | specify how deep nasted Objects/Arrays will be accepted |
array retrieve internaly stored value of array type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
array retrieve internaly stored value of array type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
void rili::JSON::array |
( |
ArrayType const & |
a | ) |
|
|
inline |
array assign array value to current JSON object
- Parameters
-
bool& rili::JSON::boolean |
( |
| ) |
|
|
inline |
boolean retrieve internaly stored value of boolean type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
bool const& rili::JSON::boolean |
( |
| ) |
const |
|
inline |
boolean retrieve internaly stored value of boolean type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
void rili::JSON::boolean |
( |
bool |
b | ) |
|
|
inline |
boolean assign bool value to current JSON object
- Parameters
-
void rili::JSON::null |
( |
| ) |
|
|
inline |
null assign null value to current JSON object
std::string& rili::JSON::number |
( |
| ) |
|
|
inline |
number retrieve internaly stored value of number type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
std::string const& rili::JSON::number |
( |
| ) |
const |
|
inline |
number retrieve internaly stored value of number type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
void rili::JSON::number |
( |
std::string const & |
n | ) |
|
|
inline |
number assign number value to current JSON object
- Parameters
-
object retrieve internaly stored value of object type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
object retrieve internaly stored value of object type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
object assign object value to current JSON object
- Parameters
-
void rili::JSON::parse |
( |
const std::string & |
json, |
|
|
size_t |
maxDepth = 100 |
|
) |
| |
parse is function used to covert JSON string to object tree representation
- Parameters
-
json | input JSON formated utf-8 encoded string |
maxDepth | specify how deep nasted Objects/Arrays will be accepted |
std::string& rili::JSON::string |
( |
| ) |
|
|
inline |
string retrieve internaly stored value of string type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
std::string const& rili::JSON::string |
( |
| ) |
const |
|
inline |
string retrieve internaly stored value of string type
- Warning
- throw std::bad_cast if type not match to really used
- Returns
- value
void rili::JSON::string |
( |
std::string const & |
s | ) |
|
|
inline |
string assign string value to current JSON object
- Parameters
-
std::string rili::JSON::stringify |
( |
| ) |
const |
|
noexcept |
stringify is function used to convert object tree structure into JSON string
- Returns
- utf-8 encoded JSON string
Type rili::JSON::type |
( |
| ) |
const |
|
inlinenoexcept |
type used to retrieve used specialized type of JSON node
- Returns
- node type
The documentation for this class was generated from the following file: