A library for working with phylogenetic and population genetic data.
v0.32.0
Table Class Reference

#include <genesis/utils/text/table.hpp>

Detailed Description

Definition at line 60 of file utils/text/table.hpp.

Public Member Functions

 Table ()=default
 
 Table (Table &&)=default
 
 Table (Table const &)=default
 
 ~Table ()=default
 
Columnadd_column (std::string label="")
 Add a column to the table. More...
 
Tableappend (std::string value)
 
Tableappend (Style const &style, std::string value)
 
void clear ()
 Clears all columns and their data from the table. More...
 
void clear_content ()
 Clears the data contents of all columns. Their labels etc stay unchanged. More...
 
size_t length () const
 
Tableline_break ()
 Finish the currently line and move to the next one. More...
 
Tableoperator<< (std::string value)
 
Tableoperator= (Table &&)=default
 
Tableoperator= (Table const &)=default
 
std::string to_string () const
 
std::string to_string (TableLayout const &layout) const
 
void write (std::ostream &out) const
 
void write (std::ostream &out, TableLayout const &layout) const
 

Classes

class  Column
 

Friends

std::ostream & operator<< (std::ostream &out, Table const &table)
 

Constructor & Destructor Documentation

◆ Table() [1/3]

Table ( )
default

◆ ~Table()

~Table ( )
default

◆ Table() [2/3]

Table ( Table const &  )
default

◆ Table() [3/3]

Table ( Table &&  )
default

Member Function Documentation

◆ add_column()

Table::Column & add_column ( std::string  label = "")

Add a column to the table.

If the table already contains columns with data, the new one is initialized with empty strings for the whole length of the table.

Definition at line 105 of file utils/text/table.cpp.

◆ append() [1/2]

Table & append ( std::string  value)

Definition at line 125 of file utils/text/table.cpp.

◆ append() [2/2]

Table & append ( Style const &  style,
std::string  value 
)

Definition at line 137 of file utils/text/table.cpp.

◆ clear()

void clear ( )

Clears all columns and their data from the table.

Definition at line 82 of file utils/text/table.cpp.

◆ clear_content()

void clear_content ( )

Clears the data contents of all columns. Their labels etc stay unchanged.

Definition at line 91 of file utils/text/table.cpp.

◆ length()

size_t length ( ) const

Definition at line 54 of file utils/text/table.cpp.

◆ line_break()

Table & line_break ( )

Finish the currently line and move to the next one.

This function fills the columns of the current line with empty strings, so that the next append() call will add content to the first column of the next line. If we are currently at the beginning of a line, this function results in an empty line (useful for grouping of lines).

Definition at line 156 of file utils/text/table.cpp.

◆ operator<<()

Table & operator<< ( std::string  value)

Definition at line 115 of file utils/text/table.cpp.

◆ operator=() [1/2]

Table& operator= ( Table &&  )
default

◆ operator=() [2/2]

Table& operator= ( Table const &  )
default

◆ to_string() [1/2]

std::string to_string ( ) const

Definition at line 241 of file utils/text/table.cpp.

◆ to_string() [2/2]

std::string to_string ( TableLayout const &  layout) const

Definition at line 248 of file utils/text/table.cpp.

◆ write() [1/2]

void write ( std::ostream &  out) const

Definition at line 171 of file utils/text/table.cpp.

◆ write() [2/2]

void write ( std::ostream &  out,
TableLayout const &  layout 
) const

Definition at line 190 of file utils/text/table.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
Table const &  table 
)
friend

Definition at line 255 of file utils/text/table.cpp.


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