|
Albert
|
#include <albert/asyncgeneratorqueryhandler.h>
Coroutine-based asynchronous generator query handler.
Convenience base class for implementing triggered query handlers using C++ coroutines. Results are produced lazily via an asynchronous item generator. The items are displayed in the order they are yielded.
This class is suitable for I/O-bound query handling (e.g. network requests, subprocessing, etc.). For CPU-bound work, prefer GeneratorQueryHandler or its subclasses.
If you derive this class you want to link against QCoro which provides coroutine support for Qt classes. Note that QCoro is still in development.
Public Member Functions | |
| virtual AsyncItemGenerator | items (QueryContext &context)=0 |
| Yields batches of items for context asynchronously and 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 | |
| ~AsyncGeneratorQueryHandler () override | |
| Destructs the handler. | |
| std::unique_ptr< QueryExecution > | execution (QueryContext &context) override |
| Returns an asynchronous 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 an asynchronous generator query execution for context.
Implements albert::QueryHandler.
|
pure virtual |
Yields batches of items for context asynchronously and lazily.
The batch size is defined by the implementation.