~mardy/unity-scopes-api/clientid-1554040

« back to all changes in this revision

Viewing changes to include/unity/scopes/Registry.h

  • Committer: CI bot
  • Author(s): Tarmac
  • Date: 2014-03-12 16:58:32 UTC
  • mfrom: (163.45.63 devel)
  • Revision ID: ps-jenkins@lists.canonical.com-20140312165832-ngmnoud825y533pk
Sync with devel branch - updated scopes API to 0.4.0. See RELEASE_NOTES for list of all changes. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
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/ObjectProxy.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
 
 
39
 
/**
40
 
\brief Map for scope name and metadata pairs.
41
 
*/
42
 
typedef std::map<std::string, ScopeMetadata> MetadataMap;
43
 
 
44
 
/**
45
 
\brief RegistryProxy provides access to the available scopes.
46
 
You can obtain a proxy to the registry by calling Runtime::registry().
47
 
*/
48
 
 
49
 
class UNITY_API Registry : public virtual ObjectProxy
50
 
{
51
 
public:
52
 
    /// @cond
53
 
    virtual ~Registry();
54
 
    /// @endcond
55
 
 
56
 
    /**
57
 
    \brief Returns the metadata for the scope with the given name.
58
 
    @return The metadata for the scope. If no scope with the given name exists, get_metadata() throws NotFoundException.
59
 
    */
60
 
    ScopeMetadata get_metadata(std::string const& scope_name) const;
61
 
 
62
 
    /**
63
 
    \brief Returns a map containing the metadata for all scopes.
64
 
    */
65
 
    MetadataMap list() const;
66
 
 
67
 
    /**
68
 
    \brief Returns a map containing only those scopes for which predicate returns true.
69
 
    \param predicate a function object the must return true for each metadata item to be include in the map.
70
 
    \return The metadata items for which the predicate returned true.
71
 
    */
72
 
    MetadataMap list_if(std::function<bool(ScopeMetadata const& item)> predicate) const;
73
 
 
74
 
protected:
75
 
    Registry(internal::RegistryImpl* impl);          // Instantiated only by RegistryImpl
76
 
    friend class internal::RegistryImpl;
77
 
 
78
 
private:
79
 
    internal::RegistryImpl* fwd() const;
80
 
};
81
 
 
82
 
} // namespace scopes
83
 
 
84
 
} // namespace unity
85
 
 
86
 
#endif