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 22 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
 
bool operator== (const Array &other) const
 Compares values.
 
bool operator!= (const Array &other) const
 
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
 

Private Member Functions

bool operator== (const Value &other) const
 Compares values.
 
bool operator!= (const Value &other) const
 

Member Typedef Documentation

◆ const_iterator

Definition at line 69 of file value.hpp.

◆ const_reverse_iterator

Definition at line 70 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 31 of file array.hpp.

◆ Array() [2/3]

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

Definition at line 34 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 185 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 197 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 191 of file value.hpp.

◆ begin()

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

◆ CheckInBounds()

void formats::json::Value::CheckInBounds ( std::size_t index) const

◆ Clone()

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

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

Definition at line 96 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 202 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 207 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 50 of file array.hpp.

◆ GetPath()

std::string formats::json::Value::GetPath ( ) const

◆ GetSize()

std::size_t formats::json::Value::GetSize ( ) const

◆ GetValue()

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

Returns formats::json::Value.

Definition at line 47 of file array.hpp.

◆ IsEmpty()

bool formats::json::Value::IsEmpty ( ) const

◆ IsRoot()

bool formats::json::Value::IsRoot ( ) const
noexcept

◆ operator!=()

bool formats::json::Array::operator!= ( const Array & other) const
inline

Definition at line 81 of file array.hpp.

◆ operator==()

bool formats::json::Array::operator== ( const Array & other) const
inline

Compares values.

Definition at line 80 of file array.hpp.

◆ 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: