Allows the results of a search query to be sent to the query source.
More...
#include <unity/scopes/SearchReply.h>
Allows the results of a search query to be sent to the query source.
virtual unity::scopes::SearchReply::~SearchReply |
( |
| ) |
|
|
virtual |
virtual Category::SCPtr unity::scopes::SearchReply::lookup_category |
( |
std::string const & |
id | ) |
|
|
pure virtual |
Returns a previously registered category.
- Returns
- The category instance or
nullptr
if the category does not exist.
Sends a single result to the source of a query.
Any calls to push() after finished() was called are ignored.
- Returns
- The return value is true if the result was accepted, false otherwise. A false return value can be due to finished() having been called earlier, or the client that sent the query having cancelled that query. The return value is false also if the query has a cardinality limit and is reached or exceeded. (The return value is false for the last valid push and subsequent pushes.)
virtual bool unity::scopes::SearchReply::push |
( |
Annotation const & |
annotation | ) |
|
|
pure virtual |
Push an annotation.
The annotation will be rendered at a next available spot below the category of last pushed result. To render an annotation in the top annotation area, push it before pushing search results.
- Note
- The Unity shell can ignore some or all annotations, depending on available screen real estate.
virtual bool unity::scopes::SearchReply::push |
( |
Filters const & |
filters, |
|
|
FilterState const & |
filter_state |
|
) |
| |
|
pure virtual |
Sends all filters and their state to the source of a query.
- Returns
- True if the filters were accepted, false otherwise.
virtual bool unity::scopes::SearchReply::register_annotation |
( |
Annotation const & |
annotation | ) |
|
|
virtual |
virtual Category::SCPtr unity::scopes::SearchReply::register_category |
( |
std::string const & |
id, |
|
|
std::string const & |
title, |
|
|
std::string const & |
icon, |
|
|
CategoryRenderer const & |
renderer_template = CategoryRenderer() |
|
) |
| |
|
pure virtual |
Register an existing category instance and send it to the source of the query.
The purpose of this call is to register a category obtained via ReplyBase::push(Category::SCPtr) when aggregating results and categories from other scope(s).
virtual void unity::scopes::SearchReply::register_category |
( |
Category::SCPtr |
category | ) |
|
|
pure virtual |
Returns a previously registered category.
- Returns
- The category instance or
nullptr
if the category does not exist registered.
virtual void unity::scopes::SearchReply::register_departments |
( |
DepartmentList const & |
departments, |
|
|
std::string |
current_department_id = "" |
|
) |
| |
|
pure virtual |
Register departments for the current search reply and provide the current department.
Departments are optional. If scope supports departments, it is expected to register departments on every search as follows:
For example, assuming the user is visiting a "History" department in "Books", and "History" has sub-departments such as "World War Two" and "Ancient", the code that registers departments for current search in "History" may look like this:
books.set_subdepartments({history});
reply->register_departments({books}, "history");
current_department_id should in most cases be the department returned by unity::scopes::CannedQuery::department_id(). Pass an empty string for current_department_id to indicate no active department.
- Parameters
-
departments | A list of departments. |
current_department_id | A department id that should be considered current. |
The documentation for this class was generated from the following file: