ArgList -> format_args
This commit is contained in:
@@ -45,7 +45,7 @@ class CustomPrintfArgFormatter :
|
||||
}
|
||||
};
|
||||
|
||||
std::string custom_format(const char *format_str, fmt::ArgList args) {
|
||||
std::string custom_format(const char *format_str, fmt::format_args args) {
|
||||
fmt::MemoryWriter writer;
|
||||
// Pass custom argument formatter as a template arg to BasicFormatter.
|
||||
fmt::BasicFormatter<char, CustomArgFormatter> formatter(args, writer);
|
||||
@@ -54,7 +54,7 @@ std::string custom_format(const char *format_str, fmt::ArgList args) {
|
||||
}
|
||||
FMT_VARIADIC(std::string, custom_format, const char *)
|
||||
|
||||
std::string custom_sprintf(const char* format_str, fmt::ArgList args){
|
||||
std::string custom_sprintf(const char* format_str, fmt::format_args args){
|
||||
fmt::MemoryWriter writer;
|
||||
fmt::PrintfFormatter<char, CustomPrintfArgFormatter> formatter(args, writer);
|
||||
formatter.format(format_str);
|
||||
|
||||
@@ -1564,7 +1564,7 @@ TEST(StrTest, Convert) {
|
||||
}
|
||||
|
||||
std::string format_message(int id, const char *format,
|
||||
const fmt::ArgList &args) {
|
||||
const fmt::format_args &args) {
|
||||
MemoryWriter w;
|
||||
w.write("[{}] ", id);
|
||||
w.write(format, args);
|
||||
@@ -1643,7 +1643,7 @@ class MockArgFormatter :
|
||||
MOCK_METHOD1(visit_int, void (int value));
|
||||
};
|
||||
|
||||
void custom_format(const char *format_str, fmt::ArgList args) {
|
||||
void custom_format(const char *format_str, fmt::format_args args) {
|
||||
fmt::MemoryWriter writer;
|
||||
fmt::BasicFormatter<char, MockArgFormatter> formatter(args, writer);
|
||||
formatter.format(format_str);
|
||||
|
||||
@@ -67,7 +67,7 @@ TEST(UtilTest, NArg) {
|
||||
int result;
|
||||
|
||||
#define MAKE_TEST(func) \
|
||||
void func(const char *, const fmt::ArgList &args) { \
|
||||
void func(const char *, const fmt::format_args &args) { \
|
||||
result = 0; \
|
||||
for (unsigned i = 0; args[i].type; ++i) \
|
||||
result += args[i].int_value; \
|
||||
@@ -91,7 +91,7 @@ struct S {};
|
||||
|
||||
#define GET_TYPE(n) S<n>
|
||||
|
||||
int test_variadic(FMT_GEN(10, GET_TYPE), const fmt::ArgList &args) { \
|
||||
int test_variadic(FMT_GEN(10, GET_TYPE), const fmt::format_args &args) { \
|
||||
int result = 0; \
|
||||
for (unsigned i = 0; args[i].type; ++i) \
|
||||
result += args[i].int_value; \
|
||||
|
||||
@@ -67,7 +67,7 @@ struct TestArgFormatter : fmt::BasicArgFormatter<TestArgFormatter, char> {
|
||||
TEST(OStreamTest, CustomArg) {
|
||||
fmt::MemoryWriter writer;
|
||||
typedef fmt::BasicFormatter<char, TestArgFormatter> Formatter;
|
||||
Formatter formatter(fmt::ArgList(), writer);
|
||||
Formatter formatter(fmt::format_args(), writer);
|
||||
fmt::FormatSpec spec;
|
||||
TestArgFormatter af(formatter, spec, "}");
|
||||
af.visit(fmt::internal::MakeArg<Formatter>(TestEnum()));
|
||||
|
||||
@@ -566,14 +566,14 @@ TEST(ArgTest, MakeArg) {
|
||||
EXPECT_EQ(fmt::internal::Arg::CUSTOM, arg.type);
|
||||
EXPECT_EQ(&t, arg.custom.value);
|
||||
fmt::MemoryWriter w;
|
||||
fmt::BasicFormatter<char> formatter(fmt::ArgList(), w);
|
||||
fmt::BasicFormatter<char> formatter(fmt::format_args(), w);
|
||||
const char *s = "}";
|
||||
arg.custom.format(&formatter, &t, &s);
|
||||
EXPECT_EQ("test", w.str());
|
||||
}
|
||||
|
||||
TEST(UtilTest, ArgList) {
|
||||
fmt::ArgList args;
|
||||
TEST(UtilTest, FormatArgs) {
|
||||
fmt::format_args args;
|
||||
EXPECT_EQ(Arg::NONE, args[1].type);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user