mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-02 19:13:44 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
41
3party/opening_hours/parse_years.cpp
Normal file
41
3party/opening_hours/parse_years.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "parse_opening_hours.hpp"
|
||||
#include "opening_hours_parsers.hpp"
|
||||
|
||||
#include <boost/phoenix/bind.hpp>
|
||||
#include <boost/phoenix/operator.hpp> // operator,
|
||||
|
||||
namespace osmoh
|
||||
{
|
||||
namespace parsing
|
||||
{
|
||||
year_selector_parser::year_selector_parser() : year_selector_parser::base_type(main)
|
||||
{
|
||||
using qi::uint_;
|
||||
using qi::lit;
|
||||
using qi::_1;
|
||||
using qi::_2;
|
||||
using qi::_3;
|
||||
using qi::_val;
|
||||
using osmoh::YearRange;
|
||||
|
||||
static const qi::int_parser<unsigned, 10, 4, 4> year = {};
|
||||
|
||||
year_range = (year >> dash >> year >> '/' >> uint_) [(bind(&YearRange::SetStart, _val, _1),
|
||||
bind(&YearRange::SetEnd, _val, _2),
|
||||
bind(&YearRange::SetPeriod, _val, _3))]
|
||||
| (year >> dash >> year) [(bind(&YearRange::SetStart, _val, _1),
|
||||
bind(&YearRange::SetEnd, _val, _2))]
|
||||
| (year >> lit('+')) [(bind(&YearRange::SetStart, _val, _1),
|
||||
bind(&YearRange::SetPlus, _val, true))]
|
||||
;
|
||||
|
||||
main %= (year_range % ',');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Parse(std::string const & str, TYearRanges & context)
|
||||
{
|
||||
return osmoh::ParseImpl<parsing::year_selector_parser>(str, context);
|
||||
}
|
||||
} // namespace osmoh
|
||||
Reference in New Issue
Block a user