Albert
Loading...
Searching...
No Matches
albert::RankItem Class Reference

#include <albert/rankitem.h>

Detailed Description

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< Itemitem
 The matched item.
 
double score
 The match score.
 

Constructor & Destructor Documentation

◆ RankItem() [1/2]

albert::RankItem::RankItem ( const std::shared_ptr< Item > &  item,
double  score 
)
explicitnoexcept

Constructs a RankItem with the given item and score.

◆ RankItem() [2/2]

albert::RankItem::RankItem ( std::shared_ptr< Item > &&  item,
double  score 
)
explicitnoexcept

Constructs a RankItem with the given item and score using move semantics.

Member Function Documentation

◆ operator<()

bool albert::RankItem::operator< ( const RankItem other) const

The less operator.

◆ operator>()

bool albert::RankItem::operator> ( const RankItem other) const

The greater operator.

Member Data Documentation

◆ item

std::shared_ptr<Item> albert::RankItem::item

The matched item.

◆ score

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.


The documentation for this class was generated from the following file: