A library for working with phylogenetic and population genetic data.
Table::Column Class Reference

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

Detailed Description

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

Public Member Functions

 Column ()=default
 Column (Column &&)=default
 Column (Column const &)=default
 Column (std::string const &label, Justification justify=Justification::kLeft)
 ~Column ()=default
void append (std::string value)
void append (Style const &style, std::string value)
void clear_content ()
Justification justify () const
void justify (Justification value)
std::string label () const
void label (std::string value)
size_t length () const
Columnoperator= (Column &&)=default
Columnoperator= (Column const &)=default
std::string row (size_t i) const
void shrink_width ()
 Shrinks the column width to the minmal width that suffices to fit in all values of the column (i.e., both data and label). More...
size_t width () const
void width (size_t value)
 Set the width of this column. More...
void write_label (std::ostream &stream) const
void write_row (std::ostream &stream, size_t row) const

Public Types

enum  Justification { kLeft, kRight, kCentered }

Constructor & Destructor Documentation

◆ Column() [1/4]

Column ( )

◆ Column() [2/4]

Column ( std::string const &  label,
Justification  justify = Justification::kLeft 

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

◆ ~Column()

~Column ( )

◆ Column() [3/4]

Column ( Column const &  )

◆ Column() [4/4]

Column ( Column &&  )

Member Function Documentation

◆ append() [1/2]

void append ( std::string  value)

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

◆ append() [2/2]

void append ( Style const &  style,
std::string  value 

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

◆ clear_content()

void clear_content ( )

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

◆ justify() [1/2]

Table::Column::Justification justify ( ) const

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

◆ justify() [2/2]

void justify ( Justification  value)

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

◆ label() [1/2]

std::string label ( ) const

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

◆ label() [2/2]

void label ( std::string  value)

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

◆ length()

size_t length ( ) const

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

◆ operator=() [1/2]

Column& operator= ( Column &&  )

◆ operator=() [2/2]

Column& operator= ( Column const &  )

◆ row()

std::string row ( size_t  i) const

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

◆ shrink_width()

void shrink_width ( )

Shrinks the column width to the minmal width that suffices to fit in all values of the column (i.e., both data and label).

The column keeps track of its needed minimal width when just adding data. Thus, this function is only neccessary to call once the width was changed manually or if the label or a data value have been changed after being added.

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

◆ width() [1/2]

size_t width ( ) const

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

◆ width() [2/2]

void width ( size_t  value)

Set the width of this column.

If the new value is smaller than the current one, nothing happens. The width can only grow, or be set to the minimal possible value using shrink_width(). This ensures that all text fits within the column.

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

◆ write_label()

void write_label ( std::ostream &  stream) const

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

◆ write_row()

void write_row ( std::ostream &  stream,
size_t  row 
) const

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

Member Enumeration Documentation

◆ Justification

enum Justification

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

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