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(unsigned 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) {
context.parse_context().advance_to(p);

View File

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

View File

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