|
Console Library 8.0.0
A header-only library that makes C++ simple
|
Classes | |
| struct | BasicFormatSpec |
| 格式说明符结构。 More... | |
Functions | |
| template<class CharT = char> | |
| void | parse_format_spec (const std::basic_string< CharT > &specStr, BasicFormatSpec< CharT > &spec) |
| 解析格式说明符。 | |
| template<class CharT = char> | |
| void | apply_format (std::basic_ostream< CharT > &os, const BasicFormatSpec< CharT > &spec) |
| 将格式说明符应用到输出流。 | |
| template<class CharT, class T> | |
| static std::enable_if< std::is_arithmetic< T >::value, void >::type | apply_space_if_nonneg (std::basic_ostream< CharT > &os, const T &value) |
| template<class CharT, class T> | |
| static std::enable_if<!std::is_arithmetic< T >::value, void >::type | apply_space_if_nonneg (std::basic_ostream< CharT > &, const T &) |
| template<typename CharT = char, typename T> | |
| void | format_value (std::basic_ostream< CharT > &os, const T &value, const BasicFormatSpec< CharT > &spec) |
| 格式化单个值。 | |
| template<class CharT = char> | |
| void | format_impl (std::basic_ostream< CharT > &os, const std::basic_string< CharT > &fmt, size_t &pos, size_t) |
| 格式化实现(无参数版本,递归终止)。 | |
| template<class CharT = char, typename T, typename... Args> | |
| void | format_impl (std::basic_ostream< CharT > &os, const std::basic_string< CharT > &fmt, size_t &pos, size_t argIndex, const T &first, const Args &...rest) |
| 格式化实现(有参数版本)。 | |
| void console::details::apply_format | ( | std::basic_ostream< CharT > & | os, |
| const BasicFormatSpec< CharT > & | spec ) |
将格式说明符应用到输出流。
| CharT | 字符类型。 |
| os | 输出流。 |
| spec | 格式说明符。 |
|
static |
|
static |
| void console::details::format_impl | ( | std::basic_ostream< CharT > & | os, |
| const std::basic_string< CharT > & | fmt, | ||
| size_t & | pos, | ||
| size_t | argIndex, | ||
| const T & | first, | ||
| const Args &... | rest ) |
格式化实现(有参数版本)。
| CharT | 字符类型。 |
| T | 第一个参数类型。 |
| Args | 剩余参数类型。 |
| os | 输出流。 |
| fmt | 格式字符串。 |
| pos | 当前解析位置。 |
| argIndex | 参数索引。 |
| first | 第一个参数。 |
| rest | 剩余参数。 |
| void console::details::format_impl | ( | std::basic_ostream< CharT > & | os, |
| const std::basic_string< CharT > & | fmt, | ||
| size_t & | pos, | ||
| size_t | ) |
格式化实现(无参数版本,递归终止)。
| CharT | 字符类型。 |
| os | 输出流。 |
| fmt | 格式字符串。 |
| pos | 当前解析位置。 |
| argIndex | 参数索引。 |
| void console::details::format_value | ( | std::basic_ostream< CharT > & | os, |
| const T & | value, | ||
| const BasicFormatSpec< CharT > & | spec ) |
格式化单个值。
| CharT | 字符类型。 |
| T | 值类型。 |
| os | 输出流。 |
| value | 要格式化的值。 |
| spec | 格式说明符。 |
| void console::details::parse_format_spec | ( | const std::basic_string< CharT > & | specStr, |
| BasicFormatSpec< CharT > & | spec ) |
解析格式说明符。
支持的语法:[[填充]对齐][宽度][:[标志][.精度][类型]]
| specStr | 格式字符串(不含花括号和前导冒号)。 |
| spec | 输出的格式说明符。 |
| BadFormat | 格式非法时抛出。 |