|
| | MapCell (const std::initializer_list< std::pair< const std::string, cell_t > > elems) |
| | Construct from a brace-enclosed list of {key, cell} pairs.
|
| |
|
auto | keys () const noexcept |
| | Lazy view over the keys of the map.
|
| |
|
auto | values () const noexcept |
| | Lazy view over the cell values of the map.
|
| |
| std::string | to_string () const override |
| | Render the map as {k1: v1, …}; null values appear as <null>.
|
| |
| json_t | to_json () const override |
| | Default JSON serialization for cells with JSON-convertible storage.
|
| |
| cell_t | clone () const override |
| | Deep-copy this cell.
|
| |
| std::size_t | hash_value () const noexcept override |
| | Equality-consistent hash that mirrors compare's display-info-insensitivity.
|
| |
| std::partial_ordering | compare (ICell const &other) const override |
| | Lexicographic three-way comparison over keys then values; ignores display info.
|
| |
| | explicit (false) BaseCell(U &&v) |
| | Construct by forwarding into the storage (v becomes Storage::value).
|
| |
| MapCell & | operator= (U &&v) |
| | Assign to the storage from v.
|
| |
|
std::map< std::string, cell_t > & | get () |
| | Mutable access to the held storage.
|
| |
|
std::map< std::string, cell_t > const & | get () const |
| | Read-only access to the held 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.
|
| |
| 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).
|
| |
Heterogeneous string-keyed map of cell_t — wire kind "m".
Wire shape:
{"k": "m", "v": {"a": {"k":"i32","v":1}, "b": {"k":"string","v":"hi"}}}
Values are full nested cells whose kind is recovered from each value's own "k". Use TypedMapCell<T> instead when every value has the same wire kind — the typed variant skips the per-value kind tag.
- See also
- TypedMapCell — homogeneous variant with element-tagged kind id.
| std::size_t parcel::MapCell::hash_value |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
Equality-consistent hash that mirrors compare's display-info-insensitivity.
Default implementation hashes the kind id and the JSON dump of "v", which works for every cell whose to_json() payload omits nested DisplayInfo. Heterogeneous container cells (ListCell, MapCell, HashMapCell) override this to recurse through hash_value() on their children — that is what keeps the hash display-info-insensitive when children carry display info of their own.
Reimplemented from parcel::ICell.
| json_t parcel::MapCell::to_json |
( |
| ) |
const |
|
inlineoverridevirtual |
Default JSON serialization for cells with JSON-convertible storage.
If Storage has a JSON adapter, emits {"k": kind_id, "v": value, optional "d": display info}. Otherwise the call throws — the derived cell must override to_json itself (ListCell, MapCell, etc.).
- Returns
- JSON object representation.
- Exceptions
-
| std::runtime_error | if Storage is not JSON-convertible. |
Reimplemented from parcel::BaseCell< MapCell, std::map< std::string, cell_t > >.