mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 03:07:36 +02:00
basic_context -> basic_format_context
This commit is contained in:
@ -863,8 +863,9 @@ inline Container &get_container(std::back_insert_iterator<Container> it) {
|
|||||||
|
|
||||||
// Formatting context.
|
// Formatting context.
|
||||||
template <typename OutputIt, typename Char>
|
template <typename OutputIt, typename Char>
|
||||||
class basic_context :
|
class basic_format_context :
|
||||||
public internal::context_base<OutputIt, basic_context<OutputIt, Char>, Char> {
|
public internal::context_base<
|
||||||
|
OutputIt, basic_format_context<OutputIt, Char>, Char> {
|
||||||
public:
|
public:
|
||||||
/** The character type for the output. */
|
/** The character type for the output. */
|
||||||
typedef Char char_type;
|
typedef Char char_type;
|
||||||
@ -874,11 +875,11 @@ class basic_context :
|
|||||||
struct formatter_type { typedef formatter<T, char_type> type; };
|
struct formatter_type { typedef formatter<T, char_type> type; };
|
||||||
|
|
||||||
private:
|
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;
|
typedef typename base::format_arg format_arg;
|
||||||
using base::get_arg;
|
using base::get_arg;
|
||||||
|
|
||||||
@ -887,12 +888,12 @@ class basic_context :
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\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.
|
stored in the object so make sure they have appropriate lifetimes.
|
||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
basic_context(OutputIt out, basic_string_view<char_type> format_str,
|
basic_format_context(OutputIt out, basic_string_view<char_type> format_str,
|
||||||
basic_format_args<basic_context> args)
|
basic_format_args<basic_format_context> args)
|
||||||
: base(out, format_str, args) {}
|
: base(out, format_str, args) {}
|
||||||
|
|
||||||
format_arg next_arg() {
|
format_arg next_arg() {
|
||||||
@ -907,7 +908,7 @@ class basic_context :
|
|||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
struct buffer_context {
|
struct buffer_context {
|
||||||
typedef basic_context<
|
typedef basic_format_context<
|
||||||
std::back_insert_iterator<internal::basic_buffer<Char>>, Char> type;
|
std::back_insert_iterator<internal::basic_buffer<Char>>, Char> type;
|
||||||
};
|
};
|
||||||
typedef buffer_context<char>::type context;
|
typedef buffer_context<char>::type context;
|
||||||
|
@ -2203,7 +2203,7 @@ class arg_formatter:
|
|||||||
private:
|
private:
|
||||||
typedef typename Range::value_type char_type;
|
typedef typename Range::value_type char_type;
|
||||||
typedef internal::arg_formatter_base<Range> base;
|
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_;
|
context_type &ctx_;
|
||||||
|
|
||||||
@ -3199,8 +3199,8 @@ class dynamic_formatter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename Range, typename Char>
|
template <typename Range, typename Char>
|
||||||
typename basic_context<Range, Char>::format_arg
|
typename basic_format_context<Range, Char>::format_arg
|
||||||
basic_context<Range, Char>::get_arg(basic_string_view<char_type> name) {
|
basic_format_context<Range, Char>::get_arg(basic_string_view<char_type> name) {
|
||||||
map_.init(this->args());
|
map_.init(this->args());
|
||||||
format_arg arg = map_.find(name);
|
format_arg arg = map_.find(name);
|
||||||
if (arg.type() == internal::none_type)
|
if (arg.type() == internal::none_type)
|
||||||
@ -3393,8 +3393,8 @@ inline wcontext::iterator format_to(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIt, typename Char = char>
|
template <typename OutputIt, typename Char = char>
|
||||||
//using context_t = basic_context<OutputIt, Char>;
|
//using context_t = basic_format_context<OutputIt, Char>;
|
||||||
struct context_t { typedef basic_context<OutputIt, Char> type; };
|
struct context_t { typedef basic_format_context<OutputIt, Char> type; };
|
||||||
|
|
||||||
template <typename OutputIt, typename Char = char>
|
template <typename OutputIt, typename Char = char>
|
||||||
//using format_args_t = basic_format_args<context_t<OutputIt, Char>>;
|
//using format_args_t = basic_format_args<context_t<OutputIt, Char>>;
|
||||||
|
@ -63,7 +63,7 @@ struct formatter<Test, Char> {
|
|||||||
|
|
||||||
typedef std::back_insert_iterator<basic_buffer<Char>> iterator;
|
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()) {
|
-> decltype(ctx.begin()) {
|
||||||
const Char *test = "test";
|
const Char *test = "test";
|
||||||
return std::copy_n(test, std::strlen(test), ctx.begin());
|
return std::copy_n(test, std::strlen(test), ctx.begin());
|
||||||
@ -506,7 +506,8 @@ VISIT_TYPE(float, double);
|
|||||||
testing::StrictMock<MockVisitor<decltype(expected)>> visitor; \
|
testing::StrictMock<MockVisitor<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, 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_) { \
|
#define CHECK_ARG(value, typename_) { \
|
||||||
|
Reference in New Issue
Block a user