44 #define FMT_VERSION 30002 47 # define FMT_SECURE_SCL _SECURE_SCL 49 # define FMT_SECURE_SCL 0 57 # define FMT_MSC_VER _MSC_VER 59 # define FMT_MSC_VER 0 62 #if FMT_MSC_VER && FMT_MSC_VER <= 1500 63 typedef unsigned __int32 uint32_t;
64 typedef unsigned __int64 uint64_t;
65 typedef __int64 intmax_t;
70 #if !defined(FMT_HEADER_ONLY) && defined(_WIN32) 72 # define FMT_API __declspec(dllexport) 73 # elif defined(FMT_SHARED) 74 # define FMT_API __declspec(dllimport) 82 # define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) 83 # define FMT_GCC_EXTENSION __extension__ 84 # if FMT_GCC_VERSION >= 406 85 # pragma GCC diagnostic push 88 # pragma GCC diagnostic ignored "-Wlong-long" 91 # pragma GCC diagnostic ignored "-Wshadow" 94 # pragma GCC diagnostic ignored "-Wsign-conversion" 96 # if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ 97 # define FMT_HAS_GXX_CXX11 1 100 # define FMT_GCC_EXTENSION 103 #if defined(__INTEL_COMPILER) 104 # define FMT_ICC_VERSION __INTEL_COMPILER 106 # define FMT_ICC_VERSION __ICL 109 #if defined(__clang__) && !defined(FMT_ICC_VERSION) 110 # pragma clang diagnostic push 111 # pragma clang diagnostic ignored "-Wdocumentation-unknown-command" 112 # pragma clang diagnostic ignored "-Wpadded" 115 #ifdef __GNUC_LIBSTD__ 116 # define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__) 120 # define FMT_HAS_FEATURE(x) __has_feature(x) 122 # define FMT_HAS_FEATURE(x) 0 126 # define FMT_HAS_BUILTIN(x) __has_builtin(x) 128 # define FMT_HAS_BUILTIN(x) 0 131 #ifdef __has_cpp_attribute 132 # define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) 134 # define FMT_HAS_CPP_ATTRIBUTE(x) 0 137 #ifndef FMT_USE_VARIADIC_TEMPLATES 141 # define FMT_USE_VARIADIC_TEMPLATES \ 142 (FMT_HAS_FEATURE(cxx_variadic_templates) || \ 143 (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800) 146 #ifndef FMT_USE_RVALUE_REFERENCES 149 # if defined(FMT_GNUC_LIBSTD_VERSION) && FMT_GNUC_LIBSTD_VERSION <= 402 150 # define FMT_USE_RVALUE_REFERENCES 0 152 # define FMT_USE_RVALUE_REFERENCES \ 153 (FMT_HAS_FEATURE(cxx_rvalue_references) || \ 154 (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1600) 159 #if defined(__GNUC__) && !defined(__EXCEPTIONS) 160 # define FMT_EXCEPTIONS 0 162 #if FMT_MSC_VER && !_HAS_EXCEPTIONS 163 # define FMT_EXCEPTIONS 0 165 #ifndef FMT_EXCEPTIONS 166 # define FMT_EXCEPTIONS 1 171 # define FMT_THROW(x) throw x 173 # define FMT_THROW(x) assert(false) 178 #ifndef FMT_USE_NOEXCEPT 179 # define FMT_USE_NOEXCEPT 0 182 #if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \ 183 (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ 185 # define FMT_DETECTED_NOEXCEPT noexcept 187 # define FMT_DETECTED_NOEXCEPT throw() 192 # define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT 194 # define FMT_NOEXCEPT 201 # define FMT_DTOR_NOEXCEPT FMT_DETECTED_NOEXCEPT 203 # define FMT_DTOR_NOEXCEPT FMT_NOEXCEPT 207 # if (defined(FMT_USE_OVERRIDE) && FMT_USE_OVERRIDE) || FMT_HAS_FEATURE(cxx_override) || \ 208 (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ 210 # define FMT_OVERRIDE override 212 # define FMT_OVERRIDE 217 # if FMT_HAS_FEATURE(cxx_nullptr) || \ 218 (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ 220 # define FMT_NULL nullptr 222 # define FMT_NULL NULL 228 #ifndef FMT_USE_DELETED_FUNCTIONS 229 # define FMT_USE_DELETED_FUNCTIONS 0 232 #if FMT_USE_DELETED_FUNCTIONS || FMT_HAS_FEATURE(cxx_deleted_functions) || \ 233 (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800 234 # define FMT_DELETED_OR_UNDEFINED = delete 235 # define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ 236 TypeName(const TypeName&) = delete; \ 237 TypeName& operator=(const TypeName&) = delete 239 # define FMT_DELETED_OR_UNDEFINED 240 # define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ 241 TypeName(const TypeName&); \ 242 TypeName& operator=(const TypeName&) 245 #ifndef FMT_USE_DEFAULTED_FUNCTIONS 246 # define FMT_USE_DEFAULTED_FUNCTIONS 0 249 #ifndef FMT_DEFAULTED_COPY_CTOR 250 # if FMT_USE_DEFAULTED_FUNCTIONS || FMT_HAS_FEATURE(cxx_defaulted_functions) || \ 251 (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800 252 # define FMT_DEFAULTED_COPY_CTOR(TypeName) \ 253 TypeName(const TypeName&) = default; 255 # define FMT_DEFAULTED_COPY_CTOR(TypeName) 259 #ifndef FMT_USE_USER_DEFINED_LITERALS 264 # define FMT_USE_USER_DEFINED_LITERALS \ 265 FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES && \ 266 (FMT_HAS_FEATURE(cxx_user_literals) || \ 267 (FMT_GCC_VERSION >= 407 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900) && \ 268 (!defined(FMT_ICC_VERSION) || FMT_ICC_VERSION >= 1500) 271 #ifndef FMT_USE_EXTERN_TEMPLATES 275 # define FMT_USE_EXTERN_TEMPLATES \ 276 ((__clang__ && FMT_USE_VARIADIC_TEMPLATES) || \ 277 (FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11)) 282 #define FMT_HAS_DECLTYPE_INCOMPLETE_RETURN_TYPES \ 283 (FMT_HAS_FEATURE(cxx_decltype_incomplete_return_types) || \ 284 (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ 285 FMT_MSC_VER >= 1900 || \ 286 FMT_ICC_VERSION >= 1200) 288 #ifdef FMT_HEADER_ONLY 290 # undef FMT_USE_EXTERN_TEMPLATES 291 # define FMT_USE_EXTERN_TEMPLATES 0 295 # define FMT_ASSERT(condition, message) assert((condition) && message) 298 #if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz) 299 # define FMT_BUILTIN_CLZ(n) __builtin_clz(n) 302 #if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll) 303 # define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) 310 #if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED) 315 # pragma intrinsic(_BitScanReverse) 316 inline uint32_t clz(uint32_t x) {
318 _BitScanReverse(&r, x);
324 # pragma warning(suppress: 6102) 327 # define FMT_BUILTIN_CLZ(n) fmt::internal::clz(n) 330 # pragma intrinsic(_BitScanReverse64) 333 inline uint32_t clzll(uint64_t x) {
336 _BitScanReverse64(&r, x);
339 if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32)))
340 return 63 - (r + 32);
343 _BitScanReverse(&r, static_cast<uint32_t>(x));
350 # pragma warning(suppress: 6102) 353 # define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n) 362 operator int()
const {
return 0; }
377 template <
typename T>
388 class numeric_limits<
fmt::internal::DummyInt> :
389 public std::numeric_limits<int> {
392 template <
typename T>
398 sizeof(
isinf(x)) ==
sizeof(
int))) {
399 return isinf(x) != 0;
401 return !
_finite(static_cast<double>(x));
405 template <
typename T>
409 sizeof(
isnan(x)) ==
sizeof(
int))) {
410 return isnan(x) != 0;
412 return _isnan(static_cast<double>(x)) != 0;
419 sizeof(
signbit(x)) ==
sizeof(
int))) {
422 if (x < 0)
return true;
423 if (!isnotanumber(x))
return false;
424 int dec = 0, sign = 0;
426 _ecvt_s(buffer,
sizeof(buffer), x, 0, &dec, &sign);
439 #if FMT_USE_RVALUE_REFERENCES 443 template <
typename Char>
449 template <
typename Char>
454 template <
typename Impl,
typename Char,
typename Spec = fmt::FormatSpec>
457 template <
typename CharType,
486 template <
typename Char>
503 : data_(
s), size_(
std::char_traits<Char>::length(
s)) {}
510 template <
typename Allocator>
512 const std::basic_string<Char, std::char_traits<Char>, Allocator> &
s)
513 : data_(
s.c_str()), size_(
s.size()) {}
521 return std::basic_string<Char>(data_, size_);
525 const Char *
data()
const {
return data_; }
528 std::size_t
size()
const {
return size_; }
532 std::size_t size = size_ < other.
size_ ? size_ : other.
size_;
533 int result = std::char_traits<Char>::compare(data_, other.
data_, size);
535 result = size_ == other.
size_ ? 0 : (size_ < other.
size_ ? -1 : 1);
587 template <
typename Char>
601 template <
typename Allocator>
603 const std::basic_string<Char, std::char_traits<Char>, Allocator> &
s)
604 : data_(
s.c_str()) {}
607 const Char *
c_str()
const {
return data_; }
617 :
std::runtime_error(message.c_str()) {}
625 template <
typename T>
628 #define FMT_SPECIALIZE_MAKE_UNSIGNED(T, U) \ 630 struct MakeUnsigned<T> { typedef U Type; } 640 template <
typename Int>
652 template <
typename T>
653 inline stdext::checked_array_iterator<T*>
make_ptr(
T *ptr, std::size_t size) {
654 return stdext::checked_array_iterator<T*>(ptr, size);
657 template <
typename T>
667 template <
typename T>
678 : ptr_(ptr), size_(0), capacity_(capacity) {}
686 virtual void grow(std::size_t size) = 0;
692 std::size_t
size()
const {
return size_; }
701 if (new_size > capacity_)
712 if (capacity > capacity_)
719 if (size_ == capacity_)
721 ptr_[size_++] = value;
725 template <
typename U>
726 void append(
const U *begin,
const U *end);
729 const T &
operator[](std::size_t index)
const {
return ptr_[index]; }
732 template <
typename T>
733 template <
typename U>
736 if (new_size > capacity_)
738 std::uninitialized_copy(begin, end,
747 template <
typename T, std::
size_t SIZE,
typename Allocator = std::allocator<T> >
754 if (this->ptr_ != data_) Allocator::deallocate(this->ptr_, this->capacity_);
762 : Allocator(alloc),
Buffer<
T>(data_, SIZE) {}
765 #if FMT_USE_RVALUE_REFERENCES 769 Allocator &this_alloc = *
this, &other_alloc = other;
770 this_alloc = std::move(other_alloc);
771 this->size_ = other.
size_;
775 std::uninitialized_copy(other.
data_, other.
data_ + this->size_,
778 this->ptr_ = other.
ptr_;
791 assert(
this != &other);
802 template <
typename T, std::
size_t SIZE,
typename Allocator>
804 std::size_t new_capacity = this->capacity_ + this->capacity_ / 2;
805 if (size > new_capacity)
807 T *new_ptr = this->allocate(new_capacity,
FMT_NULL);
809 std::uninitialized_copy(this->ptr_, this->ptr_ + this->size_,
811 std::size_t old_capacity = this->capacity_;
812 T *old_ptr = this->ptr_;
813 this->capacity_ = new_capacity;
814 this->ptr_ = new_ptr;
818 if (old_ptr != data_)
819 Allocator::deallocate(old_ptr, old_capacity);
823 template <
typename Char>
832 template <
typename Char>
836 typedef stdext::checked_array_iterator<Char*>
CharPtr;
840 static Char
cast(
int value) {
return static_cast<Char
>(value); }
843 template <
typename Char>
853 static char convert(
char value) {
return value; }
856 template <
typename T>
857 FMT_API static int format_float(
char *buffer, std::size_t size,
858 const char *
format,
unsigned width,
int precision,
T value);
861 #if FMT_USE_EXTERN_TEMPLATES 863 (
char *buffer, std::size_t size,
864 const char*
format,
unsigned width,
int precision,
double value);
866 (
char *buffer, std::size_t size,
867 const char*
format,
unsigned width,
int precision,
long double value);
873 static wchar_t convert(
char value) {
return value; }
874 static wchar_t convert(
wchar_t value) {
return value; }
876 template <
typename T>
877 FMT_API static int format_float(
wchar_t *buffer, std::size_t size,
878 const wchar_t *
format,
unsigned width,
int precision,
T value);
881 #if FMT_USE_EXTERN_TEMPLATES 883 (
wchar_t *buffer, std::size_t size,
884 const wchar_t*
format,
unsigned width,
int precision,
double value);
886 (
wchar_t *buffer, std::size_t size,
887 const wchar_t*
format,
unsigned width,
int precision,
long double value);
891 template <
bool IsSigned>
893 template <
typename T>
899 template <
typename T>
905 template <
typename T>
911 template <
bool FitsIn32Bits>
917 template <
typename T>
929 template <
typename T =
void>
931 static const uint32_t POWERS_OF_10_32[];
932 static const uint64_t POWERS_OF_10_64[];
933 static const char DIGITS[];
936 #if FMT_USE_EXTERN_TEMPLATES 942 #ifdef FMT_BUILTIN_CLZLL 948 int t = (64 - FMT_BUILTIN_CLZLL(n | 1)) * 1233 >> 12;
949 return to_unsigned(t) - (n < Data::POWERS_OF_10_64[t]) + 1;
959 if (n < 10)
return count;
960 if (n < 100)
return count + 1;
961 if (n < 1000)
return count + 2;
962 if (n < 10000)
return count + 3;
969 #ifdef FMT_BUILTIN_CLZ 972 int t = (32 - FMT_BUILTIN_CLZ(n | 1)) * 1233 >> 12;
973 return to_unsigned(t) - (n < Data::POWERS_OF_10_32[t]) + 1;
979 template <
typename Char>
994 template <
typename Char>
996 if (++digit_index_ % 3 != 0)
998 buffer -= sep_.
size();
999 std::uninitialized_copy(sep_.
data(), sep_.
data() + sep_.
size(),
1007 template <
typename UInt,
typename Char,
typename ThousandsSep>
1010 buffer += num_digits;
1011 while (value >= 100) {
1015 unsigned index =
static_cast<unsigned>((value % 100) * 2);
1017 *--buffer = Data::DIGITS[index + 1];
1019 *--buffer = Data::DIGITS[index];
1023 *--buffer =
static_cast<char>(
'0' + value);
1026 unsigned index =
static_cast<unsigned>(value * 2);
1027 *--buffer = Data::DIGITS[index + 1];
1029 *--buffer = Data::DIGITS[index];
1032 template <
typename UInt,
typename Char>
1039 # define FMT_USE_WINDOWS_H 0 1040 #elif !defined(FMT_USE_WINDOWS_H) 1041 # define FMT_USE_WINDOWS_H 1 1046 #if FMT_USE_WINDOWS_H 1056 size_t size()
const {
return buffer_.
size() - 1; }
1057 const wchar_t *c_str()
const {
return &buffer_[0]; }
1058 std::wstring str()
const {
return std::wstring(&buffer_[0], size()); }
1071 size_t size()
const {
return buffer_.
size() - 1; }
1072 const char *c_str()
const {
return &buffer_[0]; }
1073 std::string str()
const {
return std::string(&buffer_[0], size()); }
1087 template <
typename Char>
1094 void *formatter,
const void *
arg,
void *format_str_ptr);
1119 INT, UINT, LONG_LONG,
ULONG_LONG, BOOL, CHAR, LAST_INTEGER_TYPE = CHAR,
1132 template <
typename Char>
1134 template <
typename Char,
typename T>
1137 template <
typename T =
void>
1142 template <
typename T,
typename Char>
1148 template <
typename T>
1157 template <
typename T>
1164 template<
typename T,
bool ENABLE_CONVERSION>
1166 enum { value = ENABLE_CONVERSION };
1169 template<
typename T,
bool ENABLE_CONVERSION>
1171 enum { value =
false };
1174 template<
typename T>
1182 template<
typename T>
1190 #define FMT_DISABLE_CONVERSION_TO_INT(Type) \ 1192 struct ConvertToInt<Type> { enum { value = 0 }; } 1199 template<
bool B,
class T =
void>
1205 template<
bool B,
class T,
class F>
1208 template<
class T,
class F>
1213 struct Not {
enum { value = 0 }; };
1218 template <
typename T>
1228 template <
typename LConv>
1231 return lc->thousands_sep;
1236 #define FMT_CONCAT(a, b) a##b 1238 #if FMT_GCC_VERSION >= 303 1239 # define FMT_UNUSED __attribute__((unused)) 1244 #ifndef FMT_USE_STATIC_ASSERT 1245 # define FMT_USE_STATIC_ASSERT 0 1248 #if FMT_USE_STATIC_ASSERT || FMT_HAS_FEATURE(cxx_static_assert) || \ 1249 (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1600 1250 # define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message) 1252 # define FMT_CONCAT_(a, b) FMT_CONCAT(a, b) 1253 # define FMT_STATIC_ASSERT(cond, message) \ 1254 typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED 1257 template <
typename Formatter,
typename Char,
typename T>
1260 "Cannot format argument. To enable the use of ostream " 1261 "operator<< include fmt/ostream.h. Otherwise provide " 1262 "an overload of format_arg.");
1266 template <
typename Formatter>
1269 typedef typename Formatter::Char
Char;
1277 template <
typename T>
1279 template <
typename T>
1286 #if !FMT_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED) 1295 string.value = str.
data();
1296 string.size = str.
size();
1300 wstring.value = str.
data();
1301 wstring.size = str.
size();
1305 template <
typename T>
1307 void *formatter,
const void *
arg,
void *format_str_ptr) {
1308 format_arg(*static_cast<Formatter*>(formatter),
1309 *static_cast<const Char**>(format_str_ptr),
1310 *static_cast<const T*>(
arg));
1316 #define FMT_MAKE_VALUE_(Type, field, TYPE, rhs) \ 1317 MakeValue(Type value) { field = rhs; } \ 1318 static uint64_t type(Type) { return Arg::TYPE; } 1320 #define FMT_MAKE_VALUE(Type, field, TYPE) \ 1321 FMT_MAKE_VALUE_(Type, field, TYPE, value) 1333 int_value =
static_cast<int>(value);
1335 long_long_value = value;
1338 return sizeof(long) ==
sizeof(
int) ? Arg::INT : Arg::LONG_LONG;
1342 if (
const_check(
sizeof(
unsigned long) ==
sizeof(
unsigned)))
1343 uint_value =
static_cast<unsigned>(value);
1345 ulong_long_value = value;
1347 static uint64_t
type(
unsigned long) {
1348 return sizeof(
unsigned long) ==
sizeof(
unsigned) ?
1349 Arg::UINT : Arg::ULONG_LONG;
1361 #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) 1365 static uint64_t
type(
wchar_t) {
return Arg::CHAR; }
1368 #define FMT_MAKE_STR_VALUE(Type, TYPE) \ 1369 MakeValue(Type value) { set_string(value); } \ 1370 static uint64_t type(Type) { return Arg::TYPE; } 1384 set_string(value); \
1386 static uint64_t
type(Type) {
return Arg::TYPE; }
1396 template <
typename T>
1400 custom.value = &value;
1401 custom.format = &format_custom_arg<T>;
1404 template <
typename T>
1410 template <
typename T>
1417 template <
typename Char_>
1419 template <
typename Char_,
typename T>
1422 template <
typename Char_>
1424 template <
typename Char_,
typename T>
1428 template <
typename Formatter>
1435 template <
typename T>
1442 template <
typename Char>
1446 template <
typename T>
1451 template <
typename Char,
typename T>
1454 :
NamedArg<Char>(argname, value) {}
1464 template <typename Char>
1485 return type(types_, index);
1488 template <
typename Char>
1493 enum { MAX_PACKED_ARGS = 16 };
1498 : types_(types), values_(values) {}
1500 : types_(types), args_(args) {}
1502 uint64_t
types()
const {
return types_; }
1508 bool use_values =
type(MAX_PACKED_ARGS - 1) == Arg::NONE;
1509 if (index < MAX_PACKED_ARGS) {
1510 Arg::Type arg_type =
type(index);
1512 if (arg_type != Arg::NONE)
1513 val = use_values ? values_[index] : args_[index];
1514 arg.type = arg_type;
1520 arg.type = Arg::NONE;
1523 for (
unsigned i = MAX_PACKED_ARGS; i <= index; ++i) {
1524 if (args_[i].
type == Arg::NONE)
1527 return args_[index];
1531 unsigned shift = index * 4;
1532 uint64_t mask = 0xf;
1534 (types & (mask << shift)) >> shift);
1538 #define FMT_DISPATCH(call) static_cast<Impl*>(this)->call 1564 template <
typename Impl,
typename Result>
1608 template <
typename T>
1624 template <
typename T>
1665 case Arg::NAMED_ARG:
1672 case Arg::LONG_LONG:
1674 case Arg::ULONG_LONG:
1682 case Arg::LONG_DOUBLE:
1713 template <
char TYPE>
1718 bool flag(
unsigned)
const {
return false; }
1731 WidthSpec(
unsigned width,
wchar_t fill) : width_(width), fill_(fill) {}
1733 unsigned width()
const {
return width_; }
1734 wchar_t fill()
const {
return fill_; }
1742 :
WidthSpec(width, fill), align_(align) {}
1750 template <
char TYPE>
1754 bool flag(
unsigned)
const {
return false; }
1766 unsigned width = 0,
char type = 0,
wchar_t fill =
' ')
1767 :
AlignSpec(width, fill), flags_(0), precision_(-1), type_(
type) {}
1769 bool flag(
unsigned f)
const {
return (flags_ & f) != 0; }
1771 char type()
const {
return type_; }
1776 template <
typename T,
typename SpecT = TypeSpec<0>,
typename Char =
char>
1783 : SpecT(spec), value_(val) {}
1789 template <
typename Char>
1795 template <
typename FillChar>
1801 const Char *
str()
const {
return str_; }
1807 IntFormatSpec<int, TypeSpec<'b'> >
bin(
int value);
1812 IntFormatSpec<int, TypeSpec<'o'> >
oct(
int value);
1818 IntFormatSpec<int, TypeSpec<'x'> >
hex(
int value);
1824 IntFormatSpec<int, TypeSpec<'X'> >
hexu(
int value);
1840 template <
char TYPE_CODE,
typename Char>
1841 IntFormatSpec<int, AlignTypeSpec<TYPE_CODE>, Char>
pad(
1842 int value,
unsigned width, Char fill =
' ');
1844 #define FMT_DEFINE_INT_FORMATTERS(TYPE) \ 1845 inline IntFormatSpec<TYPE, TypeSpec<'b'> > bin(TYPE value) { \ 1846 return IntFormatSpec<TYPE, TypeSpec<'b'> >(value, TypeSpec<'b'>()); \ 1849 inline IntFormatSpec<TYPE, TypeSpec<'o'> > oct(TYPE value) { \ 1850 return IntFormatSpec<TYPE, TypeSpec<'o'> >(value, TypeSpec<'o'>()); \ 1853 inline IntFormatSpec<TYPE, TypeSpec<'x'> > hex(TYPE value) { \ 1854 return IntFormatSpec<TYPE, TypeSpec<'x'> >(value, TypeSpec<'x'>()); \ 1857 inline IntFormatSpec<TYPE, TypeSpec<'X'> > hexu(TYPE value) { \ 1858 return IntFormatSpec<TYPE, TypeSpec<'X'> >(value, TypeSpec<'X'>()); \ 1861 template <char TYPE_CODE> \ 1862 inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE> > pad( \ 1863 IntFormatSpec<TYPE, TypeSpec<TYPE_CODE> > f, unsigned width) { \ 1864 return IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE> >( \ 1865 f.value(), AlignTypeSpec<TYPE_CODE>(width, ' ')); \ 1872 template <char TYPE_CODE, typename Char> \ 1873 inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>, Char> pad( \ 1874 IntFormatSpec<TYPE, TypeSpec<TYPE_CODE>, Char> f, \ 1875 unsigned width, Char fill) { \ 1876 return IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>, Char>( \ 1877 f.value(), AlignTypeSpec<TYPE_CODE>(width, fill)); \ 1880 inline IntFormatSpec<TYPE, AlignTypeSpec<0> > pad( \ 1881 TYPE value, unsigned width) { \ 1882 return IntFormatSpec<TYPE, AlignTypeSpec<0> >( \ 1883 value, AlignTypeSpec<0>(width, ' ')); \ 1886 template <typename Char> \ 1887 inline IntFormatSpec<TYPE, AlignTypeSpec<0>, Char> pad( \ 1888 TYPE value, unsigned width, Char fill) { \ 1889 return IntFormatSpec<TYPE, AlignTypeSpec<0>, Char>( \ 1890 value, AlignTypeSpec<0>(width, fill)); \ 1912 template <
typename Char>
1914 const Char *str,
unsigned width, Char fill =
' ') {
1919 const wchar_t *str,
unsigned width,
char fill =
' ') {
1923 namespace internal {
1925 template <
typename Char>
1928 typedef std::vector<
1930 typedef typename MapType::value_type
Pair;
1939 for (
typename MapType::const_iterator it = map_.begin(), end = map_.end();
1941 if (it->first ==
name)
1948 template <
typename Impl,
typename Char,
typename Spec = fmt::FormatSpec>
1959 writer_.
write_int(reinterpret_cast<uintptr_t>(p), spec_);
1967 const char *str_value = value ?
"true" :
"false";
1981 : writer_(w), spec_(
s) {}
1983 template <
typename T>
1986 template <
typename T>
1991 visit_any_int(value);
1998 if (spec_.type_ && spec_.type_ !=
'c') {
2007 CharPtr out = CharPtr();
2008 const unsigned CHAR_SIZE = 1;
2009 if (spec_.width_ > CHAR_SIZE) {
2012 std::uninitialized_fill_n(out, spec_.width_ - CHAR_SIZE, fill);
2013 out += spec_.width_ - CHAR_SIZE;
2018 std::uninitialized_fill_n(out + CHAR_SIZE,
2019 spec_.width_ - CHAR_SIZE, fill);
2028 if (spec_.type_ ==
'p')
2029 return write_pointer(value);
2045 if (spec_.type_ && spec_.type_ !=
'p')
2047 write_pointer(value);
2057 FMT_API Arg do_get_arg(
unsigned arg_index,
const char *&error);
2064 next_arg_index_ = 0;
2069 if (next_arg_index_ >= 0)
2071 error =
"cannot switch from manual to automatic argument indexing";
2078 return check_no_auto_index(error) ? do_get_arg(arg_index, error) :
Arg();
2082 if (next_arg_index_ > 0) {
2083 error =
"cannot switch from automatic to manual argument indexing";
2086 next_arg_index_ = -1;
2090 template <
typename Char>
2115 template <
typename Impl,
typename Char,
typename Spec = fmt::FormatSpec>
2131 Spec &spec,
const Char *
fmt)
2133 formatter_(formatter), format_(
fmt) {}
2142 template <
typename Char>
2143 class ArgFormatter :
2144 public BasicArgFormatter<ArgFormatter<Char>, Char, FormatSpec> {
2154 template <
typename CharType,
typename ArgFormatter>
2155 class BasicFormatter :
private internal::FormatterBase {
2201 # define FMT_GEN(n, f) FMT_GEN##n(f) 2202 # define FMT_GEN1(f) f(0) 2203 # define FMT_GEN2(f) FMT_GEN1(f), f(1) 2204 # define FMT_GEN3(f) FMT_GEN2(f), f(2) 2205 # define FMT_GEN4(f) FMT_GEN3(f), f(3) 2206 # define FMT_GEN5(f) FMT_GEN4(f), f(4) 2207 # define FMT_GEN6(f) FMT_GEN5(f), f(5) 2208 # define FMT_GEN7(f) FMT_GEN6(f), f(6) 2209 # define FMT_GEN8(f) FMT_GEN7(f), f(7) 2210 # define FMT_GEN9(f) FMT_GEN8(f), f(8) 2211 # define FMT_GEN10(f) FMT_GEN9(f), f(9) 2212 # define FMT_GEN11(f) FMT_GEN10(f), f(10) 2213 # define FMT_GEN12(f) FMT_GEN11(f), f(11) 2214 # define FMT_GEN13(f) FMT_GEN12(f), f(12) 2215 # define FMT_GEN14(f) FMT_GEN13(f), f(13) 2216 # define FMT_GEN15(f) FMT_GEN14(f), f(14) 2218 namespace internal {
2221 template <
typename T>
2226 template <
unsigned N,
bool= (N < ArgList::MAX_PACKED_ARGS)>
2229 template <
unsigned N>
2233 template <
typename Formatter,
typename T>
2247 template <
unsigned N>
2251 template <
typename Formatter,
typename T>
2255 #if FMT_USE_VARIADIC_TEMPLATES 2256 template <
typename Arg,
typename... Args>
2257 inline uint64_t
make_type(
const Arg &first,
const Args & ... tail) {
2268 template <
typename T>
2272 # define FMT_ARG_TYPE_DEFAULT(n) ArgType t##n = ArgType() 2275 return t0.type | (
t1.type << 4) | (
t2.type << 8) | (
t3.type << 12) |
2276 (t4.type << 16) | (t5.type << 20) | (t6.type << 24) | (t7.type << 28) |
2277 (t8.type << 32) | (t9.type << 36) | (t10.type << 40) | (t11.type << 44) |
2278 (t12.type << 48) | (t13.type << 52) | (t14.type << 56);
2283 # define FMT_MAKE_TEMPLATE_ARG(n) typename T##n 2284 # define FMT_MAKE_ARG_TYPE(n) T##n 2285 # define FMT_MAKE_ARG(n) const T##n &v##n 2286 # define FMT_ASSIGN_char(n) \ 2287 arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter<char> >(v##n) 2288 # define FMT_ASSIGN_wchar_t(n) \ 2289 arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter<wchar_t> >(v##n) 2291 #if FMT_USE_VARIADIC_TEMPLATES 2293 # define FMT_VARIADIC_VOID(func, arg_type) \ 2294 template <typename... Args> \ 2295 void func(arg_type arg0, const Args & ... args) { \ 2296 typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \ 2297 typename ArgArray::Type array{ \ 2298 ArgArray::template make<fmt::BasicFormatter<Char> >(args)...}; \ 2299 func(arg0, fmt::ArgList(fmt::internal::make_type(args...), array)); \ 2303 # define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ 2304 template <typename... Args> \ 2305 ctor(arg0_type arg0, arg1_type arg1, const Args & ... args) { \ 2306 typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \ 2307 typename ArgArray::Type array{ \ 2308 ArgArray::template make<fmt::BasicFormatter<Char> >(args)...}; \ 2309 func(arg0, arg1, fmt::ArgList(fmt::internal::make_type(args...), array)); \ 2314 # define FMT_MAKE_REF(n) \ 2315 fmt::internal::MakeValue< fmt::BasicFormatter<Char> >(v##n) 2316 # define FMT_MAKE_REF2(n) v##n 2320 # define FMT_WRAP1(func, arg_type, n) \ 2321 template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \ 2322 inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ 2323 const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ 2324 func(arg1, fmt::ArgList( \ 2325 fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ 2329 # define FMT_VARIADIC_VOID(func, arg_type) \ 2330 inline void func(arg_type arg) { func(arg, fmt::ArgList()); } \ 2331 FMT_WRAP1(func, arg_type, 1) FMT_WRAP1(func, arg_type, 2) \ 2332 FMT_WRAP1(func, arg_type, 3) FMT_WRAP1(func, arg_type, 4) \ 2333 FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) \ 2334 FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) \ 2335 FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10) 2337 # define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \ 2338 template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \ 2339 ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \ 2340 const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ 2341 func(arg0, arg1, fmt::ArgList( \ 2342 fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ 2346 # define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ 2347 FMT_CTOR(ctor, func, arg0_type, arg1_type, 1) \ 2348 FMT_CTOR(ctor, func, arg0_type, arg1_type, 2) \ 2349 FMT_CTOR(ctor, func, arg0_type, arg1_type, 3) \ 2350 FMT_CTOR(ctor, func, arg0_type, arg1_type, 4) \ 2351 FMT_CTOR(ctor, func, arg0_type, arg1_type, 5) \ 2352 FMT_CTOR(ctor, func, arg0_type, arg1_type, 6) \ 2353 FMT_CTOR(ctor, func, arg0_type, arg1_type, 7) \ 2354 FMT_CTOR(ctor, func, arg0_type, arg1_type, 8) \ 2355 FMT_CTOR(ctor, func, arg0_type, arg1_type, 9) \ 2356 FMT_CTOR(ctor, func, arg0_type, arg1_type, 10) 2361 #define FMT_FOR_EACH1(f, x0) f(x0, 0) 2362 #define FMT_FOR_EACH2(f, x0, x1) \ 2363 FMT_FOR_EACH1(f, x0), f(x1, 1) 2364 #define FMT_FOR_EACH3(f, x0, x1, x2) \ 2365 FMT_FOR_EACH2(f, x0 ,x1), f(x2, 2) 2366 #define FMT_FOR_EACH4(f, x0, x1, x2, x3) \ 2367 FMT_FOR_EACH3(f, x0, x1, x2), f(x3, 3) 2368 #define FMT_FOR_EACH5(f, x0, x1, x2, x3, x4) \ 2369 FMT_FOR_EACH4(f, x0, x1, x2, x3), f(x4, 4) 2370 #define FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5) \ 2371 FMT_FOR_EACH5(f, x0, x1, x2, x3, x4), f(x5, 5) 2372 #define FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6) \ 2373 FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5), f(x6, 6) 2374 #define FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7) \ 2375 FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6), f(x7, 7) 2376 #define FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8) \ 2377 FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7), f(x8, 8) 2378 #define FMT_FOR_EACH10(f, x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) \ 2379 FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8), f(x9, 9) 2416 init(error_code, message,
ArgList());
2423 int error_code()
const {
return error_code_; }
2463 template <
typename Char>
2475 static Char *
get(
CharPtr p) {
return p.base(); }
2477 static Char *
get(Char *p) {
return p; }
2482 static CharPtr fill_padding(CharPtr buffer,
2483 unsigned total_size, std::size_t content_size,
wchar_t fill);
2488 std::size_t size = buffer_.
size();
2489 buffer_.
resize(size + n);
2494 template <
typename UInt>
2497 Char *ptr =
get(grow_buffer(prefix_size + num_digits));
2503 template <
typename Int>
2506 MainType abs_value =
static_cast<MainType
>(value);
2508 abs_value = 0 - abs_value;
2509 *write_unsigned_decimal(abs_value, 1) =
'-';
2511 write_unsigned_decimal(abs_value, 0);
2517 const EmptySpec &,
const char *prefix,
unsigned prefix_size) {
2518 unsigned size = prefix_size + num_digits;
2519 CharPtr p = grow_buffer(size);
2520 std::uninitialized_copy(prefix, prefix + prefix_size, p);
2521 return p + size - 1;
2524 template <
typename Spec>
2525 CharPtr prepare_int_buffer(
unsigned num_digits,
2526 const Spec &spec,
const char *prefix,
unsigned prefix_size);
2529 template <
typename T,
typename Spec>
2530 void write_int(
T value, Spec spec);
2533 template <
typename T,
typename Spec>
2534 void write_double(
T value,
const Spec &spec);
2537 template <
typename StrChar>
2538 CharPtr write_str(
const StrChar *
s, std::size_t size,
const AlignSpec &spec);
2540 template <
typename StrChar,
typename Spec>
2548 void operator<<(typename internal::WCharHelper<wchar_t, Char>::Unsupported);
2555 *format_ptr++ =
'L';
2558 template<
typename T>
2561 template <
typename Impl,
typename Char_,
typename Spec_>
2564 template <
typename Impl,
typename Char_,
typename Spec_>
2597 std::size_t size = buffer_.
size();
2599 buffer_[size] =
'\0';
2608 std::basic_string<Char>
str()
const {
2609 return std::basic_string<Char>(&buffer_[0], buffer_.
size());
2643 write_decimal(value);
2647 return *this << IntFormatSpec<unsigned>(value);
2650 write_decimal(value);
2654 return *this << IntFormatSpec<unsigned long>(value);
2657 write_decimal(value);
2667 return *this << IntFormatSpec<ULongLong>(value);
2706 const Char *str = value.data();
2707 buffer_.
append(str, str + value.size());
2713 const char *str = value.data();
2714 buffer_.
append(str, str + value.size());
2718 template <
typename T,
typename Spec,
typename FillChar>
2721 write_int(spec.value(), spec);
2725 template <
typename StrChar>
2727 const StrChar *
s = spec.str();
2728 write_str(
s, std::char_traits<Char>::length(
s), spec);
2737 template <
typename Char>
2738 template <
typename StrChar>
2740 const StrChar *
s, std::size_t size,
const AlignSpec &spec) {
2742 if (spec.
width() > size) {
2743 out = grow_buffer(spec.
width());
2746 std::uninitialized_fill_n(out, spec.
width() - size, fill);
2747 out += spec.
width() - size;
2749 out = fill_padding(out, spec.
width(), size, fill);
2751 std::uninitialized_fill_n(out + size, spec.
width() - size, fill);
2754 out = grow_buffer(size);
2756 std::uninitialized_copy(
s,
s + size, out);
2760 template <
typename Char>
2761 template <
typename StrChar,
typename Spec>
2766 if (spec.type_ && spec.type_ !=
's')
2768 const StrChar *str_value =
s.value;
2769 std::size_t str_size =
s.size;
2770 if (str_size == 0) {
2775 std::size_t precision =
static_cast<std::size_t
>(spec.precision_);
2776 if (spec.precision_ >= 0 && precision < str_size)
2777 str_size = precision;
2778 write_str(str_value, str_size, spec);
2781 template <
typename Char>
2784 CharPtr buffer,
unsigned total_size,
2785 std::size_t content_size,
wchar_t fill) {
2786 std::size_t
padding = total_size - content_size;
2787 std::size_t left_padding =
padding / 2;
2789 std::uninitialized_fill_n(buffer, left_padding, fill_char);
2790 buffer += left_padding;
2792 std::uninitialized_fill_n(buffer + content_size,
2793 padding - left_padding, fill_char);
2797 template <
typename Char>
2798 template <
typename Spec>
2801 unsigned num_digits,
const Spec &spec,
2802 const char *prefix,
unsigned prefix_size) {
2803 unsigned width = spec.width();
2806 if (spec.precision() >
static_cast<int>(num_digits)) {
2809 if (prefix_size > 0 && prefix[prefix_size - 1] ==
'0')
2811 unsigned number_size =
2814 if (number_size >= width)
2815 return prepare_int_buffer(num_digits, subspec, prefix, prefix_size);
2817 unsigned fill_size = width - number_size;
2819 CharPtr p = grow_buffer(fill_size);
2820 std::uninitialized_fill(p, p + fill_size, fill);
2822 CharPtr result = prepare_int_buffer(
2823 num_digits, subspec, prefix, prefix_size);
2825 CharPtr p = grow_buffer(fill_size);
2826 std::uninitialized_fill(p, p + fill_size, fill);
2830 unsigned size = prefix_size + num_digits;
2831 if (width <= size) {
2832 CharPtr p = grow_buffer(size);
2833 std::uninitialized_copy(prefix, prefix + prefix_size, p);
2834 return p + size - 1;
2836 CharPtr p = grow_buffer(width);
2839 std::uninitialized_copy(prefix, prefix + prefix_size, p);
2841 std::uninitialized_fill(p, end, fill);
2843 p = fill_padding(p, width, size, fill);
2844 std::uninitialized_copy(prefix, prefix + prefix_size, p);
2848 if (prefix_size != 0) {
2849 p = std::uninitialized_copy(prefix, prefix + prefix_size, p);
2850 size -= prefix_size;
2853 std::uninitialized_copy(prefix, prefix + prefix_size, end - size);
2855 std::uninitialized_fill(p, end - size, fill);
2861 template <
typename Char>
2862 template <
typename T,
typename Spec>
2864 unsigned prefix_size = 0;
2866 UnsignedType abs_value =
static_cast<UnsignedType
>(value);
2867 char prefix[4] =
"";
2871 abs_value = 0 - abs_value;
2873 prefix[0] = spec.flag(
PLUS_FLAG) ?
'+' :
' ';
2876 switch (spec.type()) {
2879 CharPtr p = prepare_int_buffer(num_digits, spec, prefix, prefix_size) + 1;
2883 case 'x':
case 'X': {
2884 UnsignedType n = abs_value;
2886 prefix[prefix_size++] =
'0';
2887 prefix[prefix_size++] = spec.type_prefix();
2889 unsigned num_digits = 0;
2892 }
while ((n >>= 4) != 0);
2893 Char *p =
get(prepare_int_buffer(
2894 num_digits, spec, prefix, prefix_size));
2896 const char *digits = spec.type() ==
'x' ?
2897 "0123456789abcdef" :
"0123456789ABCDEF";
2899 *p-- = digits[n & 0xf];
2900 }
while ((n >>= 4) != 0);
2903 case 'b':
case 'B': {
2904 UnsignedType n = abs_value;
2906 prefix[prefix_size++] =
'0';
2907 prefix[prefix_size++] = spec.type_prefix();
2909 unsigned num_digits = 0;
2912 }
while ((n >>= 1) != 0);
2913 Char *p =
get(prepare_int_buffer(num_digits, spec, prefix, prefix_size));
2916 *p-- =
static_cast<Char
>(
'0' + (n & 1));
2917 }
while ((n >>= 1) != 0);
2921 UnsignedType n = abs_value;
2923 prefix[prefix_size++] =
'0';
2924 unsigned num_digits = 0;
2927 }
while ((n >>= 3) != 0);
2928 Char *p =
get(prepare_int_buffer(num_digits, spec, prefix, prefix_size));
2931 *p-- =
static_cast<Char
>(
'0' + (n & 7));
2932 }
while ((n >>= 3) != 0);
2938 #if !(defined(ANDROID) || defined(__ANDROID__)) 2941 unsigned size =
static_cast<unsigned>(
2942 num_digits + sep.
size() * ((num_digits - 1) / 3));
2943 CharPtr p = prepare_int_buffer(size, spec, prefix, prefix_size) + 1;
2949 spec.type(), spec.flag(
CHAR_FLAG) ?
"char" :
"integer");
2954 template <
typename Char>
2955 template <
typename T,
typename Spec>
2958 char type = spec.type();
2964 case 'e':
case 'f':
case 'g':
case 'a':
2972 case 'E':
case 'G':
case 'A':
2983 if (internal::FPUtil::isnegative(static_cast<double>(value))) {
2987 sign = spec.flag(
PLUS_FLAG) ?
'+' :
' ';
2990 if (internal::FPUtil::isnotanumber(value)) {
2993 std::size_t nan_size = 4;
2994 const char *nan = upper ?
" NAN" :
" nan";
2999 CharPtr out = write_str(nan, nan_size, spec);
3005 if (internal::FPUtil::isinfinity(value)) {
3008 std::size_t inf_size = 4;
3009 const char *inf = upper ?
" INF" :
" inf";
3014 CharPtr out = write_str(inf, inf_size, spec);
3020 std::size_t offset = buffer_.
size();
3021 unsigned width = spec.width();
3023 buffer_.
reserve(buffer_.
size() + (width > 1u ? width : 1u));
3030 enum { MAX_FORMAT_SIZE = 10};
3031 Char
format[MAX_FORMAT_SIZE];
3032 Char *format_ptr =
format;
3033 *format_ptr++ =
'%';
3034 unsigned width_for_sprintf = width;
3036 *format_ptr++ =
'#';
3038 width_for_sprintf = 0;
3041 *format_ptr++ =
'-';
3043 *format_ptr++ =
'*';
3045 if (spec.precision() >= 0) {
3046 *format_ptr++ =
'.';
3047 *format_ptr++ =
'*';
3050 append_float_length(format_ptr, value);
3051 *format_ptr++ =
type;
3059 std::size_t buffer_size = buffer_.
capacity() - offset;
3064 if (buffer_size == 0) {
3066 buffer_size = buffer_.
capacity() - offset;
3069 start = &buffer_[offset];
3071 start, buffer_size,
format, width_for_sprintf, spec.precision(), value);
3074 if (offset + n < buffer_.
capacity())
3076 buffer_.
reserve(offset + n + 1);
3086 *(start - 1) = sign;
3089 *(start - 1) = fill;
3093 if (spec.align() ==
ALIGN_CENTER && spec.width() > n) {
3094 width = spec.width();
3095 CharPtr p = grow_buffer(width);
3096 std::memmove(
get(p) + (width - n) / 2,
get(p), n *
sizeof(Char));
3097 fill_padding(p, spec.width(), n, fill);
3100 if (spec.fill() !=
' ' || sign) {
3101 while (*start ==
' ')
3104 *(start - 1) = sign;
3143 template <
typename Char,
typename Allocator = std::allocator<Char> >
3152 #if FMT_USE_RVALUE_REFERENCES 3160 :
BasicWriter<Char>(buffer_), buffer_(
std::move(other.buffer_)) {
3168 BasicMemoryWriter &operator=(BasicMemoryWriter &&other) {
3169 buffer_ = std::move(other.buffer_);
3198 template <
typename Char>
3211 :
BasicWriter<Char>(buffer_), buffer_(array, size) {}
3219 template <std::
size_t SIZE>
3221 :
BasicWriter<Char>(buffer_), buffer_(array, SIZE) {}
3232 #if FMT_USE_WINDOWS_H 3268 WindowsError(
int error_code,
CStringRef message) {
3269 init(error_code, message,
ArgList());
3276 FMT_API void report_windows_error(
int error_code,
3302 w.
write(format_str, args);
3308 w.
write(format_str, args);
3348 while (value >= 100) {
3352 unsigned index =
static_cast<unsigned>((value % 100) * 2);
3354 *--buffer_end = internal::Data::DIGITS[index + 1];
3355 *--buffer_end = internal::Data::DIGITS[index];
3358 *--buffer_end =
static_cast<char>(
'0' + value);
3361 unsigned index =
static_cast<unsigned>(value * 2);
3362 *--buffer_end = internal::Data::DIGITS[index + 1];
3363 *--buffer_end = internal::Data::DIGITS[index];
3371 abs_value = 0 - abs_value;
3394 const char *
data()
const {
return str_; }
3410 std::string
str()
const {
return std::string(str_, size()); }
3416 template <
typename T>
3419 MainType abs_value =
static_cast<MainType
>(value);
3422 abs_value = 0 - abs_value;
3424 if (abs_value < 100) {
3425 if (abs_value < 10) {
3426 *buffer++ =
static_cast<char>(
'0' + abs_value);
3429 unsigned index =
static_cast<unsigned>(abs_value * 2);
3430 *buffer++ = internal::Data::DIGITS[index];
3431 *buffer++ = internal::Data::DIGITS[index + 1];
3436 buffer += num_digits;
3449 template <
typename T>
3454 template <
typename T>
3461 template <
typename Char>
3463 template <
typename Char>
3472 # pragma GCC system_header 3476 #define FMT_EXPAND(args) args 3480 #define FMT_NARG(...) FMT_NARG_(__VA_ARGS__, FMT_RSEQ_N()) 3481 #define FMT_NARG_(...) FMT_EXPAND(FMT_ARG_N(__VA_ARGS__)) 3482 #define FMT_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N 3483 #define FMT_RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 3485 #define FMT_FOR_EACH_(N, f, ...) \ 3486 FMT_EXPAND(FMT_CONCAT(FMT_FOR_EACH, N)(f, __VA_ARGS__)) 3487 #define FMT_FOR_EACH(f, ...) \ 3488 FMT_EXPAND(FMT_FOR_EACH_(FMT_NARG(__VA_ARGS__), f, __VA_ARGS__)) 3490 #define FMT_ADD_ARG_NAME(type, index) type arg##index 3491 #define FMT_GET_ARG_NAME(type, index) arg##index 3493 #if FMT_USE_VARIADIC_TEMPLATES 3494 # define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ 3495 template <typename... Args> \ 3496 ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ 3497 const Args & ... args) { \ 3498 typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \ 3499 typename ArgArray::Type array{ \ 3500 ArgArray::template make<fmt::BasicFormatter<Char> >(args)...}; \ 3501 call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), \ 3502 fmt::ArgList(fmt::internal::make_type(args...), array)); \ 3507 # define FMT_WRAP(Char, ReturnType, func, call, n, ...) \ 3508 template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \ 3509 inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ 3510 FMT_GEN(n, FMT_MAKE_ARG)) { \ 3511 fmt::internal::ArgArray<n>::Type arr; \ 3512 FMT_GEN(n, FMT_ASSIGN_##Char); \ 3513 call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \ 3514 fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), arr)); \ 3517 # define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \ 3518 inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__)) { \ 3519 call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList()); \ 3521 FMT_WRAP(Char, ReturnType, func, call, 1, __VA_ARGS__) \ 3522 FMT_WRAP(Char, ReturnType, func, call, 2, __VA_ARGS__) \ 3523 FMT_WRAP(Char, ReturnType, func, call, 3, __VA_ARGS__) \ 3524 FMT_WRAP(Char, ReturnType, func, call, 4, __VA_ARGS__) \ 3525 FMT_WRAP(Char, ReturnType, func, call, 5, __VA_ARGS__) \ 3526 FMT_WRAP(Char, ReturnType, func, call, 6, __VA_ARGS__) \ 3527 FMT_WRAP(Char, ReturnType, func, call, 7, __VA_ARGS__) \ 3528 FMT_WRAP(Char, ReturnType, func, call, 8, __VA_ARGS__) \ 3529 FMT_WRAP(Char, ReturnType, func, call, 9, __VA_ARGS__) \ 3530 FMT_WRAP(Char, ReturnType, func, call, 10, __VA_ARGS__) \ 3531 FMT_WRAP(Char, ReturnType, func, call, 11, __VA_ARGS__) \ 3532 FMT_WRAP(Char, ReturnType, func, call, 12, __VA_ARGS__) \ 3533 FMT_WRAP(Char, ReturnType, func, call, 13, __VA_ARGS__) \ 3534 FMT_WRAP(Char, ReturnType, func, call, 14, __VA_ARGS__) \ 3535 FMT_WRAP(Char, ReturnType, func, call, 15, __VA_ARGS__) 3536 #endif // FMT_USE_VARIADIC_TEMPLATES 3565 #define FMT_VARIADIC(ReturnType, func, ...) \ 3566 FMT_VARIADIC_(char, ReturnType, func, return func, __VA_ARGS__) 3568 #define FMT_VARIADIC_W(ReturnType, func, ...) \ 3569 FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__) 3571 #define FMT_CAPTURE_ARG_(id, index) ::fmt::arg(#id, id) 3573 #define FMT_CAPTURE_ARG_W_(id, index) ::fmt::arg(L###id, id) 3589 #define FMT_CAPTURE(...) FMT_FOR_EACH(FMT_CAPTURE_ARG_, __VA_ARGS__) 3591 #define FMT_CAPTURE_W(...) FMT_FOR_EACH(FMT_CAPTURE_ARG_W_, __VA_ARGS__) 3600 namespace internal {
3601 template <
typename Char>
3603 return (
'a' <= c && c <=
'z') || (
'A' <= c && c <=
'Z') ||
'_' == c;
3608 template <
typename Char>
3610 assert(
'0' <= *
s && *
s <=
'9');
3613 unsigned new_value = value * 10 + (*
s++ -
'0');
3615 if (new_value < value) {
3616 value = (std::numeric_limits<unsigned>::max)();
3620 }
while (
'0' <= *
s && *
s <=
'9');
3622 unsigned max_int = (std::numeric_limits<int>::max)();
3623 if (value > max_int)
3629 if (
arg.type > Arg::LAST_NUMERIC_TYPE) {
3630 std::string message =
3631 fmt::format(
"format specifier '{}' requires numeric argument", spec);
3636 template <
typename Char>
3638 char sign =
static_cast<char>(*s);
3640 if (
arg.type == Arg::UINT ||
arg.type == Arg::ULONG_LONG) {
3642 "format specifier '{}' requires signed argument", sign)));
3648 template <
typename Char,
typename AF>
3651 if (check_no_auto_index(error)) {
3656 error =
"argument not found";
3661 template <
typename Char,
typename AF>
3668 *
s !=
'}' && *
s !=
':' ?
"invalid format string" : error));
3673 template <
typename Char,
typename AF>
3676 const Char *start =
s;
3688 template <
typename Char,
typename ArgFormatter>
3692 const Char *
s = format_str;
3695 if (
arg.type == Arg::CUSTOM) {
3696 arg.custom.format(
this,
arg.custom.value, &
s);
3702 const Char *p =
s + 1;
3721 if (c ==
'}')
break;
3765 if (
'0' <= *
s && *
s <=
'9') {
3767 }
else if (*
s ==
'{') {
3770 parse_arg_name(
s) : parse_arg_index(
s);
3774 switch (width_arg.
type) {
3783 case Arg::LONG_LONG:
3788 case Arg::ULONG_LONG:
3794 if (value > (std::numeric_limits<int>::max)())
3796 spec.
width_ =
static_cast<int>(value);
3803 if (
'0' <= *
s && *
s <=
'9') {
3805 }
else if (*
s ==
'{') {
3808 parse_arg_name(
s) : parse_arg_index(
s);
3812 switch (precision_arg.
type) {
3821 case Arg::LONG_LONG:
3826 case Arg::ULONG_LONG:
3832 if (value > (std::numeric_limits<int>::max)())
3838 if (
arg.type <= Arg::LAST_INTEGER_TYPE ||
arg.type == Arg::POINTER) {
3840 fmt::format(
"precision not allowed in {} format specifier",
3841 arg.type == Arg::POINTER ?
"pointer" :
"integer")));
3846 if (*
s !=
'}' && *
s)
3847 spec.
type_ =
static_cast<char>(*
s++);
3858 template <
typename Char,
typename AF>
3861 const Char *start =
s;
3864 if (c !=
'{' && c !=
'}')
continue;
3866 write(writer_, start,
s);
3872 write(writer_, start,
s - 1);
3874 parse_arg_name(
s) : parse_arg_index(
s);
3877 write(writer_, start,
s);
3880 template <
typename Char,
typename It>
3892 template <
typename It>
3897 template <
typename It>
3902 #if FMT_HAS_GXX_CXX11 3903 template <
typename Range>
3904 auto join(
const Range& range,
const BasicCStringRef<char>& sep)
3905 -> ArgJoin<char, decltype(std::begin(range))> {
3906 return join(std::begin(range), std::end(range), sep);
3909 template <
typename Range>
3910 auto join(
const Range& range,
const BasicCStringRef<wchar_t>& sep)
3911 -> ArgJoin<wchar_t, decltype(std::begin(range))> {
3912 return join(std::begin(range), std::end(range), sep);
3916 template <
typename ArgFormatter,
typename Char,
typename It>
3919 const Char* end = format_str;
3922 while (*end && *end !=
'}')
3929 const Char*
save = format_str;
3931 while (it != e.
last) {
3937 format_str = end + 1;
3941 #if FMT_USE_USER_DEFINED_LITERALS 3943 namespace internal {
3945 template <
typename Char>
3949 template <
typename... Args>
3950 auto operator()(Args && ... args)
const 3951 -> decltype(
format(str, std::forward<Args>(args)...)) {
3952 return format(str, std::forward<Args>(args)...);
3956 template <
typename Char>
3960 template <
typename T>
3962 return {str, std::forward<T>(value)};
3968 inline namespace literals {
3980 inline internal::UdlFormat<char>
3981 operator"" _format(
const char *
s, std::size_t) {
return {
s}; }
3982 inline internal::UdlFormat<wchar_t>
3983 operator"" _format(
const wchar_t *
s, std::size_t) {
return {
s}; }
3995 inline internal::UdlArg<char>
3996 operator"" _a(
const char *
s, std::size_t) {
return {
s}; }
3997 inline internal::UdlArg<wchar_t>
3998 operator"" _a(
const wchar_t *
s, std::size_t) {
return {
s}; }
4002 #endif // FMT_USE_USER_DEFINED_LITERALS 4005 #if FMT_GCC_VERSION >= 406 4006 # pragma GCC diagnostic pop 4009 #if defined(__clang__) && !defined(FMT_ICC_VERSION) 4010 # pragma clang diagnostic pop 4013 #ifdef FMT_HEADER_ONLY 4014 # define FMT_FUNC inline 4020 #endif // FMT_FORMAT_H_ CharPtr prepare_int_buffer(unsigned num_digits, const EmptySpec &, const char *prefix, unsigned prefix_size)
Definition: format.h:2516
BasicCStringRef(const Char *s)
Definition: format.h:594
double double_value
Definition: format.h:1106
std::basic_string< Char > str() const
Definition: format.h:2608
Result visit_bool(bool value)
Definition: format.h:1598
AlignTypeSpec(unsigned width, wchar_t fill)
Definition: format.h:1752
uint64_t Type
Definition: format.h:915
Definition: format.h:1096
Alignment align() const
Definition: format.h:1744
MakeValue(typename WCharHelper< wchar_t, Char >::Supported value)
Definition: format.h:1362
const uint32_t T[512]
Definition: groestl_tables.h:34
static const uint8_t padding[]
Definition: blake256.c:77
BasicStringRef(const Char *s)
Definition: format.h:502
MapType::value_type Pair
Definition: format.h:1930
Definition: format.h:1706
Definition: format.h:1088
FMT_FUNC void print_colored(Color c, CStringRef format, ArgList args)
Definition: format.cc:496
Buffer< Char > & buffer_
Definition: format.h:2467
static internal::Arg::Type type(uint64_t types, unsigned index)
Definition: format.h:1530
ArgType(const T &arg)
Definition: format.h:2269
bool is_negative(T value)
Definition: format.h:906
Alignment align_
Definition: format.h:1739
Definition: format.h:1700
void operator()(Char *)
Definition: format.h:980
static void format_custom_arg(void *formatter, const void *arg, void *format_str_ptr)
Definition: format.h:1306
std::size_t size_
Definition: format.h:674
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Definition: unordered_containers_boost_serialization.h:43
T data_[SIZE]
Definition: format.h:750
static bool is_negative(T value)
Definition: format.h:894
void resize(std::size_t new_size)
Definition: format.h:700
void format_arg(fmt::BasicFormatter< Char, ArgFormatter > &f, const Char *&format_str, const ArgJoin< Char, It > &e)
Definition: format.h:3917
friend bool operator!=(BasicStringRef lhs, BasicStringRef rhs)
Definition: format.h:542
const void * value
Definition: format.h:1097
Definition: format.h:1175
friend bool operator<=(BasicStringRef lhs, BasicStringRef rhs)
Definition: format.h:548
Definition: format.h:1705
char Yes[1]
Definition: format.h:1154
Result visit_ulong_long(ULongLong value)
Definition: format.h:1593
char type() const
Definition: format.h:1719
wchar_t fill_
Definition: format.h:1729
IntFormatSpec< int, TypeSpec< 'x'> > hex(int value)
Definition: format.h:1086
BasicWriter(Buffer< Char > &b)
Definition: format.h:2571
Result visit_pointer(const void *)
Definition: format.h:1645
Definition: format.h:3281
StrFormatSpec< wchar_t > pad(const wchar_t *str, unsigned width, char fill=' ')
Definition: format.h:1918
T Type
Definition: format.h:626
static unsigned char negative(signed char b)
Definition: crypto-ops.c:1504
IntFormatSpec< int, TypeSpec< 'o'> > oct(int value)
WidthSpec(unsigned width, wchar_t fill)
Definition: format.h:1731
#define F(w, k)
Definition: sha512-blocks.c:61
T * make_ptr(T *ptr, std::size_t)
Definition: format.h:658
FMT_API void report_unknown_type(char code, const char *type)
Definition: format.cc:294
friend bool operator<(BasicStringRef lhs, BasicStringRef rhs)
Definition: format.h:545
Definition: format.h:1128
MakeValue(const NamedArgWithType< Char_, T > &value)
Definition: format.h:1420
internal::FixedBuffer< Char > buffer_
Definition: format.h:3201
MakeValue(const T &value, typename EnableIf< Not< ConvertToInt< T >::value >::value, int >::type=0)
Definition: format.h:1397
Result visit_any_double(T)
Definition: format.h:1625
FMT_FUNC void write(std::ostream &os, Writer &w)
Definition: ostream.cc:15
void operator()(Char *&buffer)
Definition: format.h:995
LConvCheck(int)
Definition: format.h:1222
void write(BasicCStringRef< Char > format, ArgList args)
Definition: format.h:2637
char Char
Definition: format.h:2392
Definition: format.h:3281
static wchar_t convert(char value)
Definition: format.h:873
int data[2]
Definition: format.h:361
std::string format(CStringRef format_str, ArgList args)
Definition: format.h:3300
BasicWriter & operator<<(unsigned long value)
Definition: format.h:2653
T type
Definition: format.h:1203
BasicCStringRef(const std::basic_string< Char, std::char_traits< Char >, Allocator > &s)
Definition: format.h:602
T const_check(T value)
Definition: format.h:378
#define BUFFER_SIZE
Definition: blockchain_utilities.h:37
Definition: format.h:1119
unsigned width_
Definition: format.h:1726
fmt::StringRef sep_
Definition: format.h:986
internal::Arg::Type type(unsigned index) const
Definition: format.h:1484
BasicArrayWriter(Char *array, std::size_t size)
Definition: format.h:3210
int precision() const
Definition: format.h:1746
FMT_GCC_EXTENSION typedef unsigned long long ULongLong
Definition: format.h:437
Definition: format.h:3881
Definition: format.h:1183
Definition: format.h:3281
Definition: block_queue.cpp:41
const T & operator[](std::size_t index) const
Definition: format.h:729
static uint64_t type(const NamedArgWithType< Char_, T > &)
Definition: format.h:1425
Definition: format.h:3199
Definition: format.h:1700
DummyInt isinf(...)
Definition: format.h:370
static uint64_t type(long)
Definition: format.h:1337
char fill() const
Definition: format.h:1721
Definition: format.h:2227
Result visit_custom(Arg::CustomValue)
Definition: format.h:1650
MakeValue(const NamedArg< Char_ > &value)
Definition: format.h:1418
Definition: format.h:1117
Char * write_unsigned_decimal(UInt value, unsigned prefix_size=0)
Definition: format.h:2495
BasicWriter & operator<<(ULongLong value)
Definition: format.h:2666
const void * pointer
Definition: format.h:1108
FMT_FUNC void format_system_error(Writer &out, int error_code, StringRef message) FMT_NOEXCEPT
Definition: format.cc:217
BasicWriter & operator<<(double value)
Definition: format.h:2670
NamedArg(BasicStringRef< Char > argname, const T &value)
Definition: format.h:1447
static wchar_t convert(wchar_t value)
Definition: format.h:874
BasicStringRef< Char > name
Definition: format.h:1444
unsigned parse_nonnegative_int(const Char *&s)
Definition: format.h:3609
ArgType()
Definition: format.h:2266
BasicStringRef(const Char *s, std::size_t size)
Definition: format.h:494
const Char * data() const FMT_NOEXCEPT
Definition: format.h:2590
uint32_t Type
Definition: format.h:912
StringValue< signed char > sstring
Definition: format.h:1110
virtual ~BasicWriter()
Definition: format.h:2579
std::size_t size() const
Definition: format.h:528
ThousandsSep(fmt::StringRef sep)
Definition: format.h:992
CustomValue custom
Definition: format.h:1113
F type
Definition: format.h:1209
ArgJoin< wchar_t, It > join(It first, It last, const BasicCStringRef< wchar_t > &sep)
Definition: format.h:3898
bool flag(unsigned) const
Definition: format.h:1754
Yes & convert(fmt::ULongLong)
T & operator[](std::size_t index)
Definition: format.h:728
FMT_FUNC void report_system_error(int error_code, fmt::StringRef message) FMT_NOEXCEPT
Definition: format.cc:472
std::size_t size
Definition: format.h:1090
friend bool operator>(BasicStringRef lhs, BasicStringRef rhs)
Definition: format.h:551
void set_string(StringRef str)
Definition: format.h:1294
Allocator get_allocator() const
Definition: format.h:799
static uint64_t type(unsigned long)
Definition: format.h:1347
void append(const U *begin, const U *end)
Definition: format.h:734
const Char * data() const
Definition: format.h:525
Definition: format.h:1700
static uint64_t type(const T &)
Definition: format.h:1411
FixedBuffer(Char *array, std::size_t size)
Definition: format.h:826
virtual ~Buffer()
Definition: format.h:689
Definition: format.h:1149
BasicStringRef< wchar_t > WStringRef
Definition: format.h:560
void arg(WStringRef, const internal::NamedArg< Char > &) FMT_DELETED_OR_UNDEFINED
void append_float_length(Char *&, T)
Definition: format.h:2559
Result visit_any_int(T)
Definition: format.h:1609
internal::Arg operator[](unsigned index) const
Definition: format.h:1505
Definition: format.h:1751
Definition: format.h:1200
Definition: format.h:1170
t0
Definition: pow22523.h:53
static uint64_t type(wchar_t)
Definition: format.h:1365
Definition: format.h:3144
void clear() FMT_NOEXCEPT
Definition: format.h:716
BasicStringRef< char > StringRef
Definition: format.h:559
std::wstring format(WCStringRef format_str, ArgList args)
Definition: format.h:3306
fmt::StringRef thousands_sep(...)
Definition: format.h:1234
BasicWriter & operator<<(long value)
Definition: format.h:2649
void clear() FMT_NOEXCEPT
Definition: format.h:2732
Alignment
Definition: format.h:1699
void write_decimal(Int value)
Definition: format.h:2504
BasicMemoryWriter< char > MemoryWriter
Definition: format.h:3175
uint64_t types() const
Definition: format.h:1502
Definition: format.h:3281
uint64_t types_
Definition: format.h:1473
RuntimeError()
Definition: format.h:1459
CharPtr grow_buffer(std::size_t n)
Definition: format.h:2487
Null< T > Unsupported
Definition: format.h:1151
BasicCStringRef< Char > sep
Definition: format.h:3884
CharPtr write_str(const StrChar *s, std::size_t size, const AlignSpec &spec)
Definition: format.h:2739
DummyInt isnan(...)
Definition: format.h:372
Null< T > Supported
Definition: format.h:1144
Type
Definition: format.h:1116
Definition: format.h:1213
Result visit_long_long(LongLong value)
Definition: format.h:1583
MakeValue(unsigned long value)
Definition: format.h:1341
Result visit_double(double value)
Definition: format.h:1614
char type_prefix() const
Definition: format.h:1720
IntFormatSpec< int, TypeSpec< 'X'> > hexu(int value)
BasicWriter & operator<<(LongLong value)
Definition: format.h:2656
Definition: format.h:1469
SystemError()
Definition: format.h:2394
Definition: format.h:1705
BasicWriter & operator<<(typename internal::WCharHelper< StringRef, Char >::Supported value)
Definition: format.h:2711
BasicCStringRef< char > CStringRef
Definition: format.h:610
unsigned uint_value
Definition: format.h:1103
friend bool operator==(BasicStringRef lhs, BasicStringRef rhs)
Definition: format.h:539
Result visit_uint(unsigned value)
Definition: format.h:1588
t3
Definition: pow225521.h:103
MapType map_
Definition: format.h:1932
static bool isinfinity(T x)
Definition: format.h:393
BasicWriter< char > Writer
Definition: format.h:444
int compare(BasicStringRef other) const
Definition: format.h:531
char type_prefix() const
Definition: format.h:1756
Definition: format.h:1465
void append_float_length(Char *&format_ptr, long double)
Definition: format.h:2554
Result visit_string(Arg::StringValue< char >)
Definition: format.h:1635
int b
Definition: base.py:1
Definition: format.h:1165
std::vector< std::pair< fmt::BasicStringRef< Char >, internal::Arg > > MapType
Definition: format.h:1929
Definition: format.h:1122
int int_value
Definition: format.h:1102
MakeUnsigned< Int >::Type to_unsigned(Int value)
Definition: format.h:641
std::size_t capacity() const
Definition: format.h:695
ArgList()
Definition: format.h:1495
friend bool operator>=(BasicStringRef lhs, BasicStringRef rhs)
Definition: format.h:554
Result visit_cstring(const char *)
Definition: format.h:1630
SystemError(int error_code, CStringRef message)
Definition: format.h:2415
StringValue< char > string
Definition: format.h:1109
BasicWriter & operator<<(char value)
Definition: format.h:2689
DummyInt signbit(...)
Definition: format.h:368
const internal::Arg * find(const fmt::BasicStringRef< Char > &name) const
Definition: format.h:1937
void check_sign(const Char *&s, const Arg &arg)
Definition: format.h:3637
BasicCStringRef< wchar_t > WCStringRef
Definition: format.h:611
type
Definition: json.h:74
const Char * value
Definition: format.h:1089
#define false
Definition: stdbool.h:38
unsigned digit_index_
Definition: format.h:989
BasicWriter & operator<<(typename internal::WCharHelper< wchar_t, Char >::Supported value)
Definition: format.h:2694
static bool isnotanumber(T x)
Definition: format.h:406
RuntimeError(const RuntimeError &rerr)
Definition: format.h:1460
ArgList(ULongLong types, const internal::Arg *args)
Definition: format.h:1499
Buffer(T *ptr=FMT_NULL, std::size_t capacity=0)
Definition: format.h:677
Definition: format.h:1565
~MemoryBuffer()
Definition: format.h:763
const internal::Arg * args_
Definition: format.h:1481
void write_int(T value, Spec spec)
Definition: format.h:2863
Definition: format.h:3281
Definition: format.h:1710
DummyInt _isnan(...)
Definition: format.h:373
Definition: format.h:1705
Char * CharPtr
Definition: format.h:838
It last
Definition: format.h:3883
BasicWriter< wchar_t > WWriter
Definition: format.h:447
MakeValue(const T &value, typename EnableIf< ConvertToInt< T >::value, int >::type=0)
Definition: format.h:1405
Formatter::Char Char
Definition: format.h:1269
void push_back(const T &value)
Definition: format.h:718
BasicWriter & operator<<(long double value)
Definition: format.h:2681
char No[2]
Definition: format.h:1155
internal::CharTraits< Char >::CharPtr CharPtr
Definition: format.h:2471
T Unsupported
Definition: format.h:1145
BasicArrayWriter(Char(&array)[SIZE])
Definition: format.h:3220
Definition: format.h:1219
BasicArrayWriter< char > ArrayWriter
Definition: format.h:3224
BasicMemoryWriter(const Allocator &alloc=Allocator())
Definition: format.h:3149
Definition: format.h:3281
MakeArg()
Definition: format.h:1431
t2
Definition: pow22523.h:103
T type
Definition: format.h:1206
int precision() const
Definition: format.h:1717
Definition: format.h:1738
const Char * data_
Definition: format.h:590
Definition: format.h:1700
Color
Definition: format.h:3281
bool flag(unsigned) const
Definition: format.h:1718
char type() const
Definition: format.h:1755
uint64_t type
Definition: format.h:2264
Definition: format.h:1714
static char convert(char value)
Definition: format.h:853
Definition: format.cc:213
T * ptr_
Definition: format.h:673
BasicWriter & operator<<(unsigned value)
Definition: format.h:2646
void require_numeric_argument(const Arg &arg, char spec)
Definition: format.h:3628
void set_string(WStringRef str)
Definition: format.h:1299
FMT_FUNC void print(std::FILE *f, CStringRef format_str, ArgList args)
Definition: format.cc:486
Result visit_unhandled_arg()
Definition: format.h:1572
StringValue< wchar_t > wstring
Definition: format.h:1112
unsigned count_digits(uint64_t n)
Definition: format.h:953
MemoryBuffer(const Allocator &alloc=Allocator())
Definition: format.h:761
Buffer< Char > & buffer() FMT_NOEXCEPT
Definition: format.h:2734
t1
Definition: pow22523.h:58
Definition: format.h:3281
Definition: format.h:1705
Result visit_char(int value)
Definition: format.h:1603
Definition: format.h:3281
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, required > &arg)
Definition: command_line.h:195
Definition: format.h:1133
IntFormatSpec< int, TypeSpec< 'b'> > bin(int value)
Definition: format.h:2263
Definition: format.h:1206
MakeArg(const T &value)
Definition: format.h:1436
void reserve(std::size_t capacity)
Definition: format.h:711
BasicData Data
Definition: format.h:940
internal::MemoryBuffer< Char, internal::INLINE_BUFFER_SIZE, Allocator > buffer_
Definition: format.h:3146
std::size_t capacity_
Definition: format.h:675
T Supported
Definition: format.h:1150
std::size_t size() const
Definition: format.h:692
Result visit_int(int value)
Definition: format.h:1578
static Arg make(const T &value)
Definition: format.h:2252
wchar_t fill() const
Definition: format.h:1734
Definition: format.h:1221
internal::Arg Arg
Definition: format.h:1567
ULongLong ulong_long_value
Definition: format.h:1105
It first
Definition: format.h:3882
BasicMemoryWriter< wchar_t > WMemoryWriter
Definition: format.h:3176
Definition: format.h:1138
std::ostream & operator<<(std::ostream &o, const crypto::public_key &v)
Definition: cryptonote_basic_impl.h:141
Definition: format.h:1725
FormatFunc format
Definition: format.h:1098
Result visit_wstring(Arg::StringValue< wchar_t >)
Definition: format.h:1640
static uint64_t type(const NamedArg< Char_ > &)
Definition: format.h:1423
Type type
Definition: format.h:1129
const char * name
Definition: simplewallet.cpp:180
Definition: format.h:2385
Definition: format.h:1429
MakeValue()
Definition: format.h:1314
unsigned width() const
Definition: format.h:1716
Definition: format.h:1135
AlignSpec(unsigned width, wchar_t fill, Alignment align=ALIGN_DEFAULT)
Definition: format.h:1741
uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
Definition: format.h:2274
static bool isnegative(double x)
Definition: format.h:416
LongLong long_long_value
Definition: format.h:1104
DummyInt _finite(...)
Definition: format.h:371
const Char * c_str() const
Definition: format.h:607
Alignment align() const
Definition: format.h:1715
Definition: format.h:1700
static bool is_negative(T)
Definition: format.h:900
long double long_double_value
Definition: format.h:1107
const Char * c_str() const
Definition: format.h:2596
ArgJoin(It first, It last, const BasicCStringRef< Char > &sep)
Definition: format.h:3886
void report_unhandled_arg()
Definition: format.h:1570
StringValue< unsigned char > ustring
Definition: format.h:1111
const internal::Value * values_
Definition: format.h:1480
std::numeric_limits< fmt::internal::DummyInt > FPUtil
Definition: format.h:364
unsigned width() const
Definition: format.h:1733
static Value make(const T &value)
Definition: format.h:2234
#define true
Definition: stdbool.h:37
#define s(x, c)
Definition: aesb.c:46
std::size_t size() const
Definition: format.h:2584
void write_double(T value, const Spec &spec)
Definition: format.h:2956
void format_decimal(char *&buffer, T value)
Definition: format.h:3417
static Char cast(int value)
Definition: format.h:840
Definition: format.h:1121
static CharPtr fill_padding(CharPtr buffer, unsigned total_size, std::size_t content_size, wchar_t fill)
Definition: format.h:2783
std::basic_string< Char > to_string() const
Definition: format.h:520
ArgList(ULongLong types, const internal::Value *values)
Definition: format.h:1497
Definition: format.h:1267
int error_code_
Definition: format.h:2390
Result visit_long_double(long double value)
Definition: format.h:1619
BasicArrayWriter< wchar_t > WArrayWriter
Definition: format.h:3225
FMT_GCC_EXTENSION typedef long long LongLong
Definition: format.h:436
DummyInt _ecvt_s(...)
Definition: format.h:369
NamedArgWithType(BasicStringRef< Char > argname, const T &value)
Definition: format.h:1453
void deallocate()
Definition: format.h:753
const Char * data_
Definition: format.h:489
bool is_name_start(Char c)
Definition: format.h:3602
Result visit(const Arg &arg)
Definition: format.h:1662
Definition: format.h:1143
Definition: format.h:1457
BasicStringRef(const std::basic_string< Char, std::char_traits< Char >, Allocator > &s)
Definition: format.h:511
std::size_t size_
Definition: format.h:490