small code cleanup

-removed Context parameter from make_printf_args and make_wprintf_args
-renamed tests
This commit is contained in:
Thomas Novotny 2018-11-18 22:00:40 +01:00
parent b643520c52
commit 2c6273e617
2 changed files with 10 additions and 13 deletions

View File

@ -578,33 +578,30 @@ struct printf_context {
std::back_insert_iterator<Buffer>, typename Buffer::value_type> type; std::back_insert_iterator<Buffer>, typename Buffer::value_type> type;
}; };
typedef basic_format_args<printf_context<internal::buffer>::type> printf_args;
typedef basic_format_args<printf_context<internal::wbuffer>::type> wprintf_args;
typedef printf_context<internal::buffer>::type printf_char_context; typedef printf_context<internal::buffer>::type printf_char_context;
typedef printf_context<internal::wbuffer>::type printf_wchar_context; typedef printf_context<internal::wbuffer>::type printf_wchar_context;
typedef basic_format_args<printf_char_context> printf_args;
typedef basic_format_args<printf_wchar_context> wprintf_args;
/** /**
\rst \rst
Constructs an `~fmt::format_arg_store` object that contains references to Constructs an `~fmt::format_arg_store` object that contains references to
arguments and can be implicitly converted to `~fmt::printf_args`. `Context` arguments and can be implicitly converted to `~fmt::printf_args`.
can be omitted in which case it defaults to `~fmt::printf_char_context`.
\endrst \endrst
*/ */
template<typename Context=printf_char_context, typename... Args> template<typename... Args>
inline format_arg_store<Context, Args...> inline format_arg_store<printf_char_context, Args...>
make_printf_args(const Args &... args) { return {args...}; } make_printf_args(const Args &... args) { return {args...}; }
/** /**
\rst \rst
Constructs an `~fmt::format_arg_store` object that contains references to Constructs an `~fmt::format_arg_store` object that contains references to
arguments and can be implicitly converted to `~fmt::wprintf_args`. `Context` arguments and can be implicitly converted to `~fmt::wprintf_args`.
can be omitted in which case it defaults to `~fmt::printf_wchar_context`.
\endrst \endrst
*/ */
template<typename Context = printf_wchar_context, typename... Args> template<typename... Args>
inline format_arg_store<Context, Args...> inline format_arg_store<printf_wchar_context, Args...>
make_wprintf_args(const Args &... args) { return {args...}; } make_wprintf_args(const Args &... args) { return {args...}; }

View File

@ -520,7 +520,7 @@ TEST(PrintfTest, CheckFormatStringRegression) {
} }
TEST(PrintfTest, VSPrintfMessageExample) { TEST(PrintfTest, VSPrintfMakeArgsExample) {
EXPECT_EQ( EXPECT_EQ(
"[42] something happened", "[42] something happened",
fmt::vsprintf( fmt::vsprintf(
@ -528,7 +528,7 @@ TEST(PrintfTest, VSPrintfMessageExample) {
} }
TEST(PrintfTest, VSPrintfWMessageExample) { TEST(PrintfTest, VSPrintfMakeWArgsExample) {
EXPECT_EQ( EXPECT_EQ(
L"[42] something happened", L"[42] something happened",
fmt::vsprintf( fmt::vsprintf(