logic: preselecting SearchNodes for autocompletion by prefiltering the Graph with the entered Query

This change only shows matches in the autocompletion list that are prefiltered by the already entered query. The
autocompletion now also shows up after an operator of type . or > has been entered to show an alphabetical list of
possible tokens.
This commit is contained in:
Eberhard Graether
2014-10-28 20:21:19 +01:00
parent ede0af4291
commit 86f4629b0d
27 changed files with 407 additions and 198 deletions
@@ -7,8 +7,9 @@
class MessageSearchAutocomplete: public Message<MessageSearchAutocomplete>
{
public:
MessageSearchAutocomplete(const std::string& query)
MessageSearchAutocomplete(const std::string& query, const std::string& word)
: query(query)
, word(word)
{
}
@@ -18,6 +19,7 @@ public:
}
const std::string query;
const std::string word;
};
#endif // MESSAGE_SEARCH_AUTOCOMPLETE_H
+19 -1
View File
@@ -120,7 +120,7 @@ namespace utility
{
if (a.size() == b.size())
{
for (int i = 0; i < a.size(); i++)
for (size_t i = 0; i < a.size(); i++)
{
if (tolower(a[i]) != tolower(b[i]))
{
@@ -131,4 +131,22 @@ namespace utility
}
return false;
}
std::string replace(std::string str, const std::string& from, const std::string& to)
{
size_t pos = 0;
if (from.size() == 0)
{
return str;
}
while ((pos = str.find(from, pos)) != std::string::npos)
{
str.replace(pos, from.length(), to);
pos += to.length();
}
return str;
}
}
+2
View File
@@ -35,6 +35,8 @@ namespace utility
bool equalsCaseInsensitive(const std::string& a, const std::string& b);
std::string replace(std::string str, const std::string& from, const std::string& to);
template <typename ContainerType>
ContainerType split(const std::string& str, const std::string& delimiter)