Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::NavigationCheckpoint Class Reference

Immutable owning checkpoint; copies share bytes and never retain providers or UI objects. A default value is empty/invalid and allocates nothing. Capture/load stage a new value; failures never replace a caller's existing checkpoint or navigation state. Envelope checksum detects accidental corruption, not malicious modification or authenticity. Parse validates structure only; restore requires a matching provider and does not apply positions to views, grant write permissions, or resolve a position against live data. More...

#include <navigation_checkpoint.hpp>

Public Member Functions

std::expected< std::vector< NavigationCheckpointEntry >, NavigationCheckpointError > restore (const NavigationBookmarkCodec &codec, NavigationCheckpointOptions options={}, std::stop_token stop={}) const
std::span< const std::byte > bytes () const noexcept

Static Public Member Functions

static std::expected< NavigationCheckpoint, NavigationCheckpointError > capture (std::span< const NavigationCheckpointEntry > entries, const NavigationBookmarkCodec &codec, NavigationCheckpointOptions options={}, std::stop_token stop={})
static std::expected< NavigationCheckpoint, NavigationCheckpointError > parse (std::span< const std::byte > bytes, NavigationCheckpointOptions options={}, std::stop_token stop={})

Static Public Attributes

static constexpr std::uint32_t FORMAT_VERSION = 1
 Binary envelope schema, independent of provider version.

Detailed Description

Immutable owning checkpoint; copies share bytes and never retain providers or UI objects. A default value is empty/invalid and allocates nothing. Capture/load stage a new value; failures never replace a caller's existing checkpoint or navigation state. Envelope checksum detects accidental corruption, not malicious modification or authenticity. Parse validates structure only; restore requires a matching provider and does not apply positions to views, grant write permissions, or resolve a position against live data.

Member Function Documentation

◆ bytes()

std::span< const std::byte > portals::NavigationCheckpoint::bytes ( ) const
noexcept
Returns
Immutable encoded bytes, valid while this value or a copy survives.

◆ capture()

std::expected< NavigationCheckpoint, NavigationCheckpointError > portals::NavigationCheckpoint::capture ( std::span< const NavigationCheckpointEntry > entries,
const NavigationBookmarkCodec & codec,
NavigationCheckpointOptions options = {},
std::stop_token stop = {} )
static
Parameters
entriesBounded metadata-only locations in the provider's single resource domain.
codecExplicit portable identity/position conversion.
optionsMaximum encoded and restored metadata.
stopCooperative cancellation, checked before and after callbacks.
Returns
New immutable envelope or a typed validation/provider/allocation failure.

◆ parse()

std::expected< NavigationCheckpoint, NavigationCheckpointError > portals::NavigationCheckpoint::parse ( std::span< const std::byte > bytes,
NavigationCheckpointOptions options = {},
std::stop_token stop = {} )
static
Parameters
bytesUntrusted encoded envelope, copied only after a full bounded preflight.
optionsEnvelope/entry/identity capacities.
stopCooperative cancellation.
Returns
Owning structurally validated checkpoint or typed rejection.

◆ restore()

std::expected< std::vector< NavigationCheckpointEntry >, NavigationCheckpointError > portals::NavigationCheckpoint::restore ( const NavigationBookmarkCodec & codec,
NavigationCheckpointOptions options = {},
std::stop_token stop = {} ) const
Parameters
codecMatching portable resource and codec; decoded bookmarks are revalidated.
optionsEnvelope and decoded bookmark limits.
stopCooperative cancellation.
Returns
Complete staged positions, without changing any navigation channel or view.

The documentation for this class was generated from the following file: