mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-02 11:29:01 +08:00
Changed clang formatting for templates
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@ namespace fmt {
|
||||
|
||||
namespace internal {
|
||||
|
||||
template <class Char> class FormatBuf : public std::basic_streambuf<Char>
|
||||
template<class Char> class FormatBuf : public std::basic_streambuf<Char>
|
||||
{
|
||||
private:
|
||||
typedef typename std::basic_streambuf<Char>::int_type int_type;
|
||||
@@ -60,12 +60,12 @@ struct DummyStream : std::ostream
|
||||
DummyStream(); // Suppress a bogus warning in MSVC.
|
||||
|
||||
// Hide all operator<< overloads from std::ostream.
|
||||
template <typename T> typename EnableIf<sizeof(T) == 0>::type operator<<(const T &);
|
||||
template<typename T> typename EnableIf<sizeof(T) == 0>::type operator<<(const T &);
|
||||
};
|
||||
|
||||
No &operator<<(std::ostream &, int);
|
||||
|
||||
template <typename T> struct ConvertToIntImpl<T, true>
|
||||
template<typename T> struct ConvertToIntImpl<T, true>
|
||||
{
|
||||
// Convert to int only if T doesn't have an overloaded operator<<.
|
||||
enum
|
||||
@@ -79,7 +79,7 @@ FMT_API void write(std::ostream &os, Writer &w);
|
||||
} // namespace internal
|
||||
|
||||
// Formats a value.
|
||||
template <typename Char, typename ArgFormatter_, typename T>
|
||||
template<typename Char, typename ArgFormatter_, typename T>
|
||||
void format_arg(BasicFormatter<Char, ArgFormatter_> &f, const Char *&format_str, const T &value)
|
||||
{
|
||||
internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE> buffer;
|
||||
|
@@ -20,9 +20,9 @@ namespace internal {
|
||||
|
||||
// Checks if a value fits in int - used to avoid warnings about comparing
|
||||
// signed and unsigned integers.
|
||||
template <bool IsSigned> struct IntChecker
|
||||
template<bool IsSigned> struct IntChecker
|
||||
{
|
||||
template <typename T> static bool fits_in_int(T value)
|
||||
template<typename T> static bool fits_in_int(T value)
|
||||
{
|
||||
unsigned max = std::numeric_limits<int>::max();
|
||||
return value <= max;
|
||||
@@ -33,9 +33,9 @@ template <bool IsSigned> struct IntChecker
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct IntChecker<true>
|
||||
template<> struct IntChecker<true>
|
||||
{
|
||||
template <typename T> static bool fits_in_int(T value)
|
||||
template<typename T> static bool fits_in_int(T value)
|
||||
{
|
||||
return value >= std::numeric_limits<int>::min() && value <= std::numeric_limits<int>::max();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
FMT_THROW(FormatError("precision is not integer"));
|
||||
}
|
||||
|
||||
template <typename T> int visit_any_int(T value)
|
||||
template<typename T> int visit_any_int(T value)
|
||||
{
|
||||
if (!IntChecker<std::numeric_limits<T>::is_signed>::fits_in_int(value))
|
||||
FMT_THROW(FormatError("number is too big"));
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
class IsZeroInt : public ArgVisitor<IsZeroInt, bool>
|
||||
{
|
||||
public:
|
||||
template <typename T> bool visit_any_int(T value)
|
||||
template<typename T> bool visit_any_int(T value)
|
||||
{
|
||||
return value == 0;
|
||||
}
|
||||
@@ -90,12 +90,12 @@ public:
|
||||
return 'p';
|
||||
}
|
||||
|
||||
template <typename T> char visit_any_int(T)
|
||||
template<typename T> char visit_any_int(T)
|
||||
{
|
||||
return 'd';
|
||||
}
|
||||
|
||||
template <typename T> char visit_any_double(T)
|
||||
template<typename T> char visit_any_double(T)
|
||||
{
|
||||
return 'g';
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename U> struct is_same
|
||||
template<typename T, typename U> struct is_same
|
||||
{
|
||||
enum
|
||||
{
|
||||
@@ -114,7 +114,7 @@ template <typename T, typename U> struct is_same
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T> struct is_same<T, T>
|
||||
template<typename T> struct is_same<T, T>
|
||||
{
|
||||
enum
|
||||
{
|
||||
@@ -126,7 +126,7 @@ template <typename T> struct is_same<T, T>
|
||||
// if T is an integral type. If T is void, the argument is converted to
|
||||
// corresponding signed or unsigned type depending on the type specifier:
|
||||
// 'd' and 'i' - signed, other - unsigned)
|
||||
template <typename T = void> class ArgConverter : public ArgVisitor<ArgConverter<T>, void>
|
||||
template<typename T = void> class ArgConverter : public ArgVisitor<ArgConverter<T>, void>
|
||||
{
|
||||
private:
|
||||
internal::Arg &arg_;
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
visit_any_int(value);
|
||||
}
|
||||
|
||||
template <typename U> void visit_any_int(U value)
|
||||
template<typename U> void visit_any_int(U value)
|
||||
{
|
||||
bool is_signed = type_ == 'd' || type_ == 'i';
|
||||
if (type_ == 's')
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T> void visit_any_int(T value)
|
||||
template<typename T> void visit_any_int(T value)
|
||||
{
|
||||
arg_.type = internal::Arg::CHAR;
|
||||
arg_.int_value = static_cast<char>(value);
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
FMT_THROW(FormatError("width is not integer"));
|
||||
}
|
||||
|
||||
template <typename T> unsigned visit_any_int(T value)
|
||||
template<typename T> unsigned visit_any_int(T value)
|
||||
{
|
||||
typedef typename internal::IntTraits<T>::MainType UnsignedType;
|
||||
UnsignedType width = static_cast<UnsignedType>(value);
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
superclass will be called.
|
||||
\endrst
|
||||
*/
|
||||
template <typename Impl, typename Char, typename Spec> class BasicPrintfArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec>
|
||||
template<typename Impl, typename Char, typename Spec> class BasicPrintfArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec>
|
||||
{
|
||||
private:
|
||||
void write_null_pointer()
|
||||
@@ -367,7 +367,7 @@ public:
|
||||
};
|
||||
|
||||
/** The default printf argument formatter. */
|
||||
template <typename Char> class PrintfArgFormatter : public BasicPrintfArgFormatter<PrintfArgFormatter<Char>, Char, FormatSpec>
|
||||
template<typename Char> class PrintfArgFormatter : public BasicPrintfArgFormatter<PrintfArgFormatter<Char>, Char, FormatSpec>
|
||||
{
|
||||
public:
|
||||
/** Constructs an argument formatter object. */
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
};
|
||||
|
||||
/** This template formats data and writes the output to a writer. */
|
||||
template <typename Char, typename ArgFormatter = PrintfArgFormatter<Char>> class PrintfFormatter : private internal::FormatterBase
|
||||
template<typename Char, typename ArgFormatter = PrintfArgFormatter<Char>> class PrintfFormatter : private internal::FormatterBase
|
||||
{
|
||||
private:
|
||||
BasicWriter<Char> &writer_;
|
||||
@@ -410,7 +410,7 @@ public:
|
||||
void format(BasicCStringRef<Char> format_str);
|
||||
};
|
||||
|
||||
template <typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags(FormatSpec &spec, const Char *&s)
|
||||
template<typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags(FormatSpec &spec, const Char *&s)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
@@ -438,7 +438,7 @@ template <typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flag
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::get_arg(const Char *s, unsigned arg_index)
|
||||
template<typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::get_arg(const Char *s, unsigned arg_index)
|
||||
{
|
||||
(void)s;
|
||||
const char *error = FMT_NULL;
|
||||
@@ -448,7 +448,7 @@ template <typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::g
|
||||
return arg;
|
||||
}
|
||||
|
||||
template <typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_header(const Char *&s, FormatSpec &spec)
|
||||
template<typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_header(const Char *&s, FormatSpec &spec)
|
||||
{
|
||||
unsigned arg_index = std::numeric_limits<unsigned>::max();
|
||||
Char c = *s;
|
||||
@@ -489,7 +489,7 @@ template <typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_
|
||||
return arg_index;
|
||||
}
|
||||
|
||||
template <typename Char, typename AF> void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str)
|
||||
template<typename Char, typename AF> void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str)
|
||||
{
|
||||
const Char *start = format_str.c_str();
|
||||
const Char *s = start;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
namespace fmt {
|
||||
template <typename ArgFormatter> void format_arg(BasicFormatter<char, ArgFormatter> &f, const char *&format_str, const std::tm &tm)
|
||||
template<typename ArgFormatter> void format_arg(BasicFormatter<char, ArgFormatter> &f, const char *&format_str, const std::tm &tm)
|
||||
{
|
||||
if (*format_str == ':')
|
||||
++format_str;
|
||||
|
Reference in New Issue
Block a user