/** Print a formatted long integer to the output stream. */ void _print_long(std::ostringstream& ss, size_t width, long v) { std::ostringstream ss_buf; ss_buf << std::left << v; if(size_t(ss_buf.tellp()) <= width) { _print_string(ss, width, ss_buf.str()); } else { _print_double(ss, width, v); } }
/** Print a formatted flexible type to the output stream. */ void _print_flexible_type(std::ostringstream& ss, size_t width, const flexible_type& t) { switch(t.get_type()) { case flex_type_enum::FLOAT: _print_double(ss, width, t.get<double>()); return; case flex_type_enum::INTEGER: _print_long(ss, width, t.get<flex_int>()); return; case flex_type_enum::STRING: _print_string(ss, width, t.get<flex_string>()); return; default: _print_string(ss, width, std::string(t)); return; } }
void print(std::ostringstream& ss, size_t width) { _print_double(ss, width, value); }