2015-10-22 20:49:08 +02:00
|
|
|
#ifndef ranked_match_hh_INCLUDED
|
|
|
|
#define ranked_match_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "string.hh"
|
|
|
|
#include "vector.hh"
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
struct RankedMatch
|
|
|
|
{
|
2015-10-27 22:25:18 +01:00
|
|
|
RankedMatch(StringView candidate, StringView query);
|
|
|
|
|
|
|
|
const StringView& candidate() const { return m_candidate; }
|
|
|
|
bool operator<(const RankedMatch& other) const;
|
|
|
|
bool operator==(const RankedMatch& other) const { return m_candidate == other.m_candidate; }
|
|
|
|
|
|
|
|
explicit operator bool() const { return not m_candidate.empty(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
StringView m_candidate;
|
2015-10-29 14:36:30 +01:00
|
|
|
bool m_first_char_match = false;
|
|
|
|
bool m_prefix = false;
|
|
|
|
int m_word_boundary_match_count = 0;
|
|
|
|
bool m_only_word_boundary = false;
|
2015-10-22 20:49:08 +02:00
|
|
|
};
|
|
|
|
|
2015-10-27 22:25:18 +01:00
|
|
|
using RankedMatchList = Vector<RankedMatch>;
|
2015-10-22 20:49:08 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // ranked_match_hh_INCLUDED
|