basic_context -> basic_format_context

This commit is contained in:
Victor Zverovich 2018-04-08 06:45:21 -07:00
parent 44cc034651
commit 26aa34f319
3 changed files with 18 additions and 16 deletions

View File

@ -863,8 +863,9 @@ inline Container &get_container(std::back_insert_iterator<Container> it) {
// Formatting context.
template <typename OutputIt, typename Char>
class basic_context :
public internal::context_base<OutputIt, basic_context<OutputIt, Char>, Char> {
class basic_format_context :
public internal::context_base<
OutputIt, basic_format_context<OutputIt, Char>, Char> {
public:
/** The character type for the output. */
typedef Char char_type;
@ -874,11 +875,11 @@ class basic_context :
struct formatter_type { typedef formatter<T, char_type> type; };
private:
internal::arg_map<basic_context> map_;
internal::arg_map<basic_format_context> map_;
FMT_DISALLOW_COPY_AND_ASSIGN(basic_context);
FMT_DISALLOW_COPY_AND_ASSIGN(basic_format_context);
typedef internal::context_base<OutputIt, basic_context, Char> base;
typedef internal::context_base<OutputIt, basic_format_context, Char> 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<char_type> format_str,
basic_format_args<basic_context> args)
basic_format_context(OutputIt out, basic_string_view<char_type> format_str,
basic_format_args<basic_format_context> args)
: base(out, format_str, args) {}
format_arg next_arg() {
@ -907,7 +908,7 @@ class basic_context :
template <typename Char>
struct buffer_context {
typedef basic_context<
typedef basic_format_context<
std::back_insert_iterator<internal::basic_buffer<Char>>, Char> type;
};
typedef buffer_context<char>::type context;

View File

@ -2203,7 +2203,7 @@ class arg_formatter:
private:
typedef typename Range::value_type char_type;
typedef internal::arg_formatter_base<Range> base;
typedef basic_context<typename base::iterator, char_type> context_type;
typedef basic_format_context<typename base::iterator, char_type> context_type;
context_type &ctx_;
@ -3199,8 +3199,8 @@ class dynamic_formatter {
};
template <typename Range, typename Char>
typename basic_context<Range, Char>::format_arg
basic_context<Range, Char>::get_arg(basic_string_view<char_type> name) {
typename basic_format_context<Range, Char>::format_arg
basic_format_context<Range, Char>::get_arg(basic_string_view<char_type> 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 <typename OutputIt, typename Char = char>
//using context_t = basic_context<OutputIt, Char>;
struct context_t { typedef basic_context<OutputIt, Char> type; };
//using context_t = basic_format_context<OutputIt, Char>;
struct context_t { typedef basic_format_context<OutputIt, Char> type; };
template <typename OutputIt, typename Char = char>
//using format_args_t = basic_format_args<context_t<OutputIt, Char>>;

View File

@ -63,7 +63,7 @@ struct formatter<Test, Char> {
typedef std::back_insert_iterator<basic_buffer<Char>> iterator;
auto format(Test, basic_context<iterator, char> &ctx)
auto format(Test, basic_format_context<iterator, char> &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<MockVisitor<decltype(expected)>> visitor; \
EXPECT_CALL(visitor, visit(expected)); \
typedef std::back_insert_iterator<basic_buffer<Char>> iterator; \
fmt::visit(visitor, make_arg<fmt::basic_context<iterator, Char>>(value)); \
fmt::visit(visitor, \
make_arg<fmt::basic_format_context<iterator, Char>>(value)); \
}
#define CHECK_ARG(value, typename_) { \