metadata 0.2.0
Modern C++23 header-only metadata container (JSON-like)
Loading...
Searching...
No Matches
md::ArrayCell Class Reference

Parcel cell wrapping an md::Array (std::vector<md::Value>). More...

#include <parcel.hpp>

Inherits parcel::BaseCell< ArrayCell, Array >.

Public Member Functions

template<class T0 , class T1 , class... Rest>
requires (std::constructible_from<Value, T0 &&> && std::constructible_from<Value, T1 &&> && (std::constructible_from<Value, Rest &&> && ...))
 ArrayCell (T0 &&a, T1 &&b, Rest &&... rest)
 Brace-init passthrough so md::ArrayCell{"a", "b", "c"} mirrors md::Array{...}.
 
std::string to_string () const override
 Compact textual rendering of the wrapped md::Array, identical to streaming via operator<<.
 

Static Public Member Functions

static parcel::cell_t from_json (parcel::json_t const &j, parcel::ParcelRegistry const &)
 Parcel deserialization entry point.
 
static parcel::cell_type_descriptor_t descriptor ()
 Registry descriptor for ArrayCell.
 

Static Public Attributes

static constexpr std::string_view kind_id = "md:a"
 Wire-stable kind id reported under the "k" slot.
 

Detailed Description

Parcel cell wrapping an md::Array (std::vector<md::Value>).

Wire kind: md:a. The "v" slot is a JSON array whose elements are serialized through the md::Value JSON adapter.

Constructor & Destructor Documentation

◆ ArrayCell()

template<class T0 , class T1 , class... Rest>
requires (std::constructible_from<Value, T0 &&> && std::constructible_from<Value, T1 &&> && (std::constructible_from<Value, Rest &&> && ...))
md::ArrayCell::ArrayCell ( T0 &&  a,
T1 &&  b,
Rest &&...  rest 
)
inline

Brace-init passthrough so md::ArrayCell{"a", "b", "c"} mirrors md::Array{...}.

Constrained to ≥2 elements so that ArrayCell{some_array} continues to forward to BaseCellArray → Value is implicit, so a 1-element overload would silently wrap the array as a single-element array.

Member Function Documentation

◆ from_json()

static parcel::cell_t md::ArrayCell::from_json ( parcel::json_t const &  j,
parcel::ParcelRegistry const &   
)
inlinestatic

Parcel deserialization entry point.

Validates "k" == "md:a" and decodes "v" as an md::Array via the <md/json.hpp> ADL hooks.

Exceptions
parcel::ParcelExceptionon shape or kind mismatch.

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