diff --git a/include/updater/csv_file_parser.hpp b/include/updater/csv_file_parser.hpp index b2b1a3d23..a1d45c0bd 100644 --- a/include/updater/csv_file_parser.hpp +++ b/include/updater/csv_file_parser.hpp @@ -23,11 +23,6 @@ namespace osrm namespace updater { -namespace -{ -namespace qi = boost::spirit::qi; -} - // Functor to parse a list of CSV files using "key,value,comment" grammar. // Key and Value structures must be a model of Random Access Sequence. // Also the Value structure must have source member that will be filled @@ -35,8 +30,8 @@ namespace qi = boost::spirit::qi; template struct CSVFilesParser { using Iterator = boost::iostreams::mapped_file_source::iterator; - using KeyRule = qi::rule; - using ValueRule = qi::rule; + using KeyRule = boost::spirit::qi::rule; + using ValueRule = boost::spirit::qi::rule; CSVFilesParser(std::size_t start_index, const KeyRule &key_rule, const ValueRule &value_rule) : start_index(start_index), key_rule(key_rule), value_rule(value_rule) @@ -94,6 +89,8 @@ template struct CSVFilesParser // Parse a single CSV file and return result as a vector auto ParseCSVFile(const std::string &filename, std::size_t file_id) const { + namespace qi = boost::spirit::qi; + std::vector> result; try { @@ -105,7 +102,7 @@ template struct CSVFilesParser BOOST_ASSERT(file_id <= std::numeric_limits::max()); ValueRule value_source = - value_rule[qi::_val = qi::_1, boost::phoenix::bind(&Value::source, qi::_val) = file_id]; + value_rule[qi::_val = qi::_1, bind(&Value::source, qi::_val) = file_id]; qi::rule()> csv_line = (key_rule >> ',' >> value_source) >> -(',' >> *(qi::char_ - qi::eol)); const auto ok = qi::parse(first, last, -(csv_line % qi::eol) >> *qi::eol, result); @@ -117,8 +114,8 @@ template struct CSVFilesParser --begin_of_line; auto line_number = std::count(mmap.begin(), first, '\n') + 1; const auto message = boost::format("CSV file %1% malformed on line %2%:\n %3%\n") % - filename % std::to_string(line_number) % - std::string(begin_of_line + 1, std::find(first, last, '\n')); + filename % std::to_string(line_number) % + std::string(begin_of_line + 1, std::find(first, last, '\n')); throw util::exception(message.str() + SOURCE_REF); } @@ -126,10 +123,10 @@ template struct CSVFilesParser return std::move(result); } - catch (const boost::exception& e) + catch (const boost::exception &e) { - const auto message = boost::format("exception in loading %1%:\n %2%") % - filename % boost::diagnostic_information(e); + const auto message = boost::format("exception in loading %1%:\n %2%") % filename % + boost::diagnostic_information(e); throw util::exception(message.str() + SOURCE_REF); } }