38#include "../basic_types/datatype_structure.hpp"
76 CTablePrinter(std::ostream* output,
const std::string& separator =
"|");
127 void AddColumn(
const std::string& header_name,
int column_width);
144 template <
typename T>
149 if (j_ == 0) *out_stream_ << separator_;
153 *out_stream_ << std::left;
155 *out_stream_ << std::right;
158 *out_stream_ << std::setw(column_widths_.at(j_) - indent) << std::setprecision(precision_) << input;
163 *out_stream_ << std::setw(indent + 1 + (
int)separator_.size()) << separator_ +
"\n";
167 *out_stream_ << std::setw(indent + (
int)inner_separator_.size()) << inner_separator_;
178 void PrintHorizontalLine();
180 std::ostream* out_stream_;
181 std::vector<std::string> column_headers_;
182 std::vector<int> column_widths_;
183 std::string separator_;
184 std::string inner_separator_;
193 bool print_header_top_line_,
194 print_header_bottom_line_;
199 stream.setf(std::ios::fixed, std::ios::floatfield);
200 stream.width(field_width);
201 stream << std::right << val;
202 stream.unsetf(std::ios::fixed);
207 stream.setf(std::ios::scientific, std::ios::floatfield);
208 stream.width(field_width);
209 stream << std::right << val;
210 stream.unsetf(std::ios::scientific);
214 stream.width(field_width);
215 stream << std::right << val;
220 stream.setf(std::ios::fixed, std::ios::floatfield);
221 stream.width(field_width - 1);
222 stream << std::right << val <<
"%";
223 stream.unsetf(std::ios::fixed);
226inline std::vector<std::string>
split(
const std::string& s,
char delimiter) {
227 std::vector<std::string> tokens;
229 std::istringstream tokenStream(s);
230 while (std::getline(tokenStream, token, delimiter)) {
231 tokens.push_back(token);
236inline int stoi(
const std::string s) {
237 std::istringstream ss(s);
244 std::istringstream ss(s);
251 std::stringstream ss;
258const static char* ws =
" \t\n\r\f\v";
261inline std::string&
rtrim(std::string& s,
const char* t = ws) {
262 s.erase(s.find_last_not_of(t) + 1);
267inline std::string&
ltrim(std::string& s,
const char* t = ws) {
268 s.erase(0, s.find_first_not_of(t));
273inline std::string&
trim(std::string& s,
const char* t = ws) {
return ltrim(
rtrim(s, t), t); }
279inline void StringToUpperCase(std::string& str) { std::transform(str.begin(), str.end(), str.begin(), ::toupper); }
287 std::string upp_str(str);
288 std::transform(upp_str.begin(), upp_str.end(), upp_str.begin(), ::toupper);
298 const auto extIndex = name.rfind(ext);
299 if (extIndex != std::string::npos && extIndex + ext.size() == name.size()) {
300 name.resize(extIndex);
passivedouble su2double
Definition code_config.hpp:181