41 # define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
43 # define FMT_CLANG_VERSION 0
46 #ifdef __INTEL_COMPILER
47 # define FMT_ICC_VERSION __INTEL_COMPILER
49 # define FMT_ICC_VERSION __ICL
51 # define FMT_ICC_VERSION 0
55 # define FMT_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__)
57 # define FMT_CUDA_VERSION 0
62 #if FMT_GCC_VERSION >= 406 || FMT_CLANG_VERSION
63 # pragma GCC diagnostic push
67 # pragma GCC diagnostic ignored "-Wshadow"
71 # pragma GCC diagnostic ignored "-Wsign-conversion"
74 # if FMT_CLANG_VERSION
75 # pragma GCC diagnostic ignored "-Wgnu-string-literal-operator-template"
79 # define FMT_SECURE_SCL _SECURE_SCL
81 # define FMT_SECURE_SCL 0
89 # define FMT_HAS_BUILTIN(x) __has_builtin(x)
91 # define FMT_HAS_BUILTIN(x) 0
94 #ifdef __GNUC_LIBSTD__
95 # define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__)
103 template <
typename Exception>
104 inline void do_throw(
const Exception &
x) {
107 volatile bool b =
true;
113 # define FMT_THROW(x) fmt::internal::do_throw(x)
115 # define FMT_THROW(x) throw x
118 # define FMT_THROW(x) do { static_cast<void>(sizeof(x)); assert(false); } while(false);
122 #ifndef FMT_USE_USER_DEFINED_LITERALS
125 # if (FMT_HAS_FEATURE(cxx_user_literals) || \
126 FMT_GCC_VERSION >= 407 || FMT_MSC_VER >= 1900) && \
127 (!(FMT_ICC_VERSION || FMT_CUDA_VERSION) || \
128 FMT_ICC_VERSION >= 1500 || FMT_CUDA_VERSION >= 700)
129 # define FMT_USE_USER_DEFINED_LITERALS 1
131 # define FMT_USE_USER_DEFINED_LITERALS 0
137 #if FMT_USE_USER_DEFINED_LITERALS && \
138 FMT_ICC_VERSION == 0 && \
139 FMT_CUDA_VERSION == 0 && \
140 ((FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L) || \
141 (defined(FMT_CLANG_VERSION) && FMT_CLANG_VERSION >= 304))
142 # define FMT_UDL_TEMPLATE 1
144 # define FMT_UDL_TEMPLATE 0
147 #ifndef FMT_USE_EXTERN_TEMPLATES
148 # ifndef FMT_HEADER_ONLY
149 # define FMT_USE_EXTERN_TEMPLATES \
150 ((FMT_CLANG_VERSION >= 209 && __cplusplus >= 201103L) || \
151 (FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11))
153 # define FMT_USE_EXTERN_TEMPLATES 0
157 #if FMT_HAS_GXX_CXX11 || FMT_HAS_FEATURE(cxx_trailing_return) || \
159 # define FMT_USE_TRAILING_RETURN 1
161 # define FMT_USE_TRAILING_RETURN 0
164 #ifndef FMT_USE_GRISU
165 # define FMT_USE_GRISU 0
172 # if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz)
173 # define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
176 # if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll)
177 # define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
184 #if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED)
191 # pragma intrinsic(_BitScanReverse)
193 inline uint32_t clz(uint32_t
x) {
195 _BitScanReverse(&r, x);
201 # pragma warning(suppress: 6102)
204 # define FMT_BUILTIN_CLZ(n) fmt::internal::clz(n)
206 # if defined(_WIN64) && !defined(__clang__)
207 # pragma intrinsic(_BitScanReverse64)
210 inline uint32_t clzll(uint64_t x) {
213 _BitScanReverse64(&r, x);
216 if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32)))
217 return 63 - (r + 32);
220 _BitScanReverse(&r, static_cast<uint32_t>(x));
227 # pragma warning(suppress: 6102)
230 # define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n)
241 template <
typename Dest,
typename Source>
243 static_assert(
sizeof(Dest) ==
sizeof(Source),
"size mismatch");
245 std::memcpy(&dest, &source,
sizeof(dest));
250 template <
typename C>
254 template <
typename T, std::
size_t N>
256 template <
typename C>
258 template <
typename T, std::
size_t N>
262 template <
typename Result>
264 template <
typename T>
270 operator int()
const {
return 0; }
272 typedef std::numeric_limits<internal::dummy_int>
fputil;
281 template <
typename Allocator>
283 #if __cplusplus >= 201103L || FMT_MSC_VER >= 1700
286 return alloc.allocate(n);
292 template <
typename T>
304 public std::numeric_limits<int> {
307 template <
typename T>
309 using namespace fmt::internal;
312 if (
const_check(
sizeof(isinf(x)) !=
sizeof(fmt::internal::dummy_int)))
313 return isinf(x) != 0;
314 return !
_finite(static_cast<double>(x));
318 template <
typename T>
320 using namespace fmt::internal;
321 if (
const_check(
sizeof(isnan(x)) !=
sizeof(fmt::internal::dummy_int)))
322 return isnan(x) != 0;
323 return _isnan(static_cast<double>(x)) != 0;
329 template <
typename Range>
332 template <
typename OutputIt,
typename T =
typename OutputIt::value_type>
338 typedef void sentinel;
339 sentinel
end()
const;
346 OutputIt
begin()
const {
return it_; }
350 template <
typename Container>
352 public output_range<std::back_insert_iterator<Container>> {
368 : std::runtime_error(message) {}
371 : std::runtime_error(message) {}
377 template <
typename T>
378 struct checked {
typedef stdext::checked_array_iterator<T*>
type; };
381 template <
typename T>
386 template <
typename T>
388 template <
typename T>
392 template <
typename T>
393 template <
typename U>
397 std::uninitialized_copy(begin, end,
405 #if !defined(__cpp_char8_t)
421 #if FMT_USE_USER_DEFINED_LITERALS
422 inline namespace literals {
463 typename Allocator = std::allocator<T> >
471 if (data != store_) Allocator::deallocate(data, this->capacity());
480 this->set(store_,
SIZE);
487 Allocator &this_alloc = *
this, &other_alloc = other;
488 this_alloc = std::move(other_alloc);
490 std::size_t size = other.
size(), capacity = other.
capacity();
491 if (data == other.store_) {
492 this->set(store_, capacity);
493 std::uninitialized_copy(other.store_, other.store_ + size,
496 this->set(data, capacity);
499 other.
set(other.store_, 0);
521 assert(
this != &other);
531 template <
typename T, std::
size_t SIZE,
typename Allocator>
533 std::size_t old_capacity = this->capacity();
534 std::size_t new_capacity = old_capacity + old_capacity / 2;
535 if (size > new_capacity)
537 T *old_data = this->
data();
538 T *new_data = internal::allocate<Allocator>(*
this, new_capacity);
540 std::uninitialized_copy(old_data, old_data + this->
size(),
542 this->set(new_data, new_capacity);
546 if (old_data != store_)
547 Allocator::deallocate(old_data, old_capacity);
555 template <
typename Char>
561 template <
typename T>
562 FMT_API static int format_float(
char *
buffer, std::size_t size,
568 template <
typename T>
569 FMT_API static int format_float(
wchar_t *
buffer, std::size_t size,
573 #if FMT_USE_EXTERN_TEMPLATES
589 template <
typename Container>
590 inline typename std::enable_if<
593 reserve(std::back_insert_iterator<Container> &it, std::size_t
n) {
595 std::size_t size = c.size();
600 template <
typename Iterator>
601 inline Iterator &
reserve(Iterator &it, std::size_t) {
return it; }
603 template <
typename Char>
606 template <
typename Char>
612 template <
typename Char>
624 : ptr_(ptr), end_(end) {}
626 template <
typename Range>
637 return ptr_ != end_ ? *ptr_ : Char();
671 return ptr_ - other.ptr_;
675 return ptr_ != other.ptr_;
679 return ptr_ >= other.ptr_;
684 template <
typename CharT>
693 template <
typename T>
696 template <
typename Char>
703 template <
typename T>
707 mutable T blackhole_;
719 std::size_t
count()
const {
return count_; }
735 template <
typename OutputIt>
743 : out_(out), limit_(limit), count_(0) {}
752 OutputIt
base()
const {
return out_; }
753 std::size_t
count()
const {
return count_; }
758 template <
typename OutputIt,
typename Enable =
typename std::is_void<
762 template <
typename OutputIt>
765 typedef std::iterator_traits<OutputIt> traits;
776 if (this->count_++ < this->limit_)
788 return this->count_ < this->limit_ ? *this->out_ : blackhole_;
792 template <
typename OutputIt>
802 if (this->count_++ < this->limit_)
814 template <
typename T>
819 template <
typename T>
825 template <
typename T>
829 typedef typename std::conditional<
830 std::numeric_limits<T>::digits <= 32, uint32_t, uint64_t>
::type main_type;
835 template <
typename T =
void>
837 static const uint32_t POWERS_OF_10_32[];
838 static const uint32_t ZERO_OR_POWERS_OF_10_32[];
839 static const uint64_t ZERO_OR_POWERS_OF_10_64[];
840 static const uint64_t POW10_SIGNIFICANDS[];
841 static const int16_t POW10_EXPONENTS[];
842 static const char DIGITS[];
843 static const char FOREGROUND_COLOR[];
844 static const char BACKGROUND_COLOR[];
845 static const char RESET_COLOR[];
846 static const wchar_t WRESET_COLOR[];
849 #if FMT_USE_EXTERN_TEMPLATES
855 #ifdef FMT_BUILTIN_CLZLL
861 int t = (64 - FMT_BUILTIN_CLZLL(n | 1)) * 1233 >> 12;
862 return to_unsigned(t) - (n < data::ZERO_OR_POWERS_OF_10_64[
t]) + 1;
872 if (n < 10)
return count;
873 if (n < 100)
return count + 1;
874 if (n < 1000)
return count + 2;
875 if (n < 10000)
return count + 3;
882 template <
typename Char>
890 template <
typename InputIt,
typename OutChar>
896 template <
typename OutChar,
typename InputIt,
typename OutputIt>
897 typename std::enable_if<
903 template <
typename OutChar,
typename InputIt,
typename OutputIt>
904 typename std::enable_if<
910 #if FMT_HAS_CPP_ATTRIBUTE(always_inline)
911 # define FMT_ALWAYS_INLINE __attribute__((always_inline))
913 # define FMT_ALWAYS_INLINE
916 template <
typename Handler>
920 template <
typename Handler>
921 inline char *
lg(uint32_t
n, Handler
h) {
922 return n < 100 ? n < 10 ? h.template on<0>(
n) : h.template on<1>(n)
924 ? n < 10000 ? n < 1000 ? h.template on<2>(
n)
925 : h.template on<3>(n)
926 : n < 100000 ? h.template on<4>(
n)
927 : h.template on<5>(n)
928 : n < 100000000 ? n < 10000000 ? h.template on<6>(
n)
929 : h.template on<7>(n)
930 : n < 1000000000 ? h.template on<8>(
n)
931 : h.template on<9>(n);
940 void write_pair(
unsigned N, uint32_t
index) {
941 std::memcpy(buffer_ + N, data::DIGITS + index * 2, 2);
947 template <
unsigned N>
char *
on(uint32_t u) {
949 *buffer_ =
static_cast<char>(u) +
'0';
956 unsigned a = n / 5 * n * 53 / 16;
957 uint64_t
t = ((1ULL << (32 +
a)) /
958 data::ZERO_OR_POWERS_OF_10_32[
n] + 1 - n / 9);
959 t = ((t * u) >> a) + n / 5 * 4;
960 write_pair(0, t >> 32);
961 for (
unsigned i = 2; i <
N; i += 2) {
962 t = 100ULL *
static_cast<uint32_t
>(
t);
963 write_pair(i, t >> 32);
966 buffer_[
N] =
static_cast<char>(
967 (10ULL *
static_cast<uint32_t
>(
t)) >> 32) +
'0';
970 return buffer_ += N + 1;
979 template <
unsigned N>
char *
on(uint32_t u) {
980 char *
buf = decimal_formatter::on<N>(u);
986 #ifdef FMT_BUILTIN_CLZ
989 int t = (32 - FMT_BUILTIN_CLZ(n | 1)) * 1233 >> 12;
990 return to_unsigned(t) - (n < data::ZERO_OR_POWERS_OF_10_32[
t]) + 1;
998 template <
typename Char>
1005 template <
typename Char>
1011 unsigned digit_index_;
1017 : sep_(sep), digit_index_(0) {}
1020 if (++digit_index_ % 3 != 0)
1022 buffer -= sep_.size();
1023 std::uninitialized_copy(sep_.data(), sep_.data() + sep_.size(),
1030 template <
typename Char>
1033 template <
typename Char>
1035 return Char(thousands_sep_impl<char>(loc));
1040 return thousands_sep_impl<wchar_t>(loc);
1046 template <
typename UInt,
typename Char,
typename ThousandsSep>
1049 buffer += num_digits;
1051 while (value >= 100) {
1055 unsigned index =
static_cast<unsigned>((value % 100) * 2);
1057 *--buffer =
static_cast<Char
>(data::DIGITS[index + 1]);
1059 *--buffer =
static_cast<Char
>(data::DIGITS[
index]);
1063 *--buffer =
static_cast<Char
>(
'0' +
value);
1066 unsigned index =
static_cast<unsigned>(value * 2);
1067 *--buffer =
static_cast<Char
>(data::DIGITS[index + 1]);
1069 *--buffer =
static_cast<Char
>(data::DIGITS[
index]);
1073 template <
typename OutChar,
typename UInt,
typename Iterator,
1074 typename ThousandsSep>
1076 Iterator out, UInt
value,
unsigned num_digits, ThousandsSep sep) {
1079 enum { max_size = std::numeric_limits<UInt>::digits10 + 1 };
1081 char_type
buffer[max_size + max_size / 3];
1083 return internal::copy_str<OutChar>(
buffer,
end, out);
1086 template <
typename OutChar,
typename It,
typename UInt>
1091 template <
unsigned BASE_BITS,
typename Char,
typename UInt>
1093 bool upper =
false) {
1094 buffer += num_digits;
1097 const char *digits = upper ?
"0123456789ABCDEF" :
"0123456789abcdef";
1098 unsigned digit = (value & ((1 << BASE_BITS) - 1));
1099 *--buffer =
static_cast<Char
>(BASE_BITS < 4 ?
'0' + digit : digits[digit]);
1100 }
while ((value >>= BASE_BITS) != 0);
1104 template <
unsigned BASE_BITS,
typename Char,
typename It,
typename UInt>
1106 bool upper =
false) {
1109 char buffer[std::numeric_limits<UInt>::digits / BASE_BITS + 2];
1110 format_uint<BASE_BITS>(
buffer,
value, num_digits, upper);
1111 return internal::copy_str<Char>(
buffer, buffer + num_digits, out);
1115 # define FMT_USE_WINDOWS_H 0
1116 #elif !defined(FMT_USE_WINDOWS_H)
1117 # define FMT_USE_WINDOWS_H 1
1122 #if FMT_USE_WINDOWS_H
1125 class utf8_to_utf16 {
1132 size_t size()
const {
return buffer_.size() - 1; }
1133 const wchar_t *c_str()
const {
return &buffer_[0]; }
1134 std::wstring str()
const {
return std::wstring(&buffer_[0],
size()); }
1139 class utf16_to_utf8 {
1147 size_t size()
const {
return buffer_.size() - 1; }
1148 const char *c_str()
const {
return &buffer_[0]; }
1161 template <
typename T =
void>
1196 template <
typename Char>
1203 template <
typename Char,
typename ErrorHandler>
1205 if (next_arg_id_ >= 0)
1207 on_error(
"cannot switch from manual to automatic argument indexing");
1211 namespace internal {
1215 template <
typename Double>
1218 template <
typename Double>
1222 template <
typename Double>
1225 template <
typename Handler>
1248 template <
typename Handler>
1251 case 0:
case 'g':
case 'G':
1252 handler.on_general();
1269 template <
typename Char,
typename Handler>
1272 if (!specs)
return handler.on_char();
1273 if (specs->
type && specs->
type !=
'c')
return handler.on_int();
1275 handler.on_error(
"invalid format specifier for char");
1279 template <
typename Char,
typename Handler>
1281 if (spec == 0 || spec ==
's')
1282 handler.on_string();
1283 else if (spec ==
'p')
1284 handler.on_pointer();
1286 handler.on_error(
"invalid type specifier");
1289 template <
typename Char,
typename ErrorHandler>
1291 if (spec != 0 && spec !=
's')
1292 eh.on_error(
"invalid type specifier");
1295 template <
typename Char,
typename ErrorHandler>
1297 if (spec != 0 && spec !=
'p')
1298 eh.on_error(
"invalid type specifier");
1301 template <
typename ErrorHandler>
1313 ErrorHandler::on_error(
"invalid type specifier");
1317 template <
typename ErrorHandler>
1329 ErrorHandler::on_error(
"invalid type specifier");
1333 template <
typename ErrorHandler>
1348 template <
typename ErrorHandler>
1358 template <
typename Context>
1365 for (
unsigned i = 0;; ++i) {
1378 for (
unsigned i = 0; ; ++i) {
1379 switch (args.
args_[i].type_) {
1383 push_back(args.
args_[i].value_);
1391 template <
typename Range>
1395 typedef decltype(internal::declval<Range>().
begin()) iterator;
1400 writer_type writer_;
1401 format_specs *specs_;
1403 struct char_writer {
1406 size_t size()
const {
return 1; }
1407 size_t width()
const {
return 1; }
1409 template <
typename It>
1410 void operator()(It &&it)
const { *it++ =
value; }
1415 writer_.write_padded(*specs_, char_writer{value});
1417 writer_.write(value);
1420 void write_pointer(
const void *
p) {
1424 writer_.write_int(reinterpret_cast<uintptr_t>(p), specs);
1430 iterator
out() {
return writer_.out(); }
1434 specs_ ? writer_.write_str(sv, *specs_) : writer_.write(sv);
1442 specs_ ? writer_.write_str(sv, *specs_) : writer_.write(sv);
1447 : writer_(r, loc), specs_(s) {}
1454 template <
typename T>
1455 typename std::enable_if<
1461 if (specs_ && specs_->type)
1462 return (*
this)(value ? 1 : 0);
1468 specs_ ? writer_.write_int(value, *specs_) : writer_.write(value);
1473 template <
typename T>
1476 writer_.write_double(value, specs_ ? *specs_ :
format_specs());
1508 if (!specs_)
return write(value), out();
1518 writer_.write_str(value, *specs_);
1520 writer_.write(value);
1528 write_pointer(value);
1533 template <
typename Char>
1535 return (
'a' <= c && c <=
'z') || (
'A' <= c && c <=
'Z') ||
'_' == c;
1542 template <
typename Iterator,
typename ErrorHandler>
1544 assert(
'0' <= *it && *it <=
'9');
1552 unsigned big = max_int / 10;
1556 value = max_int + 1;
1559 value = value * 10 + unsigned(*it -
'0');
1564 }
while (
'0' <= *it && *it <=
'9');
1565 if (value > max_int)
1566 eh.on_error(
"number is too big");
1572 template <
typename Char,
typename ErrorHandler>
1575 assert(begin != end &&
'0' <= *begin && *begin <=
'9');
1576 if (*begin ==
'0') {
1583 unsigned big = max_int / 10;
1587 value = max_int + 1;
1590 value = value * 10 + unsigned(*begin -
'0');
1592 }
while (begin != end &&
'0' <= *begin && *begin <=
'9');
1593 if (value > max_int)
1594 eh.on_error(
"number is too big");
1598 template <
typename Char,
typename Context>
1611 template <
typename T>
1615 template <
typename T>
1623 template <
typename ErrorHandler>
1628 template <
typename T>
1630 typename std::enable_if<
1633 handler_.on_error(
"negative width");
1634 return static_cast<unsigned long long>(
value);
1637 template <
typename T>
1640 handler_.on_error(
"width is not integer");
1648 template <
typename ErrorHandler>
1653 template <
typename T>
1657 handler_.on_error(
"negative precision");
1658 return static_cast<unsigned long long>(
value);
1661 template <
typename T>
1664 handler_.on_error(
"precision is not integer");
1673 template <
typename Char>
1695 specs_.precision =
static_cast<int>(
precision);
1700 specs_.type =
static_cast<char>(
type);
1709 template <
typename Handler>
1713 : Handler(handler), arg_type_(arg_type) {}
1716 : Handler(other), arg_type_(other.arg_type_) {}
1720 require_numeric_argument();
1721 Handler::on_align(align);
1731 Handler::on_minus();
1736 Handler::on_space();
1740 require_numeric_argument();
1745 require_numeric_argument();
1751 this->on_error(
"precision not allowed for this argument type");
1757 this->on_error(
"format specifier requires numeric argument");
1761 require_numeric_argument();
1764 this->on_error(
"format specifier requires signed argument");
1771 template <
template <
typename>
class Handler,
typename T,
1775 unsigned long long big_value =
1778 eh.on_error(
"number is too big");
1779 value =
static_cast<T>(big_value);
1785 template <
typename Context>
1794 template <
typename Id>
1796 set_dynamic_spec<width_checker>(
1797 this->specs_.width_, get_arg(arg_id), context_.error_handler());
1800 template <
typename Id>
1802 set_dynamic_spec<precision_checker>(
1803 this->specs_.precision, get_arg(arg_id), context_.error_handler());
1807 context_.on_error(message);
1812 return context_.next_arg();
1815 template <
typename Id>
1817 context_.parse_context().check_arg_id(arg_id);
1818 return context_.get_arg(arg_id);
1825 template <
typename Char>
1851 template <
typename Char>
1859 template <
typename ParseContext>
1861 public specs_setter<typename ParseContext::char_type> {
1871 specs_(other.specs_), context_(other.context_) {}
1873 template <
typename Id>
1875 specs_.width_ref = make_arg_ref(arg_id);
1878 template <
typename Id>
1880 specs_.precision_ref = make_arg_ref(arg_id);
1884 context_.on_error(message);
1890 template <
typename Id>
1892 context_.check_arg_id(arg_id);
1893 return arg_ref_type(arg_id);
1897 return arg_ref_type(context_.next_arg_id());
1900 dynamic_format_specs<char_type> &specs_;
1901 ParseContext &context_;
1904 template <
typename Iterator,
typename IDHandler>
1908 if (c ==
'}' || c ==
':') {
1912 if (c >=
'0' && c <=
'9') {
1914 if (*it !=
'}' && *it !=
':') {
1915 handler.on_error(
"invalid format string");
1922 handler.on_error(
"invalid format string");
1934 template <
typename Char,
typename IDHandler>
1936 const Char *
begin,
const Char *
end, IDHandler &&handler) {
1937 assert(begin != end);
1939 if (c ==
'}' || c ==
':')
1940 return handler(),
begin;
1941 if (c >=
'0' && c <=
'9') {
1943 if (begin == end || (*begin !=
'}' && *begin !=
':'))
1944 return handler.on_error(
"invalid format string"),
begin;
1949 return handler.on_error(
"invalid format string"),
begin;
1953 }
while (it != end && (
is_name_start(c) || (
'0' <= c && c <=
'9')));
1959 template <
typename SpecHandler,
typename Char>
1966 handler.on_dynamic_width(
id);
1970 handler.on_error(message);
1977 template <
typename SpecHandler,
typename Char>
1983 handler.on_dynamic_precision(
id);
1986 handler.on_dynamic_precision(
id);
1999 template <
typename Iterator,
typename SpecHandler>
2011 switch (static_cast<char>(*p)) {
2028 handler.on_error(
"invalid fill character '{'");
2034 handler.on_align(align);
2040 switch (static_cast<char>(*it)) {
2067 if (
'0' <= *it && *it <=
'9') {
2069 }
else if (*it ==
'{') {
2072 handler.on_error(
"invalid format string");
2080 if (
'0' <= *it && *it <=
'9') {
2082 }
else if (*it ==
'{') {
2086 handler.on_error(
"invalid format string");
2090 handler.on_error(
"missing precision specifier");
2093 handler.end_precision();
2097 if (*it !=
'}' && *it)
2098 handler.on_type(*it++);
2103 template <
bool IS_CONSTEXPR,
typename T,
typename Ptr = const T*>
2105 for (out = first; out != last; ++out) {
2114 const char *
first,
const char *last,
char value,
const char *&out) {
2115 out =
static_cast<const char*
>(std::memchr(
first, value, last -
first));
2119 template <
typename Handler,
typename Char>
2124 handler.on_arg_id(
id);
2127 handler.on_error(message);
2132 template <
bool IS_CONSTEXPR,
typename Char,
typename Handler>
2137 if (begin == end)
return;
2140 if (!find<IS_CONSTEXPR>(begin, end,
'}', p))
2141 return handler_.on_text(begin, end);
2143 if (p == end || *p !=
'}')
2144 return handler_.on_error(
"unmatched '}' in format string");
2145 handler_.on_text(begin, p);
2156 const Char *p =
begin;
2157 if (*
begin !=
'{' && !find<IS_CONSTEXPR>(
begin,
end,
'{', p))
2162 return handler.on_error(
"invalid format string");
2163 if (static_cast<char>(*p) ==
'}') {
2164 handler.on_arg_id();
2165 handler.on_replacement_field(p);
2166 }
else if (*p ==
'{') {
2167 handler.on_text(p, p + 1);
2170 Char
c = p !=
end ? *p : Char();
2172 handler.on_replacement_field(p);
2173 }
else if (c ==
':') {
2175 it = handler.on_format_specs(it);
2177 return handler.on_error(
"unknown format specifier");
2180 return handler.on_error(
"missing '}' in format string");
2187 template <
typename T,
typename ParseContext>
2195 template <
typename Char,
typename ErrorHandler,
typename... Args>
2200 : arg_id_(-1), context_(format_str, eh),
2201 parse_funcs_{&parse_format_specs<Args, parse_context_type>...} {}
2208 arg_id_ = context_.next_arg_id();
2213 context_.check_arg_id(
id);
2222 context_.advance_to(p);
2224 parse_funcs_[arg_id_](context_) : p;
2228 context_.on_error(message);
2233 enum { NUM_ARGS =
sizeof...(Args) };
2237 context_.on_error(
"argument index out of range");
2241 typedef const Char *(*parse_func)(parse_context_type &);
2244 parse_context_type context_;
2245 parse_func parse_funcs_[NUM_ARGS > 0 ? NUM_ARGS : 1];
2248 template <
typename Char,
typename ErrorHandler,
typename... Args>
2252 parse_format_string<true>(
s,
checker);
2256 template <
typename... Args,
typename S>
2262 (
void)invalid_format;
2268 template <
typename Context,
typename T>
2270 std::integral_constant<bool, get_type<Context, T>::value != custom_type> {};
2272 template <
template <
typename>
class Handler,
typename Spec,
typename Context>
2280 internal::set_dynamic_spec<Handler>(
2281 value, ctx.get_arg(ref.
index), ctx.error_handler());
2284 internal::set_dynamic_spec<Handler>(
2286 ctx.error_handler());
2293 template <
typename Range>
2296 typename internal::arg_formatter_base<Range>::iterator>,
2318 :
base(Range(ctx.out()), spec, ctx.locale()), ctx_(ctx) {}
2322 :
base(Range(ctx.out()), &spec), ctx_(ctx) {}
2324 using base::operator();
2365 template <
typename... Args>
2367 : std::runtime_error(
"") {
2397 template <
typename Range>
2401 typedef decltype(internal::declval<Range>().
begin()) iterator;
2406 internal::locale_ref locale_;
2408 iterator out()
const {
return out_; }
2419 template <
typename F>
2422 template <
typename F>
2423 struct padded_int_writer {
2427 std::size_t padding;
2430 size_t size()
const {
return size_; }
2431 size_t width()
const {
return size_; }
2433 template <
typename It>
2434 void operator()(It &&it)
const {
2435 if (prefix.size() != 0)
2436 it = internal::copy_str<char_type>(prefix.begin(), prefix.end(), it);
2437 it = std::fill_n(it, padding,
fill);
2445 template <
typename Spec,
typename F>
2446 void write_int(
unsigned num_digits,
string_view prefix,
2447 const Spec &spec, F
f) {
2448 std::size_t size = prefix.
size() + num_digits;
2450 std::size_t padding = 0;
2452 if (spec.width() >
size) {
2453 padding = spec.width() -
size;
2454 size = spec.width();
2456 }
else if (spec.precision > static_cast<int>(num_digits)) {
2464 write_padded(as, padded_int_writer<F>{
size, prefix,
fill, padding, f});
2468 template <
typename Int>
2469 void write_decimal(
Int value) {
2471 main_type abs_value =
static_cast<main_type
>(
value);
2474 abs_value = 0 - abs_value;
2476 auto &&it =
reserve((is_negative ? 1 : 0) + num_digits);
2479 it = internal::format_decimal<char_type>(it, abs_value, num_digits);
2483 template <
typename Int,
typename Spec>
2489 unsigned_type abs_value;
2491 unsigned prefix_size;
2496 template <
unsigned BITS>
2498 unsigned_type
n = abs_value;
2499 unsigned num_digits = 0;
2502 }
while ((n >>= BITS) != 0);
2507 :
writer(w), spec(s), abs_value(static_cast<unsigned_type>(value)),
2512 abs_value = 0 - abs_value;
2514 prefix[0] = spec.has(
PLUS_FLAG) ?
'+' :
' ';
2523 template <
typename It>
2525 it = internal::format_decimal<char_type>(it, abs_value, num_digits);
2531 writer.write_int(num_digits, get_prefix(), spec,
2532 dec_writer{abs_value, num_digits});
2539 template <
typename It>
2541 it = internal::format_uint<4, char_type>(
2542 it,
self.abs_value, num_digits,
self.spec.type !=
'x');
2548 prefix[prefix_size++] =
'0';
2549 prefix[prefix_size++] =
static_cast<char>(spec.type);
2551 unsigned num_digits = count_digits<4>();
2552 writer.write_int(num_digits, get_prefix(), spec,
2553 hex_writer{*
this, num_digits});
2561 template <
typename It>
2563 it = internal::format_uint<BITS, char_type>(it, abs_value, num_digits);
2569 prefix[prefix_size++] =
'0';
2570 prefix[prefix_size++] =
static_cast<char>(spec.type);
2572 unsigned num_digits = count_digits<1>();
2573 writer.write_int(num_digits, get_prefix(), spec,
2574 bin_writer<1>{abs_value, num_digits});
2578 unsigned num_digits = count_digits<3>();
2580 spec.precision <=
static_cast<int>(num_digits)) {
2583 prefix[prefix_size++] =
'0';
2585 writer.write_int(num_digits, get_prefix(), spec,
2586 bin_writer<3>{abs_value, num_digits});
2589 enum { SEP_SIZE = 1 };
2596 template <
typename It>
2599 it = internal::format_decimal<char_type>(
2607 unsigned size = num_digits + SEP_SIZE * ((num_digits - 1) / 3);
2608 writer.write_int(size, get_prefix(), spec,
2609 num_writer{abs_value,
size, sep});
2618 template <
typename T,
typename Spec>
2619 void write_int(T value,
const Spec &spec) {
2621 int_writer<T, Spec>(*
this, value, spec));
2624 enum {INF_SIZE = 3};
2626 struct inf_or_nan_writer {
2630 size_t size()
const {
2631 return static_cast<std::size_t
>(INF_SIZE + (
sign ? 1 : 0));
2635 template <
typename It>
2636 void operator()(It &&it)
const {
2639 it = internal::copy_str<char_type>(
2640 str, str +
static_cast<std::size_t
>(INF_SIZE), it);
2644 struct double_writer {
2652 template <
typename It>
2653 void operator()(It &&it) {
2658 it = internal::copy_str<char_type>(
buffer.begin(),
buffer.end(), it);
2663 template <
typename T>
2666 template <
typename Char>
2671 size_t size()
const {
return size_; }
2672 size_t width()
const {
2676 template <
typename It>
2677 void operator()(It &&it)
const {
2678 it = internal::copy_str<char_type>(
s, s + size_, it);
2683 template <
typename Char>
2684 void write_str(
const Char *s, std::size_t size,
const align_spec &spec) {
2685 write_padded(spec, str_writer<Char>{
s, size});
2688 template <
typename Char>
2691 template <
typename Char>
2698 : out_(out.
begin()), locale_(loc) {}
2700 void write(
int value) { write_decimal(value); }
2701 void write(
long value) { write_decimal(value); }
2702 void write(
long long value) { write_decimal(value); }
2704 void write(
unsigned value) { write_decimal(value); }
2705 void write(
unsigned long value) { write_decimal(value); }
2706 void write(
unsigned long long value) { write_decimal(value); }
2713 template <
typename T,
typename FormatSpec,
typename... FormatSpecs>
2715 write(T value, FormatSpec spec, FormatSpecs... specs) {
2718 write_int(value, s);
2751 it = internal::copy_str<char_type>(value.
begin(), value.
end(), it);
2759 template <
typename... FormatSpecs>
2764 template <
typename T>
2770 write_int(reinterpret_cast<uintptr_t>(p), specs);
2774 template <
typename Range>
2775 template <
typename F>
2778 size_t size = f.size();
2779 size_t num_code_points = width != 0 ? f.width() :
size;
2780 if (width <= num_code_points)
2782 auto &&it =
reserve(width + (size - num_code_points));
2784 std::size_t padding = width - num_code_points;
2786 it = std::fill_n(it, padding, fill);
2789 std::size_t left_padding = padding / 2;
2790 it = std::fill_n(it, left_padding, fill);
2792 it = std::fill_n(it, padding - left_padding, fill);
2795 it = std::fill_n(it, padding, fill);
2799 template <
typename Range>
2800 template <
typename Char>
2803 const Char *data = s.
data();
2804 std::size_t size = s.
size();
2807 write_str(data, size, spec);
2848 template <
typename Range>
2849 template <
typename T>
2858 if (std::signbit(value)) {
2865 struct write_inf_or_nan_t {
2869 void operator()(
const char *str)
const {
2870 writer.write_padded(spec, inf_or_nan_writer{
sign, str});
2872 } write_inf_or_nan = {*
this, spec, sign};
2876 if (internal::fputil::isnotanumber(value))
2877 return write_inf_or_nan(handler.upper ?
"NAN" :
"nan");
2878 if (internal::fputil::isinfinity(value))
2879 return write_inf_or_nan(handler.upper ?
"INF" :
"inf");
2883 spec.
type !=
'a' && spec.
type !=
'A' &&
2887 normalized_spec.type = handler.type;
2890 size_t n = buffer.
size();
2907 write_padded(as, double_writer{
n,
sign, buffer});
2915 #if FMT_USE_WINDOWS_H
2951 template <
typename... Args>
2959 FMT_API void report_windows_error(
int error_code,
2969 enum {BUFFER_SIZE = std::numeric_limits<unsigned long long>::digits10 + 3};
2970 mutable char buffer_[BUFFER_SIZE];
2975 char *
ptr = buffer_ + BUFFER_SIZE - 1;
2976 while (value >= 100) {
2980 unsigned index =
static_cast<unsigned>((value % 100) * 2);
2986 *--ptr =
static_cast<char>(
'0' +
value);
2989 unsigned index =
static_cast<unsigned>(value * 2);
2995 void format_signed(
long long value) {
2996 unsigned long long abs_value =
static_cast<unsigned long long>(
value);
2999 abs_value = 0 - abs_value;
3022 const char *
data()
const {
return str_; }
3029 buffer_[BUFFER_SIZE - 1] =
'\0';
3044 template <
typename T>
3047 main_type abs_value =
static_cast<main_type
>(
value);
3050 abs_value = 0 - abs_value;
3052 if (abs_value < 100) {
3053 if (abs_value < 10) {
3054 *buffer++ =
static_cast<char>(
'0' + abs_value);
3057 unsigned index =
static_cast<unsigned>(abs_value * 2);
3063 internal::format_decimal<char>(
buffer, abs_value, num_digits);
3064 buffer += num_digits;
3068 template <
typename T,
typename Char>
3071 typename std::enable_if<internal::format_type<
3072 typename buffer_context<Char>::type, T>::value>
::type> {
3076 template <
typename ParseContext>
3083 handler(handler_type(specs_, ctx),
type);
3085 auto type_spec = specs_.type;
3086 auto eh = ctx.error_handler();
3128 template <
typename FormatContext>
3129 auto format(
const T &
val, FormatContext &ctx) -> decltype(ctx.out()) {
3130 internal::handle_dynamic_spec<internal::width_checker>(
3131 specs_.width_, specs_.width_ref, ctx);
3132 internal::handle_dynamic_spec<internal::precision_checker>(
3133 specs_.precision, specs_.precision_ref, ctx);
3137 internal::make_arg<FormatContext>(
val));
3154 template <
typename Char =
char>
3166 template <
typename ParseContext>
3167 auto parse(ParseContext &ctx) -> decltype(ctx.begin()) {
3175 template <
typename T,
typename FormatContext>
3176 auto format(
const T &
val, FormatContext &ctx) -> decltype(ctx.out()) {
3181 if (specs_.flags == 0);
3188 if (specs_.precision != -1)
3193 internal::make_arg<FormatContext>(
val));
3198 template <
typename Context>
3199 void handle_specs(Context &ctx) {
3200 internal::handle_dynamic_spec<internal::width_checker>(
3201 specs_.width_, specs_.width_ref, ctx);
3202 internal::handle_dynamic_spec<internal::precision_checker>(
3203 specs_.precision, specs_.precision_ref, ctx);
3209 template <
typename Range,
typename Char>
3213 map_.init(this->
args());
3216 this->on_error(
"argument not found");
3220 template <
typename ArgFormatter,
typename Char,
typename Context>
3234 it = std::copy_n(begin, size, it);
3263 handler(specs_handler<Context>(specs,
context),
arg.type());
3266 on_error(
"missing '}' in format string");
3277 template <
typename ArgFormatter,
typename Char,
typename Context>
3284 internal::parse_format_string<false>(format_str,
h);
3291 template <
typename T>
3292 inline const void *
ptr(
const T *p) {
return p; }
3294 template <
typename It,
typename Char>
3301 : begin(begin), end(end), sep(sep) {}
3304 template <
typename It,
typename Char>
3306 formatter<typename std::iterator_traits<It>::value_type, Char> {
3307 template <
typename FormatContext>
3309 -> decltype(ctx.out()) {
3311 auto it = value.begin;
3312 auto out = ctx.out();
3313 if (it != value.end) {
3315 while (it != value.end) {
3316 out =
std::copy(value.sep.begin(), value.sep.end(), out);
3317 ctx.advance_to(out);
3325 template <
typename It>
3330 template <
typename It>
3336 #if FMT_USE_TRAILING_RETURN && (!FMT_GCC_VERSION || FMT_GCC_VERSION >= 405)
3337 template <
typename Range>
3343 template <
typename Range>
3362 template <
typename T>
3366 writer(buf).write(value);
3373 template <
typename T>
3381 template <
typename Char, std::
size_t SIZE>
3383 return std::basic_string<Char>(buf.
data(), buf.
size());
3386 template <
typename Char>
3391 return vformat_to<arg_formatter<range>>(
3395 template <
typename S,
typename Char = FMT_CHAR(S)>
3403 typename S,
typename... Args,
3408 const Args &... args) {
3416 namespace internal {
3423 template<
typename... Ts>
3426 template <
typename T,
typename Enable =
void>
3429 template <
typename T>
3432 template <
typename T>
3434 typedef typename T::iterator_category
type;
3438 template <
typename It>
3446 template <
typename U>
3447 static decltype(*(internal::declval<U>()))
test(std::input_iterator_tag);
3448 template <
typename U>
3449 static char&
test(std::output_iterator_tag);
3450 template <
typename U>
3451 static const char&
test(...);
3460 template <
typename OutputIt,
typename Char =
char>
3464 template <
typename OutputIt,
typename Char =
char>
3471 template <
typename String,
typename OutputIt,
typename... Args>
3477 return vformat_to<arg_formatter<range>>(
range(out),
3492 template <
typename OutputIt,
typename S,
typename... Args>
3493 inline typename std::enable_if<
3496 format_to(OutputIt out,
const S &format_str,
const Args &... args) {
3504 template <
typename OutputIt>
3512 template <
typename OutputIt,
typename Char =
typename OutputIt::value_type>
3516 template <
typename OutputIt,
typename Char =
typename OutputIt::value_type>
3522 template <
typename OutputIt,
typename Char,
typename ...Args>
3530 template <
typename OutputIt,
typename Char,
typename... Args>
3531 inline typename std::enable_if<
3537 auto it =
vformat_to(It(out, n), format_str, args);
3538 return {it.base(), it.count()};
3548 template <
typename OutputIt,
typename S,
typename... Args>
3549 inline typename std::enable_if<
3554 const Args &... args) {
3563 template <
typename Char>
3576 template <
typename... Args>
3578 const Args &... args) {
3583 #if FMT_USE_USER_DEFINED_LITERALS
3584 namespace internal {
3586 # if FMT_UDL_TEMPLATE
3587 template <
typename Char, Char... CHARS>
3588 class udl_formatter {
3590 template <
typename... Args>
3591 std::basic_string<Char> operator()(
const Args &... args)
const {
3596 (
void)invalid_format;
3597 return format(s, args...);
3601 template <
typename Char>
3602 struct udl_formatter {
3605 template <
typename... Args>
3606 auto operator()(Args &&... args)
const
3607 -> decltype(
format(str, std::forward<Args>(args)...)) {
3608 return format(str, std::forward<Args>(args)...);
3611 # endif // FMT_UDL_TEMPLATE
3613 template <
typename Char>
3617 template <
typename T>
3618 named_arg<T, Char> operator=(T &&value)
const {
3619 return {str, std::forward<T>(
value)};
3625 inline namespace literals {
3627 # if FMT_UDL_TEMPLATE
3628 template <
typename Char, Char... CHARS>
3629 FMT_CONSTEXPR internal::udl_formatter<Char, CHARS...>
operator""_format() {
3643 inline internal::udl_formatter<char>
3644 operator"" _format(
const char *s, std::size_t) {
return {s}; }
3645 inline internal::udl_formatter<wchar_t>
3646 operator"" _format(
const wchar_t *s, std::size_t) {
return {s}; }
3647 # endif // FMT_UDL_TEMPLATE
3659 inline internal::udl_arg<char>
3660 operator"" _a(
const char *s, std::size_t) {
return {s}; }
3661 inline internal::udl_arg<wchar_t>
3662 operator"" _a(
const wchar_t *s, std::size_t) {
return {s}; }
3664 #endif // FMT_USE_USER_DEFINED_LITERALS
3667 #define FMT_STRING(s) [] { \
3668 typedef typename std::remove_cv<std::remove_pointer< \
3669 typename std::decay<decltype(s)>::type>::type>::type ct; \
3670 struct str : fmt::compile_string { \
3671 typedef ct char_type; \
3672 FMT_CONSTEXPR operator fmt::basic_string_view<ct>() const { \
3673 return {s, sizeof(s) / sizeof(ct) - 1}; \
3679 #if defined(FMT_STRING_ALIAS) && FMT_STRING_ALIAS
3694 # define fmt(s) FMT_STRING(s)
3697 #ifdef FMT_HEADER_ONLY
3698 # define FMT_FUNC inline
3705 #if FMT_GCC_VERSION >= 406 || FMT_CLANG_VERSION
3706 # pragma GCC diagnostic pop
3709 #endif // FMT_FORMAT_H_
float_spec_handler(char t)
counting_iterator & operator++()
FMT_CONSTEXPR cstring_type_checker(ErrorHandler eh)
vint4 max(const vint4 &a, const vint4 &b)
FMT_CONSTEXPR void on_error()
FMT_CONSTEXPR void on_dynamic_precision(Id arg_id)
FMT_CONSTEXPR void on_align(alignment align)
truncating_iterator & operator++()
FMT_CONSTEXPR int_type_checker(ErrorHandler eh)
FMT_CONSTEXPR null_terminating_iterator operator--()
cvex test(vector P=0;int unbound=3;export float s=0;export vector Cf=0;)
FMT_CONSTEXPR void on_string()
Container & get_container(std::back_insert_iterator< Container > it)
FMT_CONSTEXPR specs_setter(basic_format_specs< Char > &specs)
FMT_CONSTEXPR null_terminating_iterator(const Range &r)
GLuint const GLchar * name
FMT_CONSTEXPR void on_error(const char *message)
void operator()(It &&it) const
truncating_iterator & operator=(value_type val)
FMT_CONSTEXPR void check_pointer_type_spec(Char spec, ErrorHandler &&eh)
FMT_CONSTEXPR void on_error(const char *message)
FMT_CONSTEXPR void on_pointer()
FMT_CONSTEXPR void end_precision()
FMT_CONSTEXPR precision_checker(ErrorHandler &eh)
FMT_CONSTEXPR std::enable_if< !std::numeric_limits< T >::is_signed, bool >::type is_negative(T)
bool operator>=(null_terminating_iterator other) const
GLint GLint GLint GLint GLint GLint GLsizei width
FMT_CONSTEXPR auto begin(const C &c) -> decltype(c.begin())
FMT_CONSTEXPR void on_oct()
T negative(const T &val)
Return the unary negation of the given value.
basic_format_specs< Char > & specs_
GLuint GLenum GLenum transform
void write(long double value)
truncating_iterator(OutputIt out, std::size_t limit)
FMT_CONSTEXPR void on_type(Char type)
static bool isinfinity(T x)
ImageBuf OIIO_API fill(cspan< float > values, ROI roi, int nthreads=0)
GLuint const GLfloat * val
void grow(std::size_t size) FMT_OVERRIDE
It format_uint(It out, UInt value, unsigned num_digits, bool upper=false)
internal::named_arg< T, char > arg(string_view name, const T &arg)
FMT_CONSTEXPR void on_minus()
GLboolean GLboolean GLboolean GLboolean a
void handle_dynamic_spec(Spec &value, arg_ref< typename Context::char_type > ref, Context &ctx)
std::ptrdiff_t difference_type
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
unsigned count_digits(uint64_t n)
FMT_CONSTEXPR void on_zero()
FMT_CONSTEXPR void handle_float_type_spec(char spec, Handler &&handler)
arg_ref(basic_string_view< Char > nm)
FMT_CONSTEXPR null_terminating_iterator operator++(int)
void write(unsigned long value)
void on_error(const char *message)
FMT_CONSTEXPR float_type_checker(ErrorHandler eh)
FMT_CONSTEXPR std::enable_if< is_integer< T >::value, unsigned long long >::type operator()(T value)
FMT_CONSTEXPR bool is_name_start(Char c)
GLsizei GLsizei GLchar * source
FMT_CONSTEXPR specs_checker(const Handler &handler, internal::type arg_type)
size_t count_code_points(basic_string_view< Char > s)
truncating_iterator(OutputIt out, std::size_t limit)
Allocator get_allocator() const
std::size_t count() const
std::enable_if< needs_conversion< InputIt, OutChar >::value, OutputIt >::type copy_str(InputIt begin, InputIt end, OutputIt it)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
void write(unsigned long long value)
FMT_CONSTEXPR Char operator*() const
#define FMT_CONSTEXPR_DECL
FMT_CONSTEXPR void on_width(unsigned width)
FMT_CONSTEXPR void operator()(unsigned id)
Tto convert(const Tfrom &source)
Context::char_type char_type
ImageBuf OIIO_API checker(int width, int height, int depth, cspan< float > color1, cspan< float > color2, int xoffset, int yoffset, int zoffset, ROI roi, int nthreads=0)
FMT_CONSTEXPR T * end(T(&array)[N]) FMT_NOEXCEPT
basic_memory_buffer & operator=(basic_memory_buffer &&other)
basic_string_view< wchar_t > wstring_view
FMT_CONSTEXPR specs_checker(const specs_checker &other)
FMT_CONSTEXPR void on_zero()
format_arg_store< context, Args...> as
FMT_CONSTEXPR dynamic_specs_handler(const dynamic_specs_handler &other)
basic_format_context< OutputIt, Char > type
system_error(int error_code, string_view message, const Args &...args)
FMT_CONSTEXPR null_terminating_iterator operator-(difference_type n)
FMT_CONSTEXPR null_terminating_iterator(const Char *ptr, const Char *end)
FMT_CONSTEXPR void operator()()
std::enable_if< sizeof(Double)!=sizeof(uint64_t), bool >::type grisu2_format(Double, buffer &, core_format_specs)
FMT_API Char thousands_sep_impl(locale_ref loc)
FMT_CONSTEXPR void handle_char_specs(const basic_format_specs< Char > *specs, Handler &&handler)
FMT_CONSTEXPR void on_bin()
u8string_view(const char *s)
#define FMT_END_NAMESPACE
FMT_CONSTEXPR size_t size() const
FMT_CONSTEXPR void on_error(const char *message)
string_value< Char > name
FMT_CONSTEXPR void on_plus()
FMT_CONSTEXPR void on_dynamic_width(Id arg_id)
truncating_iterator & operator*()
std::enable_if<!is_compile_string< S >::value >::type check_format_string(const S &)
void write(wstring_view value)
Container::value_type value_type
FMT_CONSTEXPR void operator()(basic_string_view< Char > id)
FMT_CONSTEXPR specs_setter(const specs_setter &other)
FMT_CONSTEXPR void on_num()
FMT_CONSTEXPR void check_string_type_spec(Char spec, ErrorHandler &&eh)
FMT_CONSTEXPR void operator()(unsigned id)
static bool isnotanumber(T x)
void write(long long value)
const_iterator end() const
FMT_CONSTEXPR void handle_int_type_spec(char spec, Handler &&handler)
std::enable_if< std::is_integral< T >::value, void >::type write(T value, FormatSpec spec, FormatSpecs...specs)
FMT_CONSTEXPR void on_general()
Dest bit_cast(const Source &source)
FMT_CONSTEXPR void on_int()
void advance_to(iterator it)
FMT_CONSTEXPR void operator()()
buffer_context< Char >::type::iterator vformat_to(internal::basic_buffer< Char > &buf, basic_string_view< Char > format_str, basic_format_args< typename buffer_context< Char >::type > args)
FMT_CONSTEXPR void on_align(alignment align)
FMT_CONSTEXPR auto end(const C &c) -> decltype(c.end())
counting_iterator operator++(int)
FMT_CONSTEXPR void operator()(unsigned id)
FMT_CONSTEXPR const Char * parse_arg_id(const Char *begin, const Char *end, IDHandler &&handler)
GLint GLint GLint GLint GLint x
truncating_iterator & operator++(int)
FMT_CONSTEXPR std::enable_if< is_integer< T >::value, unsigned long long >::type operator()(T value)
Iterator & reserve(Iterator &it, std::size_t)
FMT_CONSTEXPR const Char * data() const
value_type & operator*() const
std::enable_if< is_contiguous< Container >::value, typename checked< typename Container::value_type >::type >::type reserve(std::back_insert_iterator< Container > &it, std::size_t n)
ParseContext::char_type char_type
FMT_CONSTEXPR bool is_arithmetic(type t)
void sprintf_format(Double value, internal::buffer &buffer, core_format_specs spec)
GLint GLenum GLsizei GLint GLsizei const void * data
FMT_CONSTEXPR void operator()()
FMT_CONSTEXPR void on_error()
FMT_CONSTEXPR void on_hex()
std::basic_string< Char > vformat(basic_string_view< Char > format_str, basic_format_args< typename buffer_context< Char >::type > args)
format_arg get_arg(unsigned arg_id)
FMT_CONSTEXPR bool is_integral(type t)
GLubyte GLubyte GLubyte GLubyte w
FMT_CONSTEXPR T * begin(T(&array)[N]) FMT_NOEXCEPT
basic_string_view< char > string_view
FMT_CONSTEXPR std::enable_if< !is_integer< T >::value, unsigned long long >::type operator()(T)
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
truncating_iterator_base(OutputIt out, std::size_t limit)
FMT_CONSTEXPR void on_error(const char *message)
std::size_t size() const FMT_NOEXCEPT
GLuint GLsizei GLsizei * length
const_iterator begin() const
std::size_t capacity() const FMT_NOEXCEPT
std::output_iterator_tag iterator_category
FMT_CONSTEXPR arg_ref(unsigned index)
FMT_CONSTEXPR bool operator!=(null_terminating_iterator other) const
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
std::random_access_iterator_tag type
FMT_CONSTEXPR void on_fixed()
Range::value_type char_type
FMT_CONSTEXPR void end_precision()
FMT_CONSTEXPR difference_type operator-(null_terminating_iterator other) const
FMT_CONSTEXPR arg_ref & operator=(unsigned idx)
FMT_CONSTEXPR void set_dynamic_spec(T &value, basic_format_arg< Context > arg, ErrorHandler eh)
std::enable_if< std::is_same< T, void >::value >::type write(const T *p)
GLfloat GLfloat GLfloat GLfloat h
FMT_CONSTEXPR void on_char()
static const char DIGITS[]
char * lg(uint32_t n, Handler h) FMT_ALWAYS_INLINE
void operator()(It &&it) const
FMT_CONSTEXPR char_specs_checker(char type, ErrorHandler eh)
FMT_API size_t count_code_points(basic_string_view< char8_t > s)
FMT_CONSTEXPR precision_adapter(SpecHandler &h)
FMT_CONSTEXPR std::enable_if< !is_integer< T >::value, unsigned long long >::type operator()(T)
FMT_CONSTEXPR void on_hash()
GLuint GLuint GLsizei GLenum type
FMT_CONSTEXPR void operator()(basic_string_view< Char > id)
format_arg_store< Context, Args...> make_format_args(const Args &...args)
FMT_CONSTEXPR void on_precision(unsigned precision)
FMT_CONSTEXPR wchar_t fill() const
FMT_CONSTEXPR width_adapter(SpecHandler &h)
FMT_CONSTEXPR align_spec()
std::random_access_iterator_tag iterator_category
traits::value_type value_type
char8_t to_char8_t(char c)
void write(unsigned value)
void write(wchar_t value)
FMT_CONSTEXPR unsigned width() const
FMT_CONSTEXPR const ParseContext::char_type * parse_format_specs(ParseContext &ctx)
FMT_CONSTEXPR void handle_cstring_type_spec(Char spec, Handler &&handler)
FMT_CONSTEXPR null_terminating_iterator & operator=(const Char *ptr)
std::numeric_limits< internal::dummy_int > fputil
GLdouble GLdouble GLdouble b
FMT_CONSTEXPR void on_dynamic_width(Id arg_id)
T * make_checked(T *p, std::size_t)
GLsizei const GLchar *const * string
FMT_CONSTEXPR void on_minus()
arg_join(It begin, It end, basic_string_view< Char > sep)
Allocator::value_type * allocate(Allocator &alloc, std::size_t n)
FMT_CONSTEXPR std::enable_if< std::numeric_limits< T >::is_signed, bool >::type is_negative(T value)
FMT_CONSTEXPR void on_fill(Char fill)
FMT_CONSTEXPR std::make_unsigned< Int >::type to_unsigned(Int value)
FMT_CONSTEXPR void on_dynamic_precision(Id arg_id)
std::size_t count() const
basic_printf_context_t< buffer >::type context
FMT_CONSTEXPR void on_hex()
basic_string_view< Char > sep
truncating_iterator operator++(int)
void operator()(It &&it) const
FMT_CONSTEXPR void operator()(basic_string_view< Char > id)
FMT_CONSTEXPR null_terminating_iterator operator+=(difference_type n)
FMT_CONSTEXPR bool find(Ptr first, Ptr last, T value, Ptr &out)
null_terminating_iterator()
GLdouble GLdouble GLdouble r
OIIO_API bool copy(string_view from, string_view to, std::string &err)
GLuint GLuint GLsizei count
FMT_CONSTEXPR unsigned parse_nonnegative_int(const Char *&begin, const Char *end, ErrorHandler &&eh)
void operator()(It &&it) const
add_thousands_sep(basic_string_view< Char > sep)
GA_API const UT_StringHolder N
basic_memory_buffer(basic_memory_buffer &&other)
FMT_CONSTEXPR bool do_check_format_string(basic_string_view< Char > s, ErrorHandler eh=ErrorHandler())
FMT_CONSTEXPR void on_space()
counting_iterator _Unchecked_type
FMT_CONSTEXPR iterator end() const
FMT_CONSTEXPR void on_dec()
FMT_FUNC std::enable_if< sizeof(Double)==sizeof(uint64_t), bool >::type grisu2_format(Double value, buffer &buf, core_format_specs specs)
basic_memory_buffer(const Allocator &alloc=Allocator())
T::iterator_category type
void write(string_view value)
#define FMT_ASSERT(condition, message)
FMT_CONSTEXPR iterator begin() const
#define FMT_BEGIN_NAMESPACE
FMT_CONSTEXPR void on_plus()
FMT_CONSTEXPR void on_space()
truncating_iterator & operator++()
basic_string_view< Char > to_string_view(basic_string_view< Char > s)
basic_writer(Range out, internal::locale_ref loc=internal::locale_ref())
FMT_CONSTEXPR width_checker(ErrorHandler &eh)
void write(T &out, bool v)
void operator()(Char *&buffer)
GLenum GLuint GLsizei const GLchar * buf
FMT_CONSTEXPR specs_handler(basic_format_specs< char_type > &specs, Context &ctx)
FMT_CONSTEXPR void parse_format_string(basic_string_view< Char > format_str, Handler &&handler)
basic_parse_context< char_type > & parse_context()
GLenum GLint GLint * precision
FMT_CONSTEXPR void on_exp()
GLsizei const GLfloat * value
FMT_CONSTEXPR unsigned next_arg_id()
std::ptrdiff_t difference_type
FMT_CONSTEXPR null_terminating_iterator operator+(difference_type n)
FMT_CONSTEXPR void on_hash()
wchar_t thousands_sep(locale_ref loc)
FMT_CONSTEXPR internal::result_of< Visitor(int)>::type visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg)
FMT_CONSTEXPR null_terminating_iterator operator++()
output_range(OutputIt it)
std::output_iterator_tag iterator_category
back_insert_range(Container &c)
back_insert_range(typename base::iterator it)
OutputIt::container_type::value_type value_type
FMT_CONSTEXPR dynamic_specs_handler(dynamic_format_specs< char_type > &specs, ParseContext &ctx)
u8string_view(const char *s, size_t count) FMT_NOEXCEPT
void write(basic_string_view< char_type > str, FormatSpecs...specs)
FMT_CONSTEXPR const Char * pointer_from(null_terminating_iterator< Char > it)
bool find< false, char >(const char *first, const char *last, char value, const char *&out)
truncating_iterator_base _Unchecked_type
FMT_CONSTEXPR alignment align() const
void set(T *buf_data, std::size_t buf_capacity) FMT_NOEXCEPT