#include <JsonReader.hpp>
Represents a value in the JSON. Instances of this class should not exceed the lifetime of the JsonReader that they came from. Attempting to access a NestedValue for which the associated JsonReader has been destructed results in undefined behavior. Two or more instances of this class may represent the same nested value in the JSON.
chesspp::util::JsonReader::NestedValue::NestedValue |
( |
NestedValue const & |
| ) |
|
|
default |
chesspp::util::JsonReader::NestedValue::NestedValue |
( |
NestedValue && |
| ) |
|
|
default |
chesspp::util::JsonReader::NestedValue::~NestedValue |
( |
| ) |
|
|
default |
json_value const& chesspp::util::JsonReader::NestedValue::implementation |
( |
| ) |
|
|
inlinenoexcept |
Only for extreme use cases: returns the underlying json_value being wrapped.
- Returns
- the underlying json_value
std::size_t chesspp::util::JsonReader::NestedValue::length |
( |
| ) |
const |
|
inlinenoexcept |
Returns the length of array values.
- Returns
- The length of the array, or 0 if not an array.
std::map<std::string, NestedValue> chesspp::util::JsonReader::NestedValue::object |
( |
| ) |
const |
|
inline |
Provides a std::map-based view of an object value, mapping object keys to object values. Only works if type() == json_object
- Returns
- a std::map of object keys ot obejct values
chesspp::util::JsonReader::NestedValue::operator bool |
( |
| ) |
const |
|
inlinenoexcept |
Returns the boolean state of this bool value. Only works if type() == json_bool.
- Returns
- The boolean.
chesspp::util::JsonReader::NestedValue::operator double |
( |
| ) |
const |
|
inlinenoexcept |
Returns the floating-point value of this double. Only works if type() == json_double
- Returns
- The double.
chesspp::util::JsonReader::NestedValue::operator std::int16_t |
( |
| ) |
const |
|
inlinenoexcept |
chesspp::util::JsonReader::NestedValue::operator std::int32_t |
( |
| ) |
const |
|
inlinenoexcept |
chesspp::util::JsonReader::NestedValue::operator std::int64_t |
( |
| ) |
const |
|
inlinenoexcept |
chesspp::util::JsonReader::NestedValue::operator std::int8_t |
( |
| ) |
const |
|
inlinenoexcept |
chesspp::util::JsonReader::NestedValue::operator std::string |
( |
| ) |
const |
|
inlinenoexcept |
Returns the string representation of this string value. Only works if type() == json_string
- Returns
- The string
chesspp::util::JsonReader::NestedValue::operator std::uint16_t |
( |
| ) |
const |
|
inlinenoexcept |
chesspp::util::JsonReader::NestedValue::operator std::uint32_t |
( |
| ) |
const |
|
inlinenoexcept |
chesspp::util::JsonReader::NestedValue::operator std::uint64_t |
( |
| ) |
const |
|
inlinenoexcept |
chesspp::util::JsonReader::NestedValue::operator std::uint8_t |
( |
| ) |
const |
|
inlinenoexcept |
NestedValue chesspp::util::JsonReader::NestedValue::operator[] |
( |
std::string const & |
name | ) |
const |
|
inlinenoexcept |
Returns a NestedValue within this one by name. Only works if type() == json_object
- Parameters
-
name | the name of the nested JSON value. |
- Returns
- the NestedValue by name.
NestedValue chesspp::util::JsonReader::NestedValue::operator[] |
( |
char const * |
name | ) |
const |
|
inline |
Returns a NestedValue within this one by name. Only works if type() == json_object
- Parameters
-
name | the name of the nested JSON value. |
- Returns
- the NestedValue by name.
NestedValue chesspp::util::JsonReader::NestedValue::operator[] |
( |
std::size_t |
index | ) |
const |
|
inlinenoexcept |
Returns the nested value at the given array index. Only works if type() == json_array
- Parameters
-
index | The index within the array. |
- Returns
- the nested value at the given index.
NestedValue chesspp::util::JsonReader::NestedValue::parent |
( |
| ) |
const |
|
inline |
json_type chesspp::util::JsonReader::NestedValue::type |
( |
| ) |
const |
|
inlinenoexcept |
Returns the type of this value. Note that the return value is a type from the json-parse library. It may be compared to these constants: json_null json_boolean json_integer json_double json_string json_array json_object
- Returns
- The type of value represented.
The documentation for this class was generated from the following file: