Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::ui::EditField< Row, Value > Class Template Reference

UI-thread-affine typed field capability with exact-target retained inspection and discard. More...

#include <ui_model_edit.hpp>

Public Member Functions

std::expected< EditFieldSnapshot< Value >, TreeError > snapshot () const
std::expected< EditFieldSnapshot< Value >, TreeError > snapshot (const EditTarget &target) const
std::expected< EditStatus, TreeError > set (const Value &value) const
std::expected< std::optional< std::string >, TreeError > draftText (const EditTarget &target) const
 Copy retained editor bytes without parsing, refreshing or changing the displayed target.
std::expected< void, TreeError > discard (const EditTarget &target) const
EditField validate (std::function< bool(const Value &)> rule) const

Friends

class EditSession< Row >

Detailed Description

template<class Row, class Value>
class portals::ui::EditField< Row, Value >

UI-thread-affine typed field capability with exact-target retained inspection and discard.

Member Function Documentation

◆ discard()

template<class Row, class Value>
std::expected< void, TreeError > portals::ui::EditField< Row, Value >::discard ( const EditTarget & target) const
inline
Parameters
targetFrozen destination, never resolved through nearest/current.
Returns
Checked removal of this retained draft and its history; other targets are unchanged. A live admitted write returns WOULD_BLOCK until its final receipt, preserving serialization.

◆ draftText()

template<class Row, class Value>
std::expected< std::optional< std::string >, TreeError > portals::ui::EditField< Row, Value >::draftText ( const EditTarget & target) const
inline

Copy retained editor bytes without parsing, refreshing or changing the displayed target.

Parameters
targetExact retained record/field destination, including an orphan after deletion or source closure.
Returns
Owning complete text, including malformed input, or nullopt when this target has no text editor state. The call is UI-thread-affine and copies only on explicit inspection. Allocation failure returns NO_MEMORY; stale or foreign targets retain their checked identity error. The copy survives discard and navigation.

◆ set()

template<class Row, class Value>
std::expected< EditStatus, TreeError > portals::ui::EditField< Row, Value >::set ( const Value & value) const
inline
Parameters
valueOwning typed candidate.
Returns
Validation/submission status; unpublished input stays owned.

◆ snapshot() [1/2]

template<class Row, class Value>
std::expected< EditFieldSnapshot< Value >, TreeError > portals::ui::EditField< Row, Value >::snapshot ( ) const
inline
Returns
Current field snapshot retaining the endpoint's declared value ownership. Native readonly row bindings may retain an accounted source-page lease; writable candidates still require independently owning values under the common edit contract.

◆ snapshot() [2/2]

template<class Row, class Value>
std::expected< EditFieldSnapshot< Value >, TreeError > portals::ui::EditField< Row, Value >::snapshot ( const EditTarget & target) const
inline
Parameters
targetOriginal exact destination.
Returns
Retained data, including an orphan after source close.

◆ validate()

template<class Row, class Value>
EditField portals::ui::EditField< Row, Value >::validate ( std::function< bool(const Value &)> rule) const
inline
Parameters
ruleOwning typed validation rule; borrowed values expire on return.
Returns
This shared field definition with its explicit synchronous rule.

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