ljson::object class

the class that holds a json object

Constructors, destructors, conversion operators

object() explicit
constructor for ljson::object

Public functions

auto at(const std::string& key) →  class ljson::node&
access specified key with bounds checking
auto begin() →  json_object::iterator
returns an the first iterator
auto empty() const →  bool noexcept
check if the ljson::object is empty
auto end() →  json_object::iterator
returns an iterator past the last key
auto erase(const std::string& key) →  json_object::size_type
remove a key with its associated node from the ljson::object
auto erase(const json_object::iterator pos) →  json_object::iterator
remove an iterator with its associated node from the ljson::object
auto erase(const json_object::iterator begin, const json_object::iterator end) →  json_object::iterator
remove a range with its associated ljson::node's from the ljson::object
auto find(const std::string& key) →  json_object::iterator
find a key
auto insert(const std::string& key, const class node& element) →  ljson::node&
insert ljson::node into key
auto operator[](const std::string& key) →  class ljson::node&
access specified key without bounds checking or insert the key if it doesn't exist
auto size() const →  size_t noexcept
get the number of keys

Function documentation

class ljson::node& ljson::object::at(const std::string& key)

access specified key with bounds checking

Parameters
key to be accessed
Returns a reference to the ljson::node associated to the key
Exceptions
std::out_of_range if the container doesn't have the key

json_object::iterator ljson::object::begin()

returns an the first iterator

Returns the first iterator

bool ljson::object::empty() const noexcept

check if the ljson::object is empty

Returns true if it is

json_object::iterator ljson::object::end()

returns an iterator past the last key

Returns iterator past the last key

json_object::size_type ljson::object::erase(const std::string& key)

remove a key with its associated node from the ljson::object

Parameters
key the json key to be removed
Returns number of keys removed

json_object::iterator ljson::object::erase(const json_object::iterator pos)

remove an iterator with its associated node from the ljson::object

Parameters
pos the iterator to be removed
Returns iterator following the last removed iterator

json_object::iterator ljson::object::erase(const json_object::iterator begin, const json_object::iterator end)

remove a range with its associated ljson::node's from the ljson::object

Parameters
begin the beginning of the range to be removed
end the end of the range to be removed
Returns iterator following the last removed iterator

json_object::iterator ljson::object::find(const std::string& key)

find a key

Returns iterator of the found key found or end()

ljson::node& ljson::object::insert(const std::string& key, const class node& element)

insert ljson::node into key

Parameters
key the json key to insert at
element the ljson::node to be inserted
Returns a reference of the inserted ljson::node

class ljson::node& ljson::object::operator[](const std::string& key)

access specified key without bounds checking or insert the key if it doesn't exist

Parameters
key to be accessed
Returns a reference to the ljson::node associated to the key

size_t ljson::object::size() const noexcept

get the number of keys

Returns the number of keys