Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Olympe::NodeSearchPalette Class Reference

Singleton fuzzy-search palette for VS node types. More...

#include <NodeSearchPalette.h>

Public Member Functions

void Open ()
 
void Close ()
 
bool IsOpen () const
 
std::vector< NodeSearchResultFuzzySearch (const std::string &query, NodeSearchCategory filter=NodeSearchCategory::All)
 Fuzzy-searches the node catalog.
 
const std::vector< NodeSearchResult > & GetAllNodes () const
 Returns all node types in the catalog (unfiltered).
 

Static Public Member Functions

static NodeSearchPaletteGet ()
 Returns the single shared instance.
 
static int ComputeFuzzyScore (const std::string &query, const std::string &candidate)
 Computes a fuzzy match score between query and candidate.
 

Private Member Functions

 NodeSearchPalette ()
 
void InitNodeCatalog ()
 

Private Attributes

bool m_IsOpen
 
std::vector< NodeSearchResultm_NodeCatalog
 

Detailed Description

Singleton fuzzy-search palette for VS node types.

Typical usage:

palette.Open();
auto results = palette.FuzzySearch("mov");
// render results...
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
static NodeSearchPalette & Get()
Returns the single shared instance.

Definition at line 65 of file NodeSearchPalette.h.

Constructor & Destructor Documentation

◆ NodeSearchPalette()

Olympe::NodeSearchPalette::NodeSearchPalette ( )
private

Definition at line 31 of file NodeSearchPalette.cpp.

References InitNodeCatalog().

+ Here is the call graph for this function:

Member Function Documentation

◆ Close()

void Olympe::NodeSearchPalette::Close ( )

Definition at line 46 of file NodeSearchPalette.cpp.

References m_IsOpen.

◆ ComputeFuzzyScore()

int Olympe::NodeSearchPalette::ComputeFuzzyScore ( const std::string &  query,
const std::string &  candidate 
)
static

Computes a fuzzy match score between query and candidate.

Returns 0 when there is no match. Positive scores reflect quality: exact match > substring match > scattered character match.

Definition at line 180 of file NodeSearchPalette.cpp.

References GetComponentTypeID_Static(), and Olympe::ToLower().

Referenced by FuzzySearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FuzzySearch()

std::vector< NodeSearchResult > Olympe::NodeSearchPalette::FuzzySearch ( const std::string &  query,
NodeSearchCategory  filter = NodeSearchCategory::All 
)

Fuzzy-searches the node catalog.

Parameters
queryThe string typed by the user (may be empty).
filterCategory to restrict results to; defaults to All.
Returns
Results sorted by score descending.

Definition at line 121 of file NodeSearchPalette.cpp.

References Olympe::All, ComputeFuzzyScore(), GetComponentTypeID_Static(), m_NodeCatalog, and Olympe::NodeSearchResult::score.

+ Here is the call graph for this function:

◆ Get()

NodeSearchPalette & Olympe::NodeSearchPalette::Get ( )
static

Returns the single shared instance.

Definition at line 21 of file NodeSearchPalette.cpp.

◆ GetAllNodes()

const std::vector< NodeSearchResult > & Olympe::NodeSearchPalette::GetAllNodes ( ) const

Returns all node types in the catalog (unfiltered).

Definition at line 237 of file NodeSearchPalette.cpp.

References m_NodeCatalog.

◆ InitNodeCatalog()

void Olympe::NodeSearchPalette::InitNodeCatalog ( )
private

Definition at line 60 of file NodeSearchPalette.cpp.

References Olympe::Actions, Olympe::ControlFlow, Olympe::Data, GetComponentTypeID_Static(), m_NodeCatalog, SYSTEM_LOG, and Olympe::NodeSearchResult::typeName.

Referenced by NodeSearchPalette().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsOpen()

bool Olympe::NodeSearchPalette::IsOpen ( ) const

Definition at line 51 of file NodeSearchPalette.cpp.

References m_IsOpen.

◆ Open()

void Olympe::NodeSearchPalette::Open ( )

Definition at line 41 of file NodeSearchPalette.cpp.

References m_IsOpen.

Member Data Documentation

◆ m_IsOpen

bool Olympe::NodeSearchPalette::m_IsOpen
private

Definition at line 121 of file NodeSearchPalette.h.

Referenced by Close(), IsOpen(), and Open().

◆ m_NodeCatalog

std::vector<NodeSearchResult> Olympe::NodeSearchPalette::m_NodeCatalog
private

Definition at line 122 of file NodeSearchPalette.h.

Referenced by FuzzySearch(), GetAllNodes(), and InitNodeCatalog().


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