HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
printf.h
Go to the documentation of this file.
1 // Formatting library for C++ - legacy printf implementation
2 //
3 // Copyright (c) 2012 - 2016, Victor Zverovich
4 // All rights reserved.
5 //
6 // For the license information refer to format.h.
7 
8 #ifndef FMT_PRINTF_H_
9 #define FMT_PRINTF_H_
10 
11 #include <algorithm> // std::max
12 #include <limits> // std::numeric_limits
13 
14 #include "format.h"
15 
18 
19 template <typename T> struct printf_formatter { printf_formatter() = delete; };
20 
21 template <typename Char>
24 };
25 
26 template <typename OutputIt, typename Char> class basic_printf_context {
27  private:
28  OutputIt out_;
30 
31  public:
32  using char_type = Char;
35  template <typename T> using formatter_type = printf_formatter<T>;
36 
37  /**
38  \rst
39  Constructs a ``printf_context`` object. References to the arguments are
40  stored in the context object so make sure they have appropriate lifetimes.
41  \endrst
42  */
45  : out_(out), args_(args) {}
46 
47  OutputIt out() { return out_; }
48  void advance_to(OutputIt it) { out_ = it; }
49 
50  detail::locale_ref locale() { return {}; }
51 
52  format_arg arg(int id) const { return args_.get(id); }
53 
54  FMT_CONSTEXPR void on_error(const char* message) {
56  }
57 };
58 
60 
61 // Checks if a value fits in int - used to avoid warnings about comparing
62 // signed and unsigned integers.
63 template <bool IsSigned> struct int_checker {
64  template <typename T> static bool fits_in_int(T value) {
65  unsigned max = max_value<int>();
66  return value <= max;
67  }
68  static bool fits_in_int(bool) { return true; }
69 };
70 
71 template <> struct int_checker<true> {
72  template <typename T> static bool fits_in_int(T value) {
73  return value >= (std::numeric_limits<int>::min)() &&
75  }
76  static bool fits_in_int(int) { return true; }
77 };
78 
80  public:
82  int operator()(T value) {
84  throw_format_error("number is too big");
85  return (std::max)(static_cast<int>(value), 0);
86  }
87 
89  int operator()(T) {
90  throw_format_error("precision is not integer");
91  return 0;
92  }
93 };
94 
95 // An argument visitor that returns true iff arg is a zero integer.
96 class is_zero_int {
97  public:
99  bool operator()(T value) {
100  return value == 0;
101  }
102 
104  bool operator()(T) {
105  return false;
106  }
107 };
108 
109 template <typename T> struct make_unsigned_or_bool : std::make_unsigned<T> {};
110 
111 template <> struct make_unsigned_or_bool<bool> { using type = bool; };
112 
113 template <typename T, typename Context> class arg_converter {
114  private:
115  using char_type = typename Context::char_type;
116 
118  char_type type_;
119 
120  public:
122  : arg_(arg), type_(type) {}
123 
124  void operator()(bool value) {
125  if (type_ != 's') operator()<bool>(value);
126  }
127 
129  void operator()(U value) {
130  bool is_signed = type_ == 'd' || type_ == 'i';
131  using target_type = conditional_t<std::is_same<T, void>::value, U, T>;
132  if (const_check(sizeof(target_type) <= sizeof(int))) {
133  // Extra casts are used to silence warnings.
134  if (is_signed) {
135  arg_ = detail::make_arg<Context>(
136  static_cast<int>(static_cast<target_type>(value)));
137  } else {
138  using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
139  arg_ = detail::make_arg<Context>(
140  static_cast<unsigned>(static_cast<unsigned_type>(value)));
141  }
142  } else {
143  if (is_signed) {
144  // glibc's printf doesn't sign extend arguments of smaller types:
145  // std::printf("%lld", -42); // prints "4294967254"
146  // but we don't have to do the same because it's a UB.
147  arg_ = detail::make_arg<Context>(static_cast<long long>(value));
148  } else {
149  arg_ = detail::make_arg<Context>(
150  static_cast<typename make_unsigned_or_bool<U>::type>(value));
151  }
152  }
153  }
154 
156  void operator()(U) {} // No conversion needed for non-integral types.
157 };
158 
159 // Converts an integer argument to T for printf, if T is an integral type.
160 // If T is void, the argument is converted to corresponding signed or unsigned
161 // type depending on the type specifier: 'd' and 'i' - signed, other -
162 // unsigned).
163 template <typename T, typename Context, typename Char>
166 }
167 
168 // Converts an integer argument to char for printf.
169 template <typename Context> class char_converter {
170  private:
172 
173  public:
174  explicit char_converter(basic_format_arg<Context>& arg) : arg_(arg) {}
175 
177  void operator()(T value) {
178  arg_ = detail::make_arg<Context>(
179  static_cast<typename Context::char_type>(value));
180  }
181 
183  void operator()(T) {} // No conversion needed for non-integral types.
184 };
185 
186 // An argument visitor that return a pointer to a C string if argument is a
187 // string or null otherwise.
188 template <typename Char> struct get_cstring {
189  template <typename T> const Char* operator()(T) { return nullptr; }
190  const Char* operator()(const Char* s) { return s; }
191 };
192 
193 // Checks if an argument is a valid printf width specifier and sets
194 // left alignment if it is negative.
195 template <typename Char> class printf_width_handler {
196  private:
197  format_specs<Char>& specs_;
198 
199  public:
200  explicit printf_width_handler(format_specs<Char>& specs) : specs_(specs) {}
201 
203  unsigned operator()(T value) {
204  auto width = static_cast<uint32_or_64_or_128_t<T>>(value);
205  if (detail::is_negative(value)) {
206  specs_.align = align::left;
207  width = 0 - width;
208  }
209  unsigned int_max = max_value<int>();
210  if (width > int_max) throw_format_error("number is too big");
211  return static_cast<unsigned>(width);
212  }
213 
215  unsigned operator()(T) {
216  throw_format_error("width is not integer");
217  return 0;
218  }
219 };
220 
221 // Workaround for a bug with the XL compiler when initializing
222 // printf_arg_formatter's base class.
223 template <typename Char>
224 auto make_arg_formatter(buffer_appender<Char> iter, format_specs<Char>& s)
226  return {iter, s, locale_ref()};
227 }
228 
229 // The ``printf`` argument formatter.
230 template <typename OutputIt, typename Char>
231 class printf_arg_formatter : public arg_formatter<Char> {
232  private:
233  using base = arg_formatter<Char>;
235 
236  context_type& context_;
237 
238  OutputIt write_null_pointer(bool is_string = false) {
239  auto s = this->specs;
240  s.type = presentation_type::none;
241  return write_bytes(this->out, is_string ? "(null)" : "(nil)", s);
242  }
243 
244  public:
246  : base(make_arg_formatter(iter, s)), context_(ctx) {}
247 
248  OutputIt operator()(monostate value) { return base::operator()(value); }
249 
251  OutputIt operator()(T value) {
252  // MSVC2013 fails to compile separate overloads for bool and Char so use
253  // std::is_same instead.
255  format_specs<Char> fmt_specs = this->specs;
256  if (fmt_specs.type != presentation_type::none &&
257  fmt_specs.type != presentation_type::chr) {
258  return (*this)(static_cast<int>(value));
259  }
260  fmt_specs.sign = sign::none;
261  fmt_specs.alt = false;
262  fmt_specs.fill[0] = ' '; // Ignore '0' flag for char types.
263  // align::numeric needs to be overwritten here since the '0' flag is
264  // ignored for non-numeric types
265  if (fmt_specs.align == align::none || fmt_specs.align == align::numeric)
266  fmt_specs.align = align::right;
267  return write<Char>(this->out, static_cast<Char>(value), fmt_specs);
268  }
269  return base::operator()(value);
270  }
271 
273  OutputIt operator()(T value) {
274  return base::operator()(value);
275  }
276 
277  /** Formats a null-terminated C string. */
278  OutputIt operator()(const char* value) {
279  if (value) return base::operator()(value);
280  return write_null_pointer(this->specs.type != presentation_type::pointer);
281  }
282 
283  /** Formats a null-terminated wide C string. */
284  OutputIt operator()(const wchar_t* value) {
285  if (value) return base::operator()(value);
286  return write_null_pointer(this->specs.type != presentation_type::pointer);
287  }
288 
290  return base::operator()(value);
291  }
292 
293  /** Formats a pointer. */
294  OutputIt operator()(const void* value) {
295  return value ? base::operator()(value) : write_null_pointer();
296  }
297 
298  /** Formats an argument of a custom (user-defined) type. */
300  auto parse_ctx =
302  handle.format(parse_ctx, context_);
303  return this->out;
304  }
305 };
306 
307 template <typename Char>
308 void parse_flags(format_specs<Char>& specs, const Char*& it, const Char* end) {
309  for (; it != end; ++it) {
310  switch (*it) {
311  case '-':
312  specs.align = align::left;
313  break;
314  case '+':
315  specs.sign = sign::plus;
316  break;
317  case '0':
318  specs.fill[0] = '0';
319  break;
320  case ' ':
321  if (specs.sign != sign::plus) {
322  specs.sign = sign::space;
323  }
324  break;
325  case '#':
326  specs.alt = true;
327  break;
328  default:
329  return;
330  }
331  }
332 }
333 
334 template <typename Char, typename GetArg>
335 int parse_header(const Char*& it, const Char* end, format_specs<Char>& specs,
336  GetArg get_arg) {
337  int arg_index = -1;
338  Char c = *it;
339  if (c >= '0' && c <= '9') {
340  // Parse an argument index (if followed by '$') or a width possibly
341  // preceded with '0' flag(s).
342  int value = parse_nonnegative_int(it, end, -1);
343  if (it != end && *it == '$') { // value is an argument index
344  ++it;
345  arg_index = value != -1 ? value : max_value<int>();
346  } else {
347  if (c == '0') specs.fill[0] = '0';
348  if (value != 0) {
349  // Nonzero value means that we parsed width and don't need to
350  // parse it or flags again, so return now.
351  if (value == -1) throw_format_error("number is too big");
352  specs.width = value;
353  return arg_index;
354  }
355  }
356  }
357  parse_flags(specs, it, end);
358  // Parse width.
359  if (it != end) {
360  if (*it >= '0' && *it <= '9') {
361  specs.width = parse_nonnegative_int(it, end, -1);
362  if (specs.width == -1) throw_format_error("number is too big");
363  } else if (*it == '*') {
364  ++it;
365  specs.width = static_cast<int>(visit_format_arg(
366  detail::printf_width_handler<Char>(specs), get_arg(-1)));
367  }
368  }
369  return arg_index;
370 }
371 
373  -> presentation_type {
374  using pt = presentation_type;
375  constexpr auto integral_set = sint_set | uint_set | bool_set | char_set;
376  switch (c) {
377  case 'd':
378  return in(t, integral_set) ? pt::dec : pt::none;
379  case 'o':
380  return in(t, integral_set) ? pt::oct : pt::none;
381  case 'x':
382  return in(t, integral_set) ? pt::hex_lower : pt::none;
383  case 'X':
384  return in(t, integral_set) ? pt::hex_upper : pt::none;
385  case 'a':
386  return in(t, float_set) ? pt::hexfloat_lower : pt::none;
387  case 'A':
388  return in(t, float_set) ? pt::hexfloat_upper : pt::none;
389  case 'e':
390  return in(t, float_set) ? pt::exp_lower : pt::none;
391  case 'E':
392  return in(t, float_set) ? pt::exp_upper : pt::none;
393  case 'f':
394  return in(t, float_set) ? pt::fixed_lower : pt::none;
395  case 'F':
396  return in(t, float_set) ? pt::fixed_upper : pt::none;
397  case 'g':
398  return in(t, float_set) ? pt::general_lower : pt::none;
399  case 'G':
400  return in(t, float_set) ? pt::general_upper : pt::none;
401  case 'c':
402  return in(t, integral_set) ? pt::chr : pt::none;
403  case 's':
404  return in(t, string_set | cstring_set) ? pt::string : pt::none;
405  case 'p':
407  default:
408  return pt::none;
409  }
410 }
411 
412 template <typename Char, typename Context>
415  using iterator = buffer_appender<Char>;
416  auto out = iterator(buf);
417  auto context = basic_printf_context<iterator, Char>(out, args);
418  auto parse_ctx = basic_printf_parse_context<Char>(format);
419 
420  // Returns the argument with specified index or, if arg_index is -1, the next
421  // argument.
422  auto get_arg = [&](int arg_index) {
423  if (arg_index < 0)
424  arg_index = parse_ctx.next_arg_id();
425  else
426  parse_ctx.check_arg_id(--arg_index);
427  return detail::get_arg(context, arg_index);
428  };
429 
430  const Char* start = parse_ctx.begin();
431  const Char* end = parse_ctx.end();
432  auto it = start;
433  while (it != end) {
434  if (!find<false, Char>(it, end, '%', it)) {
435  it = end; // find leaves it == nullptr if it doesn't find '%'.
436  break;
437  }
438  Char c = *it++;
439  if (it != end && *it == c) {
440  out = write(out, basic_string_view<Char>(start, to_unsigned(it - start)));
441  start = ++it;
442  continue;
443  }
444  out =
445  write(out, basic_string_view<Char>(start, to_unsigned(it - 1 - start)));
446 
447  auto specs = format_specs<Char>();
448  specs.align = align::right;
449 
450  // Parse argument index, flags and width.
451  int arg_index = parse_header(it, end, specs, get_arg);
452  if (arg_index == 0) throw_format_error("argument not found");
453 
454  // Parse precision.
455  if (it != end && *it == '.') {
456  ++it;
457  c = it != end ? *it : 0;
458  if ('0' <= c && c <= '9') {
459  specs.precision = parse_nonnegative_int(it, end, 0);
460  } else if (c == '*') {
461  ++it;
462  specs.precision = static_cast<int>(
464  } else {
465  specs.precision = 0;
466  }
467  }
468 
469  auto arg = get_arg(arg_index);
470  // For d, i, o, u, x, and X conversion specifiers, if a precision is
471  // specified, the '0' flag is ignored
472  if (specs.precision >= 0 && arg.is_integral())
473  specs.fill[0] =
474  ' '; // Ignore '0' flag for non-numeric types or if '-' present.
475  if (specs.precision >= 0 && arg.type() == type::cstring_type) {
476  auto str = visit_format_arg(get_cstring<Char>(), arg);
477  auto str_end = str + specs.precision;
478  auto nul = std::find(str, str_end, Char());
479  arg = make_arg<basic_printf_context<iterator, Char>>(
481  str, to_unsigned(nul != str_end ? nul - str : specs.precision)));
482  }
483  if (specs.alt && visit_format_arg(is_zero_int(), arg)) specs.alt = false;
484  if (specs.fill[0] == '0') {
485  if (arg.is_arithmetic() && specs.align != align::left)
486  specs.align = align::numeric;
487  else
488  specs.fill[0] = ' '; // Ignore '0' flag for non-numeric types or if '-'
489  // flag is also present.
490  }
491 
492  // Parse length and convert the argument to the required type.
493  c = it != end ? *it++ : 0;
494  Char t = it != end ? *it : 0;
495  switch (c) {
496  case 'h':
497  if (t == 'h') {
498  ++it;
499  t = it != end ? *it : 0;
500  convert_arg<signed char>(arg, t);
501  } else {
502  convert_arg<short>(arg, t);
503  }
504  break;
505  case 'l':
506  if (t == 'l') {
507  ++it;
508  t = it != end ? *it : 0;
509  convert_arg<long long>(arg, t);
510  } else {
511  convert_arg<long>(arg, t);
512  }
513  break;
514  case 'j':
515  convert_arg<intmax_t>(arg, t);
516  break;
517  case 'z':
518  convert_arg<size_t>(arg, t);
519  break;
520  case 't':
521  convert_arg<std::ptrdiff_t>(arg, t);
522  break;
523  case 'L':
524  // printf produces garbage when 'L' is omitted for long double, no
525  // need to do the same.
526  break;
527  default:
528  --it;
529  convert_arg<void>(arg, c);
530  }
531 
532  // Parse type.
533  if (it == end) throw_format_error("invalid format string");
534  char type = static_cast<char>(*it++);
535  if (arg.is_integral()) {
536  // Normalize type.
537  switch (type) {
538  case 'i':
539  case 'u':
540  type = 'd';
541  break;
542  case 'c':
545  break;
546  }
547  }
548  specs.type = parse_printf_presentation_type(type, arg.type());
549  if (specs.type == presentation_type::none)
550  throw_format_error("invalid format specifier");
551 
552  start = it;
553 
554  // Format argument.
555  out = visit_format_arg(
556  printf_arg_formatter<iterator, Char>(out, specs, context), arg);
557  }
558  write(out, basic_string_view<Char>(start, to_unsigned(it - start)));
559 }
561 
562 template <typename Char>
565 
568 
571 
572 /**
573  \rst
574  Constructs an `~fmt::format_arg_store` object that contains references to
575  arguments and can be implicitly converted to `~fmt::printf_args`.
576  \endrst
577  */
578 template <typename... T>
579 inline auto make_printf_args(const T&... args)
581  return {args...};
582 }
583 
584 /**
585  \rst
586  Constructs an `~fmt::format_arg_store` object that contains references to
587  arguments and can be implicitly converted to `~fmt::wprintf_args`.
588  \endrst
589  */
590 template <typename... T>
591 inline auto make_wprintf_args(const T&... args)
593  return {args...};
594 }
595 
596 template <typename S, typename Char = char_t<S>>
597 inline auto vsprintf(
598  const S& fmt,
599  basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
603  return to_string(buf);
604 }
605 
606 /**
607  \rst
608  Formats arguments and returns the result as a string.
609 
610  **Example**::
611 
612  std::string message = fmt::sprintf("The answer is %d", 42);
613  \endrst
614 */
615 template <typename S, typename... T,
617 inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string<Char> {
618  using context = basic_printf_context_t<Char>;
619  return vsprintf(detail::to_string_view(fmt),
620  fmt::make_format_args<context>(args...));
621 }
622 
623 template <typename S, typename Char = char_t<S>>
624 inline auto vfprintf(
625  std::FILE* f, const S& fmt,
626  basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
627  -> int {
630  size_t size = buf.size();
631  return std::fwrite(buf.data(), sizeof(Char), size, f) < size
632  ? -1
633  : static_cast<int>(size);
634 }
635 
636 /**
637  \rst
638  Prints formatted data to the file *f*.
639 
640  **Example**::
641 
642  fmt::fprintf(stderr, "Don't %s!", "panic");
643  \endrst
644  */
645 template <typename S, typename... T, typename Char = char_t<S>>
646 inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int {
647  using context = basic_printf_context_t<Char>;
648  return vfprintf(f, detail::to_string_view(fmt),
649  fmt::make_format_args<context>(args...));
650 }
651 
652 template <typename S, typename Char = char_t<S>>
653 inline auto vprintf(
654  const S& fmt,
655  basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
656  -> int {
657  return vfprintf(stdout, detail::to_string_view(fmt), args);
658 }
659 
660 /**
661  \rst
662  Prints formatted data to ``stdout``.
663 
664  **Example**::
665 
666  fmt::printf("Elapsed time: %.2f seconds", 1.23);
667  \endrst
668  */
669 template <typename S, typename... T, FMT_ENABLE_IF(detail::is_string<S>::value)>
670 inline auto printf(const S& fmt, const T&... args) -> int {
671  return vprintf(
673  fmt::make_format_args<basic_printf_context_t<char_t<S>>>(args...));
674 }
675 
678 
679 #endif // FMT_PRINTF_H_
FMT_NORETURN FMT_API void throw_format_error(const char *message)
Definition: format-inl.h:39
static bool fits_in_int(int)
Definition: printf.h:76
#define FMT_ENABLE_IF(...)
Definition: core.h:289
auto make_wprintf_args(const T &...args) -> format_arg_store< wprintf_context, T...>
Definition: printf.h:591
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
typename std::enable_if< B, T >::type enable_if_t
Define Imath::enable_if_t to be std for C++14, equivalent for C++11.
#define FMT_BEGIN_EXPORT
Definition: core.h:186
bool none(const vbool4 &v)
Definition: simd.h:3601
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
FMT_CONSTEXPR void on_error(const char *message)
Definition: printf.h:54
#define FMT_END_DETAIL_NAMESPACE
Definition: format.h:53
OutputIt operator()(const char *value)
Definition: printf.h:278
auto to_string(const T &value) -> std::string
Definition: format.h:4527
presentation_type
Definition: core.h:2037
typename detail::char_t_impl< S >::type char_t
Definition: core.h:643
void format(typename Context::parse_context_type &parse_ctx, Context &ctx) const
Definition: core.h:1532
int parse_header(const Char *&it, const Char *end, format_specs< Char > &specs, GetArg get_arg)
Definition: printf.h:335
GLint left
Definition: glcorearb.h:2005
typename std::conditional< B, T, F >::type conditional_t
Definition: core.h:266
auto printf(const S &fmt, const T &...args) -> int
Definition: printf.h:670
GLuint start
Definition: glcorearb.h:475
auto make_printf_args(const T &...args) -> format_arg_store< printf_context, T...>
Definition: printf.h:579
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
GLsizei const GLfloat * value
Definition: glcorearb.h:824
char_converter(basic_format_arg< Context > &arg)
Definition: printf.h:174
GLdouble right
Definition: glad.h:2817
align_t align
Definition: core.h:2064
basic_printf_context_t< char > printf_context
Definition: printf.h:566
sign_t sign
Definition: core.h:2065
OutputIt operator()(const void *value)
Definition: printf.h:294
GLdouble s
Definition: glad.h:3009
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition: core.h:374
int width
Definition: core.h:2061
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
conditional_t< num_bits< T >()<=32 &&!FMT_REDUCE_INT_INSTANTIATIONS, uint32_t, conditional_t< num_bits< T >()<=64, uint64_t, uint128_t >> uint32_or_64_or_128_t
Definition: format.h:1158
static bool fits_in_int(T value)
Definition: printf.h:72
FMT_CONSTEXPR auto get(int id) const -> format_arg
Definition: core.h:1949
void operator()(bool value)
Definition: printf.h:124
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2138
void convert_arg(basic_format_arg< Context > &arg, Char type)
Definition: printf.h:164
const Char * operator()(T)
Definition: printf.h:189
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Definition: core.h:1859
GLuint buffer
Definition: glcorearb.h:660
const format_specs< Char > & specs
Definition: format.h:4020
OutGridT const XformOp bool bool
constexpr auto in(type t, int set) -> bool
Definition: core.h:611
#define FMT_END_NAMESPACE
Definition: core.h:179
FMT_CONSTEXPR FMT_INLINE auto operator()(T value) -> iterator
Definition: format.h:4024
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition: format.h:52
const Char * operator()(const Char *s)
Definition: printf.h:190
FMT_INLINE auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition: core.h:517
GLfloat f
Definition: glcorearb.h:1926
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
bool alt
Definition: core.h:2066
auto make_arg_formatter(buffer_appender< Char > iter, format_specs< Char > &s) -> arg_formatter< Char >
Definition: printf.h:224
basic_printf_context(OutputIt out, basic_format_args< basic_printf_context > args)
Definition: printf.h:43
auto vfprintf(std::FILE *f, const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> int
Definition: printf.h:624
void parse_flags(format_specs< Char > &specs, const Char *&it, const Char *end)
Definition: printf.h:308
printf_width_handler(format_specs< Char > &specs)
Definition: printf.h:200
arg_converter(basic_format_arg< Context > &arg, char_type type)
Definition: printf.h:121
GLuint GLuint end
Definition: glcorearb.h:475
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
OutputIt operator()(basic_string_view< Char > value)
Definition: printf.h:289
OutputIt operator()(const wchar_t *value)
Definition: printf.h:284
OutputIt out()
Definition: printf.h:47
printf_formatter()=delete
printf_arg_formatter(OutputIt iter, format_specs< Char > &s, context_type &ctx)
Definition: printf.h:245
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
Definition: printf.h:646
GLdouble t
Definition: glad.h:2397
FMT_MODULE_EXPORT FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
Definition: core.h:1564
FMT_BEGIN_DETAIL_NAMESPACE constexpr auto is_negative(T value) -> bool
Definition: format.h:1136
constexpr auto make_format_args(T &&...args) -> format_arg_store< Context, remove_cvref_t< T >...>
Definition: core.h:1842
GLsizeiptr size
Definition: glcorearb.h:664
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_opt >::value > is_signed
Definition: format.h:818
detail::fill_t< Char > fill
Definition: core.h:2068
GLenum void ** pointer
Definition: glcorearb.h:810
presentation_type type
Definition: core.h:2063
#define FMT_CONSTEXPR
Definition: core.h:104
typename type_identity< T >::type type_identity_t
Definition: core.h:275
void advance_to(OutputIt it)
Definition: printf.h:48
FMT_NORETURN void on_error(const char *message)
Definition: core.h:636
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
if(num_boxed_items<=0)
Definition: UT_RTreeImpl.h:697
**If you just want to fire and args
Definition: thread.h:618
auto vsprintf(const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> std::basic_string< Char >
Definition: printf.h:597
GLint GLsizei width
Definition: glcorearb.h:103
detail::locale_ref locale()
Definition: printf.h:50
FMT_CONSTEXPR auto get_arg(Context &ctx, ID id) -> typename Context::format_arg
Definition: format.h:4094
void vprintf(buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
Definition: printf.h:413
FMT_CONSTEXPR auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept-> int
Definition: core.h:2156
#define FMT_BEGIN_NAMESPACE
Definition: core.h:176
auto sprintf(const S &fmt, const T &...args) -> std::basic_string< Char >
Definition: printf.h:617
iterator out
Definition: format.h:4019
OutputIt operator()(typename basic_format_arg< context_type >::handle handle)
Definition: printf.h:299
constexpr FMT_INLINE auto const_check(T value) -> T
Definition: core.h:323
static bool fits_in_int(bool)
Definition: printf.h:68
auto parse_printf_presentation_type(char c, type t) -> presentation_type
Definition: printf.h:372
FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, const format_specs< Char > &specs) -> OutputIt
Definition: format.h:1900
#define FMT_END_EXPORT
Definition: core.h:187
basic_printf_context_t< wchar_t > wprintf_context
Definition: printf.h:567
OutputIt operator()(monostate value)
Definition: printf.h:248
format_arg arg(int id) const
Definition: printf.h:52
static bool fits_in_int(T value)
Definition: printf.h:64