diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-05-24 10:37:47 +0300 |
---|---|---|
committer | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-05-25 13:48:25 +0300 |
commit | 3a82ce50c4c009f7dede62defca828a042f925ba (patch) | |
tree | 664aac4f8f25b1f796255c9f1ef2d66542c53bae /indexer/string_slice.hpp | |
parent | 46b0728df00db943fe5f94e18bd8ce65bef9c5cf (diff) |
Refactor postcodes matcher.
Diffstat (limited to 'indexer/string_slice.hpp')
-rw-r--r-- | indexer/string_slice.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/indexer/string_slice.hpp b/indexer/string_slice.hpp new file mode 100644 index 0000000000..4bf3eb6a13 --- /dev/null +++ b/indexer/string_slice.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include "base/string_utils.hpp" + +#include "std/string.hpp" +#include "std/vector.hpp" + +namespace search +{ +class StringSliceBase +{ +public: + using TString = strings::UniString; + + virtual ~StringSliceBase() = default; + + virtual TString const & Get(size_t i) const = 0; + virtual size_t Size() const = 0; +}; + +class NoPrefixStringSlice : public StringSliceBase +{ +public: + NoPrefixStringSlice(vector<TString> const & strings) + : m_strings(strings) + { + } + + virtual TString const & Get(size_t i) const override { return m_strings[i]; } + virtual size_t Size() const override { return m_strings.size(); } + +private: + vector<TString> const & m_strings; +}; +} // namespace search |