osrm-backend/src/extractor/suffix_table.cpp

27 lines
670 B
C++
Raw Normal View History

2016-04-22 05:31:46 -04:00
#include "extractor/suffix_table.hpp"
#include "extractor/scripting_environment.hpp"
2016-04-22 05:31:46 -04:00
#include <boost/algorithm/string.hpp>
namespace osrm
{
namespace extractor
{
SuffixTable::SuffixTable(ScriptingEnvironment &scripting_environment)
2016-04-22 05:31:46 -04:00
{
std::vector<std::string> suffixes_vector = scripting_environment.GetNameSuffixList();
2016-04-22 05:31:46 -04:00
for (auto &suffix : suffixes_vector)
boost::algorithm::to_lower(suffix);
suffix_set.insert(std::begin(suffixes_vector), std::end(suffixes_vector));
}
bool SuffixTable::isSuffix(const std::string &possible_suffix) const
{
return suffix_set.count(possible_suffix) > 0;
}
} /* namespace extractor */
} /* namespace osrm */