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 Lesser GNU 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/Scope.h>
22 #include <set>
23 
24 namespace unity
25 {
26 
27 namespace scopes
28 {
29 
30 namespace internal
31 {
32 
33 class ScopeMetadataImpl;
34 } // namespace internal
35 
36 namespace testing
37 {
38 class ScopeMetadataBuilder;
39 } // namespace testing
40 
49 class ScopeMetadata final
50 {
51 public:
55  enum class ResultsTtlType
56  {
57  None,
58  Small,
59  Medium,
60  Large
61  };
62 
64  UNITY_DEFINES_PTRS(ScopeMetadata);
65  ~ScopeMetadata();
67 
71  //{@
72  ScopeMetadata(ScopeMetadata const& other);
74 
75  ScopeMetadata& operator=(ScopeMetadata const& other);
76  ScopeMetadata& operator=(ScopeMetadata&&);
78 
83  std::string scope_id() const;
84 
89  ScopeProxy proxy() const;
90 
95  std::string display_name() const; // localized
96 
101  std::string description() const; // localized
102 
107  std::string author() const;
108 
113  std::string art() const; // optional
114 
119  std::string icon() const; // optional
120 
125  std::string search_hint() const; // localized, optional
126 
131  std::string hot_key() const; // localized, optional
132 
137  bool invisible() const; // optional (default = false)
138 
146 
155  std::string scope_directory() const;
156 
161  VariantMap serialize() const;
162 
168 
169  // TODO: Flesh out documentation
179 
184  bool location_data_needed() const; // optional (default = false)
185 
196  std::vector<std::string> child_scope_ids() const;
197 
204  int version() const;
205 
214  std::set<std::string> keywords() const;
215 
220  bool is_aggregator() const; // optional (default = false)
221 
222 private:
223  ScopeMetadata(std::unique_ptr<internal::ScopeMetadataImpl>); // Instantiable only by ScopeMetadataImpl
224  std::unique_ptr<internal::ScopeMetadataImpl> p;
225 
226  friend class internal::ScopeMetadataImpl;
227 };
228 
229 } // namespace scopes
230 
231 } // 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:55
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:49
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.