yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::CommandPalette Class Reference

#include <command_palette.h>

Public Member Functions

void AddCommand (const std::string &name, const std::string &category, const std::string &description, const std::string &shortcut, std::function< void()> callback)
 
void RecordUsage (const std::string &name)
 
std::vector< CommandEntrySearchCommands (const std::string &query)
 
std::vector< CommandEntryGetRecentCommands (int limit=10)
 
std::vector< CommandEntryGetFrequentCommands (int limit=10)
 
void SaveHistory (const std::string &filepath)
 
void LoadHistory (const std::string &filepath)
 

Private Member Functions

int FuzzyScore (const std::string &text, const std::string &query)
 

Private Attributes

std::unordered_map< std::string, CommandEntrycommands_
 

Detailed Description

Definition at line 22 of file command_palette.h.

Member Function Documentation

◆ AddCommand()

void yaze::editor::CommandPalette::AddCommand ( const std::string & name,
const std::string & category,
const std::string & description,
const std::string & shortcut,
std::function< void()> callback )

◆ RecordUsage()

void yaze::editor::CommandPalette::RecordUsage ( const std::string & name)

Definition at line 24 of file command_palette.cc.

References commands_, and yaze::editor::CommandEntry::usage_count.

◆ SearchCommands()

std::vector< CommandEntry > yaze::editor::CommandPalette::SearchCommands ( const std::string & query)

Definition at line 79 of file command_palette.cc.

References commands_, and FuzzyScore().

Here is the call graph for this function:

◆ GetRecentCommands()

std::vector< CommandEntry > yaze::editor::CommandPalette::GetRecentCommands ( int limit = 10)

Definition at line 120 of file command_palette.cc.

References commands_.

◆ GetFrequentCommands()

std::vector< CommandEntry > yaze::editor::CommandPalette::GetFrequentCommands ( int limit = 10)

Definition at line 141 of file command_palette.cc.

References commands_.

◆ SaveHistory()

void yaze::editor::CommandPalette::SaveHistory ( const std::string & filepath)
Todo
Implement JSON serialization of command history

Definition at line 162 of file command_palette.cc.

◆ LoadHistory()

void yaze::editor::CommandPalette::LoadHistory ( const std::string & filepath)
Todo
Implement JSON deserialization of command history

Definition at line 166 of file command_palette.cc.

◆ FuzzyScore()

int yaze::editor::CommandPalette::FuzzyScore ( const std::string & text,
const std::string & query )
private

Definition at line 35 of file command_palette.cc.

Referenced by SearchCommands().

Member Data Documentation

◆ commands_

std::unordered_map<std::string, CommandEntry> yaze::editor::CommandPalette::commands_
private

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