Unity Scopes API
QueryBase.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: Michi Henning <michi.henning@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <unity/scopes/QueryCtrlProxyFwd.h>
22 #include <unity/scopes/ReplyProxyFwd.h>
23 #include <unity/scopes/ScopeProxyFwd.h>
24 #include <unity/scopes/Variant.h>
25 
26 #include <unity/util/DefinesPtrs.h>
27 #include <unity/util/NonCopyable.h>
28 
29 namespace unity
30 {
31 
32 namespace scopes
33 {
34 
35 class SearchMetadata;
36 
37 namespace internal
38 {
39 
40 class QueryBaseImpl;
41 class QueryObject;
42 class ScopeObject;
43 
44 namespace smartscopes
45 {
46 
47 class SSQueryObject;
48 class SSScopeObject;
49 
50 } // namespace smartscopes
51 
52 } // namespace internal
53 
54 
60 class QueryBase
61 {
62 public:
64  NONCOPYABLE(QueryBase);
65  UNITY_DEFINES_PTRS(QueryBase);
67 
78  virtual void cancelled() = 0; // Originator cancelled the query
79 
95  bool valid() const;
96 
111 
113  virtual ~QueryBase();
115 
116 protected:
118  QueryBase(internal::QueryBaseImpl* impl);
119  void cancel();
120  std::unique_ptr<internal::QueryBaseImpl> p;
122 
123 private:
124  friend class internal::QueryObject; // So QueryObject can call cancel()
125  friend class internal::smartscopes::SSQueryObject; // So SSQueryObject can call cancel()
126  friend class internal::ScopeObject; // So ScopeObject can call set_department_id()
127  friend class internal::smartscopes::SSScopeObject; // So SSScopeObject can call set_department_id()
128 };
129 
130 } // namespace scopes
131 
132 } // namespace unity
virtual void cancelled()=0
Called by the scopes run time when the query originator cancels a query.
Abstract server-side base interface for a query that is executed inside a scope.
Definition: QueryBase.h:60
unity::scopes::VariantMap settings() const
Returns a dictionary with the scope's current settings.
Definition: QueryBase.cpp:55
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
bool valid() const
Check whether this query is still valid.
Definition: QueryBase.cpp:50