xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::json::decoder::Array Class Referencefinal

An accessor used for reading the elements of a JSON array. More...

#include <xentara/utils/json/decoder/Array.hpp>

+ Inheritance diagram for xentara::utils::json::decoder::Array:

Classes

class  Iterator
 An iterator that can be used to iterate over the array’s elements. More...
 

Public Member Functions

 Array ()=delete
 This type is not user-constructible.
 
internal auto begin () -> Iterator
 Returns an object that can be used to iterate over the elements.
 
constexpr auto end () noexcept -> std::default_sentinel_t
 Returns an sentinel that can be used to determine if an iterator is exhausted.
 
auto document () const -> std::reference_wrapper< const Document >
 Gets the JSON document that the array belongs to.
 
auto lineNumber () const -> std::uint_least32_t
 Gets the line number in the JSON document that the array is on.
 
auto location () const -> Location
 Gets the location of the array within the JSON document.
 

Detailed Description

An accessor used for reading the elements of a JSON array.

Objects of this class can be moved, but not copied.

Constructor & Destructor Documentation

◆ Array()

xentara::utils::json::decoder::Array::Array ( )
delete

This type is not user-constructible.

Member Function Documentation

◆ begin()

auto xentara::utils::json::decoder::Array::begin ( ) -> Iterator

Returns an object that can be used to iterate over the elements.

Returns
An iterator that allows reading of the elements
Exceptions
std::runtime_errorAn error occured reading the first element from the stream

◆ document()

auto xentara::utils::json::decoder::Array::document ( ) const -> std::reference_wrapper<const Document>

Gets the JSON document that the array belongs to.

Returns
The document

◆ end()

constexpr auto xentara::utils::json::decoder::Array::end ( ) -> std::default_sentinel_t
constexprnoexcept

Returns an sentinel that can be used to determine if an iterator is exhausted.

Returns
An sentinel for element iterators

◆ lineNumber()

auto xentara::utils::json::decoder::Array::lineNumber ( ) const -> std::uint_least32_t

Gets the line number in the JSON document that the array is on.

Returns
The line number of the square bracket that opens the array

◆ location()

auto xentara::utils::json::decoder::Array::location ( ) const -> Location

Gets the location of the array within the JSON document.

Returns
The location of the square bracket that opens the array