Euphoria
eu::core::Table< T > Struct Template Reference

#include <table.h>

Public Types

using Idx = int
 

Public Member Functions

 Table ()=default
 
void add_row (T d=T())
 
void clear (T d=T())
 
template<typename TFunc >
void set_all (TFunc f)
 
void add_row (const std::vector< T > &row, T d=T())
 Add a new row to the table. More...
 
void expand_width (Idx new_width, T d=T())
 Expand the table to the new width. More...
 
bool is_inside (Idx x, Idx y) const
 
size_t get_data_index (const vec2i &pos) const
 
Recti get_indices () const
 
Idx get_width () const
 
Idx get_height () const
 
operator[] (const vec2i &pos) const
 
std::vector< T >::reference operator[] (const vec2i &pos)
 

Static Public Member Functions

static Table from_width_height (Idx width, Idx height, T d=T())
 
static Table from_height_width (Idx height, Idx width, T d=T())
 
static constexpr Idx conv (size_t t)
 

Detailed Description

template<typename T>
struct eu::core::Table< T >

Definition at line 17 of file table.h.

Member Typedef Documentation

◆ Idx

template<typename T >
using eu::core::Table< T >::Idx = int

Definition at line 19 of file table.h.

Constructor & Destructor Documentation

◆ Table()

template<typename T >
eu::core::Table< T >::Table ( )
default

Member Function Documentation

◆ add_row() [1/2]

template<typename T >
void eu::core::Table< T >::add_row ( const std::vector< T > &  row,
d = T() 
)
inline

Add a new row to the table.

Places the new row at the bottom left and resizes the table if necessary. Fills the (new) empty space with default values.

Parameters
rowthe new row
dthe default value (if needed)

Definition at line 66 of file table.h.

◆ add_row() [2/2]

template<typename T >
void eu::core::Table< T >::add_row ( d = T())
inline

Definition at line 33 of file table.h.

◆ clear()

template<typename T >
void eu::core::Table< T >::clear ( d = T())
inline

Definition at line 40 of file table.h.

◆ conv()

template<typename T >
static constexpr Idx eu::core::Table< T >::conv ( size_t  t)
inlinestaticconstexpr

Definition at line 181 of file table.h.

◆ expand_width()

template<typename T >
void eu::core::Table< T >::expand_width ( Idx  new_width,
d = T() 
)
inline

Expand the table to the new width.

Aligns existing content to the left, fills the empty space with default values.

Parameters
new_widththe new width
dthe default value

Definition at line 113 of file table.h.

◆ from_height_width()

template<typename T >
static Table eu::core::Table< T >::from_height_width ( Idx  height,
Idx  width,
d = T() 
)
inlinestatic

Definition at line 28 of file table.h.

◆ from_width_height()

template<typename T >
static Table eu::core::Table< T >::from_width_height ( Idx  width,
Idx  height,
d = T() 
)
inlinestatic

Definition at line 23 of file table.h.

◆ get_data_index()

template<typename T >
size_t eu::core::Table< T >::get_data_index ( const vec2i pos) const
inline

Definition at line 136 of file table.h.

◆ get_height()

template<typename T >
Idx eu::core::Table< T >::get_height ( ) const
inline

Definition at line 158 of file table.h.

◆ get_indices()

template<typename T >
Recti eu::core::Table< T >::get_indices ( ) const
inline

Definition at line 148 of file table.h.

◆ get_width()

template<typename T >
Idx eu::core::Table< T >::get_width ( ) const
inline

Definition at line 153 of file table.h.

◆ is_inside()

template<typename T >
bool eu::core::Table< T >::is_inside ( Idx  x,
Idx  y 
) const
inline

Definition at line 131 of file table.h.

◆ operator[]() [1/2]

template<typename T >
std::vector<T>::reference eu::core::Table< T >::operator[] ( const vec2i pos)
inline

Definition at line 172 of file table.h.

◆ operator[]() [2/2]

template<typename T >
T eu::core::Table< T >::operator[] ( const vec2i pos) const
inline

Definition at line 165 of file table.h.

◆ set_all()

template<typename T >
template<typename TFunc >
void eu::core::Table< T >::set_all ( TFunc  f)
inline

Definition at line 49 of file table.h.


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