Adjusted json::value operator indices.
This commit is contained in:
@@ -162,13 +162,13 @@ namespace JJX::json {
|
||||
};
|
||||
struct number : value {
|
||||
/// The default constructor initializes to floating-point literal zero.
|
||||
explicit number() : value(0.0) {}
|
||||
explicit number(double v) : value(v) {}
|
||||
explicit number();
|
||||
explicit number(double v);
|
||||
};
|
||||
struct boolean : value {
|
||||
/// The default constructor initializes to false.
|
||||
explicit boolean() : value(false) {}
|
||||
explicit boolean(bool v) : value(v) {}
|
||||
explicit boolean();
|
||||
explicit boolean(bool v);
|
||||
};
|
||||
|
||||
/// A specialized json::value which provides STL compatibility with std::map, and other functions for convenience.
|
||||
@@ -176,9 +176,9 @@ namespace JJX::json {
|
||||
struct object : value
|
||||
{
|
||||
/// The default constructor initializes to an empty map.
|
||||
explicit object() : value(std::map<std::string, value>{}) {}
|
||||
explicit object();
|
||||
/// Constructs this object from a list of key-value pairs, in the form of std::map.
|
||||
explicit object(const std::map<std::string, value>& v) : value(v) {}
|
||||
explicit object(const std::map<std::string, value>& v);
|
||||
|
||||
/// Adds a key-value pair to this object.
|
||||
void insert(const std::pair<std::string, value>& kvp);
|
||||
|
11
src/JSON.cpp
11
src/JSON.cpp
@@ -693,8 +693,19 @@ namespace JJX::json {
|
||||
return this->value::object->at(key).type;
|
||||
}
|
||||
|
||||
object::object() : value(std::map<std::string, value>{}) {}
|
||||
|
||||
object::object(const std::map<std::string, value> &v) : value(v) {}
|
||||
|
||||
array::array(): value(std::vector<value>{}) {}
|
||||
|
||||
size_t array::size() const { return value::array->size();}
|
||||
|
||||
number::number() : value(0.0) {}
|
||||
|
||||
number::number(double v) : value(v) {}
|
||||
|
||||
boolean::boolean() : value(false) {}
|
||||
|
||||
boolean::boolean(bool v) : value(v) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user