Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
38
3party/opening_hours/parse_opening_hours.hpp
Normal file
38
3party/opening_hours/parse_opening_hours.hpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include "opening_hours.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
|
||||
namespace osmoh
|
||||
{
|
||||
template<typename Parser, typename Context>
|
||||
bool ParseImpl(std::string const & str, Context & context)
|
||||
{
|
||||
using boost::spirit::qi::phrase_parse;
|
||||
using boost::spirit::standard_wide::space;
|
||||
|
||||
Parser parser;
|
||||
#ifndef NDEBUG
|
||||
boost::spirit::qi::what(parser);
|
||||
#endif
|
||||
|
||||
auto first = begin(str);
|
||||
auto const last = end(str);
|
||||
auto parsed = phrase_parse(first, last, parser, space, context);
|
||||
|
||||
if (!parsed || first != last)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Parse(std::string const &, TTimespans &);
|
||||
bool Parse(std::string const &, Weekdays &);
|
||||
bool Parse(std::string const &, TMonthdayRanges &);
|
||||
bool Parse(std::string const &, TYearRanges &);
|
||||
bool Parse(std::string const &, TWeekRanges &);
|
||||
bool Parse(std::string const &, TRuleSequences &);
|
||||
} // namespace osmoh
|
||||
Loading…
Add table
Add a link
Reference in a new issue