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 <memory>
24 
25 namespace unity
26 {
27 
28 namespace scopes
29 {
30 
31 namespace internal
32 {
33 class ActivationResponseImpl;
34 }
35 
40 class ActivationResponse final
41 {
42 public:
46  enum Status
47  {
53  };
54 
63 
69 
73  //{@
76 
77  ActivationResponse& operator=(ActivationResponse const& other);
78  ActivationResponse& operator=(ActivationResponse&& other);
80 
86 
93  void set_scope_data(Variant const& data);
94 
99  Variant scope_data() const;
100 
107  CannedQuery query() const;
108 
110  VariantMap serialize() const;
111 
114 
115 private:
116  std::unique_ptr<internal::ActivationResponseImpl> p;
117  ActivationResponse(internal::ActivationResponseImpl* pimpl);
118  friend class internal::ActivationResponseImpl;
119 };
120 
121 } // namespace scopes
122 
123 } // namespace unity
Variant scope_data() const
Get data attached to this response object.
Definition: ActivationResponse.cpp:81
Definition: ActivationResponse.h:49
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:71
Definition: ActivationResponse.h:52
ActivationResponse(Status status)
Creates ActivationResponse with given status.
Definition: ActivationResponse.cpp:29
Definition: ActivationResponse.h:51
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:50
Parameters of a search query.
Definition: CannedQuery.h:49
Status
Status of a unity::scopes::ScopeBase::activate or unity::scopes::ScopeBase::perform_action request...
Definition: ActivationResponse.h:46
ActivationResponse::Status status() const
Get activation status.
Definition: ActivationResponse.cpp:76
Definition: ActivationResponse.h:48
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:40