GEOS
Classes | Public Types | Public Member Functions | List of all members
geos::TableLayout Class Reference

Class for setup the table layout. More...

#include <TableLayout.hpp>

Classes

struct  CellLayout
 Structure grouping the cell information to display it in a table (content, type, alignment, ...). More...
 
class  Column
 Class representing a column in a table layout. More...
 
struct  ColumnAlignement
 Structure to set up values m_alignment for each colum. More...
 
class  DeepFirstIterator
 Iterator to loop over all columns, starting by the deepest sub columns, then to their parents, then to their siblings. More...
 

Public Types

enum  Alignment { right , left , center }
 Type of aligment for a column.
 
enum  MarginValue : integer { tiny = 0 , small = 1 , medium = 2 , large = 3 }
 Space to apply between all data and border.
 
enum  Section { header , values }
 Enumeration for table sections.
 
using TableLayoutArgs = std::initializer_list< std::variant< string_view, TableLayout::Column > >
 Alias for an initializer list of variants that can contain either a string or a layout column.
 

Public Member Functions

DeepFirstIterator beginDeepFirst ()
 
DeepFirstIterator endDeepFirst ()
 
 TableLayout (string_view title, std::vector< TableLayout::Column > const &columns)
 Construct a new Table Layout object. More...
 
 TableLayout (string_view title, TableLayoutArgs args)
 Construct a new Table Layout object. More...
 
 TableLayout (TableLayoutArgs args)
 Construct a new Table Layout object. More...
 
 TableLayout (string_view title, std::vector< string > const &args)
 Construct a new Table Layout object. More...
 
size_t getMaxDepth () const
 Get the max depth of a column. More...
 
std::vector< Column > & getColumns ()
 
std::vector< Column > const & getColumns () const
 
string_view getTitle () const
 
TableLayoutsetTitle (string_view title)
 
TableLayoutenableLineBreak (bool value)
 Remove the return line at the end & begenning of the table. More...
 
TableLayoutsetMargin (MarginValue marginValue)
 Set the minimal margin width between cell content and borders. More...
 
bool isLineBreakEnabled () const
 
integer const & getBorderMargin () const
 
integer const & getColumnMargin () const
 
integer const & getMarginValue () const
 
integer const & getMarginTitle () const
 
std::vector< size_t > & getSublineInHeaderCounts ()
 Get the Nb Rows object. More...
 
std::vector< size_t > & getNbSubDataLines ()
 Get the Nb Rows object. More...
 
void addToColumns (string_view m_header)
 Create and add a column to the columns vector given a string. More...
 

Detailed Description

Class for setup the table layout.

Definition at line 35 of file TableLayout.hpp.

Constructor & Destructor Documentation

◆ TableLayout() [1/4]

geos::TableLayout::TableLayout ( string_view  title,
std::vector< TableLayout::Column > const &  columns 
)
inline

Construct a new Table Layout object.

Parameters
titleThe table title
columnsA vector containing all column initialized

Definition at line 364 of file TableLayout.hpp.

◆ TableLayout() [2/4]

geos::TableLayout::TableLayout ( string_view  title,
TableLayoutArgs  args 
)
inline

Construct a new Table Layout object.

Parameters
titleThe table title
argsAn initializer_list containing string / column

Definition at line 380 of file TableLayout.hpp.

◆ TableLayout() [3/4]

geos::TableLayout::TableLayout ( TableLayoutArgs  args)
inline

Construct a new Table Layout object.

Parameters
argsAn initializer_list containing string / column

Definition at line 393 of file TableLayout.hpp.

◆ TableLayout() [4/4]

geos::TableLayout::TableLayout ( string_view  title,
std::vector< string > const &  args 
)
inline

Construct a new Table Layout object.

Parameters
titleThe table title
argsAn initializer_list containing string / column

Definition at line 404 of file TableLayout.hpp.

Member Function Documentation

◆ addToColumns()

void geos::TableLayout::addToColumns ( string_view  m_header)

Create and add a column to the columns vector given a string.

Parameters
m_headerThe column name

◆ beginDeepFirst()

DeepFirstIterator geos::TableLayout::beginDeepFirst ( )
Returns
Return an itarator pointing on the first leaf of the first columns vector Example on 2 column with Column A : 2 layer and Column B : 3 layers A.A -> A-B -> A-C -> A -> B-A-A -> B-A-B -> B-A -> B-B-A -> B-B-B -> B-B -> B

◆ enableLineBreak()

TableLayout& geos::TableLayout::enableLineBreak ( bool  value)

Remove the return line at the end & begenning of the table.

Parameters
valueValue to desactivate or not wrapLine at the end
Returns
The tableLayout reference

◆ endDeepFirst()

DeepFirstIterator geos::TableLayout::endDeepFirst ( )
inline
Returns
Return a end itarator This iterator is initialized with a null pointer representing a position after the last valid element

Definition at line 349 of file TableLayout.hpp.

◆ getBorderMargin()

integer const& geos::TableLayout::getBorderMargin ( ) const
inline
Returns
The border margin, number of spaces at both left and right table sides plus vertical character

Definition at line 466 of file TableLayout.hpp.

◆ getColumnMargin()

integer const& geos::TableLayout::getColumnMargin ( ) const
inline
Returns
The column margin, numbers of spaces separating both left and right side from a vertical line

Definition at line 473 of file TableLayout.hpp.

◆ getColumns() [1/2]

std::vector< Column >& geos::TableLayout::getColumns ( )
inline
Returns
The columns vector

Definition at line 421 of file TableLayout.hpp.

◆ getColumns() [2/2]

std::vector< Column > const& geos::TableLayout::getColumns ( ) const
inline
Returns
The columns vector

Definition at line 427 of file TableLayout.hpp.

◆ getMarginTitle()

integer const& geos::TableLayout::getMarginTitle ( ) const
inline
Returns
The margin title

Definition at line 485 of file TableLayout.hpp.

◆ getMarginValue()

integer const& geos::TableLayout::getMarginValue ( ) const
inline
Returns
The table margin value

Definition at line 479 of file TableLayout.hpp.

◆ getMaxDepth()

size_t geos::TableLayout::getMaxDepth ( ) const

Get the max depth of a column.

Returns
The max column depth

◆ getNbSubDataLines()

std::vector< size_t >& geos::TableLayout::getNbSubDataLines ( )
inline

Get the Nb Rows object.

Returns
std::vector< integer >&

Definition at line 499 of file TableLayout.hpp.

◆ getSublineInHeaderCounts()

std::vector< size_t >& geos::TableLayout::getSublineInHeaderCounts ( )
inline

Get the Nb Rows object.

Returns
std::vector< integer >&

Definition at line 492 of file TableLayout.hpp.

◆ getTitle()

string_view geos::TableLayout::getTitle ( ) const
inline
Returns
The table name

Definition at line 433 of file TableLayout.hpp.

◆ isLineBreakEnabled()

bool geos::TableLayout::isLineBreakEnabled ( ) const
Returns
check if the line break at the end & beginning is activated

◆ setMargin()

TableLayout& geos::TableLayout::setMargin ( MarginValue  marginValue)

Set the minimal margin width between cell content and borders.

Parameters
marginValueThe margin value
Returns
The tableLayout reference

◆ setTitle()

TableLayout& geos::TableLayout::setTitle ( string_view  title)
Parameters
titleThe table title
Returns
The tableLayout reference

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