|
parcel 0.2.2
Wrappable, wire-transferable C++23 value system with JSON serialization
|
Concrete payload field descriptor backed by a member pointer. More...
#include <struct.h>


Public Member Functions | |
| MemberFieldDescriptor (FieldT Payload::*member_ptr, std::string key, DisplayInfo info) | |
| Construct with the member pointer, JSON key, and (initial) display info. | |
| std::string_view | key () const override |
JSON key under which this field appears in "v". | |
| std::string_view | kind () const override |
| Cell kind id for the field's value type. | |
| DisplayInfo | display_info () const override |
| Display info for this field. | |
| bool | is_required () const override |
| Whether the field must be present on deserialization. | |
| json_t | to_json () const override |
| Serialize the field descriptor itself. | |
| DisplayInfo & | mutable_display_info () override |
Mutable access to this field's display info — used by FieldsBuilder. | |
| void | set_required (const bool r) override |
| Override the field's required flag. | |
| void | to_json_into (json_t &v_obj, Payload const &p) const override |
Serialize this field from p into the value object v_obj. | |
| void | from_json_into (json_t const &field_json, Payload &p, ParcelRegistry const ®) const override |
Deserialize this field from field_json into p. | |
| std::partial_ordering | compare (Payload const &a, Payload const &b) const override |
| Three-way compare this field across two payload instances. | |
| void | to_string_into (std::string &out, Payload const &p) const override |
Append key: value for this field to the rendered string. | |
Concrete payload field descriptor backed by a member pointer.
The required flag defaults to false for std::optional<T> fields and true otherwise — matching the natural reading of "optional means
may be absent".
The member pointer is held at runtime (not as a non-type template parameter) so it can be a FieldT Base::* implicitly converted to FieldT Payload::*. This keeps FieldsBuilder<Derived>::field<&Base::x> usable for redeclaring/overriding inherited fields after extend<>.
| Payload | The struct type being described. |
| FieldT | The type of the member pointed at by member_ptr. |
| CellT | The cell type used to wrap FieldT on the wire. |
|
inline |
Construct with the member pointer, JSON key, and (initial) display info.
| member_ptr | Pointer-to-member into Payload. |
| key | JSON key under which this field appears. |
| info | Initial display info. |
|
inlineoverridevirtual |
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.
Implements parcel::IPayloadFieldDescriptor< Payload >.
|
inlineoverridevirtual |
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. |
Implements parcel::IPayloadFieldDescriptor< Payload >.
|
inlineoverridevirtual |
Serialize the field descriptor itself.
key, kind, display_info, required. Implements parcel::IFieldDescriptor.
|
inlineoverridevirtual |
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. |
Implements parcel::IPayloadFieldDescriptor< Payload >.
|
inlineoverridevirtual |
Append key: value for this field to the rendered string.
| out | String buffer to append to. |
| p | Payload instance to read from. |
Implements parcel::IPayloadFieldDescriptor< Payload >.