|
nfx-serialization 0.3.0
Cross-platform C++ JSON serialization library with extensible trait capabilities
|
JSON array wrapper for Document. More...
#include <nfx/serialization/json/Document.h>
Classes | |
| class | Iterator |
| Forward iterator for Array elements. More... | |
Public Member Functions | |
| Array () | |
| Default constructor - creates empty array. | |
| Array (const Document::Array &other) | |
| Copy constructor. | |
| Array (Document::Array &&other) noexcept | |
| Move constructor. | |
| ~Array ()=default | |
| Destructor. | |
| Document::Array & | operator= (const Document::Array &other) |
| Copy assignment operator. | |
| Document::Array & | operator= (Document::Array &&other) noexcept |
| Move assignment operator. | |
| bool | operator== (const Document::Array &other) const |
| Equality comparison. | |
| bool | operator!= (const Document::Array &other) const |
| Inequality comparison. | |
| std::string | toString (int indent=0) const |
| Convert array to JSON string. | |
| std::vector< uint8_t > | toBytes () const |
| Convert array to JSON bytes. | |
| size_t | size () const |
| Get number of elements in array. | |
| void | clear () |
| Clear all elements from array. | |
| bool | remove (size_t index) |
| Remove element at index. | |
| bool | contains (std::string_view indexStr) const |
| Check if an element exists at the specified index. | |
| template<JsonValue T> | |
| std::optional< T > | get (size_t index) const |
| Get element at index. | |
| template<JsonValue T> | |
| bool | get (size_t index, T &value) const |
| Get element at index into output parameter. | |
| template<JsonValue T> | |
| std::optional< T > | get (std::string_view path) const |
| Get nested element at path. | |
| template<JsonValue T> | |
| bool | get (std::string_view path, T &value) const |
| Get nested element at path into output parameter. | |
| template<JsonValue T> | |
| void | set (size_t index, const T &value) |
| Set element at index (copy version). | |
| template<JsonValue T> | |
| void | set (size_t index, T &&value) |
| Set element at index (move version). | |
| template<JsonValue T> | |
| void | set (std::string_view path, const T &value) |
| Set nested element at path (copy version). | |
| template<JsonValue T> | |
| void | set (std::string_view path, T &&value) |
| Set nested element at path (move version). | |
| template<JsonValue T> | |
| void | append (const T &value) |
| Append element to end of array (copy version). | |
| template<JsonValue T> | |
| void | append (T &&value) |
| Append element to end of array (move version). | |
| void | append (Document &value) |
| Append Document to end of array (reference version). | |
| void | append (Document::Array &value) |
| Append Array to end of array (reference version). | |
| void | append (Document::Object &value) |
| Append Object to end of array (reference version). | |
| template<JsonValue T> | |
| void | insert (size_t index, const T &value) |
| Insert element at index (copy version). | |
| template<JsonValue T> | |
| void | insert (size_t index, T &&value) |
| Insert element at index (move version). | |
| void | insert (size_t index, Document &value) |
| Insert Document at index (reference version). | |
| void | insert (size_t index, Document::Array &value) |
| Insert Array at index (reference version). | |
| void | insert (size_t index, Document::Object &value) |
| Insert Object at index (reference version). | |
| bool | isValid () const |
| Check if array is valid. | |
| std::string | lastError () const |
| Get last error message. | |
| Iterator | begin () const |
| Get iterator to first element. | |
| Iterator | end () const |
| Get iterator past last element. | |
Friends | |
| class | Document |
| class | Document_impl |
JSON array wrapper for Document.
Provides type-safe access to JSON array elements with support for indexed access, element addition/insertion/removal, and nested operations.
Definition at line 663 of file Document.h.
| nfx::serialization::json::Document::Array::Array | ( | const Document::Array & | other | ) |
Copy constructor.
| other | Array to copy from |
|
noexcept |
Move constructor.
| other | Array to move from |
| void nfx::serialization::json::Document::Array::append | ( | const T & | value | ) |
Append element to end of array (copy version).
| T | Type to append |
| value | Value to copy and append |
| void nfx::serialization::json::Document::Array::append | ( | Document & | value | ) |
Append Document to end of array (reference version).
| value | Document reference to append |
| void nfx::serialization::json::Document::Array::append | ( | Document::Array & | value | ) |
Append Array to end of array (reference version).
| value | Array reference to append |
| void nfx::serialization::json::Document::Array::append | ( | Document::Object & | value | ) |
Append Object to end of array (reference version).
| value | Object reference to append |
| void nfx::serialization::json::Document::Array::append | ( | T && | value | ) |
Append element to end of array (move version).
| T | Type to append |
| value | Value to move and append |
| Iterator nfx::serialization::json::Document::Array::begin | ( | ) | const |
Get iterator to first element.
| bool nfx::serialization::json::Document::Array::contains | ( | std::string_view | indexStr | ) | const |
Check if an element exists at the specified index.
| indexStr | Index as string (e.g., "0", "1") or JSON Pointer (e.g., "/0", "/1") |
| Iterator nfx::serialization::json::Document::Array::end | ( | ) | const |
Get iterator past last element.
| std::optional< T > nfx::serialization::json::Document::Array::get | ( | size_t | index | ) | const |
Get element at index.
| T | Type to retrieve |
| index | Array index |
| bool nfx::serialization::json::Document::Array::get | ( | size_t | index, |
| T & | value ) const |
Get element at index into output parameter.
| T | Type to retrieve |
| index | Array index | |
| [out] | value | Output parameter to store the result |
| std::optional< T > nfx::serialization::json::Document::Array::get | ( | std::string_view | path | ) | const |
Get nested element at path.
| T | Type to retrieve |
| path | JSON pointer path |
| bool nfx::serialization::json::Document::Array::get | ( | std::string_view | path, |
| T & | value ) const |
Get nested element at path into output parameter.
| T | Type to retrieve |
| path | JSON pointer path | |
| [out] | value | Output parameter to store the result |
| void nfx::serialization::json::Document::Array::insert | ( | size_t | index, |
| const T & | value ) |
Insert element at index (copy version).
| T | Type to insert |
| index | Position to insert at |
| value | Value to copy and insert |
| void nfx::serialization::json::Document::Array::insert | ( | size_t | index, |
| Document & | value ) |
Insert Document at index (reference version).
| index | Position to insert at |
| value | Document reference to insert |
| void nfx::serialization::json::Document::Array::insert | ( | size_t | index, |
| Document::Array & | value ) |
Insert Array at index (reference version).
| index | Position to insert at |
| value | Array reference to insert |
| void nfx::serialization::json::Document::Array::insert | ( | size_t | index, |
| Document::Object & | value ) |
Insert Object at index (reference version).
| index | Position to insert at |
| value | Object reference to insert |
| void nfx::serialization::json::Document::Array::insert | ( | size_t | index, |
| T && | value ) |
Insert element at index (move version).
| T | Type to insert |
| index | Position to insert at |
| value | Value to move and insert |
| bool nfx::serialization::json::Document::Array::isValid | ( | ) | const |
Check if array is valid.
| std::string nfx::serialization::json::Document::Array::lastError | ( | ) | const |
Get last error message.
| bool nfx::serialization::json::Document::Array::operator!= | ( | const Document::Array & | other | ) | const |
Inequality comparison.
| other | Array to compare with |
| Document::Array & nfx::serialization::json::Document::Array::operator= | ( | const Document::Array & | other | ) |
Copy assignment operator.
| other | Array to copy from |
|
noexcept |
Move assignment operator.
| other | Array to move from |
| bool nfx::serialization::json::Document::Array::operator== | ( | const Document::Array & | other | ) | const |
Equality comparison.
| other | Array to compare with |
| bool nfx::serialization::json::Document::Array::remove | ( | size_t | index | ) |
Remove element at index.
| index | Array index |
| void nfx::serialization::json::Document::Array::set | ( | size_t | index, |
| const T & | value ) |
Set element at index (copy version).
| T | Type to set |
| index | Array index |
| value | Value to copy |
| void nfx::serialization::json::Document::Array::set | ( | size_t | index, |
| T && | value ) |
Set element at index (move version).
| T | Type to set |
| index | Array index |
| value | Value to move |
| void nfx::serialization::json::Document::Array::set | ( | std::string_view | path, |
| const T & | value ) |
Set nested element at path (copy version).
| T | Type to set |
| path | JSON pointer path |
| value | Value to copy |
| void nfx::serialization::json::Document::Array::set | ( | std::string_view | path, |
| T && | value ) |
Set nested element at path (move version).
| T | Type to set |
| path | JSON pointer path |
| value | Value to move |
| size_t nfx::serialization::json::Document::Array::size | ( | ) | const |
Get number of elements in array.
| std::vector< uint8_t > nfx::serialization::json::Document::Array::toBytes | ( | ) | const |
Convert array to JSON bytes.
| std::string nfx::serialization::json::Document::Array::toString | ( | int | indent = 0 | ) | const |
Convert array to JSON string.
| indent | Indentation level for pretty printing
|
|
friend |
Definition at line 669 of file Document.h.
|
friend |
Definition at line 670 of file Document.h.