Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Registry.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 #ifndef UNITY_SCOPES_REGISTRY_H
20 #define UNITY_SCOPES_REGISTRY_H
21 
22 #include <unity/scopes/Object.h>
23 #include <unity/scopes/RegistryProxyFwd.h>
24 #include <unity/scopes/ScopeMetadata.h>
25 
26 #include <map>
27 
28 namespace unity
29 {
30 
31 namespace scopes
32 {
33 
34 namespace internal
35 {
36 class RegistryImpl;
37 }
38 
42 typedef std::map<std::string, ScopeMetadata> MetadataMap;
43 
50 class Registry : public virtual Object
51 {
52 public:
54  virtual ~Registry();
56 
62  virtual ScopeMetadata get_metadata(std::string const& scope_id) = 0;
63 
68  virtual MetadataMap list() = 0;
69 
75  virtual MetadataMap list_if(std::function<bool(ScopeMetadata const& item)> predicate) = 0;
76 
77 protected:
79  Registry();
81 };
82 
83 } // namespace scopes
84 
85 } // namespace unity
86 
87 #endif
virtual MetadataMap list()=0
Returns a map containing the metadata for all scopes.
Holds scope attributes such as name, description, icon etc.
Definition: ScopeMetadata.h:48
virtual MetadataMap list_if(std::function< bool(ScopeMetadata const &item)> predicate)=0
Returns a map containing only those scopes for which predicate returns true.
White pages service for available scopes.
Definition: Registry.h:50
virtual ScopeMetadata get_metadata(std::string const &scope_id)=0
Returns the metadata for the scope with the given ID.
The root base class for all proxies.
Definition: Object.h:35
std::map< std::string, ScopeMetadata > MetadataMap
Map for scope ID and metadata pairs.
Definition: Registry.h:42