Unity Scopes Qt library
QScopeBaseAPI.h
1 /*
2  * Copyright (C) 2015 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: Xavi Garcia <xavi.garcia.mena@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <unity/scopes/ScopeBase.h>
22 #include <unity/scopes/QueryBase.h>
23 #include <unity/scopes/ReplyProxyFwd.h>
24 #include <unity/scopes/QueryBase.h>
25 #include <unity/scopes/PreviewQueryBase.h>
26 
28 
29 #include <memory>
30 #include <thread>
31 
32 namespace unity
33 {
34 
35 namespace scopes
36 {
37 
38 namespace qt
39 {
40 
41 class QScopeBase;
42 
43 namespace internal
44 {
45 class QScopeBaseAPIImpl;
46 }
47 
56 class QScopeBaseAPI : public unity::scopes::ScopeBase
57 {
58 public:
60  using FactoryFunc = std::function<QScopeBase*()>;
61 
62  NONCOPYABLE(QScopeBaseAPI);
63  UNITY_DEFINES_PTRS(QScopeBaseAPI);
64 
65  QScopeBaseAPI(FactoryFunc const& creator);
66  virtual ~QScopeBaseAPI() = default;
68 
78  virtual void start(std::string const& scope_id) override;
79 
91  virtual void stop() override;
92 
96  virtual unity::scopes::PreviewQueryBase::UPtr preview(const unity::scopes::Result&,
97  const unity::scopes::ActionMetadata&) override;
98 
102  virtual unity::scopes::SearchQueryBase::UPtr search(unity::scopes::CannedQuery const& q,
103  unity::scopes::SearchMetadata const&) override;
104 
105 private:
107  std::unique_ptr<internal::QScopeBaseAPIImpl> p;
108  friend class internal::QScopeBaseAPIImpl;
110 };
111 
112 } // namespace qt
113 
114 } // namespace scopes
115 
116 } // namespace unity
virtual unity::scopes::SearchQueryBase::UPtr search(unity::scopes::CannedQuery const &q, unity::scopes::SearchMetadata const &) override
virtual void stop() override
Called by the scopes run time when the scope should shut down.
virtual unity::scopes::PreviewQueryBase::UPtr preview(const unity::scopes::Result &, const unity::scopes::ActionMetadata &) override
virtual void start(std::string const &scope_id) override
Called by the scopes run time after the create function completes.
Definition: HttpAsyncReader.h:39
Definition: QScopeBaseAPI.h:56