Albert
Loading...
Searching...
No Matches
albert::GeneratorQueryHandler Class Referenceabstract

#include <albert/generatorqueryhandler.h>

Description

Coroutine-based synchronous generator query handler.

Convenience base class for implementing triggered query handlers using C++ coroutines. Results are produced lazily via a synchronous item generator. Item production is executed in a worker thread, allowing CPU-bound work without blocking the main thread. The items are displayed in the order they are yielded.

This class is intended for computational workloads. For I/O-bound or event-driven tasks, prefer AsyncGeneratorQueryHandler.

Inheritance diagram for albert::GeneratorQueryHandler:
[legend]

Public Member Functions

virtual ItemGenerator items (QueryContext &context)=0
 Yields batches of items for context lazily.
 
- Public Member Functions inherited from albert::QueryHandler
virtual QString synopsis (const QString &query) const
 Returns the input hint for the given query.
 
virtual bool allowTriggerRemap () const
 Returns true if the user is allowed to set a custom trigger, otherwise returns false.
 
virtual QString defaultTrigger () const
 Returns the default trigger.
 
virtual bool supportsFuzzyMatching () const
 Returns true if the handler supports fuzzy matching, otherwise returns false.
 
- Public Member Functions inherited from albert::Extension
virtual QString id () const =0
 Returns the extension identifier.
 
virtual QString name () const =0
 Returns the pretty, human readable extension name.
 
virtual QString description () const =0
 Returns the brief extension description.
 

Protected Member Functions

 ~GeneratorQueryHandler () override
 Destructs the handler.
 
std::unique_ptr< QueryExecutionexecution (QueryContext &context) override
 Returns a threaded synchronous generator query execution for context.
 
- Protected Member Functions inherited from albert::QueryHandler
 ~QueryHandler () override
 Destructs the handler.
 
virtual void setFuzzyMatching (bool enabled)
 Sets the fuzzy matching mode to enabled.
 
virtual void setTrigger (const QString &trigger)
 Notifies that the user-defined trigger has changed to trigger.
 
- Protected Member Functions inherited from albert::Extension
virtual ~Extension ()
 Destructs the extension.
 

Constructor & Destructor Documentation

◆ ~GeneratorQueryHandler()

albert::GeneratorQueryHandler::~GeneratorQueryHandler ( )
overrideprotected

Destructs the handler.

Member Function Documentation

◆ execution()

std::unique_ptr< QueryExecution > albert::GeneratorQueryHandler::execution ( QueryContext context)
overrideprotectedvirtual

Returns a threaded synchronous generator query execution for context.

Implements albert::QueryHandler.

◆ items()

virtual ItemGenerator albert::GeneratorQueryHandler::items ( QueryContext context)
pure virtual

Yields batches of items for context lazily.

The batch size is defined by the implementation.

Note
Executed in a background thread.

Implemented in albert::RankedQueryHandler.


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