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 #include <ostream>
14 
15 #include "format.h"
16 
19 
20 template <typename T> struct printf_formatter { printf_formatter() = delete; };
21 
22 template <typename Char>
25 };
26 
27 template <typename OutputIt, typename Char> class basic_printf_context {
28  private:
29  OutputIt out_;
31 
32  public:
33  using char_type = Char;
36  template <typename T> using formatter_type = printf_formatter<T>;
37 
38  /**
39  \rst
40  Constructs a ``printf_context`` object. References to the arguments are
41  stored in the context object so make sure they have appropriate lifetimes.
42  \endrst
43  */
46  : out_(out), args_(args) {}
47 
48  OutputIt out() { return out_; }
49  void advance_to(OutputIt it) { out_ = it; }
50 
51  detail::locale_ref locale() { return {}; }
52 
53  format_arg arg(int id) const { return args_.get(id); }
54 
55  FMT_CONSTEXPR void on_error(const char* message) {
56  detail::error_handler().on_error(message);
57  }
58 };
59 
61 
62 // Checks if a value fits in int - used to avoid warnings about comparing
63 // signed and unsigned integers.
64 template <bool IsSigned> struct int_checker {
65  template <typename T> static bool fits_in_int(T value) {
66  unsigned max = max_value<int>();
67  return value <= max;
68  }
69  static bool fits_in_int(bool) { return true; }
70 };
71 
72 template <> struct int_checker<true> {
73  template <typename T> static bool fits_in_int(T value) {
74  return value >= (std::numeric_limits<int>::min)() &&
76  }
77  static bool fits_in_int(int) { return true; }
78 };
79 
81  public:
83  int operator()(T value) {
85  FMT_THROW(format_error("number is too big"));
86  return (std::max)(static_cast<int>(value), 0);
87  }
88 
90  int operator()(T) {
91  FMT_THROW(format_error("precision is not integer"));
92  return 0;
93  }
94 };
95 
96 // An argument visitor that returns true iff arg is a zero integer.
97 class is_zero_int {
98  public:
100  bool operator()(T value) {
101  return value == 0;
102  }
103 
105  bool operator()(T) {
106  return false;
107  }
108 };
109 
110 template <typename T> struct make_unsigned_or_bool : std::make_unsigned<T> {};
111 
112 template <> struct make_unsigned_or_bool<bool> { using type = bool; };
113 
114 template <typename T, typename Context> class arg_converter {
115  private:
116  using char_type = typename Context::char_type;
117 
119  char_type type_;
120 
121  public:
123  : arg_(arg), type_(type) {}
124 
125  void operator()(bool value) {
126  if (type_ != 's') operator()<bool>(value);
127  }
128 
130  void operator()(U value) {
131  bool is_signed = type_ == 'd' || type_ == 'i';
132  using target_type = conditional_t<std::is_same<T, void>::value, U, T>;
133  if (const_check(sizeof(target_type) <= sizeof(int))) {
134  // Extra casts are used to silence warnings.
135  if (is_signed) {
136  arg_ = detail::make_arg<Context>(
137  static_cast<int>(static_cast<target_type>(value)));
138  } else {
139  using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
140  arg_ = detail::make_arg<Context>(
141  static_cast<unsigned>(static_cast<unsigned_type>(value)));
142  }
143  } else {
144  if (is_signed) {
145  // glibc's printf doesn't sign extend arguments of smaller types:
146  // std::printf("%lld", -42); // prints "4294967254"
147  // but we don't have to do the same because it's a UB.
148  arg_ = detail::make_arg<Context>(static_cast<long long>(value));
149  } else {
150  arg_ = detail::make_arg<Context>(
151  static_cast<typename make_unsigned_or_bool<U>::type>(value));
152  }
153  }
154  }
155 
157  void operator()(U) {} // No conversion needed for non-integral types.
158 };
159 
160 // Converts an integer argument to T for printf, if T is an integral type.
161 // If T is void, the argument is converted to corresponding signed or unsigned
162 // type depending on the type specifier: 'd' and 'i' - signed, other -
163 // unsigned).
164 template <typename T, typename Context, typename Char>
167 }
168 
169 // Converts an integer argument to char for printf.
170 template <typename Context> class char_converter {
171  private:
173 
174  public:
175  explicit char_converter(basic_format_arg<Context>& arg) : arg_(arg) {}
176 
178  void operator()(T value) {
179  arg_ = detail::make_arg<Context>(
180  static_cast<typename Context::char_type>(value));
181  }
182 
184  void operator()(T) {} // No conversion needed for non-integral types.
185 };
186 
187 // An argument visitor that return a pointer to a C string if argument is a
188 // string or null otherwise.
189 template <typename Char> struct get_cstring {
190  template <typename T> const Char* operator()(T) { return nullptr; }
191  const Char* operator()(const Char* s) { return s; }
192 };
193 
194 // Checks if an argument is a valid printf width specifier and sets
195 // left alignment if it is negative.
196 template <typename Char> class printf_width_handler {
197  private:
199 
200  format_specs& specs_;
201 
202  public:
203  explicit printf_width_handler(format_specs& specs) : specs_(specs) {}
204 
206  unsigned operator()(T value) {
207  auto width = static_cast<uint32_or_64_or_128_t<T>>(value);
208  if (detail::is_negative(value)) {
209  specs_.align = align::left;
210  width = 0 - width;
211  }
212  unsigned int_max = max_value<int>();
213  if (width > int_max) FMT_THROW(format_error("number is too big"));
214  return static_cast<unsigned>(width);
215  }
216 
218  unsigned operator()(T) {
219  FMT_THROW(format_error("width is not integer"));
220  return 0;
221  }
222 };
223 
224 // The ``printf`` argument formatter.
225 template <typename OutputIt, typename Char>
226 class printf_arg_formatter : public arg_formatter<Char> {
227  private:
228  using base = arg_formatter<Char>;
231 
232  context_type& context_;
233 
234  OutputIt write_null_pointer(bool is_string = false) {
235  auto s = this->specs;
236  s.type = 0;
237  return write_bytes(this->out, is_string ? "(null)" : "(nil)", s);
238  }
239 
240  public:
242  : base{iter, s, locale_ref()}, context_(ctx) {}
243 
244  OutputIt operator()(monostate value) { return base::operator()(value); }
245 
247  OutputIt operator()(T value) {
248  // MSVC2013 fails to compile separate overloads for bool and Char so use
249  // std::is_same instead.
251  format_specs fmt_specs = this->specs;
252  if (fmt_specs.type && fmt_specs.type != 'c')
253  return (*this)(static_cast<int>(value));
254  fmt_specs.sign = sign::none;
255  fmt_specs.alt = false;
256  fmt_specs.fill[0] = ' '; // Ignore '0' flag for char types.
257  // align::numeric needs to be overwritten here since the '0' flag is
258  // ignored for non-numeric types
259  if (fmt_specs.align == align::none || fmt_specs.align == align::numeric)
260  fmt_specs.align = align::right;
261  return write<Char>(this->out, static_cast<Char>(value), fmt_specs);
262  }
263  return base::operator()(value);
264  }
265 
267  OutputIt operator()(T value) {
268  return base::operator()(value);
269  }
270 
271  /** Formats a null-terminated C string. */
272  OutputIt operator()(const char* value) {
273  if (value) return base::operator()(value);
274  return write_null_pointer(this->specs.type != 'p');
275  }
276 
277  /** Formats a null-terminated wide C string. */
278  OutputIt operator()(const wchar_t* value) {
279  if (value) return base::operator()(value);
280  return write_null_pointer(this->specs.type != 'p');
281  }
282 
284  return base::operator()(value);
285  }
286 
287  /** Formats a pointer. */
288  OutputIt operator()(const void* value) {
289  return value ? base::operator()(value) : write_null_pointer();
290  }
291 
292  /** Formats an argument of a custom (user-defined) type. */
294  auto parse_ctx =
296  handle.format(parse_ctx, context_);
297  return this->out;
298  }
299 };
300 
301 template <typename Char>
302 void parse_flags(basic_format_specs<Char>& specs, const Char*& it,
303  const Char* end) {
304  for (; it != end; ++it) {
305  switch (*it) {
306  case '-':
307  specs.align = align::left;
308  break;
309  case '+':
310  specs.sign = sign::plus;
311  break;
312  case '0':
313  specs.fill[0] = '0';
314  break;
315  case ' ':
316  if (specs.sign != sign::plus) {
317  specs.sign = sign::space;
318  }
319  break;
320  case '#':
321  specs.alt = true;
322  break;
323  default:
324  return;
325  }
326  }
327 }
328 
329 template <typename Char, typename GetArg>
330 int parse_header(const Char*& it, const Char* end,
331  basic_format_specs<Char>& specs, GetArg get_arg) {
332  int arg_index = -1;
333  Char c = *it;
334  if (c >= '0' && c <= '9') {
335  // Parse an argument index (if followed by '$') or a width possibly
336  // preceded with '0' flag(s).
337  int value = parse_nonnegative_int(it, end, -1);
338  if (it != end && *it == '$') { // value is an argument index
339  ++it;
340  arg_index = value != -1 ? value : max_value<int>();
341  } else {
342  if (c == '0') specs.fill[0] = '0';
343  if (value != 0) {
344  // Nonzero value means that we parsed width and don't need to
345  // parse it or flags again, so return now.
346  if (value == -1) FMT_THROW(format_error("number is too big"));
347  specs.width = value;
348  return arg_index;
349  }
350  }
351  }
352  parse_flags(specs, it, end);
353  // Parse width.
354  if (it != end) {
355  if (*it >= '0' && *it <= '9') {
356  specs.width = parse_nonnegative_int(it, end, -1);
357  if (specs.width == -1) FMT_THROW(format_error("number is too big"));
358  } else if (*it == '*') {
359  ++it;
360  specs.width = static_cast<int>(visit_format_arg(
361  detail::printf_width_handler<Char>(specs), get_arg(-1)));
362  }
363  }
364  return arg_index;
365 }
366 
367 template <typename Char, typename Context>
370  using OutputIt = buffer_appender<Char>;
371  auto out = OutputIt(buf);
372  auto context = basic_printf_context<OutputIt, Char>(out, args);
373  auto parse_ctx = basic_printf_parse_context<Char>(format);
374 
375  // Returns the argument with specified index or, if arg_index is -1, the next
376  // argument.
377  auto get_arg = [&](int arg_index) {
378  if (arg_index < 0)
379  arg_index = parse_ctx.next_arg_id();
380  else
381  parse_ctx.check_arg_id(--arg_index);
382  return detail::get_arg(context, arg_index);
383  };
384 
385  const Char* start = parse_ctx.begin();
386  const Char* end = parse_ctx.end();
387  auto it = start;
388  while (it != end) {
389  if (!detail::find<false, Char>(it, end, '%', it)) {
390  it = end; // detail::find leaves it == nullptr if it doesn't find '%'
391  break;
392  }
393  Char c = *it++;
394  if (it != end && *it == c) {
395  out = detail::write(
396  out, basic_string_view<Char>(start, detail::to_unsigned(it - start)));
397  start = ++it;
398  continue;
399  }
401  start, detail::to_unsigned(it - 1 - start)));
402 
404  specs.align = align::right;
405 
406  // Parse argument index, flags and width.
407  int arg_index = parse_header(it, end, specs, get_arg);
408  if (arg_index == 0) parse_ctx.on_error("argument not found");
409 
410  // Parse precision.
411  if (it != end && *it == '.') {
412  ++it;
413  c = it != end ? *it : 0;
414  if ('0' <= c && c <= '9') {
415  specs.precision = parse_nonnegative_int(it, end, 0);
416  } else if (c == '*') {
417  ++it;
418  specs.precision = static_cast<int>(
419  visit_format_arg(detail::printf_precision_handler(), get_arg(-1)));
420  } else {
421  specs.precision = 0;
422  }
423  }
424 
425  auto arg = get_arg(arg_index);
426  // For d, i, o, u, x, and X conversion specifiers, if a precision is
427  // specified, the '0' flag is ignored
428  if (specs.precision >= 0 && arg.is_integral())
429  specs.fill[0] =
430  ' '; // Ignore '0' flag for non-numeric types or if '-' present.
431  if (specs.precision >= 0 && arg.type() == detail::type::cstring_type) {
432  auto str = visit_format_arg(detail::get_cstring<Char>(), arg);
433  auto str_end = str + specs.precision;
434  auto nul = std::find(str, str_end, Char());
435  arg = detail::make_arg<basic_printf_context<OutputIt, Char>>(
437  str, detail::to_unsigned(nul != str_end ? nul - str
438  : specs.precision)));
439  }
440  if (specs.alt && visit_format_arg(detail::is_zero_int(), arg))
441  specs.alt = false;
442  if (specs.fill[0] == '0') {
443  if (arg.is_arithmetic() && specs.align != align::left)
444  specs.align = align::numeric;
445  else
446  specs.fill[0] = ' '; // Ignore '0' flag for non-numeric types or if '-'
447  // flag is also present.
448  }
449 
450  // Parse length and convert the argument to the required type.
451  c = it != end ? *it++ : 0;
452  Char t = it != end ? *it : 0;
453  using detail::convert_arg;
454  switch (c) {
455  case 'h':
456  if (t == 'h') {
457  ++it;
458  t = it != end ? *it : 0;
459  convert_arg<signed char>(arg, t);
460  } else {
461  convert_arg<short>(arg, t);
462  }
463  break;
464  case 'l':
465  if (t == 'l') {
466  ++it;
467  t = it != end ? *it : 0;
468  convert_arg<long long>(arg, t);
469  } else {
470  convert_arg<long>(arg, t);
471  }
472  break;
473  case 'j':
474  convert_arg<intmax_t>(arg, t);
475  break;
476  case 'z':
477  convert_arg<size_t>(arg, t);
478  break;
479  case 't':
480  convert_arg<std::ptrdiff_t>(arg, t);
481  break;
482  case 'L':
483  // printf produces garbage when 'L' is omitted for long double, no
484  // need to do the same.
485  break;
486  default:
487  --it;
488  convert_arg<void>(arg, c);
489  }
490 
491  // Parse type.
492  if (it == end) FMT_THROW(format_error("invalid format string"));
493  specs.type = static_cast<char>(*it++);
494  if (arg.is_integral()) {
495  // Normalize type.
496  switch (specs.type) {
497  case 'i':
498  case 'u':
499  specs.type = 'd';
500  break;
501  case 'c':
503  detail::char_converter<basic_printf_context<OutputIt, Char>>(arg),
504  arg);
505  break;
506  }
507  }
508 
509  start = it;
510 
511  // Format argument.
512  out = visit_format_arg(
513  detail::printf_arg_formatter<OutputIt, Char>(out, specs, context), arg);
514  }
515  detail::write(out, basic_string_view<Char>(start, to_unsigned(it - start)));
516 }
518 
519 template <typename Char>
522 
525 
528 
529 /**
530  \rst
531  Constructs an `~fmt::format_arg_store` object that contains references to
532  arguments and can be implicitly converted to `~fmt::printf_args`.
533  \endrst
534  */
535 template <typename... T>
536 inline auto make_printf_args(const T&... args)
538  return {args...};
539 }
540 
541 /**
542  \rst
543  Constructs an `~fmt::format_arg_store` object that contains references to
544  arguments and can be implicitly converted to `~fmt::wprintf_args`.
545  \endrst
546  */
547 template <typename... T>
548 inline auto make_wprintf_args(const T&... args)
550  return {args...};
551 }
552 
553 template <typename S, typename Char = char_t<S>>
554 inline auto vsprintf(
555  const S& fmt,
556  basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
559  vprintf(buffer, to_string_view(fmt), args);
560  return to_string(buffer);
561 }
562 
563 /**
564  \rst
565  Formats arguments and returns the result as a string.
566 
567  **Example**::
568 
569  std::string message = fmt::sprintf("The answer is %d", 42);
570  \endrst
571 */
572 template <typename S, typename... T,
574 inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string<Char> {
575  using context = basic_printf_context_t<Char>;
576  return vsprintf(to_string_view(fmt), fmt::make_format_args<context>(args...));
577 }
578 
579 template <typename S, typename Char = char_t<S>>
580 inline auto vfprintf(
581  std::FILE* f, const S& fmt,
582  basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
583  -> int {
585  vprintf(buffer, to_string_view(fmt), args);
586  size_t size = buffer.size();
587  return std::fwrite(buffer.data(), sizeof(Char), size, f) < size
588  ? -1
589  : static_cast<int>(size);
590 }
591 
592 /**
593  \rst
594  Prints formatted data to the file *f*.
595 
596  **Example**::
597 
598  fmt::fprintf(stderr, "Don't %s!", "panic");
599  \endrst
600  */
601 template <typename S, typename... T, typename Char = char_t<S>>
602 inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int {
603  using context = basic_printf_context_t<Char>;
604  return vfprintf(f, to_string_view(fmt),
605  fmt::make_format_args<context>(args...));
606 }
607 
608 template <typename S, typename Char = char_t<S>>
609 inline auto vprintf(
610  const S& fmt,
611  basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
612  -> int {
613  return vfprintf(stdout, to_string_view(fmt), args);
614 }
615 
616 /**
617  \rst
618  Prints formatted data to ``stdout``.
619 
620  **Example**::
621 
622  fmt::printf("Elapsed time: %.2f seconds", 1.23);
623  \endrst
624  */
625 template <typename S, typename... T, FMT_ENABLE_IF(detail::is_string<S>::value)>
626 inline auto printf(const S& fmt, const T&... args) -> int {
627  return vprintf(
628  to_string_view(fmt),
629  fmt::make_format_args<basic_printf_context_t<char_t<S>>>(args...));
630 }
631 
632 template <typename S, typename Char = char_t<S>>
634  std::basic_ostream<Char>& os, const S& fmt,
635  basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args)
636  -> int {
638  vprintf(buffer, to_string_view(fmt), args);
639  os.write(buffer.data(), static_cast<std::streamsize>(buffer.size()));
640  return static_cast<int>(buffer.size());
641 }
642 template <typename S, typename... T, typename Char = char_t<S>>
643 FMT_DEPRECATED auto fprintf(std::basic_ostream<Char>& os, const S& fmt,
644  const T&... args) -> int {
645  return vfprintf(os, to_string_view(fmt),
647 }
648 
651 
652 #endif // FMT_PRINTF_H_
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition: core.h:405
#define FMT_MODULE_EXPORT_END
Definition: core.h:242
static bool fits_in_int(int)
Definition: printf.h:77
#define FMT_ENABLE_IF(...)
Definition: core.h:341
auto make_wprintf_args(const T &...args) -> format_arg_store< wprintf_context, T...>
Definition: printf.h:548
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.
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
FMT_CONSTEXPR void on_error(const char *message)
Definition: printf.h:55
OutputIt operator()(const char *value)
Definition: printf.h:272
auto to_string(const T &value) -> std::string
Definition: format.h:2597
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition: core.h:243
#define FMT_DEPRECATED
Definition: format.h:120
void format(typename Context::parse_context_type &parse_ctx, Context &ctx) const
Definition: core.h:1427
#define FMT_END_DETAIL_NAMESPACE
Definition: core.h:244
typename std::conditional< B, T, F >::type conditional_t
Definition: core.h:322
auto printf(const S &fmt, const T &...args) -> int
Definition: printf.h:626
GLuint start
Definition: glcorearb.h:475
auto make_printf_args(const T &...args) -> format_arg_store< printf_context, T...>
Definition: printf.h:536
GLsizei const GLfloat * value
Definition: glcorearb.h:824
char_converter(basic_format_arg< Context > &arg)
Definition: printf.h:175
basic_printf_context_t< char > printf_context
Definition: printf.h:523
constexpr auto const_check(T value) -> T
Definition: core.h:355
OutputIt operator()(const void *value)
Definition: printf.h:288
GLdouble s
Definition: glad.h:3009
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T >>> buffer_appender
Definition: core.h:956
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
printf_arg_formatter(OutputIt iter, format_specs &s, context_type &ctx)
Definition: printf.h:241
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:847
static bool fits_in_int(T value)
Definition: printf.h:73
FMT_CONSTEXPR auto get(int id) const -> format_arg
Definition: core.h:1825
void operator()(bool value)
Definition: printf.h:125
void parse_flags(basic_format_specs< Char > &specs, const Char *&it, const Char *end)
Definition: printf.h:302
void convert_arg(basic_format_arg< Context > &arg, Char type)
Definition: printf.h:165
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_t >::value > is_signed
Definition: format.h:821
align_t align
Definition: core.h:1912
const Char * operator()(T)
Definition: printf.h:190
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Definition: core.h:1736
PUGIXML_CHAR char_t
Definition: pugixml.hpp:125
GLuint buffer
Definition: glcorearb.h:660
#define FMT_END_NAMESPACE
Definition: core.h:229
#define FMT_THROW(x)
Definition: format.h:93
FMT_CONSTEXPR FMT_INLINE auto operator()(T value) -> iterator
Definition: format.h:1985
const Char * operator()(const Char *s)
Definition: printf.h:191
FMT_CONSTEXPR auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept-> int
Definition: core.h:2107
GLfloat f
Definition: glcorearb.h:1926
FMT_INLINE auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition: core.h:545
basic_printf_context(OutputIt out, basic_format_args< basic_printf_context > args)
Definition: printf.h:44
auto vfprintf(std::FILE *f, const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> int
Definition: printf.h:580
arg_converter(basic_format_arg< Context > &arg, char_type type)
Definition: printf.h:122
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:283
OutputIt operator()(const wchar_t *value)
Definition: printf.h:278
detail::fill_t< Char > fill
Definition: core.h:1916
OutputIt out()
Definition: printf.h:48
printf_formatter()=delete
constexpr auto make_format_args(const Args &...args) -> format_arg_store< Context, Args...>
Definition: core.h:1719
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
Definition: printf.h:602
GLdouble t
Definition: glad.h:2397
int parse_header(const Char *&it, const Char *end, basic_format_specs< Char > &specs, GetArg get_arg)
Definition: printf.h:330
GLsizeiptr size
Definition: glcorearb.h:664
#define FMT_CONSTEXPR
Definition: core.h:98
FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, const basic_format_specs< Char > &specs) -> OutputIt
Definition: format.h:1302
printf_width_handler(format_specs &specs)
Definition: printf.h:203
typename type_identity< T >::type type_identity_t
Definition: core.h:329
void advance_to(OutputIt it)
Definition: printf.h:49
FMT_CONSTEXPR auto is_negative(T value) -> bool
Definition: format.h:826
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
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
Definition: core.h:1458
**If you just want to fire and args
Definition: thread.h:609
auto vsprintf(const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> std::basic_string< Char >
Definition: printf.h:554
GLint GLsizei width
Definition: glcorearb.h:103
detail::locale_ref locale()
Definition: printf.h:51
const basic_format_specs< Char > & specs
Definition: format.h:1981
Definition: core.h:1131
FMT_CONSTEXPR auto get_arg(Context &ctx, ID id) -> typename Context::format_arg
Definition: format.h:2061
void vprintf(buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
Definition: printf.h:368
#define FMT_BEGIN_NAMESPACE
Definition: core.h:234
auto sprintf(const S &fmt, const T &...args) -> std::basic_string< Char >
Definition: printf.h:574
iterator out
Definition: format.h:1980
OutputIt operator()(typename basic_format_arg< context_type >::handle handle)
Definition: printf.h:293
static bool fits_in_int(bool)
Definition: printf.h:69
void write(T &out, bool v)
Definition: ImfXdr.h:287
#define FMT_MODULE_EXPORT_BEGIN
Definition: core.h:241
type
Definition: core.h:1059
basic_printf_context_t< wchar_t > wprintf_context
Definition: printf.h:524
OutputIt operator()(monostate value)
Definition: printf.h:244
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2089
format_arg arg(int id) const
Definition: printf.h:53
static bool fits_in_int(T value)
Definition: printf.h:65