21#include <commons/color.hpp>
22#include <commons/icons.hpp>
23#include <commons/json/metadata.hpp>
24#include <commons/metadata.hpp>
44 using base_t::operator=;
46 static constexpr std::string_view kind_id =
"md:v";
48 [[nodiscard]] std::string
to_string()
const override {
49 std::ostringstream os;
58 static cell_type_descriptor_t descriptor() {
59 static const auto d = std::make_shared<SimpleCellTypeDescriptor<ValueCell>>(DisplayInfo{
61 .description =
"Dynamic JSON-shaped value from the commons metadata tree.",
62 .icon = comms::Icons::mdi::variable,
63 .color = comms::Colors::mui::deep_purple[500],
80 using base_t::operator=;
86 ObjectCell(
const std::initializer_list<comms::md::Object::value_type> il)
87 :
base_t(comms::md::Object(il)) {}
89 static constexpr std::string_view kind_id =
"md:o";
91 [[nodiscard]] std::string
to_string()
const override {
92 std::ostringstream os;
101 static cell_type_descriptor_t descriptor() {
102 static const auto d = std::make_shared<SimpleCellTypeDescriptor<ObjectCell>>(DisplayInfo{
103 .name =
"md::Object",
104 .description =
"Unordered string-keyed map of md::Value (md::Object/Metadata).",
105 .icon = comms::Icons::mdi::code_braces,
106 .color = comms::Colors::mui::amber[700],
122 using base_t::base_t;
123 using base_t::operator=;
132 template <
class T0,
class T1,
class... Rest>
133 requires(std::constructible_from<comms::md::Value, T0 &&> &&
134 std::constructible_from<comms::md::Value, T1 &&> &&
135 (std::constructible_from<comms::md::Value, Rest &&> && ...))
137 :
base_t(comms::md::Array{comms::md::Value(std::forward<T0>(a)),
138 comms::md::Value(std::forward<T1>(b)),
139 comms::md::Value(std::forward<Rest>(rest))...}) {}
141 static constexpr std::string_view kind_id =
"md:a";
144 std::ostringstream os;
153 static cell_type_descriptor_t descriptor() {
154 static const auto d = std::make_shared<SimpleCellTypeDescriptor<ArrayCell>>(DisplayInfo{
156 .description =
"Heterogeneous vector of md::Value (md::Array).",
157 .icon = comms::Icons::mdi::code_brackets,
158 .color = comms::Colors::mui::green[600],
Core ICell interface, cell_t handle, BaseCell CRTP base, and CellLike concept.
std::shared_ptr< ICell > cell_t
Shared handle to any ICell-derived value — the canonical cell pointer.
Definition cell.h:68
Cell wrapping a comms::md::Array (std::vector<comms::md::Value>).
Definition metadata.h:118
std::string to_string() const override
Render the cell's value as a compact human-readable string.
Definition metadata.h:143
ArrayCell(T0 &&a, T1 &&b, Rest &&... rest)
Brace-init passthrough so ArrayCell{"a", "b", "c"} mirrors comms::md::Array{...}.
Definition metadata.h:136
Cell wrapping a comms::md::Object (a.k.a.
Definition metadata.h:75
std::string to_string() const override
Render the cell's value as a compact human-readable string.
Definition metadata.h:91
ObjectCell(const std::initializer_list< comms::md::Object::value_type > il)
Brace-init passthrough so ObjectCell{{"k", 1}, {"k2", "v"}} mirrors comms::md::Object{....
Definition metadata.h:86
Runtime catalog of cell-type descriptors, keyed by wire kind id.
Definition registry.h:115
Cell wrapping a comms::md::Value.
Definition metadata.h:39
std::string to_string() const override
Render the cell's value as a compact human-readable string.
Definition metadata.h:48
The default_cell_for<T> trait that drives FieldsBuilder field-type inference.
#define PARCEL_DEFAULT_CELL(CellT)
Register a cell type as the default wrapper for its payload type.
Definition defaults.h:269
Runtime cell-type descriptors and the schema-graph mix-ins (IHasFields, ISubTypes).
nlohmann::json typedef shared across cell types.
nlohmann::json json_t
Project-wide alias for nlohmann::json.
Definition json.h:19
CRTP base providing default to_json / clone / kind plumbing on top of a storage type.
Definition cell.h:343
static cell_t from_json_strict(json_t const &j)
Strict shorthand for the recurring cell_from_json + make_shared.
Definition cell.h:571
comms::md::Value value
Held value of the cell.
Definition cell.h:348