Photon 1.0.0
Loading...
Searching...
No Matches
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
19template <typename T>
21{
22 printf_formatter() = delete;
23};
24
25template <typename Char>
30
31template <typename OutputIt, typename Char>
33{
34private:
35 OutputIt out_;
37
38public:
39 using char_type = Char;
42 template <typename T>
44
56
57 OutputIt out()
58 {
59 return out_;
60 }
61 void advance_to(OutputIt it)
62 {
63 out_ = it;
64 }
65
66 detail::locale_ref locale()
67 {
68 return {};
69 }
70
71 format_arg arg(int id) const
72 {
73 return args_.get(id);
74 }
75
76 FMT_CONSTEXPR void on_error(const char* message)
77 {
78 detail::error_handler().on_error(message);
79 }
80};
81
83
84// Checks if a value fits in int - used to avoid warnings about comparing
85// signed and unsigned integers.
86template <bool IsSigned>
88{
89 template <typename T>
90 static bool fits_in_int(T value)
91 {
92 unsigned max = max_value<int>();
93 return value <= max;
94 }
95 static bool fits_in_int(bool)
96 {
97 return true;
98 }
99};
100
101template <>
102struct int_checker<true>
103{
104 template <typename T>
105 static bool fits_in_int(T value)
106 {
107 return value >= (std::numeric_limits<int>::min)() &&
108 value <= max_value<int>();
109 }
110 static bool fits_in_int(int)
111 {
112 return true;
113 }
114};
115
117{
118public:
119 template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
121 {
122 if (!int_checker<std::numeric_limits<T>::is_signed>::fits_in_int(value))
123 FMT_THROW(format_error("number is too big"));
124 return (std::max)(static_cast<int>(value), 0);
125 }
126
127 template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
129 {
130 FMT_THROW(format_error("precision is not integer"));
131 return 0;
132 }
133};
134
135// An argument visitor that returns true iff arg is a zero integer.
137{
138public:
139 template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
141 {
142 return value == 0;
143 }
144
145 template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
147 {
148 return false;
149 }
150};
151
152template <typename T>
153struct make_unsigned_or_bool : std::make_unsigned<T>
154{
155};
156
157template <>
159{
160 using type = bool;
161};
162
163template <typename T, typename Context>
165{
166private:
167 using char_type = typename Context::char_type;
168
171
172public:
177
178 void operator()(bool value)
179 {
180 if (type_ != 's')
181 operator()<bool>(value);
182 }
183
184 template <typename U, FMT_ENABLE_IF(std::is_integral<U>::value)>
186 {
187 bool is_signed = type_ == 'd' || type_ == 'i';
188 using target_type = conditional_t<std::is_same<T, void>::value, U, T>;
189 if (const_check(sizeof(target_type) <= sizeof(int)))
190 {
191 // Extra casts are used to silence warnings.
192 if (is_signed)
193 {
194 arg_ = detail::make_arg<Context>(
195 static_cast<int>(static_cast<target_type>(value)));
196 }
197 else
198 {
199 using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
200 arg_ = detail::make_arg<Context>(
201 static_cast<unsigned>(static_cast<unsigned_type>(value)));
202 }
203 }
204 else
205 {
206 if (is_signed)
207 {
208 // glibc's printf doesn't sign extend arguments of smaller types:
209 // std::printf("%lld", -42); // prints "4294967254"
210 // but we don't have to do the same because it's a UB.
211 arg_ = detail::make_arg<Context>(static_cast<long long>(value));
212 }
213 else
214 {
215 arg_ = detail::make_arg<Context>(
216 static_cast<typename make_unsigned_or_bool<U>::type>(value));
217 }
218 }
219 }
220
221 template <typename U, FMT_ENABLE_IF(!std::is_integral<U>::value)>
223 {
224 } // No conversion needed for non-integral types.
225};
226
227// Converts an integer argument to T for printf, if T is an integral type.
228// If T is void, the argument is converted to corresponding signed or unsigned
229// type depending on the type specifier: 'd' and 'i' - signed, other -
230// unsigned).
231template <typename T, typename Context, typename Char>
236
237// Converts an integer argument to char for printf.
238template <typename Context>
240{
241private:
243
244public:
246 : arg_(arg)
247 {
248 }
249
250 template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
252 {
253 arg_ = detail::make_arg<Context>(
254 static_cast<typename Context::char_type>(value));
255 }
256
257 template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
259 {
260 } // No conversion needed for non-integral types.
261};
262
263// An argument visitor that return a pointer to a C string if argument is a
264// string or null otherwise.
265template <typename Char>
267{
268 template <typename T>
269 const Char* operator()(T)
270 {
271 return nullptr;
272 }
273 const Char* operator()(const Char* s)
274 {
275 return s;
276 }
277};
278
279// Checks if an argument is a valid printf width specifier and sets
280// left alignment if it is negative.
281template <typename Char>
283{
284private:
286
288
289public:
291 : specs_(specs)
292 {
293 }
294
295 template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
296 unsigned operator()(T value)
297 {
298 auto width = static_cast<uint32_or_64_or_128_t<T>>(value);
299 if (detail::is_negative(value))
300 {
301 specs_.align = align::left;
302 width = 0 - width;
303 }
304 unsigned int_max = max_value<int>();
305 if (width > int_max)
306 FMT_THROW(format_error("number is too big"));
307 return static_cast<unsigned>(width);
308 }
309
310 template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
311 unsigned operator()(T)
312 {
313 FMT_THROW(format_error("width is not integer"));
314 return 0;
315 }
316};
317
318// The ``printf`` argument formatter.
319template <typename OutputIt, typename Char>
321{
322private:
326
328
329 OutputIt write_null_pointer(bool is_string = false)
330 {
331 auto s = this->specs;
333 return write_bytes(this->out, is_string ? "(null)" : "(nil)", s);
334 }
335
336public:
338 : base{iter, s, locale_ref()}, context_(ctx)
339 {
340 }
341
343 {
344 return base::operator()(value);
345 }
346
347 template <typename T, FMT_ENABLE_IF(detail::is_integral<T>::value)>
348 OutputIt operator()(T value)
349 {
350 // MSVC2013 fails to compile separate overloads for bool and Char so use
351 // std::is_same instead.
352 if (std::is_same<T, Char>::value)
353 {
354 format_specs fmt_specs = this->specs;
355 if (fmt_specs.type != presentation_type::none &&
356 fmt_specs.type != presentation_type::chr)
357 {
358 return (*this)(static_cast<int>(value));
359 }
360 fmt_specs.sign = sign::none;
361 fmt_specs.alt = false;
362 fmt_specs.fill[0] = ' '; // Ignore '0' flag for char types.
363 // align::numeric needs to be overwritten here since the '0' flag is
364 // ignored for non-numeric types
365 if (fmt_specs.align == align::none || fmt_specs.align == align::numeric)
366 fmt_specs.align = align::right;
367 return write<Char>(this->out, static_cast<Char>(value), fmt_specs);
368 }
369 return base::operator()(value);
370 }
371
372 template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
373 OutputIt operator()(T value)
374 {
375 return base::operator()(value);
376 }
377
379 OutputIt operator()(const char* value)
380 {
381 if (value)
382 return base::operator()(value);
384 }
385
387 OutputIt operator()(const wchar_t* value)
388 {
389 if (value)
390 return base::operator()(value);
392 }
393
395 {
396 return base::operator()(value);
397 }
398
400 OutputIt operator()(const void* value)
401 {
402 return value ? base::operator()(value) : write_null_pointer();
403 }
404
407 {
408 auto parse_ctx =
410 handle.format(parse_ctx, context_);
411 return this->out;
412 }
413};
414
415template <typename Char>
416void parse_flags(basic_format_specs<Char>& specs, const Char*& it, const Char* end)
417{
418 for (; it != end; ++it)
419 {
420 switch (*it)
421 {
422 case '-':
423 specs.align = align::left;
424 break;
425 case '+':
426 specs.sign = sign::plus;
427 break;
428 case '0':
429 specs.fill[0] = '0';
430 break;
431 case ' ':
432 if (specs.sign != sign::plus)
433 {
434 specs.sign = sign::space;
435 }
436 break;
437 case '#':
438 specs.alt = true;
439 break;
440 default:
441 return;
442 }
443 }
444}
445
446template <typename Char, typename GetArg>
447int parse_header(const Char*& it, const Char* end, basic_format_specs<Char>& specs, GetArg get_arg)
448{
449 int arg_index = -1;
450 Char c = *it;
451 if (c >= '0' && c <= '9')
452 {
453 // Parse an argument index (if followed by '$') or a width possibly
454 // preceded with '0' flag(s).
455 int value = parse_nonnegative_int(it, end, -1);
456 if (it != end && *it == '$')
457 { // value is an argument index
458 ++it;
459 arg_index = value != -1 ? value : max_value<int>();
460 }
461 else
462 {
463 if (c == '0')
464 specs.fill[0] = '0';
465 if (value != 0)
466 {
467 // Nonzero value means that we parsed width and don't need to
468 // parse it or flags again, so return now.
469 if (value == -1)
470 FMT_THROW(format_error("number is too big"));
471 specs.width = value;
472 return arg_index;
473 }
474 }
475 }
476 parse_flags(specs, it, end);
477 // Parse width.
478 if (it != end)
479 {
480 if (*it >= '0' && *it <= '9')
481 {
482 specs.width = parse_nonnegative_int(it, end, -1);
483 if (specs.width == -1)
484 FMT_THROW(format_error("number is too big"));
485 }
486 else if (*it == '*')
487 {
488 ++it;
489 specs.width = static_cast<int>(visit_format_arg(
490 detail::printf_width_handler<Char>(specs), get_arg(-1)));
491 }
492 }
493 return arg_index;
494}
495
496template <typename Char, typename Context>
498{
499 using OutputIt = buffer_appender<Char>;
500 auto out = OutputIt(buf);
501 auto context = basic_printf_context<OutputIt, Char>(out, args);
503
504 // Returns the argument with specified index or, if arg_index is -1, the next
505 // argument.
506 auto get_arg = [&](int arg_index) {
507 if (arg_index < 0)
508 arg_index = parse_ctx.next_arg_id();
509 else
510 parse_ctx.check_arg_id(--arg_index);
511 return detail::get_arg(context, arg_index);
512 };
513
514 const Char* start = parse_ctx.begin();
515 const Char* end = parse_ctx.end();
516 auto it = start;
517 while (it != end)
518 {
519 if (!detail::find<false, Char>(it, end, '%', it))
520 {
521 it = end; // detail::find leaves it == nullptr if it doesn't find '%'
522 break;
523 }
524 Char c = *it++;
525 if (it != end && *it == c)
526 {
528 out, basic_string_view<Char>(start, detail::to_unsigned(it - start)));
529 start = ++it;
530 continue;
531 }
533 start, detail::to_unsigned(it - 1 - start)));
534
536 specs.align = align::right;
537
538 // Parse argument index, flags and width.
539 int arg_index = parse_header(it, end, specs, get_arg);
540 if (arg_index == 0)
541 parse_ctx.on_error("argument not found");
542
543 // Parse precision.
544 if (it != end && *it == '.')
545 {
546 ++it;
547 c = it != end ? *it : 0;
548 if ('0' <= c && c <= '9')
549 {
550 specs.precision = parse_nonnegative_int(it, end, 0);
551 }
552 else if (c == '*')
553 {
554 ++it;
555 specs.precision = static_cast<int>(
556 visit_format_arg(detail::printf_precision_handler(), get_arg(-1)));
557 }
558 else
559 {
560 specs.precision = 0;
561 }
562 }
563
564 auto arg = get_arg(arg_index);
565 // For d, i, o, u, x, and X conversion specifiers, if a precision is
566 // specified, the '0' flag is ignored
567 if (specs.precision >= 0 && arg.is_integral())
568 specs.fill[0] =
569 ' '; // Ignore '0' flag for non-numeric types or if '-' present.
570 if (specs.precision >= 0 && arg.type() == detail::type::cstring_type)
571 {
572 auto str = visit_format_arg(detail::get_cstring<Char>(), arg);
573 auto str_end = str + specs.precision;
574 auto nul = std::find(str, str_end, Char());
575 arg = detail::make_arg<basic_printf_context<OutputIt, Char>>(
577 str, detail::to_unsigned(nul != str_end ? nul - str
578 : specs.precision)));
579 }
580 if (specs.alt && visit_format_arg(detail::is_zero_int(), arg))
581 specs.alt = false;
582 if (specs.fill[0] == '0')
583 {
584 if (arg.is_arithmetic() && specs.align != align::left)
585 specs.align = align::numeric;
586 else
587 specs.fill[0] = ' '; // Ignore '0' flag for non-numeric types or if '-'
588 // flag is also present.
589 }
590
591 // Parse length and convert the argument to the required type.
592 c = it != end ? *it++ : 0;
593 Char t = it != end ? *it : 0;
594 using detail::convert_arg;
595 switch (c)
596 {
597 case 'h':
598 if (t == 'h')
599 {
600 ++it;
601 t = it != end ? *it : 0;
602 convert_arg<signed char>(arg, t);
603 }
604 else
605 {
606 convert_arg<short>(arg, t);
607 }
608 break;
609 case 'l':
610 if (t == 'l')
611 {
612 ++it;
613 t = it != end ? *it : 0;
614 convert_arg<long long>(arg, t);
615 }
616 else
617 {
618 convert_arg<long>(arg, t);
619 }
620 break;
621 case 'j':
622 convert_arg<intmax_t>(arg, t);
623 break;
624 case 'z':
625 convert_arg<size_t>(arg, t);
626 break;
627 case 't':
628 convert_arg<std::ptrdiff_t>(arg, t);
629 break;
630 case 'L':
631 // printf produces garbage when 'L' is omitted for long double, no
632 // need to do the same.
633 break;
634 default:
635 --it;
636 convert_arg<void>(arg, c);
637 }
638
639 // Parse type.
640 if (it == end)
641 FMT_THROW(format_error("invalid format string"));
642 char type = static_cast<char>(*it++);
643 if (arg.is_integral())
644 {
645 // Normalize type.
646 switch (type)
647 {
648 case 'i':
649 case 'u':
650 type = 'd';
651 break;
652 case 'c':
654 detail::char_converter<basic_printf_context<OutputIt, Char>>(arg),
655 arg);
656 break;
657 }
658 }
660 if (specs.type == presentation_type::none)
661 parse_ctx.on_error("invalid type specifier");
662
663 start = it;
664
665 // Format argument.
667 detail::printf_arg_formatter<OutputIt, Char>(out, specs, context), arg);
668 }
670}
672
673template <typename Char>
676
679
682
689template <typename... T>
690inline auto make_printf_args(const T&... args)
692{
693 return {args...};
694}
695
702template <typename... T>
703inline auto make_wprintf_args(const T&... args)
705{
706 return {args...};
707}
708
709template <typename S, typename Char = char_t<S>>
710inline auto vsprintf(
711 const S& fmt,
713 -> std::basic_string<Char>
714{
716 vprintf(buffer, detail::to_string_view(fmt), args);
717 return to_string(buffer);
718}
719
729template <typename S, typename... T, typename Char = enable_if_t<detail::is_string<S>::value, char_t<S>>>
730inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string<Char>
731{
732 using context = basic_printf_context_t<Char>;
733 return vsprintf(detail::to_string_view(fmt),
734 fmt::make_format_args<context>(args...));
735}
736
737template <typename S, typename Char = char_t<S>>
738inline auto vfprintf(
740 -> int
741{
743 vprintf(buffer, detail::to_string_view(fmt), args);
744 size_t size = buffer.size();
745 return std::fwrite(buffer.data(), sizeof(Char), size, f) < size
746 ? -1
747 : static_cast<int>(size);
748}
749
759template <typename S, typename... T, typename Char = char_t<S>>
760inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int
761{
762 using context = basic_printf_context_t<Char>;
763 return vfprintf(f, detail::to_string_view(fmt),
764 fmt::make_format_args<context>(args...));
765}
766
767template <typename S, typename Char = char_t<S>>
768inline auto vprintf(
769 const S& fmt,
771 -> int
772{
773 return vfprintf(stdout, detail::to_string_view(fmt), args);
774}
775
785template <typename S, typename... T, FMT_ENABLE_IF(detail::is_string<S>::value)>
786inline auto printf(const S& fmt, const T&... args) -> int
787{
788 return vprintf(
789 detail::to_string_view(fmt),
790 fmt::make_format_args<basic_printf_context_t<char_t<S>>>(args...));
791}
792
795
796#endif // FMT_PRINTF_H_
Definition printf.h:165
char_type type_
Definition printf.h:170
arg_converter(basic_format_arg< Context > &arg, char_type type)
Definition printf.h:173
void operator()(U)
Definition printf.h:222
basic_format_arg< Context > & arg_
Definition printf.h:169
void operator()(U value)
Definition printf.h:185
typename Context::char_type char_type
Definition printf.h:167
void operator()(bool value)
Definition printf.h:178
Definition core.h:2083
void format(typename Context::parse_context_type &parse_ctx, Context &ctx) const
Definition core.h:2090
Definition core.h:2054
Definition core.h:2524
FMT_CONSTEXPR auto get(int id) const -> format_arg
Definition core.h:2614
Definition core.h:770
Definition format.h:955
Definition printf.h:33
basic_format_args< basic_printf_context > args_
Definition printf.h:36
OutputIt out()
Definition printf.h:57
printf_formatter< T > formatter_type
Definition printf.h:43
basic_format_arg< basic_printf_context > format_arg
Definition printf.h:40
OutputIt out_
Definition printf.h:35
Char char_type
Definition printf.h:39
FMT_CONSTEXPR void on_error(const char *message)
Definition printf.h:76
format_arg arg(int id) const
Definition printf.h:71
detail::locale_ref locale()
Definition printf.h:66
basic_printf_context(OutputIt out, basic_format_args< basic_printf_context > args)
Definition printf.h:51
basic_printf_parse_context< Char > parse_context_type
Definition printf.h:41
void advance_to(OutputIt it)
Definition printf.h:61
Definition printf.h:27
Definition core.h:483
Definition core.h:1032
FMT_CONSTEXPR auto data() noexcept -> T *
Definition core.h:1102
constexpr auto size() const noexcept -> size_t
Definition core.h:1090
Definition printf.h:240
void operator()(T value)
Definition printf.h:251
void operator()(T)
Definition printf.h:258
basic_format_arg< Context > & arg_
Definition printf.h:242
char_converter(basic_format_arg< Context > &arg)
Definition printf.h:245
Definition core.h:2442
Definition format.h:1113
Definition printf.h:137
bool operator()(T value)
Definition printf.h:140
bool operator()(T)
Definition printf.h:146
Definition core.h:2245
Definition printf.h:321
OutputIt operator()(const void *value)
Definition printf.h:400
OutputIt operator()(const char *value)
Definition printf.h:379
printf_arg_formatter(OutputIt iter, format_specs &s, context_type &ctx)
Definition printf.h:337
OutputIt operator()(const wchar_t *value)
Definition printf.h:387
OutputIt operator()(monostate value)
Definition printf.h:342
arg_formatter< Char > base
Definition printf.h:323
OutputIt operator()(basic_string_view< Char > value)
Definition printf.h:394
basic_format_specs< Char > format_specs
Definition printf.h:325
OutputIt operator()(T value)
Definition printf.h:348
context_type & context_
Definition printf.h:327
OutputIt write_null_pointer(bool is_string=false)
Definition printf.h:329
OutputIt operator()(typename basic_format_arg< context_type >::handle handle)
Definition printf.h:406
Definition printf.h:117
int operator()(T value)
Definition printf.h:120
int operator()(T)
Definition printf.h:128
Definition printf.h:283
unsigned operator()(T)
Definition printf.h:311
format_specs & specs_
Definition printf.h:287
basic_format_specs< Char > format_specs
Definition printf.h:285
printf_width_handler(format_specs &specs)
Definition printf.h:290
unsigned operator()(T value)
Definition printf.h:296
Definition core.h:1598
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
Definition color.h:646
typename std::enable_if< B, T >::type enable_if_t
Definition core.h:302
constexpr FMT_INLINE auto const_check(T value) -> T
Definition core.h:390
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
Definition core.h:2133
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Definition core.h:2506
typename detail::char_t_impl< S >::type char_t
Definition core.h:759
#define FMT_END_DETAIL_NAMESPACE
Definition core.h:231
#define FMT_MODULE_EXPORT_BEGIN
Definition core.h:226
FMT_CONSTEXPR auto parse_presentation_type(Char type) -> presentation_type
Definition core.h:3276
#define FMT_CONSTEXPR
Definition core.h:106
type
Definition core.h:681
#define FMT_BEGIN_NAMESPACE
Definition core.h:214
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition core.h:228
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T > > > buffer_appender
Definition core.h:1398
#define FMT_ENABLE_IF(...)
Definition core.h:364
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition core.h:455
FMT_CONSTEXPR auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept -> int
Definition core.h:3053
typename type_identity< T >::type type_identity_t
Definition core.h:319
typename std::conditional< B, T, F >::type conditional_t
Definition core.h:304
#define FMT_END_NAMESPACE
Definition core.h:219
#define FMT_MODULE_EXPORT_END
Definition core.h:227
#define out
Definition encodings.cpp:5
FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, const basic_format_specs< Char > &specs) -> OutputIt
Definition format.h:2049
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_opt >::value > is_signed
Definition format.h:1179
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:1212
auto to_string(const T &value) -> std::string
Definition format.h:4827
#define FMT_THROW(x)
Definition format.h:99
FMT_CONSTEXPR auto get_arg(Context &ctx, ID id) -> typename Context::format_arg
Definition format.h:4144
auto write(OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
Definition chrono.h:481
Definition bin_to_hex.h:111
void convert_arg(basic_format_arg< Context > &arg, Char type)
Definition printf.h:232
auto vfprintf(std::FILE *f, const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char > > > args) -> int
Definition printf.h:738
basic_format_args< wprintf_context > wprintf_args
Definition printf.h:681
auto vsprintf(const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char > > > args) -> std::basic_string< Char >
Definition printf.h:710
auto make_wprintf_args(const T &... args) -> format_arg_store< wprintf_context, T... >
Definition printf.h:703
basic_format_args< printf_context > printf_args
Definition printf.h:680
void vprintf(buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
Definition printf.h:497
basic_printf_context< detail::buffer_appender< Char >, Char > basic_printf_context_t
Definition printf.h:675
basic_printf_context_t< wchar_t > wprintf_context
Definition printf.h:678
auto fprintf(std::FILE *f, const S &fmt, const T &... args) -> int
Definition printf.h:760
auto printf(const S &fmt, const T &... args) -> int
Definition printf.h:786
auto sprintf(const S &fmt, const T &... args) -> std::basic_string< Char >
Definition printf.h:730
basic_printf_context_t< char > printf_context
Definition printf.h:677
void parse_flags(basic_format_specs< Char > &specs, const Char *&it, const Char *end)
Definition printf.h:416
auto make_printf_args(const T &... args) -> format_arg_store< printf_context, T... >
Definition printf.h:690
int parse_header(const Char *&it, const Char *end, basic_format_specs< Char > &specs, GetArg get_arg)
Definition printf.h:447
Definition format.h:4034
const basic_format_specs< Char > & specs
Definition format.h:4039
iterator out
Definition format.h:4038
Definition core.h:2772
presentation_type type
Definition core.h:2775
sign_t sign
Definition core.h:2777
detail::fill_t< Char > fill
Definition core.h:2780
align_t align
Definition core.h:2776
bool alt
Definition core.h:2778
int precision
Definition core.h:2774
int width
Definition core.h:2773
Definition printf.h:267
const Char * operator()(const Char *s)
Definition printf.h:273
const Char * operator()(T)
Definition printf.h:269
static bool fits_in_int(T value)
Definition printf.h:105
static bool fits_in_int(int)
Definition printf.h:110
Definition printf.h:88
static bool fits_in_int(bool)
Definition printf.h:95
static bool fits_in_int(T value)
Definition printf.h:90
Definition core.h:666
bool type
Definition printf.h:160
Definition printf.h:154
Definition core.h:352
Definition printf.h:21
printf_formatter()=delete
s
Definition tag_strings.h:47