Merge remote-tracking branch 'origin/master' into dl_using_keyword
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#ifndef OSRM_EXTRACT_DATASOURCES_HPP
|
||||
#define OSRM_EXTRACT_DATASOURCES_HPP
|
||||
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <util/string_view.hpp>
|
||||
#include <util/typedefs.hpp>
|
||||
#include <string_view>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -22,11 +25,11 @@ class Datasources
|
||||
std::fill(sources.begin(), sources.end(), '\0');
|
||||
}
|
||||
|
||||
util::StringView GetSourceName(DatasourceID id) const
|
||||
std::string_view GetSourceName(DatasourceID id) const
|
||||
{
|
||||
auto begin = sources.data() + (MAX_LENGTH_NAME * id);
|
||||
|
||||
return util::StringView{begin, lengths[id]};
|
||||
return std::string_view{begin, lengths[id]};
|
||||
}
|
||||
|
||||
void SetSourceName(DatasourceID id, const std::string &name)
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
#define OSRM_EXTRACTOR_NAME_TABLE_HPP
|
||||
|
||||
#include "util/indexed_data.hpp"
|
||||
#include "util/string_view.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -50,7 +50,7 @@ template <storage::Ownership Ownership> class NameTableImpl
|
||||
{
|
||||
public:
|
||||
using IndexedData =
|
||||
util::detail::IndexedDataImpl<util::VariableGroupBlock<16, util::StringView>, Ownership>;
|
||||
util::detail::IndexedDataImpl<util::VariableGroupBlock<16, std::string_view>, Ownership>;
|
||||
using ResultType = typename IndexedData::ResultType;
|
||||
using ValueType = typename IndexedData::ValueType;
|
||||
|
||||
@@ -58,7 +58,7 @@ template <storage::Ownership Ownership> class NameTableImpl
|
||||
|
||||
NameTableImpl(IndexedData indexed_data_) : indexed_data{std::move(indexed_data_)} {}
|
||||
|
||||
util::StringView GetNameForID(const NameID id) const
|
||||
std::string_view GetNameForID(const NameID id) const
|
||||
{
|
||||
if (id == INVALID_NAMEID)
|
||||
return {};
|
||||
@@ -66,7 +66,7 @@ template <storage::Ownership Ownership> class NameTableImpl
|
||||
return indexed_data.at(id + 0);
|
||||
}
|
||||
|
||||
util::StringView GetDestinationsForID(const NameID id) const
|
||||
std::string_view GetDestinationsForID(const NameID id) const
|
||||
{
|
||||
if (id == INVALID_NAMEID)
|
||||
return {};
|
||||
@@ -74,7 +74,7 @@ template <storage::Ownership Ownership> class NameTableImpl
|
||||
return indexed_data.at(id + 1);
|
||||
}
|
||||
|
||||
util::StringView GetExitsForID(const NameID id) const
|
||||
std::string_view GetExitsForID(const NameID id) const
|
||||
{
|
||||
if (id == INVALID_NAMEID)
|
||||
return {};
|
||||
@@ -82,7 +82,7 @@ template <storage::Ownership Ownership> class NameTableImpl
|
||||
return indexed_data.at(id + 4);
|
||||
}
|
||||
|
||||
util::StringView GetRefForID(const NameID id) const
|
||||
std::string_view GetRefForID(const NameID id) const
|
||||
{
|
||||
if (id == INVALID_NAMEID)
|
||||
return {};
|
||||
@@ -91,7 +91,7 @@ template <storage::Ownership Ownership> class NameTableImpl
|
||||
return indexed_data.at(id + OFFSET_REF);
|
||||
}
|
||||
|
||||
util::StringView GetPronunciationForID(const NameID id) const
|
||||
std::string_view GetPronunciationForID(const NameID id) const
|
||||
{
|
||||
if (id == INVALID_NAMEID)
|
||||
return {};
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define OSRM_EXTRACTOR_SUFFIX_LIST_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "util/string_view.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -23,7 +23,7 @@ class SuffixTable final
|
||||
|
||||
// check whether a string is part of the know suffix list
|
||||
bool isSuffix(const std::string &possible_suffix) const;
|
||||
bool isSuffix(util::StringView possible_suffix) const;
|
||||
bool isSuffix(std::string_view possible_suffix) const;
|
||||
|
||||
private:
|
||||
// Store lower-cased strings in SuffixTable and a set of StringViews for quick membership
|
||||
@@ -36,7 +36,7 @@ class SuffixTable final
|
||||
// require us to first convert StringViews into strings (allocation), do the membership,
|
||||
// and destroy the StringView again.
|
||||
std::vector<std::string> suffixes;
|
||||
std::unordered_set<util::StringView> suffix_set;
|
||||
std::unordered_set<std::string_view> suffix_set;
|
||||
};
|
||||
|
||||
} /* namespace extractor */
|
||||
|
||||
Reference in New Issue
Block a user