MCPcopy Create free account
hub / github.com/HowardHinnant/date / parse_dow

Function parse_dow

src/tz.cpp:887–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885// Parsing helpers
886
887static
888unsigned
889parse_dow(std::istream& in)
890{
891 static std::string const dow_names[] =
892 {"sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"};
893 auto s = get_alpha_word(in);
894 tolower(s);
895 auto dow = std::find_if(std::begin(dow_names), std::end(dow_names),
896 [&s](std::string const& dow)
897 {
898 return is_prefix_of(s, dow);
899 })
900 - dow_names;
901 if (dow >= std::end(dow_names) - std::begin(dow_names))
902 throw std::runtime_error("oops: bad dow name: " + s);
903 return static_cast<unsigned>(dow);
904}
905
906static
907std::chrono::seconds

Callers 1

tz.cppFile · 0.85

Calls 3

get_alpha_wordFunction · 0.85
tolowerFunction · 0.85
is_prefix_ofFunction · 0.85

Tested by

no test coverage detected