PcapPlusPlus
|
#include <TablePrinter.h>
Public Member Functions | |
TablePrinter (std::vector< std::string > columnNames, std::vector< int > columnWidths) | |
virtual | ~TablePrinter () |
bool | printRow (std::string values, char delimiter) |
bool | printRow (std::vector< std::string > values) |
void | printSeparator () |
void | closeTable () |
A class for printing tables in command-line
pcpp::TablePrinter::TablePrinter | ( | std::vector< std::string > | columnNames, |
std::vector< int > | columnWidths | ||
) |
C'tor - get column names and column widths
[in] | columnNames | A vector of strings containing column names |
[in] | columnWidths | A vector of integers containing column widths |
|
virtual |
A d'tor for this class. Closes the table if not closed
void pcpp::TablePrinter::closeTable | ( | ) |
Close the table - should be called after all rows were printed. Calling this method is not a must as it's called in the class d'tor
bool pcpp::TablePrinter::printRow | ( | std::string | values, |
char | delimiter | ||
) |
Print a single row by providing a single string containing all values delimited by a specified character. For example: if specified delimiter is '|' and there are 3 columns an example input can be: "value for column1|value for column2|value for column3"
[in] | values | A string delimited by a specified delimiter that contains values for all columns |
[in] | delimiter | A delimiter that separates between values of different columns in the values string |
bool pcpp::TablePrinter::printRow | ( | std::vector< std::string > | values | ) |
Print a single row
[in] | values | A vector of strings containing values for all columns |
void pcpp::TablePrinter::printSeparator | ( | ) |
Print a separator line