| 685 | |
| 686 | template <typename Char> |
| 687 | unsigned fmt::internal::PrintfFormatter<Char>::parse_header( |
| 688 | const Char *&s, FormatSpec &spec) { |
| 689 | unsigned arg_index = UINT_MAX; |
| 690 | Char c = *s; |
| 691 | if (c >= '0' && c <= '9') { |
| 692 | // Parse an argument index (if followed by '$') or a width possibly |
| 693 | // preceded with '0' flag(s). |
| 694 | unsigned value = parse_nonnegative_int(s); |
| 695 | if (*s == '$') { // value is an argument index |
| 696 | ++s; |
| 697 | arg_index = value; |
| 698 | } else { |
| 699 | if (c == '0') |
| 700 | spec.fill_ = '0'; |
| 701 | if (value != 0) { |
| 702 | // Nonzero value means that we parsed width and don't need to |
| 703 | // parse it or flags again, so return now. |
| 704 | spec.width_ = value; |
| 705 | return arg_index; |
| 706 | } |
| 707 | } |
| 708 | } |
| 709 | parse_flags(spec, s); |
| 710 | // Parse width. |
| 711 | if (*s >= '0' && *s <= '9') { |
| 712 | spec.width_ = parse_nonnegative_int(s); |
| 713 | } else if (*s == '*') { |
| 714 | ++s; |
| 715 | spec.width_ = WidthHandler(spec).visit(get_arg(s)); |
| 716 | } |
| 717 | return arg_index; |
| 718 | } |
| 719 | |
| 720 | template <typename Char> |
| 721 | void fmt::internal::PrintfFormatter<Char>::format( |
no test coverage detected