Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorShellLauncher::FuzzyMatcher Class Reference

#include <PhosphorShellLauncher/FuzzyMatcher.h>

Static Public Member Functions

static std::optional< FuzzyMatch > match (QStringView pattern, QStringView candidate, bool caseSensitive=false)
static bool patternIsCaseSensitive (QStringView pattern)
 fzf's smart case, as a decision a caller can make in one line.
static int perfectScore (int length)

Static Public Attributes

static constexpr int ScoreMatch = 16
static constexpr int ScoreGapStart = -3
static constexpr int ScoreGapExtension = -1
static constexpr int BonusBoundary = ScoreMatch / 2
static constexpr int BonusNonWord = ScoreMatch / 2
static constexpr int BonusCamel123 = BonusBoundary + ScoreGapExtension
static constexpr int BonusConsecutive = -(ScoreGapStart + ScoreGapExtension)
static constexpr int BonusFirstCharMultiplier = 2
static constexpr int BonusBoundaryWhite = BonusBoundary + 2
static constexpr int BonusBoundaryDelimiter = BonusBoundary + 1

Member Function Documentation

◆ match()

std::optional< FuzzyMatch > PhosphorShellLauncher::FuzzyMatcher::match ( QStringView pattern,
QStringView candidate,
bool caseSensitive = false )
staticnodiscard

◆ patternIsCaseSensitive()

bool PhosphorShellLauncher::FuzzyMatcher::patternIsCaseSensitive ( QStringView pattern)
staticnodiscard

fzf's smart case, as a decision a caller can make in one line.

True when the pattern contains an upper-case character, which is the user saying they mean that capital. Providers pass the result of this to match(), so a lower-case query still matches anything and a typed capital narrows.

◆ perfectScore()

int PhosphorShellLauncher::FuzzyMatcher::perfectScore ( int length)
staticnodiscard

Member Data Documentation

◆ BonusBoundary

int PhosphorShellLauncher::FuzzyMatcher::BonusBoundary = ScoreMatch / 2
staticconstexpr

◆ BonusBoundaryDelimiter

int PhosphorShellLauncher::FuzzyMatcher::BonusBoundaryDelimiter = BonusBoundary + 1
staticconstexpr

◆ BonusBoundaryWhite

int PhosphorShellLauncher::FuzzyMatcher::BonusBoundaryWhite = BonusBoundary + 2
staticconstexpr

◆ BonusCamel123

int PhosphorShellLauncher::FuzzyMatcher::BonusCamel123 = BonusBoundary + ScoreGapExtension
staticconstexpr

◆ BonusConsecutive

int PhosphorShellLauncher::FuzzyMatcher::BonusConsecutive = -(ScoreGapStart + ScoreGapExtension)
staticconstexpr

◆ BonusFirstCharMultiplier

int PhosphorShellLauncher::FuzzyMatcher::BonusFirstCharMultiplier = 2
staticconstexpr

◆ BonusNonWord

int PhosphorShellLauncher::FuzzyMatcher::BonusNonWord = ScoreMatch / 2
staticconstexpr

◆ ScoreGapExtension

int PhosphorShellLauncher::FuzzyMatcher::ScoreGapExtension = -1
staticconstexpr

◆ ScoreGapStart

int PhosphorShellLauncher::FuzzyMatcher::ScoreGapStart = -3
staticconstexpr

◆ ScoreMatch

int PhosphorShellLauncher::FuzzyMatcher::ScoreMatch = 16
staticconstexpr

The documentation for this class was generated from the following file:
  • phosphor-shell-launcher/include/PhosphorShellLauncher/FuzzyMatcher.h