MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / parse_chrono_format

Function parse_chrono_format

extlibs/fmt/include/fmt/chrono.h:478–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476// Parses a put_time-like format string and invokes handler actions.
477template <typename Char, typename Handler>
478FMT_CONSTEXPR const Char* parse_chrono_format(const Char* begin,
479 const Char* end,
480 Handler&& handler) {
481 auto ptr = begin;
482 while (ptr != end) {
483 auto c = *ptr;
484 if (c == '}') break;
485 if (c != '%') {
486 ++ptr;
487 continue;
488 }
489 if (begin != ptr) handler.on_text(begin, ptr);
490 ++ptr; // consume '%'
491 if (ptr == end) FMT_THROW(format_error("invalid format"));
492 c = *ptr++;
493 switch (c) {
494 case '%':
495 handler.on_text(ptr - 1, ptr);
496 break;
497 case 'n': {
498 const Char newline[] = {'\n'};
499 handler.on_text(newline, newline + 1);
500 break;
501 }
502 case 't': {
503 const Char tab[] = {'\t'};
504 handler.on_text(tab, tab + 1);
505 break;
506 }
507 // Day of the week:
508 case 'a':
509 handler.on_abbr_weekday();
510 break;
511 case 'A':
512 handler.on_full_weekday();
513 break;
514 case 'w':
515 handler.on_dec0_weekday(numeric_system::standard);
516 break;
517 case 'u':
518 handler.on_dec1_weekday(numeric_system::standard);
519 break;
520 // Month:
521 case 'b':
522 handler.on_abbr_month();
523 break;
524 case 'B':
525 handler.on_full_month();
526 break;
527 // Hour, minute, second:
528 case 'H':
529 handler.on_24_hour(numeric_system::standard);
530 break;
531 case 'I':
532 handler.on_12_hour(numeric_system::standard);
533 break;
534 case 'M':
535 handler.on_minute(numeric_system::standard);

Callers 2

do_parseMethod · 0.85
formatMethod · 0.85

Calls 15

format_errorFunction · 0.85
on_textMethod · 0.45
on_abbr_weekdayMethod · 0.45
on_full_weekdayMethod · 0.45
on_dec0_weekdayMethod · 0.45
on_dec1_weekdayMethod · 0.45
on_abbr_monthMethod · 0.45
on_full_monthMethod · 0.45
on_24_hourMethod · 0.45
on_12_hourMethod · 0.45
on_minuteMethod · 0.45
on_secondMethod · 0.45

Tested by

no test coverage detected