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 <unity/scopes/PreviewWidget.h>
25 #include <memory>
26 
27 namespace unity
28 {
29 
30 namespace scopes
31 {
32 
33 namespace internal
34 {
35 class ActivationResponseImpl;
36 }
37 
42 class ActivationResponse final
43 {
44 public:
49  enum Status
50  {
57  UpdatePreview
58  };
59 
67  ActivationResponse(Status status);
68 
73  ActivationResponse(CannedQuery const& query);
74 
80  ActivationResponse(Result const& updated_result);
81 
90  ActivationResponse(PreviewWidgetList const& updated_widgets);
91 
95  //{@
98 
99  ActivationResponse& operator=(ActivationResponse const& other);
100  ActivationResponse& operator=(ActivationResponse&& other);
102 
107  ActivationResponse::Status status() const;
108 
115  void set_scope_data(Variant const& data);
116 
121  Variant scope_data() const;
122 
129  CannedQuery query() const;
130 
137  Result updated_result() const;
138 
144  PreviewWidgetList updated_widgets() const;
145 
147  VariantMap serialize() const;
148 
151 
152 private:
153  std::unique_ptr<internal::ActivationResponseImpl> p;
154  ActivationResponse(internal::ActivationResponseImpl* pimpl);
155  friend class internal::ActivationResponseImpl;
156 };
157 
158 } // namespace scopes
159 
160 } // namespace unity
Definition: ActivationResponse.h:52
Simple variant class that can hold an integer, boolean, string, double, dictionary, array or null value.
Definition: Variant.h:57
Definition: ActivationResponse.h:55
The attributes of a result returned by a Scope.
Definition: Result.h:50
Definition: ActivationResponse.h:54
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:53
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:49
std::list< PreviewWidget > PreviewWidgetList
List of preview widgets (see unity::scopes::PreviewWidget)
Definition: PreviewWidget.h:45
Definition: ActivationResponse.h:56
Definition: ActivationResponse.h:51
Response to a result activation.
Definition: ActivationResponse.h:42