A hierarchical environment properties holder created from a composite property. More...
#include <EnvironmentProperties.hpp>
Classes | |
class | Item |
Instances of the Item class are returned from iterators. More... | |
class | iterator |
The EnvironmentProperties iterator. More... | |
Public Types | |
typedef iterator | const_iterator |
The const iterator of EnvironmentProperties is the same as a non-const one. More... | |
Public Member Functions | |
EnvironmentProperties (std::unique_ptr< const Impl::BindingMap > &&bindings_) | |
Create an environment properties instance. More... | |
EnvironmentProperties () | |
Create an empty environment properties instance. More... | |
iterator | begin () |
Get an iterator positioned at the beginning of the environment properties list. More... | |
const_iterator | begin () const |
Get a const iterator positioned at the beginning of the environment properties list. More... | |
bool | empty () const |
Returns true if the environment properties object is empty. More... | |
iterator | end () |
Get an iterator positioned at the end of the environment properties list. More... | |
const_iterator | end () const |
Get a const iterator positioned at the end of the environment properties list. More... | |
std::shared_ptr< EnvironmentProperties > | getComposite (std::string_view name) const |
Get a child environment properties instance with the specified name. More... | |
std::shared_ptr< EnvironmentProperties > | getCompositeOrNull (std::string_view name) const |
Get a child environment properties instance with the specified name. More... | |
template<typename BaseT > | |
std::unique_ptr< BaseT > | getUnique (std::string_view name) const |
Get a polymorphic value of the specified type and name. More... | |
template<typename BaseT > | |
std::unique_ptr< BaseT > | getUnique (std::string_view name, std::unique_ptr< BaseT > &&defaultValue) const |
Get a polymorphic value of the specified type and name. More... | |
template<typename ValueT > | |
ValueT | getValue (std::string_view name) const |
Get a non-polymorphic value of the specified type and name. More... | |
template<typename ValueT > | |
ValueT | getValue (std::string_view name, const ValueT &defaultValue) const |
Get a non-polymorphic value of the specified type and name. More... | |
bool | hasComposite (std::string_view name) const |
Returns true if the composite property has a child composite binding with the specified name. More... | |
template<typename BaseT > | |
bool | hasUnique (std::string_view name) const |
Returns true if the composite property has a unique pointer binding matching the specified type and name. More... | |
template<typename ValueT > | |
bool | hasValue (std::string_view name) const |
Returns true if the composite property has a value binding matching the specified type and name. More... | |
A hierarchical environment properties holder created from a composite property.
An instance of this class contains a set of value and/or shared injector bindings, which were created from the parsing of a composite property within a hierarchical property file.
The direct or indirect value binding descendants of an EnvironmentProperties instance represent the simple and composite properties that were contained within the composite property in the hierarchical property file. Descendant value bindings may be a mixture of untyped simple properties (supplied as std::string) and typed simple properties (supplied as the type specified within the injector configuration). All descendant shared bindings are more instances of the EnvironmentProperties.
EnvironmentProperties instances may be iterated over. As the contained items being iterated over are of different types, (T, std::unique_ptr<T>, and std::shared_ptr<EnvironmentProperties>), de-referenced iterators provide opaque EnvironmentProperties::Item proxy objects. The EnvironmentProperties::Item class provides a similar API to the EnvironmentProperties class, allowing type and name examination of the contained binding, and extraction via getValue, getUnique, and getComposite methods.
typedef iterator const_iterator |
The const iterator of EnvironmentProperties is the same as a non-const one.
|
inline |
Create an environment properties instance.
This is usually performed by the injector environment configuration.
|
inline |
Create an empty environment properties instance.
This is required by certain Balau components.
|
inline |
Get an iterator positioned at the beginning of the environment properties list.
|
inline |
Get a const iterator positioned at the beginning of the environment properties list.
|
inline |
Returns true if the environment properties object is empty.
|
inline |
Get an iterator positioned at the end of the environment properties list.
|
inline |
Get a const iterator positioned at the end of the environment properties list.
|
inline |
Get a child environment properties instance with the specified name.
If no suitable binding is found, NoBindingException is thrown.
name | the name of the binding |
NoBindingException | if no suitable binding was found |
|
inline |
Get a child environment properties instance with the specified name.
If no suitable binding is found, null is returned.
name | the name of the binding |
|
inline |
Get a polymorphic value of the specified type and name.
The value is cloned from the prototype via the base type's provider function in the unique binding.
If no suitable binding is found, NoBindingException is thrown.
BaseT | the base type of the unique binding |
name | the name of the binding |
NoBindingException | if no suitable binding was found |
|
inline |
Get a polymorphic value of the specified type and name.
The value is cloned from the prototype via the type's provider function in the unique binding.
If no suitable binding is found, the supplied default value is moved into the return value.
BaseT | the base type of the unique binding |
name | the name of the binding |
defaultValue | a default value to copy if no suitable binding was found |
|
inline |
Get a non-polymorphic value of the specified type and name.
The value is copy constructed from the prototype in the value binding.
If no suitable binding is found, NoBindingException is thrown.
ValueT | the type of the value binding |
name | the name of the binding |
NoBindingException | if no suitable binding was found |
|
inline |
Get a non-polymorphic value of the specified type and name.
The value is copy constructed from the prototype in the value binding.
If no suitable binding is found, the supplied default value is copied into the return value.
ValueT | the type of the value binding |
name | the name of the binding |
defaultValue | a default value to copy if no suitable binding was found |
|
inline |
Returns true if the composite property has a child composite binding with the specified name.
name | the name of the binding |
|
inline |
Returns true if the composite property has a unique pointer binding matching the specified type and name.
BaseT | the base type of the binding |
name | the name of the binding |
|
inline |
Returns true if the composite property has a value binding matching the specified type and name.
ValueT | the value binding type |
name | the name of the binding |