unity.scopes.qt.QSearchQueryBaseAPI

Abstract base class to represent a particular query. More...

#include <unity/scopes/qt/QSearchQueryBaseAPI.h>

Inheritance diagram for unity::scopes::qt::QSearchQueryBaseAPI: src="https://assets.ubuntu.com/v1/d720597a-classunity_1_1scopes_1_1qt_1_1_q_search_query_base_a_p_i__inherit__graph.png" border="0" alt="Inheritance graph"/>

Public Member Functions

virtual void run (SearchReplyProxy const &reply) final
 Called by scopes run time to start the query. More...
 
virtual void cancelled () final
 Called by the scopes run time when the query originator cancels a query. More...
 
src="https://assets.ubuntu.com/v1/c6607712-closed.png" alt="-"/> Public Member Functions inherited from unity::scopes::SearchQueryBase
CannedQuery query () const
 Get a canned query for this search request. More...
 
SearchMetadata search_metadata () const
 Get metadata for this search request. More...
 
QueryCtrlProxy subsearch (ScopeProxy const &scope, std::string const &query_string, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ChildScope const &scope, std::string const &query_string, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ScopeProxy const &scope, std::string const &query_string, FilterState const &filter_state, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ScopeProxy const &scope, std::string const &query_string, std::string const &department_id, FilterState const &filter_state, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ChildScope const &scope, std::string const &query_string, std::string const &department_id, FilterState const &filter_state, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ScopeProxy const &scope, std::string const &query_string, std::string const &department_id, FilterState const &filter_state, SearchMetadata const &hints, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ChildScope const &scope, std::string const &query_string, std::string const &department_id, FilterState const &filter_state, SearchMetadata const &hints, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ChildScope const &scope, std::string const &query_string, std::string const &department_id, FilterState const &filter_state, Variant const &user_data, SearchMetadata const &hints, SearchListenerBase::SPtr const &reply)
 
QueryCtrlProxy subsearch (ScopeProxy const &scope, std::string const &query_string, std::string const &department_id, FilterState const &filter_state, Variant const &user_data, SearchMetadata const &hints, SearchListenerBase::SPtr const &reply)
 
src="https://assets.ubuntu.com/v1/c6607712-closed.png" alt="-"/> Public Member Functions inherited from unity::scopes::QueryBase
bool valid () const
 Check whether this query is still valid. More...
 
unity::scopes::VariantMap settings () const
 Returns a dictionary with the scope's current settings. More...
 

Detailed Description

Abstract base class to represent a particular query.

A scope must return an instance of this class from its implementation of ScopeBase::search().

This is the class that links scope API calls with the main QThread. The instance of this class is moved to the main QThread and pushes events to the Qt event loop.

Note
The constructor of the instance must complete in a timely manner. Do not perform anything in the constructor that might block.

Member Function Documentation

virtual void unity::scopes::qt::QSearchQueryBaseAPI::cancelled ( )
finalvirtual

Called by the scopes run time when the query originator cancels a query.

Your implementation of this method should ensure that the scope stops processing the current query as soon as possible. Any calls to a push() method once a query is cancelled are ignored, so continuing to push after cancellation only wastes CPU cycles. (push() returns false once a query is cancelled or exceeds its cardinality limit.)

Implements unity::scopes::QueryBase.

virtual void unity::scopes::qt::QSearchQueryBaseAPI::run ( SearchReplyProxy const &  reply)
finalvirtual

Called by scopes run time to start the query.

Your implementation of run() can use the reply proxy to push results for the query. You can push results from within run(), in which case the query implicitly completes when run() returns. Alternatively, run() can store the reply proxy and return immediately. In this case, you can use the stored proxy to push results from another thread. It is safe to call push() from multiple threads without synchronization.

The query completes either when run() returns, or when the last stored reply proxy goes out of scope (whichever happens last).

Parameters
replyThe proxy on which to push results for the query.

Implements unity::scopes::SearchQueryBase.