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

Scoped action/model ownership on the tree UI thread, outside frames. Tree, router and scheduler outlive the binding. Admitted operations retain their state across callback removal. Deferred drafts retain their baseline revision and never overwrite external changes. No operation exposes an ordinary text draft or history. More...

#include <password.hpp>

Public Member Functions

 ~PasswordBinding ()
 Disconnect future actions/subscriptions; admitted callbacks retain owners.
 PasswordBinding (PasswordBinding &&other) noexcept
PasswordBinding & operator= (PasswordBinding &&other) noexcept
 PasswordBinding (const PasswordBinding &)=delete
PasswordBinding & operator= (const PasswordBinding &)=delete
std::expected< void, PasswordFailure > sync (Node< Widget > focused)
std::expected< PasswordResult, PasswordFailure > confirm ()
std::expected< PasswordResult, PasswordFailure > cancel ()
std::expected< PasswordResult, PasswordFailure > setValue (PasswordValue value)

Friends

class ManagedScene
struct ui::detail::RefAccess
std::expected< PasswordBinding, PasswordFailure > bindPassword (WidgetTree &tree, EventRouter &router, Node< Password > node, std::shared_ptr< Property< PasswordValue > > model, std::function< void(PasswordResult)> onResult, std::shared_ptr< Clipboard > clipboard={}, std::function< bool(SecretView)> validate={})
 Bind and securely inspect the initial model before publishing presentation.

Detailed Description

Scoped action/model ownership on the tree UI thread, outside frames. Tree, router and scheduler outlive the binding. Admitted operations retain their state across callback removal. Deferred drafts retain their baseline revision and never overwrite external changes. No operation exposes an ordinary text draft or history.

Constructor & Destructor Documentation

◆ PasswordBinding()

portals::PasswordBinding::PasswordBinding ( PasswordBinding && other)
noexcept
Parameters
otherBinding emptied by ownership transfer on UI.

Member Function Documentation

◆ cancel()

std::expected< PasswordResult, PasswordFailure > portals::PasswordBinding::cancel ( )
Returns
Outcome after checked adoption of the latest model; immediate published edits are not undone. Delivers onResult once; a failed secure access can invalidate the previous shared value. Combined operation/delivery failure returns an owning FAILED result with both causes.

◆ confirm()

std::expected< PasswordResult, PasswordFailure > portals::PasswordBinding::confirm ( )
Returns
Confirmation outcome; semantic rejection preserves the protected draft. Delivers onResult once after consistency is established. Technical failures are returned and reported once. If result delivery also throws, the returned FAILED result retains both failure and callbackError.

◆ operator=()

PasswordBinding & portals::PasswordBinding::operator= ( PasswordBinding && other)
noexcept
Parameters
otherReplacement installed before retiring reentrant old captures.
Returns
This binding; self-move preserves state.

◆ setValue()

std::expected< PasswordResult, PasswordFailure > portals::PasswordBinding::setValue ( PasswordValue value)
Parameters
valueProtected candidate retained by identity, checked against this editor's policy.
Returns
Same publication/validation policy as user input; readOnly does not block this explicit operation. Delivers onResult once. No-op identity replacement does not invalidate or publish. Combined operation/delivery failure returns an owning FAILED result with both causes.

◆ sync()

std::expected< void, PasswordFailure > portals::PasswordBinding::sync ( Node< Widget > focused)
Parameters
focusedCurrent router focus; empty means no focus.
Returns
Checked synchronization/focus failure, preserving typed secure causes.

◆ bindPassword

std::expected< PasswordBinding, PasswordFailure > bindPassword ( WidgetTree & tree,
EventRouter & router,
Node< Password > node,
std::shared_ptr< Property< PasswordValue > > model,
std::function< void(PasswordResult)> onResult,
std::shared_ptr< Clipboard > clipboard = {},
std::function< bool(SecretView)> validate = {} )
friend

Bind and securely inspect the initial model before publishing presentation.

Parameters
treeBorrowed UI owner, outliving binding and model.
routerBorrowed router for tree, outliving binding.
nodeLive protected editor; one action binding per node is permitted.
modelShared protected model owner; external replacements are checked before input.
onResultRequired owning UI callback; may remove this node or binding.
clipboardOptional shared service, called only with explicit ENABLED paste policy.
validateOptional owning semantic validator, borrowing plaintext synchronously; false retains the draft.
Returns
Scoped binding or original typed setup failure. Exceptions translate to TreeError without messages.

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