|
parcel 0.2.2
Wrappable, wire-transferable C++23 value system with JSON serialization
|
Field-descriptor extension that knows how to read/write a specific Payload.
More...
#include <struct.h>


Public Member Functions | |
| virtual void | to_json_into (json_t &v_obj, Payload const &p) const =0 |
Serialize this field from p into the value object v_obj. | |
| virtual void | from_json_into (json_t const &field_json, Payload &p, ParcelRegistry const ®) const =0 |
Deserialize this field from field_json into p. | |
| virtual void | to_string_into (std::string &out, Payload const &p) const =0 |
Append key: value for this field to the rendered string. | |
| virtual std::partial_ordering | compare (Payload const &a, Payload const &b) const =0 |
| Three-way compare this field across two payload instances. | |
| virtual DisplayInfo & | mutable_display_info ()=0 |
Mutable access to this field's display info — used by FieldsBuilder. | |
| virtual void | set_required (bool r)=0 |
| Override the field's required flag. | |
Public Member Functions inherited from parcel::IFieldDescriptor | |
| virtual std::string_view | key () const =0 |
JSON key under which this field appears in "v". | |
| virtual std::string_view | kind () const =0 |
| Cell kind id for the field's value type. | |
| virtual DisplayInfo | display_info () const =0 |
| Display info for this field. | |
| virtual bool | is_required () const =0 |
| Whether the field must be present on deserialization. | |
| virtual json_t | to_json () const =0 |
| Serialize the field descriptor itself. | |
Field-descriptor extension that knows how to read/write a specific Payload.
Refines IFieldDescriptor with hooks the StructCell machinery uses to project payload members in and out of JSON.
| Payload | The struct type whose fields are described. |
|
pure virtual |
Three-way compare this field across two payload instances.
StructCell::compare walks fields in declaration order and short- circuits on the first non-equal result; ignores display info. Optional fields follow std::optional's <=>: absent < present, both absent is equal.
Implemented in parcel::InheritedFieldDescriptor< DerivedPayload, ParentPayload >, and parcel::MemberFieldDescriptor< Payload, FieldT, CellT >.
|
pure virtual |
Deserialize this field from field_json into p.
| field_json | JSON value for this field (already a wrapped cell). |
| p | Payload instance to write into. |
| reg | Registry forwarded to nested cell deserializers. |
Implemented in parcel::InheritedFieldDescriptor< DerivedPayload, ParentPayload >, and parcel::MemberFieldDescriptor< Payload, FieldT, CellT >.
|
pure virtual |
Serialize this field from p into the value object v_obj.
| v_obj | Target JSON object (the "v" block of the cell). |
| p | Payload instance to read from. |
Implemented in parcel::InheritedFieldDescriptor< DerivedPayload, ParentPayload >, and parcel::MemberFieldDescriptor< Payload, FieldT, CellT >.
|
pure virtual |
Append key: value for this field to the rendered string.
| out | String buffer to append to. |
| p | Payload instance to read from. |
Implemented in parcel::InheritedFieldDescriptor< DerivedPayload, ParentPayload >, and parcel::MemberFieldDescriptor< Payload, FieldT, CellT >.