Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 #ifndef UNITY_SCOPES_SCOPEMETADATA_H
20 #define UNITY_SCOPES_SCOPEMETADATA_H
21 
22 #include <unity/scopes/Scope.h>
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 
186 private:
187  ScopeMetadata(std::unique_ptr<internal::ScopeMetadataImpl>); // Instantiable only by ScopeMetadataImpl
188  std::unique_ptr<internal::ScopeMetadataImpl> p;
189 
190  friend class internal::ScopeMetadataImpl;
191 };
192 
193 } // namespace scopes
194 
195 } // namespace unity
196 
197 #endif
std::shared_ptr< Scope > ScopeProxy
Convenience type definition.
Definition: ScopeProxyFwd.h:35
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:44
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::string description() const
Get the description for this scope.
VariantMap appearance_attributes() const
Get optional display attributes.
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.
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:39
std::string scope_directory() const
Get directory where scope config files and .so file lives.
std::string icon() const
Get the icon for this scope.
VariantArray settings_definitions() const
Return the settings definitions for this scope.