Unity Scopes API
unity::scopes::ActivationResponse Class Referencefinal

Response to a result activation. More...

#include <unity/scopes/ActivationResponse.h>

Public Types

enum  Status {
  NotHandled, ShowDash, HideDash, ShowPreview,
  PerformQuery, UpdateResult
}
 Status of a unity::scopes::ScopeBase::activate, unity::scopes::ScopeBase::perform_action, or unity::scopes::ScopeBase::activate_result_action request. More...
 

Public Member Functions

 ActivationResponse (Status status)
 Creates ActivationResponse with given status. More...
 
 ActivationResponse (CannedQuery const &query)
 Creates an ActivationResponse with status Status::PerformQuery and a search query to be executed. More...
 
 ActivationResponse (Result const &updated_result)
 Creates an ActivationResponse with status Status::UpdateResult and an updated result that replaces the original result of the action. More...
 
ActivationResponse::Status status () const
 Get activation status. More...
 
void set_scope_data (Variant const &data)
 Attach arbitrary data to this response. More...
 
Variant scope_data () const
 Get data attached to this response object. More...
 
CannedQuery query () const
 A query to be executed if status is Status::PerformQuery. More...
 
Result updated_result () const
 The updated result if status is Status::UpdateResult. More...
 
Copy and assignment

Copy and assignment operators (move and non-move versions) have the usual value semantics.

 ActivationResponse (ActivationResponse const &other)
 
 ActivationResponse (ActivationResponse &&other)
 
ActivationResponseoperator= (ActivationResponse const &other)
 
ActivationResponseoperator= (ActivationResponse &&other)
 

Detailed Description

Response to a result activation.

Member Enumeration Documentation

Status of a unity::scopes::ScopeBase::activate, unity::scopes::ScopeBase::perform_action, or unity::scopes::ScopeBase::activate_result_action request.

Enumerator
NotHandled 

Activation of this result wasn't handled by the scope

ShowDash 

Activation of this result was handled, show the Dash

HideDash 

Activation of this result was handled, hide the Dash

ShowPreview 

Preview should be requested for this result

PerformQuery 

Perform new search. This state is implied if creating ActivationResponse with CannedQuery object and is invalid otherwise

UpdateResult 

Update the result. This state is implied if creating ActivationResponse with Result object and is invalid otherwise

Constructor & Destructor Documentation

unity::scopes::ActivationResponse::ActivationResponse ( Status  status)

Creates ActivationResponse with given status.

Parameters
statusThe activation status.
Exceptions
unity::InvalidArgumentExceptionif status is Status::PerformQuery or Status::Update. To create an ActivationResponse for one of these types, use the ActivationResponse(CannedQuery const&) or ActivationResponse(Result const&) constructors.
unity::scopes::ActivationResponse::ActivationResponse ( CannedQuery const &  query)

Creates an ActivationResponse with status Status::PerformQuery and a search query to be executed.

Parameters
queryThe search query to be executed by the client.
unity::scopes::ActivationResponse::ActivationResponse ( Result const &  updated_result)

Creates an ActivationResponse with status Status::UpdateResult and an updated result that replaces the original result of the action.

Parameters
updated_resultThe updated result to replace the original result of the action.

Member Function Documentation

CannedQuery unity::scopes::ActivationResponse::query ( ) const

A query to be executed if status is Status::PerformQuery.

Exceptions
unity::LogicExceptionif the status of this ActivationResponse is anything other than Status::PerformQuery.
Returns
The query to be executed by the client.
Variant unity::scopes::ActivationResponse::scope_data ( ) const

Get data attached to this response object.

Returns
The data attached to the response.
void unity::scopes::ActivationResponse::set_scope_data ( Variant const &  data)

Attach arbitrary data to this response.

The attached data is sent back to the scope if the status of this response is Status::ShowPreview.

Parameters
dataAn arbitrary value attached to the response.
ActivationResponse::Status unity::scopes::ActivationResponse::status ( ) const

Get activation status.

Returns
The activation status.
Result unity::scopes::ActivationResponse::updated_result ( ) const

The updated result if status is Status::UpdateResult.

Exceptions
unity::LogicExceptionif the status of this ActivationResponse is anything other than Status::UpdateResult.
Returns
The result to be displayed instead of the original result.

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