GGUI::SnapshotRows class

A snapshot's node rows. Copying copies every row; the snapshot being written shares with the previous one instead (ShareFrom).

Public static functions

static auto BytesOf(const SnapshotChunk& chunk) -> size_t
Memory one chunk holds.

Constructors, destructors, conversion operators

SnapshotRows() defaulted
No rows.
~SnapshotRows()
SnapshotRows(const SnapshotRows& other)
A copy of every row, shared with nothing.

Public functions

auto operator=(const SnapshotRows& other) -> SnapshotRows&
The same, assigned.
auto At(uint32_t slot) const -> const SnapshotNode*
The row at slot; null if none.
auto ChunkOf(uint32_t slot) const -> const SnapshotChunk*
The chunk holding slot's row; null if none.
auto Shares(uint32_t slot, const SnapshotRows& other) const -> bool
True if the row at slot is physically the same shared row in both.
auto Bytes() const -> size_t
Memory held, counting shared chunks as its own.
void Collect(std::vector<const SnapshotChunk*>& out) const
Its chunk pointers, for deduplicating memory counts across snapshots.
void ShareFrom(const SnapshotRows* other)
Share other's rows (null: none). Only into rows nobody is reading.
auto Edit(uint32_t slot) -> SnapshotNode&
The row to write, created if missing and unshared first if shared.
void SetNames(uint32_t slot, std::string_view name, std::string_view description)
Set the row's accessible name and description.
void SetImage(uint32_t slot, const struct SnapshotImage* image)
An image or viewport's look; null: none.
void SetDrawing(uint32_t slot, const std::vector<UIPrimitive>* drawing)
A canvas's drawing, in its own units; null: none.
void SetSpans(uint32_t slot, const std::vector<SnapshotSpan>* spans)
Rich text's spans; null: none.