|
Albert
|
#include <albert/generatorqueryhandler.h>
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.
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< QueryExecution > | execution (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. | |
|
overrideprotected |
Destructs the handler.
|
overrideprotectedvirtual |
Returns a threaded synchronous generator query execution for context.
Implements albert::QueryHandler.
|
pure virtual |
Yields batches of items for context lazily.
The batch size is defined by the implementation.
Implemented in albert::RankedQueryHandler.