Remove use cases of deprecated functionality

This commit is contained in:
Elias Kosunen 2019-01-29 16:31:25 -05:00 committed by Victor Zverovich
parent 34951f1999
commit c3268f4e50
3 changed files with 14 additions and 14 deletions

View File

@ -3084,9 +3084,9 @@ struct format_handler : internal::error_handler {
void on_arg_id() { arg = context.next_arg(); } void on_arg_id() { arg = context.next_arg(); }
void on_arg_id(unsigned id) { void on_arg_id(unsigned id) {
context.parse_context().check_arg_id(id); context.parse_context().check_arg_id(id);
arg = context.get_arg(id); arg = context.arg(id);
} }
void on_arg_id(basic_string_view<Char> id) { arg = context.get_arg(id); } void on_arg_id(basic_string_view<Char> id) { arg = context.arg(id); }
void on_replacement_field(const Char* p) { void on_replacement_field(const Char* p) {
context.parse_context().advance_to(p); context.parse_context().advance_to(p);

View File

@ -284,8 +284,8 @@ class prepared_format {
const auto arg = const auto arg =
value.spec.arg_id.which == value.spec.arg_id.which ==
format_part_t::argument_id::which_arg_id::index format_part_t::argument_id::which_arg_id::index
? ctx.get_arg(arg_id_value.index) ? ctx.arg(arg_id_value.index)
: ctx.get_arg(arg_id_value.named_index.to_view(format_)); : ctx.arg(arg_id_value.named_index.to_view(format_));
auto specs = value.spec.parsed_specs; auto specs = value.spec.parsed_specs;
@ -317,7 +317,7 @@ class prepared_format {
void format_arg(Context& ctx, Id arg_id) const { void format_arg(Context& ctx, Id arg_id) const {
ctx.parse_context().check_arg_id(arg_id); ctx.parse_context().check_arg_id(arg_id);
const auto stopped_at = const auto stopped_at =
visit_format_arg(arg_formatter<Range>(ctx), ctx.get_arg(arg_id)); visit_format_arg(arg_formatter<Range>(ctx), ctx.arg(arg_id));
ctx.advance_to(stopped_at); ctx.advance_to(stopped_at);
} }

View File

@ -290,13 +290,13 @@ VISIT_TYPE(unsigned long, unsigned long long);
VISIT_TYPE(float, double); VISIT_TYPE(float, double);
#define CHECK_ARG_(Char, expected, value) \ #define CHECK_ARG_(Char, expected, value) \
{ \ { \
testing::StrictMock<mock_visitor<decltype(expected)>> visitor; \ testing::StrictMock<mock_visitor<decltype(expected)>> visitor; \
EXPECT_CALL(visitor, visit(expected)); \ EXPECT_CALL(visitor, visit(expected)); \
typedef std::back_insert_iterator<basic_buffer<Char>> iterator; \ typedef std::back_insert_iterator<basic_buffer<Char>> iterator; \
fmt::visit(visitor, \ fmt::visit_format_arg( \
make_arg<fmt::basic_format_context<iterator, Char>>(value)); \ visitor, make_arg<fmt::basic_format_context<iterator, Char>>(value)); \
} }
#define CHECK_ARG(value, typename_) \ #define CHECK_ARG(value, typename_) \
@ -391,14 +391,14 @@ TEST(ArgTest, CustomArg) {
visitor; visitor;
testing::StrictMock<visitor> v; testing::StrictMock<visitor> v;
EXPECT_CALL(v, visit(_)).WillOnce(testing::Invoke(check_custom())); EXPECT_CALL(v, visit(_)).WillOnce(testing::Invoke(check_custom()));
fmt::visit(v, make_arg<fmt::format_context>(test)); fmt::visit_format_arg(v, make_arg<fmt::format_context>(test));
} }
TEST(ArgTest, VisitInvalidArg) { TEST(ArgTest, VisitInvalidArg) {
testing::StrictMock<mock_visitor<fmt::monostate>> visitor; testing::StrictMock<mock_visitor<fmt::monostate>> visitor;
EXPECT_CALL(visitor, visit(_)); EXPECT_CALL(visitor, visit(_));
fmt::basic_format_arg<fmt::format_context> arg; fmt::basic_format_arg<fmt::format_context> arg;
visit(visitor, arg); fmt::visit_format_arg(visitor, arg);
} }
TEST(StringViewTest, Length) { TEST(StringViewTest, Length) {