morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::table::CellEdits Class Reference

Commits cell edits row by row, in order. More...

#include <edits.hpp>

Public Member Functions

 CellEdits (RowPatcher &patcher, EditCommit commit, Engine *engine=nullptr)
 Builds the committer.
 CellEdits (CellEdits const &)=delete
CellEdits & operator= (CellEdits const &)=delete
 CellEdits (CellEdits &&)=delete
CellEdits & operator= (CellEdits &&)=delete
 ~CellEdits ()
 Ends the engine edit of every row with an edit in flight or settling: its completion will be ignored, so nothing else would.
void commit (EditRequest request)
 Commits an edit: now, or after the row's earlier edits settle.
bool stale (RowId const &row, std::string_view column) const
 Whether a cell has an edit committed and not yet settled.
std::optional< std::string > error (RowId const &row, std::string_view column) const
 The error a cell shows, until its next edit succeeds.
std::size_t unsettled () const
 Edits committed and not yet settled, across rows.

Detailed Description

Commits cell edits row by row, in order.

Owner-affine. A completion that arrives after the CellEdits is destroyed is ignored, and destroying it ends the engine edit of every row it still has in flight. The commit function, the patcher and the engine's handlers may commit again, or destroy this object, from inside a call it makes.

Definition at line 71 of file edits.hpp.

Constructor & Destructor Documentation

◆ CellEdits()

morph::table::CellEdits::CellEdits ( RowPatcher & patcher,
EditCommit commit,
Engine * engine = nullptr )
inline

Builds the committer.

Parameters
patcherReplaces a row with the server's reply; must outlive this object.
commitRuns the table's mutation.
engineOptional: the engine whose rows hold their place while an edit is in flight; must outlive this object.

Definition at line 78 of file edits.hpp.

◆ ~CellEdits()

morph::table::CellEdits::~CellEdits ( )
inline

Ends the engine edit of every row with an edit in flight or settling: its completion will be ignored, so nothing else would.

Definition at line 89 of file edits.hpp.

Member Function Documentation

◆ commit()

void morph::table::CellEdits::commit ( EditRequest request)
inline

Commits an edit: now, or after the row's earlier edits settle.

Parameters
requestThe edit.

Definition at line 106 of file edits.hpp.

◆ stale()

bool morph::table::CellEdits::stale ( RowId const & row,
std::string_view column ) const
inlinenodiscard

Whether a cell has an edit committed and not yet settled.

Parameters
rowThe row's key.
columnThe column's id.
Returns
true while stale.

Definition at line 118 of file edits.hpp.

◆ error()

std::optional< std::string > morph::table::CellEdits::error ( RowId const & row,
std::string_view column ) const
inlinenodiscard

The error a cell shows, until its next edit succeeds.

Parameters
rowThe row's key.
columnThe column's id.
Returns
The message, or nothing.

Definition at line 131 of file edits.hpp.

◆ unsettled()

std::size_t morph::table::CellEdits::unsettled ( ) const
inlinenodiscard

Edits committed and not yet settled, across rows.

Returns
The count.

Definition at line 142 of file edits.hpp.


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