Alexandria
2.16
Please provide a description of the project.
|
Go to the documentation of this file.
27 #include <boost/lexical_cast.hpp>
42 : m_stream_holder(
std::move(stream_holder)) {
48 <<
"has started is not allowed";
50 if (indicator.
empty()) {
60 <<
"has started is not allowed";
69 <<
"format is not allowed";
74 while (!message_stream.eof()) {
92 auto& info = *table.getColumnInfo();
94 for (
size_t i=0; i<info.size(); ++i) {
95 auto& desc = info.getDescription(i);
98 if (!desc.unit.empty()) {
99 out <<
" (" << desc.unit <<
")";
101 if (!desc.description.empty()) {
102 out <<
" - " << desc.description;
112 for (
size_t i=0; i<info.size(); ++i) {
113 out <<
std::setw(column_lengths[i]) <<
quoted(info.getDescription(i).name);
124 for (
auto row : table) {
125 for (
size_t i=0; i<row.size(); ++i) {
AsciiWriter & setCommentIndicator(const std::string &indicator)
Set the comment indicator.
TableWriter implementation for writing ASCII tables to streams.
std::unique_ptr< InstOrRefHolder< std::ostream > > m_stream_holder
AsciiWriter & showColumnInfo(bool show)
Sets if the column information will be written to the stream.
std::string typeToKeyword(std::type_index type)
Converts a type to its string representation.
void addComment(const std::string &message) override
Adds a comment to the stream.
std::string quoted(const std::string &str)
void init(const Table &table) override
std::vector< size_t > calculateColumnLengths(const Table &table)
Calculates the sizes in characters each column of the table needs.
void append(const Table &table) override
AsciiWriter(std::ostream &stream)
Constructs an AsciiWriter which writes to the given stream.