morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::table::RowsSource< Row > Class Template Referencefinal

A DataSource over typed rows: one column per key glaze writes, its kind inferred from the value's type. More...

#include <query.hpp>

Inheritance diagram for morph::table::RowsSource< Row >:
morph::table::DataSource

Public Member Functions

 RowsSource (std::shared_ptr< std::vector< Row > const > rows, RowKey< Row > key, std::map< std::string, ColumnKind, std::less<> > const &kinds={}, std::map< std::string, std::string, std::less<> > const &comparators={})
 Builds the source.
std::span< ColumnInfo const > columns () const override
 The columns.
std::shared_ptr< RowSnapshot const > snapshot () const override
 The current rows; a pointer copy.
void subscribe (ChangeListener &listener) override
 Registers listener.
void unsubscribe (ChangeListener &listener) override
 Removes listener; safe from inside a notification.
void setRows (std::shared_ptr< std::vector< Row > const > rows)
 Replaces the rows and notifies Reset.

Detailed Description

template<typename Row>
class morph::table::RowsSource< Row >

A DataSource over typed rows: one column per key glaze writes, its kind inferred from the value's type.

bool is Bool; other integers Integer (an unsigned value above INT64_MAX is an invalid cell); floating point Number; Rational Decimal; a Quantity Quantity; DateTime and Timestamp DateTime; a type glaze writes as one of its members (Ranged, Choice, Tagged) that member's kind; everything else Text (an enum by its glaze name). A std::optional member's empty state, or anything glaze writes as null, is an empty cell. A row with a glz::meta has the columns its meta names. setRows replaces the rows and notifies Reset.

Template Parameters
RowA glaze-reflectable aggregate.

Definition at line 575 of file query.hpp.

Constructor & Destructor Documentation

◆ RowsSource()

template<typename Row>
morph::table::RowsSource< Row >::RowsSource ( std::shared_ptr< std::vector< Row > const > rows,
RowKey< Row > key,
std::map< std::string, ColumnKind, std::less<> > const & kinds = {},
std::map< std::string, std::string, std::less<> > const & comparators = {} )
inline

Builds the source.

Parameters
rowsThe rows.
keyThe key projection.
kindsColumn kinds that replace the inferred ones, by column id (for example Date for an int64 of epoch days).
comparatorsComparator names by column id, from Services::comparators; a column named here is Custom.

Definition at line 584 of file query.hpp.

Member Function Documentation

◆ columns()

template<typename Row>
std::span< ColumnInfo const > morph::table::RowsSource< Row >::columns ( ) const
inlinenodiscardoverridevirtual

The columns.

Returns
One per reflected member.

Implements morph::table::DataSource.

Definition at line 604 of file query.hpp.

◆ snapshot()

template<typename Row>
std::shared_ptr< RowSnapshot const > morph::table::RowsSource< Row >::snapshot ( ) const
inlinenodiscardoverridevirtual

The current rows; a pointer copy.

Returns
The snapshot.

Implements morph::table::DataSource.

Definition at line 608 of file query.hpp.

◆ subscribe()

template<typename Row>
void morph::table::RowsSource< Row >::subscribe ( ChangeListener & listener)
inlineoverridevirtual

Registers listener.

Parameters
listenerThe listener.

Implements morph::table::DataSource.

Definition at line 612 of file query.hpp.

◆ unsubscribe()

template<typename Row>
void morph::table::RowsSource< Row >::unsubscribe ( ChangeListener & listener)
inlineoverridevirtual

Removes listener; safe from inside a notification.

Parameters
listenerThe listener.

Implements morph::table::DataSource.

Definition at line 616 of file query.hpp.

◆ setRows()

template<typename Row>
void morph::table::RowsSource< Row >::setRows ( std::shared_ptr< std::vector< Row > const > rows)
inline

Replaces the rows and notifies Reset.

Parameters
rowsThe new rows.

Definition at line 620 of file query.hpp.


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