Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 #ifndef UNITY_SCOPES_ACTIVATIONRESPONSE_H
20 #define UNITY_SCOPES_ACTIVATIONRESPONSE_H
21 
22 #include <unity/scopes/Variant.h>
23 #include <unity/scopes/CannedQuery.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:
47  enum Status
48  {
54  };
55 
64 
70 
74  //{@
77 
78  ActivationResponse& operator=(ActivationResponse const& other);
79  ActivationResponse& operator=(ActivationResponse&& other);
81 
87 
94  void set_scope_data(Variant const& data);
95 
100  Variant scope_data() const;
101 
108  CannedQuery query() const;
109 
111  VariantMap serialize() const;
112 
115 
116 private:
117  std::unique_ptr<internal::ActivationResponseImpl> p;
118  ActivationResponse(internal::ActivationResponseImpl* pimpl);
119  friend class internal::ActivationResponseImpl;
120 };
121 
122 } // namespace scopes
123 
124 } // namespace unity
125 
126 #endif
Variant scope_data() const
Get data attached to this response object.
Definition: ActivationResponse.cpp:81
Definition: ActivationResponse.h:50
Simple variant class that can hold an integer, boolean, string, double, dictionary, array or null value.
Definition: Variant.h:58
void set_scope_data(Variant const &data)
Attach arbitrary data to this response.
Definition: ActivationResponse.cpp:71
Definition: ActivationResponse.h:53
ActivationResponse(Status status)
Creates ActivationResponse with given status.
Definition: ActivationResponse.cpp:29
Definition: ActivationResponse.h:52
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:39
Definition: ActivationResponse.h:51
Parameters of a search query.
Definition: CannedQuery.h:46
Status
Status of a unity::scopes::ScopeBase::activate or unity::scopes::ScopeBase::perform_action request...
Definition: ActivationResponse.h:47
ActivationResponse::Status status() const
Get activation status.
Definition: ActivationResponse.cpp:76
Definition: ActivationResponse.h:49
CannedQuery query() const
A query to be executed if status is Status::PerformQuery.
Definition: ActivationResponse.cpp:86
Response to a result activation.
Definition: ActivationResponse.h:41