Unity Scopes API
ActivationResponse.h
1 /*
2  * Copyright (C) 2013 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Pawel Stolowski <pawel.stolowski@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <unity/scopes/Variant.h>
22 #include <unity/scopes/CannedQuery.h>
23 #include <unity/scopes/Result.h>
24 #include <memory>
25 
26 namespace unity
27 {
28 
29 namespace scopes
30 {
31 
32 namespace internal
33 {
34 class ActivationResponseImpl;
35 }
36 
41 class ActivationResponse final
42 {
43 public:
48  enum Status
49  {
56  };
57 
66 
72 
79 
83  //{@
86 
87  ActivationResponse& operator=(ActivationResponse const& other);
88  ActivationResponse& operator=(ActivationResponse&& other);
90 
96 
103  void set_scope_data(Variant const& data);
104 
109  Variant scope_data() const;
110 
117  CannedQuery query() const;
118 
125  Result updated_result() const;
126 
128  VariantMap serialize() const;
129 
132 
133 private:
134  std::unique_ptr<internal::ActivationResponseImpl> p;
135  ActivationResponse(internal::ActivationResponseImpl* pimpl);
136  friend class internal::ActivationResponseImpl;
137 };
138 
139 } // namespace scopes
140 
141 } // namespace unity
Variant scope_data() const
Get data attached to this response object.
Definition: ActivationResponse.cpp:86
Definition: ActivationResponse.h:51
Simple variant class that can hold an integer, boolean, string, double, dictionary, array or null value.
Definition: Variant.h:57
void set_scope_data(Variant const &data)
Attach arbitrary data to this response.
Definition: ActivationResponse.cpp:76
Result updated_result() const
The updated result if status is Status::UpdateResult.
Definition: ActivationResponse.cpp:96
Definition: ActivationResponse.h:54
The attributes of a result returned by a Scope.
Definition: Result.h:50
ActivationResponse(Status status)
Creates ActivationResponse with given status.
Definition: ActivationResponse.cpp:29
Definition: ActivationResponse.h:53
Top-level namespace for all things Unity-related.
Definition: Version.h:49
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:38
Definition: ActionMetadata.h:31
Definition: ActivationResponse.h:52
Parameters of a search query.
Definition: CannedQuery.h:49
Status
Status of a unity::scopes::ScopeBase::activate, unity::scopes::ScopeBase::perform_action, or unity::scopes::ScopeBase::activate_result_action request.
Definition: ActivationResponse.h:48
ActivationResponse::Status status() const
Get activation status.
Definition: ActivationResponse.cpp:81
Definition: ActivationResponse.h:55
Definition: ActivationResponse.h:50
CannedQuery query() const
A query to be executed if status is Status::PerformQuery.
Definition: ActivationResponse.cpp:91
Response to a result activation.
Definition: ActivationResponse.h:41