Add inline namespace fmt::v5
This commit is contained in:
@@ -133,6 +133,15 @@
|
||||
# define FMT_DTOR_NOEXCEPT FMT_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if FMT_HAS_FEATURE(cxx_inline_namespaces) || FMT_MSC_VER >= 1900
|
||||
# define FMT_INLINE_NAMESPACE inline namespace
|
||||
# define FMT_END_NAMESPACE }}
|
||||
#else
|
||||
# define FMT_INLINE_NAMESPACE namespace
|
||||
# define FMT_END_NAMESPACE } using namespace v5; }
|
||||
#endif
|
||||
#define FMT_BEGIN_NAMESPACE namespace fmt { FMT_INLINE_NAMESPACE v5 {
|
||||
|
||||
#if !defined(FMT_HEADER_ONLY) && defined(_WIN32)
|
||||
# ifdef FMT_EXPORT
|
||||
# define FMT_API __declspec(dllexport)
|
||||
@@ -172,7 +181,7 @@
|
||||
# include <functional>
|
||||
#endif
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
// An implementation of declval for pre-C++11 compilers such as gcc 4.
|
||||
namespace internal {
|
||||
@@ -1190,7 +1199,7 @@ template <typename Char>
|
||||
struct is_contiguous<std::basic_string<Char>> : std::true_type {};
|
||||
|
||||
template <typename Char>
|
||||
struct is_contiguous<fmt::internal::basic_buffer<Char>> : std::true_type {};
|
||||
struct is_contiguous<internal::basic_buffer<Char>> : std::true_type {};
|
||||
|
||||
/** Formats a string and writes the output to ``out``. */
|
||||
template <typename Container>
|
||||
@@ -1288,6 +1297,6 @@ inline void print(wstring_view format_str, const Args & ... args) {
|
||||
format_arg_store<wformat_context, Args...> as(args...);
|
||||
vprint(format_str, as);
|
||||
}
|
||||
} // namespace fmt
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_CORE_H_
|
||||
|
||||
@@ -69,7 +69,7 @@ inline fmt::internal::null<> strerror_s(char *, std::size_t, ...) {
|
||||
return fmt::internal::null<>();
|
||||
}
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
FMT_FUNC format_error::~format_error() throw() {}
|
||||
FMT_FUNC system_error::~system_error() FMT_DTOR_NOEXCEPT {}
|
||||
@@ -522,7 +522,7 @@ FMT_FUNC void vprint_colored(color c, wstring_view format, wformat_args args) {
|
||||
|
||||
FMT_FUNC locale locale_provider::locale() { return fmt::locale(); }
|
||||
|
||||
} // namespace fmt
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED)
|
||||
# include <intrin.h> // _BitScanReverse, _BitScanReverse64
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
// Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning.
|
||||
# ifndef __clang__
|
||||
@@ -206,10 +206,10 @@ inline uint32_t clzll(uint64_t x) {
|
||||
}
|
||||
# define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n)
|
||||
}
|
||||
}
|
||||
FMT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
|
||||
// An equivalent of `*reinterpret_cast<Dest*>(&source)` that doesn't produce
|
||||
@@ -246,7 +246,7 @@ struct dummy_int {
|
||||
int data[2];
|
||||
operator int() const { return 0; }
|
||||
};
|
||||
typedef std::numeric_limits<fmt::internal::dummy_int> fputil;
|
||||
typedef std::numeric_limits<internal::dummy_int> fputil;
|
||||
|
||||
// Dummy implementations of system functions such as signbit and ecvt called
|
||||
// if the latter are not available.
|
||||
@@ -322,7 +322,7 @@ typename Allocator::value_type *allocate(Allocator& alloc, std::size_t n) {
|
||||
template <typename T>
|
||||
inline T const_check(T value) { return value; }
|
||||
} // namespace internal
|
||||
} // namespace fmt
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
// Standard permits specialization of std::numeric_limits. This specialization
|
||||
@@ -339,7 +339,7 @@ class numeric_limits<fmt::internal::dummy_int> :
|
||||
using namespace fmt::internal;
|
||||
// The resolution "priority" is:
|
||||
// isinf macro > std::isinf > ::isinf > fmt::internal::isinf
|
||||
if (const_check(sizeof(isinf(x)) != sizeof(fmt::internal::dummy_int)))
|
||||
if (const_check(sizeof(isinf(x)) != sizeof(dummy_int)))
|
||||
return isinf(x) != 0;
|
||||
return !_finite(static_cast<double>(x));
|
||||
}
|
||||
@@ -368,8 +368,7 @@ class numeric_limits<fmt::internal::dummy_int> :
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
namespace fmt {
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
template <typename Range>
|
||||
class basic_writer;
|
||||
|
||||
@@ -2328,7 +2327,7 @@ class system_error : public std::runtime_error {
|
||||
may look like "Unknown error -1" and is platform-dependent.
|
||||
\endrst
|
||||
*/
|
||||
FMT_API void format_system_error(fmt::internal::buffer &out, int error_code,
|
||||
FMT_API void format_system_error(internal::buffer &out, int error_code,
|
||||
fmt::string_view message) FMT_NOEXCEPT;
|
||||
|
||||
/**
|
||||
@@ -3527,10 +3526,8 @@ inline std::size_t formatted_size(string_view format_str,
|
||||
auto it = format_to(internal::counting_iterator<char>(), format_str, args...);
|
||||
return it.count();
|
||||
}
|
||||
} // namespace fmt
|
||||
|
||||
#if FMT_USE_USER_DEFINED_LITERALS
|
||||
namespace fmt {
|
||||
namespace internal {
|
||||
|
||||
# if FMT_UDL_TEMPLATE
|
||||
@@ -3611,8 +3608,8 @@ operator"" _a(const char *s, std::size_t) { return {s}; }
|
||||
inline internal::udl_arg<wchar_t>
|
||||
operator"" _a(const wchar_t *s, std::size_t) { return {s}; }
|
||||
} // inline namespace literals
|
||||
} // namespace fmt
|
||||
#endif // FMT_USE_USER_DEFINED_LITERALS
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#define FMT_STRING(s) [] { \
|
||||
struct S : fmt::format_string { \
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_LOCALE_H_
|
||||
#define FMT_LOCALE_H_
|
||||
|
||||
#include "format.h"
|
||||
#include <locale>
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
class locale {
|
||||
private:
|
||||
std::locale locale_;
|
||||
@@ -17,4 +20,6 @@ class locale {
|
||||
explicit locale(std::locale loc = std::locale()) : locale_(loc) {}
|
||||
std::locale get() { return locale_; }
|
||||
};
|
||||
}
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_LOCALE_
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
#include "format.h"
|
||||
#include <ostream>
|
||||
|
||||
namespace fmt {
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
|
||||
template <class Char>
|
||||
@@ -149,7 +148,6 @@ inline void print(std::wostream &os, wstring_view format_str,
|
||||
const Args & ... args) {
|
||||
vprint(os, format_str, make_format_args<wformat_context>(args...));
|
||||
}
|
||||
|
||||
} // namespace fmt
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_OSTREAM_H_
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
#define FMT_RETRY(result, expression) FMT_RETRY_VAL(result, expression, -1)
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
/**
|
||||
\rst
|
||||
@@ -388,7 +388,7 @@ class Locale {
|
||||
|
||||
Locale() : locale_(newlocale(LC_NUMERIC_MASK, "C", FMT_NULL)) {
|
||||
if (!locale_)
|
||||
FMT_THROW(fmt::system_error(errno, "cannot create locale"));
|
||||
FMT_THROW(system_error(errno, "cannot create locale"));
|
||||
}
|
||||
~Locale() { freelocale(locale_); }
|
||||
|
||||
@@ -404,7 +404,7 @@ class Locale {
|
||||
}
|
||||
};
|
||||
#endif // FMT_LOCALE
|
||||
} // namespace fmt
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#if !FMT_USE_RVALUE_REFERENCES
|
||||
namespace std {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "ostream.h"
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
|
||||
// Checks if a value fits in int - used to avoid warnings about comparing
|
||||
@@ -706,6 +706,6 @@ inline int fprintf(std::wostream &os, wstring_view format_str,
|
||||
typename printf_context<internal::buffer>::type>(args...);
|
||||
return vfprintf(os, format_str, vargs);
|
||||
}
|
||||
} // namespace fmt
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_PRINTF_H_
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "format.h"
|
||||
#include <ctime>
|
||||
|
||||
namespace fmt {
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
namespace internal{
|
||||
inline null<> localtime_r(...) { return null<>(); }
|
||||
@@ -146,6 +146,6 @@ struct formatter<std::tm, Char> {
|
||||
|
||||
basic_memory_buffer<Char> tm_format;
|
||||
};
|
||||
}
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_TIME_H_
|
||||
|
||||
Reference in New Issue
Block a user