From 26aa34f3194c060c762955c7f4b92b9e4f5666dd Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 8 Apr 2018 06:45:21 -0700 Subject: [PATCH] basic_context -> basic_format_context --- include/fmt/core.h | 19 ++++++++++--------- include/fmt/format.h | 10 +++++----- test/util-test.cc | 5 +++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index dc766daf..dd8dda8e 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -863,8 +863,9 @@ inline Container &get_container(std::back_insert_iterator it) { // Formatting context. template -class basic_context : - public internal::context_base, Char> { +class basic_format_context : + public internal::context_base< + OutputIt, basic_format_context, Char> { public: /** The character type for the output. */ typedef Char char_type; @@ -874,11 +875,11 @@ class basic_context : struct formatter_type { typedef formatter type; }; private: - internal::arg_map map_; + internal::arg_map map_; - FMT_DISALLOW_COPY_AND_ASSIGN(basic_context); + FMT_DISALLOW_COPY_AND_ASSIGN(basic_format_context); - typedef internal::context_base base; + typedef internal::context_base base; typedef typename base::format_arg format_arg; using base::get_arg; @@ -887,12 +888,12 @@ class basic_context : /** \rst - Constructs a ``basic_context`` object. References to the arguments are + Constructs a ``basic_format_context`` object. References to the arguments are stored in the object so make sure they have appropriate lifetimes. \endrst */ - basic_context(OutputIt out, basic_string_view format_str, - basic_format_args args) + basic_format_context(OutputIt out, basic_string_view format_str, + basic_format_args args) : base(out, format_str, args) {} format_arg next_arg() { @@ -907,7 +908,7 @@ class basic_context : template struct buffer_context { - typedef basic_context< + typedef basic_format_context< std::back_insert_iterator>, Char> type; }; typedef buffer_context::type context; diff --git a/include/fmt/format.h b/include/fmt/format.h index fc50d737..ac0f4586 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2203,7 +2203,7 @@ class arg_formatter: private: typedef typename Range::value_type char_type; typedef internal::arg_formatter_base base; - typedef basic_context context_type; + typedef basic_format_context context_type; context_type &ctx_; @@ -3199,8 +3199,8 @@ class dynamic_formatter { }; template -typename basic_context::format_arg - basic_context::get_arg(basic_string_view name) { +typename basic_format_context::format_arg + basic_format_context::get_arg(basic_string_view name) { map_.init(this->args()); format_arg arg = map_.find(name); if (arg.type() == internal::none_type) @@ -3393,8 +3393,8 @@ inline wcontext::iterator format_to( } template -//using context_t = basic_context; -struct context_t { typedef basic_context type; }; +//using context_t = basic_format_context; +struct context_t { typedef basic_format_context type; }; template //using format_args_t = basic_format_args>; diff --git a/test/util-test.cc b/test/util-test.cc index 1c9897fa..8f391822 100644 --- a/test/util-test.cc +++ b/test/util-test.cc @@ -63,7 +63,7 @@ struct formatter { typedef std::back_insert_iterator> iterator; - auto format(Test, basic_context &ctx) + auto format(Test, basic_format_context &ctx) -> decltype(ctx.begin()) { const Char *test = "test"; return std::copy_n(test, std::strlen(test), ctx.begin()); @@ -506,7 +506,8 @@ VISIT_TYPE(float, double); testing::StrictMock> visitor; \ EXPECT_CALL(visitor, visit(expected)); \ typedef std::back_insert_iterator> iterator; \ - fmt::visit(visitor, make_arg>(value)); \ + fmt::visit(visitor, \ + make_arg>(value)); \ } #define CHECK_ARG(value, typename_) { \