Add search/query.?pp

This commit is contained in:
Yury Melnichek 2011-05-20 17:30:02 +02:00 committed by Alex Zolotarev
parent 4a98be33ca
commit ab47cb8632
3 changed files with 42 additions and 2 deletions

19
search/query.cpp Normal file
View file

@ -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();
}
}
}

19
search/query.hpp Normal file
View file

@ -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<string> m_Keywords;
string m_Prefix;
};
} // namespace search1

View file

@ -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 \