JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::object_node_handle Class Referencefinal

A node handle used when a value is kind::object to access elements of the object in potentially destructive manner. More...

#include <jsonv/value.hpp>

Public Types

using key_type = std::string
 The key type of the object.
 
using mapped_type = value
 The mapped type of the object.
 

Public Member Functions

 object_node_handle (object_node_handle &&src) noexcept
 Take over the element owned by src, if any. src is left empty.
 
object_node_handle & operator= (object_node_handle &&src) noexcept
 Release the element this handle owns, if any, and take over the one owned by src, if any.
 
bool empty () const noexcept
 
 operator bool () const noexcept
 
key_type & key () const
 Returns a non-const reference to the key_type member of the element.
 
mapped_type & mapped () const
 Returns a non-const reference to the mapped_type member of the element.
 

Friends

class value
 

Detailed Description

A node handle used when a value is kind::object to access elements of the object in potentially destructive manner.

This makes it possible to modify the contents of a node extracted from an object, and then re-insert it without having to copy the element.

Definition at line 1227 of file value.hpp.

Member Typedef Documentation

◆ key_type

The key type of the object.

Definition at line 1231 of file value.hpp.

◆ mapped_type

The mapped type of the object.

Definition at line 1234 of file value.hpp.

Constructor & Destructor Documentation

◆ object_node_handle()

jsonv::object_node_handle::object_node_handle ( )
inlineexplicitnoexcept

Definition at line 1237 of file value.hpp.

Member Function Documentation

◆ empty()

bool jsonv::object_node_handle::empty ( ) const
inlinenoexcept
Returns
true if the node handle is empty; false if otherwise.

Definition at line 1252 of file value.hpp.

◆ key()

key_type & jsonv::object_node_handle::key ( ) const

Returns a non-const reference to the key_type member of the element.

Exceptions
std::invalid_argumentif the node handle is empty.

◆ mapped()

mapped_type & jsonv::object_node_handle::mapped ( ) const

Returns a non-const reference to the mapped_type member of the element.

Exceptions
std::invalid_argumentif the node handle is empty.

◆ operator bool()

jsonv::object_node_handle::operator bool ( ) const
inlineexplicitnoexcept
Returns
false if the node handle is empty; true if otherwise.

Definition at line 1256 of file value.hpp.

◆ operator=()

object_node_handle & jsonv::object_node_handle::operator= ( object_node_handle &&  src)
noexcept

Release the element this handle owns, if any, and take over the one owned by src, if any.

src is left empty. Self-assignment has no effect.

Friends And Related Symbol Documentation

◆ value

friend class value
friend

Definition at line 1274 of file value.hpp.


The documentation for this class was generated from the following file: