|
parcel 0.2.4
Wrappable, wire-transferable C++23 value system with JSON serialization
|
Cell carrying the serializable history of a comms::StatusTransitionTimeline<typename P::storage_t>.
More...
#include <lifecycle.h>


Public Types | |
| using | status_t = typename P::storage_t |
| The status type carried by each transition. | |
| using | transition_t = comms::StatusTransition< status_t > |
| The element type of the stored history. | |
| using | timeline_t = comms::StatusTransitionTimeline< status_t > |
| The live timeline type this cell projects. | |
Public Member Functions | |
| StatusTransitionTimelineCell (const timeline_t &tl) | |
| Snapshot a live timeline's transition history into the cell. | |
| void | load_into (timeline_t &tl) const |
Restore the stored history into a live timeline via load_transitions (no replay — subscribers are not notified and links are taken verbatim, matching commons' from_json). | |
| std::string | to_string () const override |
| Render the cell's value as a compact human-readable string. | |
| std::partial_ordering | compare (ICell const &other) const override |
| Default three-way comparison: kind first, then storage value. | |
| template<typename U > requires std::assignable_from<Storage&, U&&> | |
| Derived & | operator= (U &&v) |
Assign to the storage from v. | |
Public Member Functions inherited from parcel::BaseCell< Derived, Storage > | |
| template<typename U > requires std::constructible_from<Storage, U&&> | |
| explicit (false) BaseCell(U &&v) | |
Construct by forwarding into the storage (v becomes Storage::value). | |
| template<typename U > requires std::assignable_from<Storage&, U&&> | |
| Derived & | operator= (U &&v) |
Assign to the storage from v. | |
| Storage & | get () |
| Mutable access to the held storage. | |
| Storage const & | get () const |
| Read-only access to the held storage. | |
| std::string_view | kind () const override |
| Wire-stable kind identifier for this cell. | |
| std::optional< DisplayInfo > const & | overridden_display_info () const override |
| Read-only access to this cell's optional display info. | |
| cell_t | clone () const override |
| Deep-copy this cell. | |
| json_t | to_json () const override |
| Default JSON serialization for cells with JSON-convertible storage. | |
| void | inject_display_info (json_t &j) const |
Copy this cell's display info (if any) into the JSON object under "d". | |
Public Member Functions inherited from parcel::ICell | |
| virtual std::string | to_formatted_string () const |
| Render the cell as a multi-line, indented string. | |
| virtual std::size_t | hash_value () const noexcept |
Equality-consistent hash that mirrors compare's display-info-insensitivity. | |
| cell_t | with_display_info (DisplayInfo m) const |
| Return a deep copy with the entire display info block replaced. | |
| cell_t | with_name (std::string v) const |
Return a deep copy with name set to v. | |
| cell_t | with_description (std::string v) const |
Return a deep copy with description set to v. | |
| cell_t | with_icon (comms::Icon icon) const |
Return a deep copy with icon set to the typed icon. | |
| cell_t | with_icon (std::string const &v) const |
Return a deep copy with icon parsed from an Iconify set:name string (e.g. | |
| cell_t | with_color (comms::Color color) const |
Return a deep copy with color set to the typed color. | |
| cell_t | with_color (std::string const &v) const |
Return a deep copy with color parsed from a color string (hex like "#ffcc00", a CSS-functional form, or a CSS color name). | |
Additional Inherited Members | |
Static Public Member Functions inherited from parcel::BaseCell< Derived, Storage > | |
| template<typename... Args> requires std::constructible_from<Derived, Args&&...> | |
| static std::shared_ptr< Derived > | of (Args &&... args) |
Construct a shared_ptr<Derived> forwarding the arguments. | |
| template<typename... Args> requires std::constructible_from<Derived, Args&&...> | |
| static std::unique_ptr< Derived > | unique (Args &&... args) |
Construct a unique_ptr<Derived> forwarding the arguments. | |
| template<typename Out > | |
| static void | absorb_display_info (json_t const &j, Out &out) |
Read "d" (if present) from a JSON object and assign it onto a cell. | |
| static cell_t | from_json_strict (json_t const &j) |
Strict shorthand for the recurring cell_from_json + make_shared. | |
Public Attributes inherited from parcel::BaseCell< Derived, Storage > | |
| Storage | value {} |
| Held value of the cell. | |
Static Public Attributes inherited from parcel::ICell | |
| static constexpr std::string_view | KEY_KIND = "k" |
JSON key for the kind id ("k"). | |
| static constexpr std::string_view | KEY_VALUE = "v" |
JSON key for the value payload ("v"). | |
| static constexpr std::string_view | KEY_DESCRIPTION = "d" |
JSON key for the optional display info block ("d"). | |
Protected Member Functions inherited from parcel::BaseCell< Derived, Storage > | |
| void | set_display_info (std::optional< DisplayInfo > m) override |
| Replace this cell's display info in place. | |
Static Protected Member Functions inherited from parcel::BaseCell< Derived, Storage > | |
| template<typename T > | |
| static T | cell_from_json (const json_t &j, const std::string_view expected_kind) |
Validate a wrapped {"k","v"} JSON object and extract its "v" as T. | |
Protected Attributes inherited from parcel::BaseCell< Derived, Storage > | |
| std::optional< DisplayInfo > | display_info_ |
| Optional display info; omitted from JSON when empty. | |
Cell carrying the serializable history of a comms::StatusTransitionTimeline<typename P::storage_t>.
Wire kind "status_transition_timeline:" + P::kind_id (JSON array of transitions).
| P | Status cell whose storage is the status type T (see StatusTransitionCell). |
The storage is the timeline's std::vector<StatusTransition<T>> snapshot — the live timeline is non-copyable/non-movable (it owns a mutex) and so cannot be a cell's storage. The wire shape is identical to the commons timeline's own JSON (a bare array of transitions), wrapped in the parcel {"k","v"} envelope.
|
inlineoverridevirtual |
Default three-way comparison: kind first, then storage value.
If Storage supports <=>, that comparison is forwarded directly (which yields partial_ordering for floating-point storage). If only == is available, equal values map to equivalent and unequal values to unordered. Storage types lacking either, or std::variant storage (which UnionCell overrides), return unordered.
| other | Cell to compare with. |
Reimplemented from parcel::BaseCell< Derived, Storage >.
|
inline |
Restore the stored history into a live timeline via load_transitions (no replay — subscribers are not notified and links are taken verbatim, matching commons' from_json).
| tl | Timeline to overwrite with this cell's history. |
|
inline |
Assign to the storage from v.
| U | Any type assignable to the storage. |
| v | Replacement value. |
|
inlineoverridevirtual |
Render the cell's value as a compact human-readable string.
Implements parcel::ICell.