16 #ifndef IMPALA_UTIL_TABLE_PRINTER_H
17 #define IMPALA_UTIL_TABLE_PRINTER_H
19 #include <boost/uuid/uuid.hpp>
21 #include "gen-cpp/Types_types.h"
33 void AddColumn(
const std::string& label,
bool left_align);
40 void AddRow(
const std::vector<std::string>& row);
43 std::string
ToString(
const std::string& prefix =
"")
const;
53 std::vector<std::vector<std::string> >
rows_;
57 void PrintRow(std::stringstream* ss,
const std::vector<std::string>& row,
58 const std::vector<int>& widths)
const;
std::string ToString(const std::string &prefix="") const
Print to a table with prefix coming before the output.
void AddColumn(const std::string &label, bool left_align)
std::vector< std::vector< std::string > > rows_
std::vector< bool > left_align_
For each column, true if the value should be left aligned, right aligned otherwise.
std::vector< std::string > labels_
int max_output_width_
-1 to indicate unlimited.
std::vector< int > max_col_widths_
void AddRow(const std::vector< std::string > &row)
Add a row to the table. This must have the same width as labels.
void set_max_output_width(int width)
void PrintRow(std::stringstream *ss, const std::vector< std::string > &row, const std::vector< int > &widths) const
Helper function to print one row to ss.