Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::SimpleTableModel Class Reference

Simple in-memory table model backed by a vector of string vectors. More...

#include <table.hpp>

Public Member Functions

void set_data (std::vector< std::vector< std::string > > rows)
void add_row (std::vector< std::string > row)
int row_count () const override
 Number of rows in the table.
std::string cell_text (int row, int column) const override
 Cell text for a given row and column index.
bool sort (int column, bool ascending) override
 Optional: sort the data by column. Return true if handled.
virtual void row_selected (int row)
 Optional: called when a row is selected.
virtual void row_double_clicked (int row)
 Optional: called when a row is double-clicked.
void add_column (TableColumn column)
void add_row (std::vector< TableCell > cells)
 Add a row.
std::size_t column_count () const
const TableColumn & column (std::size_t i) const
const TableCell & cell (std::size_t row, std::size_t col) const
void toggle_sort (std::size_t col)
 Sort rows by column col.
void sort_by (std::size_t col, TableSortOrder order)
 Explicit sort (used by tests and by code that wants a specific order).
void clear_sort ()
 Clear any sort; original insertion order is restored.
int sort_column () const
TableSortOrder sort_order () const

Detailed Description

Simple in-memory table model backed by a vector of string vectors.

Member Function Documentation

◆ add_column()

void pulp::view::TableModel::add_column ( TableColumn column)
inlineinherited

◆ add_row() [1/2]

void pulp::view::SimpleTableModel::add_row ( std::vector< std::string > row)
inline

◆ add_row() [2/2]

void pulp::view::TableModel::add_row ( std::vector< TableCell > cells)
inlineinherited

Add a row.

Pads with empty cells if short.

If a previous sort was active, sort state is dropped but the insertion-order mapping is restored first so a later clear_sort() can still return rows to their original order. This matches the clear_sort contract documented above; without the restore step a dynamic table that receives new rows after sorting would get stuck at the post-sort layout. Fix per #200 review.

◆ cell()

const TableCell & pulp::view::TableModel::cell ( std::size_t row,
std::size_t col ) const
inlineinherited

◆ cell_text()

std::string pulp::view::SimpleTableModel::cell_text ( int row,
int column ) const
inlineoverridevirtual

Cell text for a given row and column index.

Implements pulp::view::TableModel.

◆ clear_sort()

void pulp::view::TableModel::clear_sort ( )
inlineinherited

Clear any sort; original insertion order is restored.

◆ column()

const TableColumn & pulp::view::TableModel::column ( std::size_t i) const
inlineinherited

◆ column_count()

std::size_t pulp::view::TableModel::column_count ( ) const
inlineinherited

◆ row_count()

int pulp::view::SimpleTableModel::row_count ( ) const
inlineoverridevirtual

Number of rows in the table.

Implements pulp::view::TableModel.

◆ row_double_clicked()

virtual void pulp::view::TableModel::row_double_clicked ( int row)
inlinevirtualinherited

Optional: called when a row is double-clicked.

◆ row_selected()

virtual void pulp::view::TableModel::row_selected ( int row)
inlinevirtualinherited

Optional: called when a row is selected.

◆ set_data()

void pulp::view::SimpleTableModel::set_data ( std::vector< std::vector< std::string > > rows)
inline

◆ sort()

bool pulp::view::SimpleTableModel::sort ( int column,
bool ascending )
inlineoverridevirtual

Optional: sort the data by column. Return true if handled.

Reimplemented from pulp::view::TableModel.

◆ sort_by()

void pulp::view::TableModel::sort_by ( std::size_t col,
TableSortOrder order )
inherited

Explicit sort (used by tests and by code that wants a specific order).

◆ sort_column()

int pulp::view::TableModel::sort_column ( ) const
inlineinherited

◆ sort_order()

TableSortOrder pulp::view::TableModel::sort_order ( ) const
inlineinherited

◆ toggle_sort()

void pulp::view::TableModel::toggle_sort ( std::size_t col)
inherited

Sort rows by column col.

Passing the same column cycles None → Ascending → Descending → None, matching how spreadsheet UIs toggle via header clicks.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/view/include/pulp/view/table.hpp