userver: formats::json::Array Class Reference
Loading...
Searching...
No Matches
formats::json::Array Class Referencefinal

#include <userver/formats/json/array.hpp>

Detailed Description

Non-mutable JSON array representation.

This class is implemented in terms of formats::json::Value and cannot represent anything else but a JSON array. Use it when you need to explicitly state that only JSON array is expected.

Definition at line 23 of file array.hpp.

Inheritance diagram for formats::json::Array:

Public Types

using const_iterator
using const_reverse_iterator

Public Member Functions

 Array ()
 Creates empty array.
 Array (const Value &value)
 Array (Value &&value)
 Array (ValueBuilder &&builder)
 Creates array extracting value from the builder.
 Array (const Array &)=default
 Array (Array &&) noexcept=default
Arrayoperator= (const Array &) &=default
Arrayoperator= (Array &&) noexcept=default
const ValueGetValue () const &
 Returns formats::json::Value.
Value && ExtractValue () &&
 Returns formats::json::Value.
Value operator[] (std::string_view key) const =delete
Array Clone () const
 Returns a deep copy of array (see formats::json::Value::Clone).
Value operator[] (std::size_t index) const
const_iterator begin () const
const_iterator end () const
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
bool IsEmpty () const
std::size_t GetSize () const
void CheckInBounds (std::size_t index) const
template<typename T>
auto As () const
template<typename T, typename First, typename... Rest>
auto As (First &&default_arg, Rest &&... more_default_args) const
template<typename T>
auto As (DefaultConstructed) const
template<typename T>
ConvertTo () const
template<typename T, typename First, typename... Rest>
ConvertTo (First &&default_arg, Rest &&... more_default_args) const
std::string GetPath () const
bool IsRoot () const noexcept

Member Typedef Documentation

◆ const_iterator

using formats::json::Value::const_iterator

Definition at line 70 of file value.hpp.

◆ const_reverse_iterator

using formats::json::Value::const_reverse_iterator

Definition at line 71 of file value.hpp.

Constructor & Destructor Documentation

◆ Array() [1/3]

formats::json::Array::Array ( const Value & value)
inlineexplicit
Exceptions
TypeMismatchExceptionif value is not an array

Definition at line 32 of file array.hpp.

◆ Array() [2/3]

formats::json::Array::Array ( Value && value)
inlineexplicit
Exceptions
TypeMismatchExceptionif value is not an array

Definition at line 39 of file array.hpp.

◆ Array() [3/3]

formats::json::Array::Array ( ValueBuilder && builder)
explicit

Creates array extracting value from the builder.

Exceptions
TypeMismatchExceptionif extracted value is not an array.

Member Function Documentation

◆ As() [1/3]

template<typename T>
auto formats::json::Value::As ( ) const
See also
formats::json::Value::As

Definition at line 183 of file value.hpp.

◆ As() [2/3]

template<typename T>
auto formats::json::Value::As ( Value::DefaultConstructed ) const
See also
formats::json::Value::As

Definition at line 195 of file value.hpp.

◆ As() [3/3]

template<typename T, typename First, typename... Rest>
auto formats::json::Value::As ( First && default_arg,
Rest &&... more_default_args ) const
See also
formats::json::Value::As

Definition at line 189 of file value.hpp.

◆ begin()

const_iterator formats::json::Value::begin ( ) const

◆ CheckInBounds()

◆ Clone()

Array formats::json::Array::Clone ( ) const
inline

Returns a deep copy of array (see formats::json::Value::Clone).

Definition at line 101 of file array.hpp.

◆ ConvertTo() [1/2]

template<typename T>
T formats::json::Value::ConvertTo ( ) const
See also
formats::json::Value::ConvertTo

Definition at line 200 of file value.hpp.

◆ ConvertTo() [2/2]

template<typename T, typename First, typename... Rest>
T formats::json::Value::ConvertTo ( First && default_arg,
Rest &&... more_default_args ) const
See also
formats::json::Value::ConvertTo

Definition at line 205 of file value.hpp.

◆ end()

const_iterator formats::json::Value::end ( ) const

◆ ExtractValue()

Value && formats::json::Array::ExtractValue ( ) &&
inline

Returns formats::json::Value.

Definition at line 59 of file array.hpp.

◆ GetPath()

◆ GetSize()

◆ GetValue()

const Value & formats::json::Array::GetValue ( ) const &
inline

Returns formats::json::Value.

Definition at line 56 of file array.hpp.

◆ IsEmpty()

◆ IsRoot()

◆ operator[]()

Value formats::json::Value::operator[] ( std::size_t index) const

◆ rbegin()

const_reverse_iterator formats::json::Value::rbegin ( ) const

◆ rend()

const_reverse_iterator formats::json::Value::rend ( ) const

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