diff --git a/fmt/format.cc b/fmt/format.cc index 3dd42e1a..1e34dabb 100644 --- a/fmt/format.cc +++ b/fmt/format.cc @@ -224,7 +224,7 @@ FMT_FUNC void format_system_error( } // namespace internal FMT_FUNC void SystemError::init( - int err_code, CStringRef format_str, format_args args) { + int err_code, CStringRef format_str, args args) { error_code_ = err_code; MemoryWriter w; format_system_error(w, err_code, vformat(format_str, args)); @@ -348,7 +348,7 @@ FMT_FUNC int internal::UTF16ToUTF8::convert(WStringRef s) { } FMT_FUNC void WindowsError::init( - int err_code, CStringRef format_str, format_args args) { + int err_code, CStringRef format_str, args args) { error_code_ = err_code; MemoryWriter w; internal::format_windows_error(w, err_code, vformat(format_str, args)); @@ -428,17 +428,17 @@ FMT_FUNC void report_windows_error( } #endif -FMT_FUNC void vprint(std::FILE *f, CStringRef format_str, format_args args) { +FMT_FUNC void vprint(std::FILE *f, CStringRef format_str, args args) { MemoryWriter w; w.vformat(format_str, args); std::fwrite(w.data(), 1, w.size(), f); } -FMT_FUNC void vprint(CStringRef format_str, format_args args) { +FMT_FUNC void vprint(CStringRef format_str, args args) { vprint(stdout, format_str, args); } -FMT_FUNC void vprint_colored(Color c, CStringRef format, format_args args) { +FMT_FUNC void vprint_colored(Color c, CStringRef format, args args) { char escape[] = "\x1b[30m"; escape[3] = static_cast('0' + c); std::fputs(escape, stdout); @@ -448,7 +448,7 @@ FMT_FUNC void vprint_colored(Color c, CStringRef format, format_args args) { template void printf(basic_writer &w, BasicCStringRef format, - format_args args); + args args); FMT_FUNC int vfprintf(std::FILE *f, CStringRef format, printf_args args) { MemoryWriter w; @@ -465,7 +465,7 @@ template struct internal::BasicData; template void internal::FixedBuffer::grow(std::size_t); -template void internal::ArgMap::init(const format_args &args); +template void internal::ArgMap::init(const args &args); template void printf_context::format(writer &writer); @@ -483,7 +483,7 @@ template class basic_context; template void internal::FixedBuffer::grow(std::size_t); -template void internal::ArgMap::init(const wformat_args &args); +template void internal::ArgMap::init(const wargs &args); template void printf_context::format(wwriter &writer); diff --git a/fmt/format.h b/fmt/format.h index 742904f2..a6a87fb5 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1369,9 +1369,6 @@ class basic_arg { } }; -typedef basic_arg format_arg; -typedef basic_arg wformat_arg; - /** \rst Visits an argument dispatching to the appropriate visit method based on @@ -1625,8 +1622,8 @@ class basic_args { } }; -typedef basic_args format_args; -typedef basic_args wformat_args; +typedef basic_args args; +typedef basic_args wargs; enum Alignment { ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ALIGN_NUMERIC @@ -2111,7 +2108,7 @@ class basic_context : */ class SystemError : public internal::RuntimeError { private: - void init(int err_code, CStringRef format_str, format_args args); + void init(int err_code, CStringRef format_str, args args); protected: int error_code_; @@ -2943,7 +2940,7 @@ FMT_API void report_system_error(int error_code, /** A Windows error. */ class WindowsError : public SystemError { private: - FMT_API void init(int error_code, CStringRef format_str, format_args args); + FMT_API void init(int error_code, CStringRef format_str, args args); public: /** @@ -2989,7 +2986,7 @@ FMT_API void report_windows_error(int error_code, enum Color { BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE }; -FMT_API void vprint_colored(Color c, CStringRef format, format_args args); +FMT_API void vprint_colored(Color c, CStringRef format, args args); /** Formats a string and prints it to stdout using ANSI escape sequences @@ -3003,7 +3000,7 @@ inline void print_colored(Color c, CStringRef format_str, vprint_colored(c, format_str, make_args(args...)); } -inline std::string vformat(CStringRef format_str, format_args args) { +inline std::string vformat(CStringRef format_str, args args) { MemoryWriter w; w.vformat(format_str, args); return w.str(); @@ -3023,7 +3020,7 @@ inline std::string format(CStringRef format_str, const Args & ... args) { return vformat(format_str, make_args(args...)); } -inline std::wstring vformat(WCStringRef format_str, wformat_args args) { +inline std::wstring vformat(WCStringRef format_str, wargs args) { WMemoryWriter w; w.vformat(format_str, args); return w.str(); @@ -3035,7 +3032,7 @@ inline std::wstring format(WCStringRef format_str, const Args & ... args) { return vformat(format_str, vargs); } -FMT_API void vprint(std::FILE *f, CStringRef format_str, format_args args); +FMT_API void vprint(std::FILE *f, CStringRef format_str, args args); /** \rst @@ -3051,7 +3048,7 @@ inline void print(std::FILE *f, CStringRef format_str, const Args & ... args) { vprint(f, format_str, make_args(args...)); } -FMT_API void vprint(CStringRef format_str, format_args args); +FMT_API void vprint(CStringRef format_str, args args); /** \rst diff --git a/fmt/ostream.cc b/fmt/ostream.cc index 0c7c7501..d6f26985 100644 --- a/fmt/ostream.cc +++ b/fmt/ostream.cc @@ -28,7 +28,7 @@ FMT_FUNC void write(std::ostream &os, writer &w) { } FMT_FUNC void vprint(std::ostream &os, CStringRef format_str, - format_args args) { + args args) { MemoryWriter w; w.vformat(format_str, args); internal::write(os, w); diff --git a/fmt/ostream.h b/fmt/ostream.h index 040a185b..4db6f9c4 100644 --- a/fmt/ostream.h +++ b/fmt/ostream.h @@ -91,7 +91,7 @@ void format_value(basic_writer &w, const T &value, w, internal::make_arg< basic_context >(str), ctx); } -FMT_API void vprint(std::ostream &os, CStringRef format_str, format_args args); +FMT_API void vprint(std::ostream &os, CStringRef format_str, args args); /** \rst diff --git a/fmt/posix.h b/fmt/posix.h index 19e80024..afc69584 100644 --- a/fmt/posix.h +++ b/fmt/posix.h @@ -166,7 +166,7 @@ public: // of MinGW that define fileno as a macro. int (fileno)() const; - void vprint(CStringRef format_str, const format_args &args) { + void vprint(CStringRef format_str, const args &args) { fmt::vprint(file_, format_str, args); } diff --git a/test/custom-formatter-test.cc b/test/custom-formatter-test.cc index 526a9258..01d8b953 100644 --- a/test/custom-formatter-test.cc +++ b/test/custom-formatter-test.cc @@ -45,7 +45,7 @@ class CustomPrintfArgFormatter : public PrintfArgFormatter { } }; -std::string custom_vformat(fmt::CStringRef format_str, fmt::format_args args) { +std::string custom_vformat(fmt::CStringRef format_str, fmt::args args) { fmt::MemoryWriter writer; // Pass custom argument formatter as a template arg to vformat. fmt::vwrite(writer, format_str, args); diff --git a/test/format-impl-test.cc b/test/format-impl-test.cc index c19329f7..6308273e 100644 --- a/test/format-impl-test.cc +++ b/test/format-impl-test.cc @@ -55,9 +55,8 @@ struct ValueExtractor { }; TEST(FormatTest, ArgConverter) { - using fmt::format_arg; fmt::LongLong value = std::numeric_limits::max(); - format_arg arg = fmt::internal::make_arg(value); + auto arg = fmt::internal::make_arg(value); visit(fmt::internal::ArgConverter< fmt::LongLong, fmt::context>(arg, 'd'), arg); EXPECT_EQ(value, visit(ValueExtractor(), arg)); diff --git a/test/format-test.cc b/test/format-test.cc index 35a9e476..f10e1b1f 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1566,7 +1566,7 @@ TEST(StrTest, Convert) { EXPECT_EQ("2012-12-9", s); } -std::string vformat_message(int id, const char *format, fmt::format_args args) { +std::string vformat_message(int id, const char *format, fmt::args args) { MemoryWriter w; w.format("[{}] ", id); w.vformat(format, args); @@ -1656,7 +1656,7 @@ class MockArgFormatter : public fmt::internal::ArgFormatterBase { void operator()(fmt::internal::CustomValue) {} }; -void custom_vformat(fmt::CStringRef format_str, fmt::format_args args) { +void custom_vformat(fmt::CStringRef format_str, fmt::args args) { fmt::MemoryWriter writer; fmt::vwrite(writer, format_str, args); } diff --git a/test/ostream-test.cc b/test/ostream-test.cc index af279b8f..6eab45a6 100644 --- a/test/ostream-test.cc +++ b/test/ostream-test.cc @@ -65,7 +65,7 @@ struct TestArgFormatter : fmt::ArgFormatter { TEST(OStreamTest, CustomArg) { fmt::MemoryWriter writer; - fmt::context ctx("}", fmt::format_args()); + fmt::context ctx("}", fmt::args()); fmt::format_specs spec; TestArgFormatter af(writer, ctx, spec); visit(af, fmt::internal::make_arg(TestEnum())); diff --git a/test/util-test.cc b/test/util-test.cc index e84415d8..19cbcb8f 100644 --- a/test/util-test.cc +++ b/test/util-test.cc @@ -53,7 +53,6 @@ #undef max using fmt::basic_arg; -using fmt::format_arg; using fmt::buffer; using fmt::StringRef; using fmt::internal::MemoryBuffer; @@ -408,7 +407,7 @@ TEST(UtilTest, Increment) { } TEST(UtilTest, FormatArgs) { - fmt::format_args args; + fmt::args args; EXPECT_FALSE(args[1]); } @@ -570,7 +569,7 @@ TEST(UtilTest, CustomArg) { testing::Invoke([&](fmt::internal::CustomValue custom) { EXPECT_EQ(&test, custom.value); fmt::MemoryWriter w; - fmt::context ctx("}", fmt::format_args()); + fmt::context ctx("}", fmt::args()); custom.format(w, &test, &ctx); EXPECT_EQ("test", w.str()); return Visitor::Result(); @@ -582,7 +581,7 @@ TEST(ArgVisitorTest, VisitInvalidArg) { typedef MockVisitor Visitor; testing::StrictMock visitor; EXPECT_CALL(visitor, visit(_)); - format_arg arg; + fmt::basic_arg arg; visit(visitor, arg); }