Pigweed
 
Loading...
Searching...
No Matches
pw::JsonArray Class Reference

#include <builder.h>

Inheritance diagram for pw::JsonArray:
pw::JsonBuilder pw::JsonBuffer< kMaxSize >

Public Member Functions

constexpr JsonArray (const JsonArray &)=delete
 
constexpr JsonArrayoperator= (const JsonArray &)=delete
 
constexpr bool IsValue () const
 
constexpr bool IsArray () const
 
constexpr bool IsObject () const
 
constexpr operator std::string_view () const
 
constexpr const char * data () const
 
constexpr size_t size () const
 
constexpr size_t max_size () const
 
constexpr bool ok () const
 
constexpr Status status () const
 
constexpr Status last_status () const
 
constexpr void clear ()
 
constexpr void clear_status ()
 
template<typename T >
constexpr JsonArrayAppend (const T &value)
 
constexpr NestedJsonArray AppendNestedArray ()
 Appends a nested array to this array.
 
constexpr NestedJsonObject AppendNestedObject ()
 Appends a nested object to this array.
 
template<typename Iterable >
constexpr JsonArrayExtend (const Iterable &iterable)
 
template<typename T , size_t kSize>
constexpr JsonArrayExtend (const T(&iterable)[kSize])
 

Friends

class JsonBuilder
 

Detailed Description

Stores a JSON array: a sequence of values. Provides functions for adding items to the array, as well as the common functions for accessing the serialized data (see documentation for JsonBuilder).

Member Function Documentation

◆ Append()

template<typename T >
constexpr JsonArray & pw::JsonArray::Append ( const T &  value)
constexpr

Adds a value to the JSON array. Updates the status.

It is an error to call Append() if the underlying JsonBuilder is no longer an array.

◆ Extend() [1/2]

template<typename Iterable >
constexpr JsonArray & pw::JsonArray::Extend ( const Iterable &  iterable)
constexpr

Appends all elements from an iterable container. If there is an error, changes are reverted.

◆ Extend() [2/2]

template<typename T , size_t kSize>
constexpr JsonArray & pw::JsonArray::Extend ( const T(&)  iterable[kSize])
constexpr

Appends all elements from an iterable container. If there is an error, changes are reverted.


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