Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 #ifndef UNITY_SCOPES_QUERYBASE_H
20 #define UNITY_SCOPES_QUERYBASE_H
21 
22 #include <unity/scopes/QueryCtrlProxyFwd.h>
23 #include <unity/scopes/ReplyProxyFwd.h>
24 #include <unity/scopes/ScopeProxyFwd.h>
25 #include <unity/scopes/Variant.h>
26 
27 #include <unity/util/DefinesPtrs.h>
28 #include <unity/util/NonCopyable.h>
29 
30 namespace unity
31 {
32 
33 namespace scopes
34 {
35 
36 class SearchMetadata;
37 
38 namespace internal
39 {
40 
41 class QueryBaseImpl;
42 class QueryObject;
43 class ScopeObject;
44 
45 namespace smartscopes
46 {
47 
48 class SSQueryObject;
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 
77  virtual void cancelled() = 0; // Originator cancelled the query
78 
80  virtual ~QueryBase();
82 
83 protected:
85  QueryBase();
86  void cancel();
87  std::unique_ptr<internal::QueryBaseImpl> p;
89 
90 private:
91  void set_metadata(SearchMetadata const& metadata);
92 
93  friend class internal::QueryObject; // So QueryObject can call cancel()
94  friend class internal::smartscopes::SSQueryObject; // So SSQueryObject can call cancel()
95  friend class internal::ScopeObject; // So ScopeObject can call set_metadata()
96 };
97 
98 } // namespace scopes
99 
100 } // namespace unity
101 
102 #endif
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
Metadata passed with search requests.
Definition: SearchMetadata.h:41