2
* Copyright (C) 2013 Canonical Ltd
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.
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.
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/>.
16
* Authored by: Michi Henning <michi.henning@canonical.com>
19
#ifndef UNITY_SCOPES_REGISTRY_H
20
#define UNITY_SCOPES_REGISTRY_H
22
#include <unity/scopes/ObjectProxy.h>
23
#include <unity/scopes/RegistryProxyFwd.h>
24
#include <unity/scopes/ScopeMetadata.h>
40
\brief Map for scope name and metadata pairs.
42
typedef std::map<std::string, ScopeMetadata> MetadataMap;
45
\brief RegistryProxy provides access to the available scopes.
46
You can obtain a proxy to the registry by calling Runtime::registry().
49
class UNITY_API Registry : public virtual ObjectProxy
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.
60
ScopeMetadata get_metadata(std::string const& scope_name) const;
63
\brief Returns a map containing the metadata for all scopes.
65
MetadataMap list() const;
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.
72
MetadataMap list_if(std::function<bool(ScopeMetadata const& item)> predicate) const;
75
Registry(internal::RegistryImpl* impl); // Instantiated only by RegistryImpl
76
friend class internal::RegistryImpl;
79
internal::RegistryImpl* fwd() const;