Albert
|
#include <albert/rankitem.h>
An Item with a score.
Used to rank item results of mutliple handlers
Public Member Functions | |
RankItem (const std::shared_ptr< Item > &item, double score) noexcept | |
Constructs a RankItem with the given item and score . | |
RankItem (std::shared_ptr< Item > &&item, double score) noexcept | |
Constructs a RankItem with the given item and score using move semantics. | |
bool | operator< (const RankItem &other) const |
The less operator. | |
bool | operator> (const RankItem &other) const |
The greater operator. | |
Public Attributes | |
std::shared_ptr< Item > | item |
The matched item. | |
double | score |
The match score. | |
|
explicitnoexcept |
Constructs a RankItem with the given item
and score
.
|
explicitnoexcept |
Constructs a RankItem with the given item
and score
using move semantics.
bool albert::RankItem::operator< | ( | const RankItem & | other | ) | const |
The less operator.
bool albert::RankItem::operator> | ( | const RankItem & | other | ) | const |
The greater operator.
std::shared_ptr<Item> albert::RankItem::item |
The matched item.
double albert::RankItem::score |
The match score.
The match score should make sense in the context of the matched item. Often "make sense" means it should be the fraction of matched characters over length of the string matched agaist. The empty string should yield a match with a score of 0.
Must be in the range (0,1]. Not checked for performance.