diff --git a/fmt/format.h b/fmt/format.h index 3eb8b1fe..bb3bbfd8 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -381,10 +381,10 @@ template class basic_arg; template -class ArgFormatter; +class arg_formatter; template -class PrintfArgFormatter; +class printf_arg_formatter; template class basic_context; @@ -2016,7 +2016,7 @@ class context_base { /** The default argument formatter. */ template -class ArgFormatter : public internal::ArgFormatterBase { +class arg_formatter : public internal::ArgFormatterBase { private: basic_context &ctx_; @@ -2033,8 +2033,8 @@ class ArgFormatter : public internal::ArgFormatterBase { format specifier information for standard argument types. \endrst */ - ArgFormatter(basic_buffer &buffer, basic_context &ctx, - format_specs &spec) + arg_formatter(basic_buffer &buffer, basic_context &ctx, + format_specs &spec) : internal::ArgFormatterBase(buffer, spec), ctx_(ctx) {} using internal::ArgFormatterBase::operator(); @@ -2277,7 +2277,7 @@ class basic_writer { friend class internal::ArgFormatterBase; template - friend class PrintfArgFormatter; + friend class printf_arg_formatter; public: /** @@ -2939,11 +2939,11 @@ void vformat_to(basic_buffer &buffer, BasicCStringRef format_str, basic_args args); inline void vformat_to(buffer &buf, CStringRef format_str, args args) { - vformat_to>(buf, format_str, args); + vformat_to>(buf, format_str, args); } inline void vformat_to(wbuffer &buf, WCStringRef format_str, wargs args) { - vformat_to>(buf, format_str, args); + vformat_to>(buf, format_str, args); } template diff --git a/fmt/ostream.h b/fmt/ostream.h index f99b9a71..45103734 100644 --- a/fmt/ostream.h +++ b/fmt/ostream.h @@ -86,7 +86,7 @@ void format_value(basic_buffer &buf, const T &value, internal::MemoryBuffer buffer; internal::format_value(buffer, value); basic_string_view str(buffer.data(), buffer.size()); - do_format_arg< ArgFormatter >( + do_format_arg< arg_formatter >( buf, internal::make_arg< basic_context >(str), ctx); } diff --git a/fmt/printf.h b/fmt/printf.h index a13684c5..0f3a200a 100644 --- a/fmt/printf.h +++ b/fmt/printf.h @@ -210,7 +210,7 @@ class PrintfWidthHandler { \endrst */ template -class PrintfArgFormatter : public internal::ArgFormatterBase { +class printf_arg_formatter : public internal::ArgFormatterBase { private: void write_null_pointer() { this->spec().type_ = 0; @@ -229,7 +229,7 @@ class PrintfArgFormatter : public internal::ArgFormatterBase { specifier information for standard argument types. \endrst */ - PrintfArgFormatter(basic_buffer &buffer, format_specs &spec) + printf_arg_formatter(basic_buffer &buffer, format_specs &spec) : internal::ArgFormatterBase(buffer, spec) {} using Base::operator(); @@ -295,7 +295,7 @@ class PrintfArgFormatter : public internal::ArgFormatterBase { /** This template formats data and writes the output to a writer. */ template > + typename ArgFormatter = printf_arg_formatter > class printf_context : private internal::context_base< Char, printf_context> { diff --git a/test/custom-formatter-test.cc b/test/custom-formatter-test.cc index 4a582c1a..c4d1f1e8 100644 --- a/test/custom-formatter-test.cc +++ b/test/custom-formatter-test.cc @@ -10,38 +10,38 @@ #include "fmt/printf.h" #include "gtest-extra.h" -using fmt::PrintfArgFormatter; +using fmt::printf_arg_formatter; // A custom argument formatter that doesn't print `-` for floating-point values // rounded to 0. -class CustomArgFormatter : public fmt::ArgFormatter { +class CustomArgFormatter : public fmt::arg_formatter { public: CustomArgFormatter(fmt::buffer &buf, fmt::basic_context &ctx, fmt::format_specs &s) - : fmt::ArgFormatter(buf, ctx, s) {} + : fmt::arg_formatter(buf, ctx, s) {} - using fmt::ArgFormatter::operator(); + using fmt::arg_formatter::operator(); void operator()(double value) { if (round(value * pow(10, spec().precision())) == 0) value = 0; - fmt::ArgFormatter::operator()(value); + fmt::arg_formatter::operator()(value); } }; // A custom argument formatter that doesn't print `-` for floating-point values // rounded to 0. -class CustomPrintfArgFormatter : public PrintfArgFormatter { +class CustomPrintfArgFormatter : public printf_arg_formatter { public: CustomPrintfArgFormatter(fmt::buffer &buf, fmt::format_specs &spec) - : PrintfArgFormatter(buf, spec) {} + : printf_arg_formatter(buf, spec) {} - using PrintfArgFormatter::operator(); + using printf_arg_formatter::operator(); void operator()(double value) { if (round(value * pow(10, spec().precision())) == 0) value = 0; - PrintfArgFormatter::operator()(value); + printf_arg_formatter::operator()(value); } }; diff --git a/test/ostream-test.cc b/test/ostream-test.cc index 761820b6..c28635b7 100644 --- a/test/ostream-test.cc +++ b/test/ostream-test.cc @@ -58,9 +58,9 @@ TEST(OStreamTest, Enum) { EXPECT_EQ("0", fmt::format("{}", A)); } -struct TestArgFormatter : fmt::ArgFormatter { +struct TestArgFormatter : fmt::arg_formatter { TestArgFormatter(fmt::buffer &buf, fmt::context &ctx, fmt::format_specs &s) - : fmt::ArgFormatter(buf, ctx, s) {} + : fmt::arg_formatter(buf, ctx, s) {} }; TEST(OStreamTest, CustomArg) {