|
| std::string | to_string () const override |
| | Render the value as a string.
|
| |
| | explicit (false) BaseCell(U &&v) |
| | Construct by forwarding into the storage (v becomes Storage::value).
|
| |
| PrimitiveCell< T > & | operator= (U &&v) |
| | Assign to the storage from v.
|
| |
|
T & | get () |
| | Mutable access to the held storage.
|
| |
|
T const & | get () const |
| | Read-only access to the held storage.
|
| |
| std::partial_ordering | compare (ICell const &other) const override |
| | Default three-way comparison: kind first, then storage value.
|
| |
| 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".
|
| |
| 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).
|
| |
|
|
static constexpr std::string_view | kind_id = trait_t::type_id |
| | Wire kind id (taken from PrimitiveTraits<T>::type_id).
|
| |
|
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").
|
| |
template<PrimitiveStorage T>
class parcel::PrimitiveCell< T >
Leaf cell wrapping a single scalar (or complex) value of type T.
Wire shape:
{"k": "<type_id>", "v": <value>}
with <type_id> taken from PrimitiveTraits<T>::type_id (e.g. "i32", "string"). 128-bit integers serialize their "v" as a decimal string and complex numbers as a [real, imaginary] array, via the commons ADL serializers pulled in through json.h.
- Template Parameters
-
| T | A type satisfying PrimitiveStorage. |
- See also
- PrimitiveTraits — wire id and default display info per
T.
-
SimpleCellTypeDescriptor — descriptor used by
descriptor().
template<PrimitiveStorage T>
Render the value as a string.
Strings are returned verbatim, bool becomes "true" / "false", char becomes a 1-byte string, 128-bit integers are formatted by hand (since std::to_string has no overload), complex numbers render as "(real, imaginary)", and everything else routes through std::to_string.
- Returns
- Compact textual form of the value.
Implements parcel::ICell.