Blender V4.3
blender::string_search::StringSearch< T > Class Template Reference

#include <BLI_string_search.hh>

Inherits blender::string_search::StringSearchBase.

Inherited by blender::ui::string_search::StringSearch< T >.

Public Member Functions

 StringSearch (const RecentCache *recent_cache, const MainWordsHeuristic main_words_heuristic)
 
void add (const StringRef str, T *user_data, const int weight=0)
 
Vector< T * > query (const StringRef query) const
 

Detailed Description

template<typename T>
class blender::string_search::StringSearch< T >

StringSearch filters and sorts search items based on a string query. Every search item has data of type T attached that is used to identify it.

When querying, the a match score is computed between the query string and each item. Items that don't match are filtered out, the rest is sorted by the score. Elements with the same score are further sorted based on the optionally provided weight and other heuristics.

The usage is simple. First add all the search items and then use the query method.

Definition at line 87 of file BLI_string_search.hh.

Constructor & Destructor Documentation

◆ StringSearch()

template<typename T >
blender::string_search::StringSearch< T >::StringSearch ( const RecentCache * recent_cache,
const MainWordsHeuristic main_words_heuristic )
inline

Member Function Documentation

◆ add()

template<typename T >
void blender::string_search::StringSearch< T >::add ( const StringRef str,
T * user_data,
const int weight = 0 )
inline

Add a new possible result to the search.

Parameters
weightCan be used to customize the order when multiple items have the same match score.

Definition at line 101 of file BLI_string_search.hh.

References blender::string_search::StringSearchBase::add_impl().

Referenced by blender::ui::attribute_search_add_items(), id_search_cb(), id_search_cb_tagged(), blender::ed::space_node::link_drag_search_update_fn(), menu_search_update_fn(), blender::ed::space_node::node_find_update_fn(), and operator_enum_search_update_fn().

◆ query()

template<typename T >
Vector< T * > blender::string_search::StringSearch< T >::query ( const StringRef query) const
inline

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