Unity Scopes API
AbstractScopeBase.h
1 /*
2  * Copyright (C) 2014 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/ActivationQueryBase.h>
22 #include <unity/scopes/ChildScope.h>
23 #include <unity/scopes/PreviewQueryBase.h>
24 #include <unity/scopes/Registry.h>
25 #include <unity/scopes/SearchQueryBase.h>
26 
27 namespace unity
28 {
29 
30 namespace scopes
31 {
32 
41 {
42 public:
44  virtual void start(std::string const& scope_id) = 0;
45  virtual void stop() = 0;
46  virtual void run() = 0;
47  virtual SearchQueryBase::UPtr search(CannedQuery const& query, SearchMetadata const& metadata) = 0;
48  virtual ActivationQueryBase::UPtr activate(Result const& result, ActionMetadata const& metadata) = 0;
49  virtual ActivationQueryBase::UPtr perform_action(Result const& result,
50  ActionMetadata const& metadata,
51  std::string const& widget_id,
52  std::string const& action_id) = 0;
53  virtual PreviewQueryBase::UPtr preview(Result const& result, ActionMetadata const& metadata) = 0;
54  virtual std::string scope_directory() const = 0;
55  virtual std::string cache_directory() const = 0;
56  virtual std::string tmp_directory() const = 0;
57  virtual unity::scopes::RegistryProxy registry() const = 0;
58  virtual VariantMap settings() const = 0;
59 
60  virtual ~AbstractScopeBase();
61 
62  virtual ChildScopeList find_child_scopes() const = 0;
63  virtual ChildScopeList child_scopes() const = 0;
64 
65  virtual ActivationQueryBase::UPtr activate_result_action(Result const& result,
66  ActionMetadata const& metadata,
67  std::string const& action_id) = 0;
68 
69 protected:
72 };
73 
74 } // namespace scopes
75 
76 } // namespace unity
Metadata passed with search requests.
Definition: SearchMetadata.h:45
Metadata passed to scopes for preview and activation.
Definition: ActionMetadata.h:41
The attributes of a result returned by a Scope.
Definition: Result.h:50
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
Parameters of a search query.
Definition: CannedQuery.h:49
std::shared_ptr< Registry > RegistryProxy
Convenience type definition.
Definition: RegistryProxyFwd.h:33
Abstract base class for a scope implementation.
Definition: AbstractScopeBase.h:40
std::vector< ChildScope > ChildScopeList
A list of child scopes.
Definition: ChildScope.h:33