Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
unity::scopes::SearchReply Class Referenceabstract

Allows the results of a search query to be sent to the query source. More...

#include <unity/scopes/SearchReply.h>

Inheritance diagram for unity::scopes::SearchReply:

Public Member Functions

virtual void register_departments (DepartmentList const &departments, std::string current_department_id="")=0
 Register departments for the current search reply and provide the current department. More...
 
virtual Category::SCPtr register_category (std::string const &id, std::string const &title, std::string const &icon, CategoryRenderer const &renderer_template=CategoryRenderer())=0
 Register an existing category instance and send it to the source of the query. More...
 
virtual void register_category (Category::SCPtr category)=0
 Returns a previously registered category. More...
 
virtual Category::SCPtr lookup_category (std::string const &id)=0
 Returns a previously registered category. More...
 
virtual bool push (CategorisedResult const &result)=0
 Sends a single result to the source of a query. More...
 
virtual bool register_annotation (Annotation const &annotation)=0
 Register an annotation. More...
 
virtual bool push (Filters const &filters, FilterState const &filter_state)=0
 Sends all filters and their state to the source of a query. More...
 
virtual ~SearchReply ()
 Destroys a Reply. More...
 
- Public Member Functions inherited from unity::scopes::Reply
virtual void finished ()=0
 Informs the source of a query that the query results are complete. More...
 
virtual void error (std::exception_ptr ex)=0
 Informs the source of a query that the query was terminated due to an error. More...
 
virtual ~Reply ()
 Destroys a Reply. More...
 
- Public Member Functions inherited from unity::scopes::Object
virtual std::string endpoint ()=0
 Returns the endpoint this proxy connects to. More...
 
virtual std::string identity ()=0
 Returns the identity of the target object of this proxy. More...
 
virtual std::string category ()=0
 Returns the category of the target object of this proxy. More...
 
virtual int64_t timeout ()=0
 Returns the timeout in milliseconds if this proxy is a twoway proxy. More...
 
virtual std::string to_string ()=0
 converts a proxy into its string representation. More...
 

Detailed Description

Allows the results of a search query to be sent to the query source.

Constructor & Destructor Documentation

virtual unity::scopes::SearchReply::~SearchReply ( )
virtual

Destroys a Reply.

If a Reply goes out of scope without a prior call to finished(), the destructor implicitly calls finished().

Member Function Documentation

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.
virtual bool unity::scopes::SearchReply::push ( CategorisedResult const &  result)
pure virtual

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 ( 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)
pure virtual

Register an annotation.

The annotation will be rendered at a next available spot below any category registered earlier. To render annotations in the top annotation area, call register_annotation() before registering any categories.

Note
The Unity shell can ignore some or all annotations, depending on available screen real estate.
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.

current_department_id should in most cases be the department returned by Query::department_id(). Pass an empty string for current_department_id to indicate no active department.

Parameters
departmentsA list of departments.
current_department_idA department id that should be considered current.

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