63 lines
1.3 KiB
C++
63 lines
1.3 KiB
C++
#ifndef SEARCH_MATCH_H
|
|
#define SEARCH_MATCH_H
|
|
|
|
#include <ostream>
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "data/graph/Node.h"
|
|
#include "utility/types.h"
|
|
|
|
struct SearchMatch
|
|
{
|
|
enum SearchType
|
|
{
|
|
SEARCH_NONE,
|
|
SEARCH_TOKEN,
|
|
SEARCH_COMMAND,
|
|
SEARCH_OPERATOR,
|
|
SEARCH_FULLTEXT
|
|
};
|
|
|
|
enum CommandType
|
|
{
|
|
COMMAND_ALL,
|
|
COMMAND_ERROR,
|
|
COMMAND_COLOR_SCHEME_TEST
|
|
};
|
|
|
|
static void log(const std::vector<SearchMatch>& matches, const std::string& query);
|
|
|
|
static std::string getSearchTypeName(SearchType type);
|
|
static std::string searchMatchesToString(const std::vector<SearchMatch>& matches);
|
|
|
|
static SearchMatch createCommand(CommandType type);
|
|
static std::string getCommandName(CommandType type);
|
|
static CommandType getCommandType(const std::string& name);
|
|
|
|
static const char FULLTEXT_SEARCH_CHARACTER = '?';
|
|
|
|
SearchMatch();
|
|
SearchMatch(const std::string& query);
|
|
|
|
bool isValid() const;
|
|
|
|
void print(std::ostream& ostream) const;
|
|
|
|
std::string getFullName() const;
|
|
std::string getNodeTypeAsString() const;
|
|
std::string getSearchTypeName() const;
|
|
|
|
std::string text;
|
|
std::string typeName;
|
|
Node::NodeType nodeType;
|
|
SearchType searchType;
|
|
std::vector<size_t> indices;
|
|
|
|
std::vector<NameHierarchy> nameHierarchies;
|
|
};
|
|
|
|
|
|
#endif // SEARCH_MATCH_H
|