Unity Scopes API
ScopeMetadata.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/ScopeProxyFwd.h>
22 #include <unity/scopes/Variant.h>
23 #include <unity/util/DefinesPtrs.h>
24 
25 #include <set>
26 
27 namespace unity
28 {
29 
30 namespace scopes
31 {
32 
33 namespace internal
34 {
35 class ScopeMetadataImpl;
36 } // namespace internal
37 
38 namespace testing
39 {
40 class ScopeMetadataBuilder;
41 } // namespace testing
42 
51 class ScopeMetadata final
52 {
53 public:
57  enum class ResultsTtlType
58  {
59  None,
60  Small,
61  Medium,
62  Large
63  };
64 
66  UNITY_DEFINES_PTRS(ScopeMetadata);
67  ~ScopeMetadata();
69 
73  //{@
74  ScopeMetadata(ScopeMetadata const& other);
76 
77  ScopeMetadata& operator=(ScopeMetadata const& other);
78  ScopeMetadata& operator=(ScopeMetadata&&);
80 
85  std::string scope_id() const;
86 
91  ScopeProxy proxy() const;
92 
97  std::string display_name() const; // localized
98 
103  std::string description() const; // localized
104 
109  std::string author() const;
110 
115  std::string art() const; // optional
116 
121  std::string icon() const; // optional
122 
127  std::string search_hint() const; // localized, optional
128 
133  std::string hot_key() const; // localized, optional
134 
139  bool invisible() const; // optional (default = false)
140 
148 
157  std::string scope_directory() const;
158 
163  VariantMap serialize() const;
164 
170 
171  // TODO: Flesh out documentation
181 
186  bool location_data_needed() const; // optional (default = false)
187 
198  std::vector<std::string> child_scope_ids() const;
199 
206  int version() const;
207 
216  std::set<std::string> keywords() const;
217 
222  bool is_aggregator() const; // optional (default = false)
223 
224 private:
225  ScopeMetadata(std::unique_ptr<internal::ScopeMetadataImpl>); // Instantiable only by ScopeMetadataImpl
226  std::unique_ptr<internal::ScopeMetadataImpl> p;
227 
228  friend class internal::ScopeMetadataImpl;
229 };
230 
231 } // namespace scopes
232 
233 } // namespace unity
std::shared_ptr< Scope > ScopeProxy
Convenience type definition.
Definition: ScopeProxyFwd.h:34
std::string scope_id() const
Get the scope identifier.
ResultsTtlType results_ttl_type() const
Return the TTL for the results this scope produces.
std::string display_name() const
Get the display name for this scope.
std::vector< Variant > VariantArray
An array of variants.
Definition: Variant.h:43
std::string hot_key() const
Get the hot key for this scope.
ResultsTtlType
Enum representing the expected valid lifetime of results from the scope.
Definition: ScopeMetadata.h:57
std::set< std::string > keywords() const
Return the set of keywords specified by this scope.
std::string description() const
Get the description for this scope.
VariantMap appearance_attributes() const
Get optional display attributes.
std::vector< std::string > child_scope_ids() const
Return the list of scope identifiers aggregated by this scope.
Definition: OnlineAccountClient.h:39
Holds scope attributes such as name, description, icon etc.
Definition: ScopeMetadata.h:51
std::string art() const
Get the art for this scope.
std::string search_hint() const
Get the search hint for this scope.
bool invisible() const
Check if this scope should be hidden in the Dash.
std::string author() const
Get the author for this scope.
bool is_aggregator() const
Check if this scope is an aggregator.
Top-level namespace for all things Unity-related.
Definition: Version.h:49
VariantMap serialize() const
Return a dictionary of all metadata attributes.
bool location_data_needed() const
Check if this scope wants location data.
ScopeProxy proxy() const
Get the proxy object for this scope.
std::map< std::string, Variant > VariantMap
A dictionary of (string, Variant) pairs.
Definition: Variant.h:38
Definition: ActionMetadata.h:31
std::string scope_directory() const
Get directory where scope config files and .so file lives.
int version() const
Return the version of the scope.
std::string icon() const
Get the icon for this scope.
VariantArray settings_definitions() const
Return the settings definitions for this scope.