MCPcopy Create free account
hub / github.com/fmtlib/fmt / parse

Function parse

include/fmt/ranges.h:431–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429 }
430
431 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* {
432 auto it = ctx.begin();
433 auto end = ctx.end();
434 detail::maybe_set_debug_format(underlying_, true);
435 if (it == end) return underlying_.parse(ctx);
436
437 switch (detail::to_ascii(*it)) {
438 case 'n':
439 set_brackets({}, {});
440 ++it;
441 break;
442 case '?':
443 is_debug = true;
444 set_brackets({}, {});
445 ++it;
446 if (it == end || *it != 's') report_error("invalid format specifier");
447 FMT_FALLTHROUGH;
448 case 's':
449 if (!std::is_same<T, Char>::value)
450 report_error("invalid format specifier");
451 if (!is_debug) {
452 set_brackets(detail::string_literal<Char, '"'>{},
453 detail::string_literal<Char, '"'>{});
454 set_separator({});
455 detail::maybe_set_debug_format(underlying_, false);
456 }
457 ++it;
458 return it;
459 }
460
461 if (it != end && *it != '}') {
462 if (*it != ':') report_error("invalid format specifier");
463 detail::maybe_set_debug_format(underlying_, false);
464 ++it;
465 }
466
467 ctx.advance_to(it);
468 return underlying_.parse(ctx);
469 }
470
471 template <typename R, typename FormatContext>
472 FMT_CONSTEXPR auto format(R&& range, FormatContext& ctx) const

Callers 5

parseMethod · 0.70
parseMethod · 0.70
parseMethod · 0.70
parseMethod · 0.70
parseMethod · 0.70

Calls 9

maybe_set_debug_formatFunction · 0.85
to_asciiFunction · 0.85
set_bracketsFunction · 0.85
report_errorFunction · 0.85
set_separatorFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
parseMethod · 0.45
advance_toMethod · 0.45

Tested by

no test coverage detected