BasicFormatter -> basic_formatter
This commit is contained in:
@@ -17,7 +17,7 @@ using fmt::BasicPrintfArgFormatter;
|
||||
class CustomArgFormatter
|
||||
: public fmt::BasicArgFormatter<CustomArgFormatter, char> {
|
||||
public:
|
||||
CustomArgFormatter(fmt::BasicFormatter<char, CustomArgFormatter> &f,
|
||||
CustomArgFormatter(fmt::basic_formatter<char, CustomArgFormatter> &f,
|
||||
fmt::FormatSpec &s, const char *fmt)
|
||||
: fmt::BasicArgFormatter<CustomArgFormatter, char>(f, s, fmt) {}
|
||||
|
||||
@@ -45,12 +45,12 @@ class CustomPrintfArgFormatter :
|
||||
}
|
||||
};
|
||||
|
||||
typedef fmt::BasicFormatter<char, CustomArgFormatter> CustomFormatter;
|
||||
typedef fmt::basic_formatter<char, CustomArgFormatter> CustomFormatter;
|
||||
|
||||
std::string custom_vformat(const char *format_str,
|
||||
fmt::basic_format_args<CustomFormatter> args) {
|
||||
fmt::MemoryWriter writer;
|
||||
// Pass custom argument formatter as a template arg to BasicFormatter.
|
||||
// Pass custom argument formatter as a template arg to basic_formatter.
|
||||
CustomFormatter formatter(args, writer);
|
||||
formatter.format(format_str);
|
||||
return writer.str();
|
||||
|
||||
@@ -1355,7 +1355,7 @@ TEST(FormatterTest, FormatCStringRef) {
|
||||
EXPECT_EQ("test", format("{0}", CStringRef("test")));
|
||||
}
|
||||
|
||||
void format_value(fmt::BasicFormatter<char> &f, const char *, const Date &d) {
|
||||
void format_value(fmt::basic_formatter<char> &f, const char *, const Date &d) {
|
||||
f.writer() << d.year() << '-' << d.month() << '-' << d.day();
|
||||
}
|
||||
|
||||
@@ -1368,7 +1368,7 @@ TEST(FormatterTest, FormatCustom) {
|
||||
class Answer {};
|
||||
|
||||
template <typename Char>
|
||||
void format_value(fmt::BasicFormatter<Char> &f, const Char *, Answer) {
|
||||
void format_value(fmt::basic_formatter<Char> &f, const Char *, Answer) {
|
||||
f.writer() << "42";
|
||||
}
|
||||
|
||||
@@ -1559,7 +1559,7 @@ std::string vformat_message(int id, const char *format, fmt::format_args args) {
|
||||
|
||||
template <typename... Args>
|
||||
std::string format_message(int id, const char *format, const Args & ... args) {
|
||||
auto va = fmt::make_format_args<fmt::BasicFormatter<char>>(args...);
|
||||
auto va = fmt::make_format_args<fmt::basic_formatter<char>>(args...);
|
||||
return vformat_message(id, format, va);
|
||||
}
|
||||
|
||||
@@ -1624,7 +1624,7 @@ class MockArgFormatter :
|
||||
public:
|
||||
typedef fmt::internal::ArgFormatterBase<MockArgFormatter, char> Base;
|
||||
|
||||
MockArgFormatter(fmt::BasicFormatter<char, MockArgFormatter> &f,
|
||||
MockArgFormatter(fmt::basic_formatter<char, MockArgFormatter> &f,
|
||||
fmt::FormatSpec &s, const char *)
|
||||
: fmt::internal::ArgFormatterBase<MockArgFormatter, char>(f.writer(), s) {
|
||||
EXPECT_CALL(*this, visit_int(42));
|
||||
@@ -1633,7 +1633,7 @@ class MockArgFormatter :
|
||||
MOCK_METHOD1(visit_int, void (int value));
|
||||
};
|
||||
|
||||
typedef fmt::BasicFormatter<char, MockArgFormatter> CustomFormatter;
|
||||
typedef fmt::basic_formatter<char, MockArgFormatter> CustomFormatter;
|
||||
|
||||
void custom_vformat(const char *format_str,
|
||||
fmt::basic_format_args<CustomFormatter> args) {
|
||||
|
||||
@@ -59,14 +59,14 @@ TEST(OStreamTest, Enum) {
|
||||
}
|
||||
|
||||
struct TestArgFormatter : fmt::BasicArgFormatter<TestArgFormatter, char> {
|
||||
TestArgFormatter(fmt::BasicFormatter<char, TestArgFormatter> &f,
|
||||
TestArgFormatter(fmt::basic_formatter<char, TestArgFormatter> &f,
|
||||
fmt::FormatSpec &s, const char *fmt)
|
||||
: fmt::BasicArgFormatter<TestArgFormatter, char>(f, s, fmt) {}
|
||||
};
|
||||
|
||||
TEST(OStreamTest, CustomArg) {
|
||||
fmt::MemoryWriter writer;
|
||||
typedef fmt::BasicFormatter<char, TestArgFormatter> Formatter;
|
||||
typedef fmt::basic_formatter<char, TestArgFormatter> Formatter;
|
||||
Formatter formatter(fmt::basic_format_args<Formatter>(), writer);
|
||||
fmt::FormatSpec spec;
|
||||
TestArgFormatter af(formatter, spec, "}");
|
||||
|
||||
@@ -64,13 +64,13 @@ namespace {
|
||||
struct Test {};
|
||||
|
||||
template <typename Char>
|
||||
void format_value(fmt::BasicFormatter<Char> &f, const Char *, Test) {
|
||||
void format_value(fmt::basic_formatter<Char> &f, const Char *, Test) {
|
||||
f.writer() << "test";
|
||||
}
|
||||
|
||||
template <typename Char, typename T>
|
||||
Arg make_arg(const T &value) {
|
||||
typedef fmt::internal::MakeValue< fmt::BasicFormatter<Char> > MakeValue;
|
||||
typedef fmt::internal::MakeValue< fmt::basic_formatter<Char> > MakeValue;
|
||||
Arg arg = MakeValue(value);
|
||||
arg.type = fmt::internal::type<T>();
|
||||
return arg;
|
||||
@@ -566,7 +566,7 @@ 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::format_args(), w);
|
||||
fmt::basic_formatter<char> formatter(fmt::format_args(), w);
|
||||
const char *s = "}";
|
||||
arg.custom.format(&formatter, &t, &s);
|
||||
EXPECT_EQ("test", w.str());
|
||||
|
||||
Reference in New Issue
Block a user