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

Weak UI-affine navigation handle owned by an existing scene/model scope. Removing a view does not remove its context. Closing the scene cancels pending resolution and retires all callbacks. Handles retain no model, snapshot, widget, source or runtime. Copied immutable channel snapshots and bookmarks remain ordinary independent values. More...

#include <managed_navigation.hpp>

Public Member Functions

 ManagedNavigation ()=default
 Empty handle; operations return CLOSED.
template<class T>
std::expected< void, ManagedError > setModel (ManagedModel< T > model, ModelRebindOptions options={}) const
template<class T>
bool model (ManagedModel< T > model, ModelRebindOptions options={}) const
std::expected< ManagedSource< NavigationPosition >, TreeError > current () const
std::expected< ManagedSource< NavigationSelection >, TreeError > selection () const
std::expected< ManagedSource< NavigationPosition >, TreeError > readingAnchor () const
std::expected< std::optional< ModelBookmark >, TreeError > bookmark () const
std::expected< std::optional< ModelBookmark >, TreeError > readingBookmark () const
std::expected< void, TreeError > navigate (RowId id) const
std::expected< void, TreeError > setCurrent (ModelBookmark bookmark) const
std::expected< void, TreeError > clearCurrent () const
std::expected< void, TreeError > setSelection (std::span< const RowId > rows) const
std::expected< void, TreeError > setReadingAnchor (ModelBookmark bookmark) const
std::expected< void, TreeError > clearReadingAnchor () const
std::expected< void, TreeError > setChangeMap (PositionChangeMap changes) const
std::expected< PositionRequest, TreeError > beginResolve (std::uint64_t revision) const
std::expected< bool, TreeError > applyReply (const PositionReply &reply) const
std::expected< std::stop_token, TreeError > stopToken () const

Friends

class ManagedScene
struct ui::detail::Access
struct ui::detail::EditAccess

Detailed Description

Weak UI-affine navigation handle owned by an existing scene/model scope. Removing a view does not remove its context. Closing the scene cancels pending resolution and retires all callbacks. Handles retain no model, snapshot, widget, source or runtime. Copied immutable channel snapshots and bookmarks remain ordinary independent values.

Member Function Documentation

◆ applyReply()

std::expected< bool, TreeError > portals::ManagedNavigation::applyReply ( const PositionReply & reply) const
Parameters
replyQualified provider receipt; stale results cannot replace newer navigation.
Returns
True when admitted, false when stale, or malformed/access/allocation failure.

◆ beginResolve()

std::expected< PositionRequest, TreeError > portals::ManagedNavigation::beginResolve ( std::uint64_t revision) const
Parameters
revisionExact target provider revision in this context's delivery session.
Returns
Qualified metadata-only request, WOULD_BLOCK without current, or checked failure. The caller uses its existing worker path; this method neither dispatches nor blocks.

◆ bookmark()

std::expected< std::optional< ModelBookmark >, TreeError > portals::ManagedNavigation::bookmark ( ) const
Returns
Latest revision-qualified current metadata, or checked access failure.

◆ clearCurrent()

std::expected< void, TreeError > portals::ManagedNavigation::clearCurrent ( ) const
Returns
Success or checked access failure; cancels any older resolution request.

◆ clearReadingAnchor()

std::expected< void, TreeError > portals::ManagedNavigation::clearReadingAnchor ( ) const
Returns
Success or checked access failure; leaves current and selection unchanged.

◆ current()

std::expected< ManagedSource< NavigationPosition >, TreeError > portals::ManagedNavigation::current ( ) const
Returns
Read-only current channel, WRONG_THREAD, or CLOSED.

◆ model()

template<class T>
bool portals::ManagedNavigation::model ( ManagedModel< T > model,
ModelRebindOptions options = {} ) const
Template Parameters
TImmutable common domain row type.
Parameters
modelDestination model.
optionsSame policy as setModel.
Returns
True on admission; false reports the original error once through the scene.

◆ navigate()

std::expected< void, TreeError > portals::ManagedNavigation::navigate ( RowId id) const
Parameters
idStable row in the original finite model, resolved through its bounded index.
Returns
Success, WOULD_BLOCK for unavailable identity/data, or checked access/provider failure.

◆ readingAnchor()

std::expected< ManagedSource< NavigationPosition >, TreeError > portals::ManagedNavigation::readingAnchor ( ) const
Returns
Explicit logical reading-anchor channel, independent of current and pixels.

◆ readingBookmark()

std::expected< std::optional< ModelBookmark >, TreeError > portals::ManagedNavigation::readingBookmark ( ) const
Returns
Latest revision-qualified reading metadata, or checked access failure.

◆ selection()

std::expected< ManagedSource< NavigationSelection >, TreeError > portals::ManagedNavigation::selection ( ) const
Returns
Read-only selected-set channel, independent of current and keyboard focus.

◆ setChangeMap()

std::expected< void, TreeError > portals::ManagedNavigation::setChangeMap ( PositionChangeMap changes) const
Parameters
changesComplete bounded proof for a future finite-model reconciliation.
Returns
Success or checked access failure. Missing proof never permits ordinal guessing.

◆ setCurrent()

std::expected< void, TreeError > portals::ManagedNavigation::setCurrent ( ModelBookmark bookmark) const
Parameters
bookmarkOwning compatible source metadata, without retaining a provider.
Returns
Success or validation/access failure; same logical current emits no notification.

◆ setModel()

template<class T>
std::expected< void, ManagedError > portals::ManagedNavigation::setModel ( ManagedModel< T > model,
ModelRebindOptions options = {} ) const
Template Parameters
TImmutable row type shared by the context and all participating views.
Parameters
modelSame-scene destination; provider work is bounded and never performs UI I/O.
optionsRemember/reset and bounded history policy.
Returns
Atomic group admission, or a checked error preserving the installed group.

◆ setReadingAnchor()

std::expected< void, TreeError > portals::ManagedNavigation::setReadingAnchor ( ModelBookmark bookmark) const
Parameters
bookmarkOwning logical reading anchor, never a viewport offset.
Returns
Success or validation/access failure; current and selection are unchanged.

◆ setSelection()

std::expected< void, TreeError > portals::ManagedNavigation::setSelection ( std::span< const RowId > rows) const
Parameters
rowsSelected IDs in this context's source domain; copied and canonicalized.
Returns
Success, NODE_LIMIT for the configured limit, or validation/access/allocation failure.

◆ stopToken()

std::expected< std::stop_token, TreeError > portals::ManagedNavigation::stopToken ( ) const
Returns
Cooperative token for the currently admitted request, or checked access failure.

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