From ab47cb8632287e82f81e0a38ff9e583fd2b0882b Mon Sep 17 00:00:00 2001 From: Yury Melnichek Date: Fri, 20 May 2011 17:30:02 +0200 Subject: [PATCH] Add search/query.?pp --- search/query.cpp | 19 +++++++++++++++++++ search/query.hpp | 19 +++++++++++++++++++ search/search.pro | 6 ++++-- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 search/query.cpp create mode 100644 search/query.hpp diff --git a/search/query.cpp b/search/query.cpp new file mode 100644 index 0000000000..d2668c133c --- /dev/null +++ b/search/query.cpp @@ -0,0 +1,19 @@ +#include "query.hpp" +#include "../base/utf8_string.hpp" + +namespace search1 +{ + +Query::Query(string const & query) +{ + utf8_string::Split(query, m_Keywords, &utf8_string::IsSearchDelimiter); + if (!query.empty() && !utf8_string::IsSearchDelimiter(query[query.size() - 1])) + { + m_Prefix.swap(m_Keywords.back()); + m_Keywords.pop_back(); + } +} + + + +} diff --git a/search/query.hpp b/search/query.hpp new file mode 100644 index 0000000000..cdbf85bc94 --- /dev/null +++ b/search/query.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include "../base/base.hpp" +#include "../std/string.hpp" +#include "../std/vector.hpp" + +namespace search1 +{ + +class Query +{ +public: + explicit Query(string const & query); +private: + vector m_Keywords; + string m_Prefix; +}; + +} // namespace search1 diff --git a/search/search.pro b/search/search.pro index be2cc35b62..b74ed1811e 100644 --- a/search/search.pro +++ b/search/search.pro @@ -10,7 +10,9 @@ DEPENDENCIES = indexer geometry coding base include($$ROOT_DIR/common.pri) HEADERS += \ - search_processor.hpp \ + query.hpp \ + search_processor.hpp \ SOURCES += \ - search_processor.cpp \ + query.cpp \ + search_processor.cpp \