operator[]
JSON::Node::operator[]
Returns the element at a certain index in an Array Node or a certain key in an Object Node.
Declaration
Node& operator[](const std::string& childName);
Parameters
Name |
Type |
Description |
---|---|---|
childName |
const std::string& |
The name of the child. |
Returns
A reference to the JSON::Node associated with the key childName
.
Notes
This function can only be called on a JSON::Node with the Object JSON::Type.
Declaration
const Node& operator[](const std::string& childName) const;
Parameters
Name |
Type |
Description |
---|---|---|
childName |
const std::string& |
The name of the child. |
Returns
A const reference to the JSON::Node associated with the key childName
.
Notes
This function can only be called on a JSON::Node with the Object JSON::Type.
Declaration
Node& operator[](const size_t element);
Parameters
Name |
Type |
Description |
---|---|---|
element |
size_t |
The index of the child. |
Returns
A reference to the JSON::Node at index element
.
Notes
This function can only be called on a JSON::Node with the Array JSON::Type.
Declaration
const Node& operator[](const size_t element) const;
Parameters
Name |
Type |
Description |
---|---|---|
element |
size_t |
The index of the child. |
Returns
A const reference to the JSON::Node at index element
.
Notes
This function can only be called on a JSON::Node with the Array JSON::Type.