Commit 522de7b5 authored by Victor Zverovich's avatar Victor Zverovich

Replace using with typedef for compatibility with gcc-4.6

parent 0b508fd2
...@@ -168,8 +168,8 @@ class basic_string_view { ...@@ -168,8 +168,8 @@ class basic_string_view {
size_t size_; size_t size_;
public: public:
using char_type = Char; typedef Char char_type;
using iterator = const Char *; typedef const Char *iterator;
FMT_CONSTEXPR basic_string_view() FMT_NOEXCEPT : data_(0), size_(0) {} FMT_CONSTEXPR basic_string_view() FMT_NOEXCEPT : data_(0), size_(0) {}
...@@ -242,8 +242,8 @@ class basic_string_view { ...@@ -242,8 +242,8 @@ class basic_string_view {
#endif #endif
namespace fmt { namespace fmt {
using string_view = basic_string_view<char>; typedef basic_string_view<char> string_view;
using wstring_view = basic_string_view<wchar_t>; typedef basic_string_view<wchar_t> wstring_view;
template <typename Context> template <typename Context>
class basic_arg; class basic_arg;
...@@ -285,7 +285,7 @@ class basic_buffer { ...@@ -285,7 +285,7 @@ class basic_buffer {
virtual void grow(std::size_t capacity) = 0; virtual void grow(std::size_t capacity) = 0;
public: public:
using value_type = T; typedef T value_type;
virtual ~basic_buffer() {} virtual ~basic_buffer() {}
...@@ -335,8 +335,8 @@ class basic_buffer { ...@@ -335,8 +335,8 @@ class basic_buffer {
const T &operator[](std::size_t index) const { return ptr_[index]; } const T &operator[](std::size_t index) const { return ptr_[index]; }
}; };
using buffer = basic_buffer<char>; typedef basic_buffer<char> buffer;
using wbuffer = basic_buffer<wchar_t>; typedef basic_buffer<wchar_t> wbuffer;
// A container-backed buffer. // A container-backed buffer.
template <typename Container> template <typename Container>
...@@ -443,7 +443,7 @@ struct custom_value { ...@@ -443,7 +443,7 @@ struct custom_value {
template <typename Context> template <typename Context>
class value { class value {
public: public:
using char_type = typename Context::char_type; typedef typename Context::char_type char_type;
union { union {
int int_value; int int_value;
...@@ -499,7 +499,7 @@ class value { ...@@ -499,7 +499,7 @@ class value {
// Get the formatter type through the context to allow different contexts // Get the formatter type through the context to allow different contexts
// have different extension points, e.g. `formatter<T>` for `format` and // have different extension points, e.g. `formatter<T>` for `format` and
// `printf_formatter<T>` for `printf`. // `printf_formatter<T>` for `printf`.
typename Context::template formatter_type<T> f; typename Context::template formatter_type<T>::type f;
auto &&parse_ctx = ctx.parse_context(); auto &&parse_ctx = ctx.parse_context();
parse_ctx.advance_to(f.parse(parse_ctx)); parse_ctx.advance_to(f.parse(parse_ctx));
ctx.advance_to(f.format(*static_cast<const T*>(arg), ctx)); ctx.advance_to(f.format(*static_cast<const T*>(arg), ctx));
...@@ -531,12 +531,11 @@ FMT_MAKE_VALUE(UINT, unsigned, unsigned) ...@@ -531,12 +531,11 @@ FMT_MAKE_VALUE(UINT, unsigned, unsigned)
// To minimize the number of types we need to deal with, long is translated // To minimize the number of types we need to deal with, long is translated
// either to int or to long long depending on its size. // either to int or to long long depending on its size.
using long_type = typedef std::conditional<sizeof(long) == sizeof(int), int, long long>::type
std::conditional<sizeof(long) == sizeof(int), int, long long>::type; long_type;
FMT_MAKE_VALUE((sizeof(long) == sizeof(int) ? INT : LONG_LONG), long, long_type) FMT_MAKE_VALUE((sizeof(long) == sizeof(int) ? INT : LONG_LONG), long, long_type)
using ulong_type = typedef std::conditional<sizeof(unsigned long) == sizeof(unsigned),
std::conditional<sizeof(unsigned long) == sizeof(unsigned), unsigned, unsigned long long>::type ulong_type;
unsigned, unsigned long long>::type;
FMT_MAKE_VALUE((sizeof(unsigned long) == sizeof(unsigned) ? UINT : ULONG_LONG), FMT_MAKE_VALUE((sizeof(unsigned long) == sizeof(unsigned) ? UINT : ULONG_LONG),
unsigned long, ulong_type) unsigned long, ulong_type)
...@@ -628,7 +627,7 @@ class basic_arg { ...@@ -628,7 +627,7 @@ class basic_arg {
friend class basic_format_args<Context>; friend class basic_format_args<Context>;
friend class internal::arg_map<Context>; friend class internal::arg_map<Context>;
using char_type = typename Context::char_type; typedef typename Context::char_type char_type;
public: public:
class handle { class handle {
...@@ -663,8 +662,8 @@ class basic_parse_context : private ErrorHandler { ...@@ -663,8 +662,8 @@ class basic_parse_context : private ErrorHandler {
int next_arg_id_; int next_arg_id_;
public: public:
using char_type = Char; typedef Char char_type;
using iterator = typename basic_string_view<Char>::iterator; typedef typename basic_string_view<Char>::iterator iterator;
explicit FMT_CONSTEXPR basic_parse_context( explicit FMT_CONSTEXPR basic_parse_context(
basic_string_view<Char> format_str, ErrorHandler eh = ErrorHandler()) basic_string_view<Char> format_str, ErrorHandler eh = ErrorHandler())
...@@ -704,8 +703,8 @@ class basic_parse_context : private ErrorHandler { ...@@ -704,8 +703,8 @@ class basic_parse_context : private ErrorHandler {
FMT_CONSTEXPR ErrorHandler error_handler() const { return *this; } FMT_CONSTEXPR ErrorHandler error_handler() const { return *this; }
}; };
using parse_context = basic_parse_context<char>; typedef basic_parse_context<char> parse_context;
using wparse_context = basic_parse_context<wchar_t>; typedef basic_parse_context<wchar_t> wparse_context;
namespace internal { namespace internal {
// A map from argument names to their values for named arguments. // A map from argument names to their values for named arguments.
...@@ -714,7 +713,7 @@ class arg_map { ...@@ -714,7 +713,7 @@ class arg_map {
private: private:
FMT_DISALLOW_COPY_AND_ASSIGN(arg_map); FMT_DISALLOW_COPY_AND_ASSIGN(arg_map);
using char_type = typename Context::char_type; typedef typename Context::char_type char_type;
struct entry { struct entry {
basic_string_view<char_type> name; basic_string_view<char_type> name;
...@@ -748,7 +747,7 @@ class arg_map { ...@@ -748,7 +747,7 @@ class arg_map {
template <typename OutputIt, typename Context, typename Char> template <typename OutputIt, typename Context, typename Char>
class context_base { class context_base {
public: public:
using iterator = OutputIt; typedef OutputIt iterator;
private: private:
basic_parse_context<Char> parse_context_; basic_parse_context<Char> parse_context_;
...@@ -756,8 +755,8 @@ class context_base { ...@@ -756,8 +755,8 @@ class context_base {
basic_format_args<Context> args_; basic_format_args<Context> args_;
protected: protected:
using char_type = Char; typedef Char char_type;
using format_arg = basic_arg<Context>; typedef basic_arg<Context> format_arg;
context_base(OutputIt out, basic_string_view<char_type> format_str, context_base(OutputIt out, basic_string_view<char_type> format_str,
basic_format_args<Context> args) basic_format_args<Context> args)
...@@ -801,7 +800,7 @@ class context_base { ...@@ -801,7 +800,7 @@ class context_base {
// Extracts a reference to the container from back_insert_iterator. // Extracts a reference to the container from back_insert_iterator.
template <typename Container> template <typename Container>
inline Container &get_container(std::back_insert_iterator<Container> it) { inline Container &get_container(std::back_insert_iterator<Container> it) {
using iterator = std::back_insert_iterator<Container>; typedef std::back_insert_iterator<Container> iterator;
struct accessor: iterator { struct accessor: iterator {
accessor(iterator it) : iterator(it) {} accessor(iterator it) : iterator(it) {}
using iterator::container; using iterator::container;
...@@ -816,11 +815,11 @@ class output_range { ...@@ -816,11 +815,11 @@ class output_range {
OutputIt it_; OutputIt it_;
// Unused yet. // Unused yet.
using sentinel = void; typedef void sentinel;
sentinel end() const; sentinel end() const;
public: public:
using value_type = T; typedef T value_type;
explicit output_range(OutputIt it): it_(it) {} explicit output_range(OutputIt it): it_(it) {}
OutputIt begin() const { return it_; } OutputIt begin() const { return it_; }
...@@ -832,18 +831,19 @@ class basic_context : ...@@ -832,18 +831,19 @@ class basic_context :
public internal::context_base<OutputIt, basic_context<OutputIt, Char>, Char> { public internal::context_base<OutputIt, basic_context<OutputIt, Char>, Char> {
public: public:
/** The character type for the output. */ /** The character type for the output. */
using char_type = Char; typedef Char char_type;
// using formatter_type = formatter<T, char_type>;
template <typename T> template <typename T>
using formatter_type = formatter<T, char_type>; struct formatter_type { typedef formatter<T, char_type> type; };
private: private:
internal::arg_map<basic_context> map_; internal::arg_map<basic_context> map_;
FMT_DISALLOW_COPY_AND_ASSIGN(basic_context); FMT_DISALLOW_COPY_AND_ASSIGN(basic_context);
using base = internal::context_base<OutputIt, basic_context, Char>; typedef internal::context_base<OutputIt, basic_context, Char> base;
using format_arg = typename base::format_arg; typedef typename base::format_arg format_arg;
using base::get_arg; using base::get_arg;
public: public:
...@@ -872,8 +872,8 @@ class basic_context : ...@@ -872,8 +872,8 @@ class basic_context :
template <typename Char> template <typename Char>
using buffer_context_t = basic_context< using buffer_context_t = basic_context<
std::back_insert_iterator<internal::basic_buffer<Char>>, Char>; std::back_insert_iterator<internal::basic_buffer<Char>>, Char>;
using context = buffer_context_t<char>; typedef buffer_context_t<char> context;
using wcontext = buffer_context_t<wchar_t>; typedef buffer_context_t<wchar_t> wcontext;
namespace internal { namespace internal {
template <typename Context, typename T> template <typename Context, typename T>
...@@ -882,7 +882,7 @@ class get_type { ...@@ -882,7 +882,7 @@ class get_type {
static const T& val(); static const T& val();
public: public:
using value_type = decltype(make_value<Context>(val())); typedef decltype(make_value<Context>(val())) value_type;
static const type value = value_type::type_tag; static const type value = value_type::type_tag;
}; };
...@@ -923,8 +923,8 @@ class arg_store { ...@@ -923,8 +923,8 @@ class arg_store {
// Packed is a macro on MinGW so use IS_PACKED instead. // Packed is a macro on MinGW so use IS_PACKED instead.
static const bool IS_PACKED = NUM_ARGS < internal::MAX_PACKED_ARGS; static const bool IS_PACKED = NUM_ARGS < internal::MAX_PACKED_ARGS;
using value_type = typename std::conditional< typedef typename std::conditional<
IS_PACKED, internal::value<Context>, basic_arg<Context>>::type; IS_PACKED, internal::value<Context>, basic_arg<Context>>::type value_type;
// If the arguments are not packed, add one more element to mark the end. // If the arguments are not packed, add one more element to mark the end.
value_type data_[NUM_ARGS + (IS_PACKED && NUM_ARGS != 0 ? 0 : 1)]; value_type data_[NUM_ARGS + (IS_PACKED && NUM_ARGS != 0 ? 0 : 1)];
...@@ -959,8 +959,8 @@ inline arg_store<context, Args...> make_args(const Args & ... args) { ...@@ -959,8 +959,8 @@ inline arg_store<context, Args...> make_args(const Args & ... args) {
template <typename Context> template <typename Context>
class basic_format_args { class basic_format_args {
public: public:
using size_type = unsigned; typedef unsigned size_type;
using format_arg = basic_arg<Context> ; typedef basic_arg<Context> format_arg;
private: private:
// To reduce compiled code size per formatting function call, types of first // To reduce compiled code size per formatting function call, types of first
...@@ -1028,8 +1028,8 @@ class basic_format_args { ...@@ -1028,8 +1028,8 @@ class basic_format_args {
} }
}; };
using format_args = basic_format_args<context>; typedef basic_format_args<context> format_args;
using wformat_args = basic_format_args<wcontext>; typedef basic_format_args<wcontext> wformat_args;
namespace internal { namespace internal {
template <typename Char> template <typename Char>
......
This diff is collapsed.
...@@ -309,7 +309,7 @@ class basic_printf_context : ...@@ -309,7 +309,7 @@ class basic_printf_context :
using char_type = Char; using char_type = Char;
template <typename T> template <typename T>
using formatter_type = printf_formatter<T>; struct formatter_type { typedef printf_formatter<T> type; };
private: private:
using base = internal::context_base<OutputIt, basic_printf_context, Char>; using base = internal::context_base<OutputIt, basic_printf_context, Char>;
......
...@@ -440,15 +440,17 @@ struct custom_context { ...@@ -440,15 +440,17 @@ struct custom_context {
template <typename T> template <typename T>
struct formatter_type { struct formatter_type {
template <typename ParseContext> struct type {
auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { template <typename ParseContext>
return ctx.begin(); auto parse(ParseContext &ctx) -> decltype(ctx.begin()) {
} return ctx.begin();
}
const char *format(const T &, custom_context& ctx) {
ctx.called = true; const char *format(const T &, custom_context& ctx) {
return 0; ctx.called = true;
} return 0;
}
};
}; };
bool called; bool called;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment