From 397e8dd9d586cf99f9fa39d221a524af3a12f650 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 15 Apr 2019 11:39:19 -0700 Subject: [PATCH] clang-format --- include/fmt/printf.h | 19 +++++++++---------- test/printf-test.cc | 27 +++++++++++++++------------ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 2cf74e0b..dd553139 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -197,8 +197,7 @@ using internal::printf; // For printing into memory_buffer. template class printf_arg_formatter; -template -class basic_printf_context; +template class basic_printf_context; /** \rst @@ -212,6 +211,7 @@ class printf_arg_formatter public internal::arg_formatter_base { public: typedef decltype(internal::declval().begin()) iterator; + private: typedef typename Range::value_type char_type; typedef internal::arg_formatter_base base; @@ -326,8 +326,7 @@ template struct printf_formatter { }; /** This template formats data and writes the output to a writer. */ -template -class basic_printf_context { +template class basic_printf_context { public: /** The character type for the output. */ typedef Char char_type; @@ -377,14 +376,15 @@ class basic_printf_context { } /** Formats stored arguments and writes the output to the range. */ - template>>> + template >>> OutputIt format(); }; template void basic_printf_context::parse_flags(format_specs& spec, - const Char*& it, - const Char* end) { + const Char*& it, + const Char* end) { for (; it != end; ++it) { switch (*it) { case '-': @@ -714,8 +714,8 @@ inline int vfprintf( /** Formats arguments and writes the output to the range. */ template > + typename Context = + basic_printf_context> typename ArgFormatter::iterator vprintf(internal::buffer& out, basic_string_view format_str, basic_format_args args) { @@ -724,7 +724,6 @@ typename ArgFormatter::iterator vprintf(internal::buffer& out, return iter; } - /** \rst Prints formatted data to the stream *os*. diff --git a/test/printf-test.cc b/test/printf-test.cc index 9e479780..c0108103 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -556,31 +556,34 @@ TEST(PrintfTest, VSPrintfMakeWArgsExample) { } typedef fmt::printf_arg_formatter< - fmt::back_insert_range>> formatter_t; + fmt::back_insert_range>> + formatter_t; typedef fmt::basic_printf_context context_t; // A custom printf argument formatter that doesn't print `-` for floating-point // values rounded to 0. class custom_printf_arg_formatter : public formatter_t { public: - using formatter_t::iterator; + using formatter_t::iterator; - custom_printf_arg_formatter(formatter_t::iterator iter, formatter_t::format_specs& spec, context_t& ctx) + custom_printf_arg_formatter(formatter_t::iterator iter, + formatter_t::format_specs& spec, context_t& ctx) : formatter_t(iter, spec, ctx) {} using formatter_t::operator(); #if FMT_MSC_VER > 0 && FMT_MSC_VER <= 1804 - template ::value)> - iterator operator()(T value) { + template ::value)> + iterator operator()(T value){ #else - iterator operator()(double value) { + iterator operator()(double value) { #endif - // Comparing a float to 0.0 is safe. - if (round(value * pow(10, spec()->precision)) == 0.0) value = 0; - return formatter_t::operator()(value); - } -}; + // Comparing a float to 0.0 is safe. + if (round(value * pow(10, spec()->precision)) == 0.0) value = 0; + return formatter_t::operator()(value); +} +} +; typedef fmt::basic_format_args format_args_t; @@ -592,7 +595,7 @@ std::string custom_vformat(fmt::string_view format_str, format_args_t args) { template std::string custom_format(const char* format_str, const Args&... args) { - auto va = fmt::make_printf_args (args...); + auto va = fmt::make_printf_args(args...); return custom_vformat(format_str, va); }