ASCO Aerial Autonomy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
HtmlTableWriter Class Reference

Helper class to write html tables to text format. More...

#include <html_utils.h>

Public Member Functions

 HtmlTableWriter (int width=120)
 constructor initializes the table header More...
 
template<typename DataT >
void addCell (const DataT &data, std::string header="", std::string bg_color=Colors::white, int colspan=1)
 Add a cell to the table. Should be called after beginning a row. Otherwise will throw an exception. More...
 
void beginRow ()
 Begin a new row in the table. More...
 
void addHeader (std::string header, std::string text_color=Colors::black, int colspan=1)
 Add a table header. Should be called after beginning a row. More...
 
std::string getTableString ()
 Get the html table in string format. More...
 

Detailed Description

Helper class to write html tables to text format.

Constructor & Destructor Documentation

HtmlTableWriter::HtmlTableWriter ( int  width = 120)
inline

constructor initializes the table header

Parameters
widthThe width of each column in the table in px

Member Function Documentation

template<typename DataT >
void HtmlTableWriter::addCell ( const DataT &  data,
std::string  header = "",
std::string  bg_color = Colors::white,
int  colspan = 1 
)
inline

Add a cell to the table. Should be called after beginning a row. Otherwise will throw an exception.

Template Parameters
DataTType of data to add to cell
Parameters
datavalue of the data to add
headerIf header is provided it is added along with data to same cell
bg_colorBackground color of the cell to use (Default white) The color is provided as a hexcode #RGB where R, G, B go from 0 to F
colspanThe number of columns to use for the cell
void HtmlTableWriter::addHeader ( std::string  header,
std::string  text_color = Colors::black,
int  colspan = 1 
)
inline

Add a table header. Should be called after beginning a row.

This is similar to a addCell but is bold and is placed at the top of the table

Parameters
headerHeader value to add.
text_colorThe color of the text in header. Default is black
void HtmlTableWriter::beginRow ( )
inline

Begin a new row in the table.

std::string HtmlTableWriter::getTableString ( )
inline

Get the html table in string format.

Returns
string of html table

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