ocean.util.config.ConfigFiller

Provides convenient functions to fill the values of a given aggregate.

Provides functions that use a given source to fill the member variables of a provided aggregate or newly created instance of a given class.

The provided class can use certain wrappers to add conditions or informations to the variable in question. The value of a wrapped variable can be accessed using the opCall syntax "variable()"

Overview of available wrappers:

* Required — This variable has to be set in the configuration file

Members

Classes

ConfigException (from ocean.util.config.ConfigParser)
class ConfigException via public import ocean.util.config.ConfigParser : ConfigException;

ConfigException

SolarSystemEntity
class SolarSystemEntity
Undocumented in source.

Functions

Value
BaseType!(T) Value(T v)

Returns the value of the given struct/value.

defComp
bool defComp(T a, T b)

Default compare function, used with the LimitCmp struct/template

enable_loose_parsing
bool enable_loose_parsing(bool state)

Set whether loose parsing is enabled or not. Loose parsing means, that variables that have no effect are allowed.

fill
T fill(cstring group, Source config)

Creates an instance of T, and fills it with according values from the configuration file. The name of each variable will used to get it from the given section in the configuration file.

fill
T fill(cstring group, T reference, Source config)

Fill the given instance of T with according values from the configuration file. The name of each variable will used to get it from the given section in the configuration file.

iterate
ConfigIterator!(T) iterate(istring root, Source config)

Creates an iterator that iterates over groups that start with a common string, filling an instance of the passed class type from the variables of each matching group and calling the delegate.

readFields
void readFields(cstring group, T reference, Source config)

Fills the fields of the reference from config file's group.

readFields
void readFields(cstring group, T reference, Source config)

Fills the fields of the reference from config file's group.

Structs

ConfigIterator
struct ConfigIterator(T, Source = ConfigParser)

Config Iterator. Iterates over variables of a category

LimitCmp
struct LimitCmp(T, T init = T.init, alias comp = defComp!(T), Set...)

Configuration settings that are limited to a certain set of values can be marked as such by wrapping them with this template.

Max
struct Max(T, T max, T init = T.init)

Configuration settings that are required to be within a certain numeric range can be marked as such by wrapping them with this template.

Min
struct Min(T, T min, T init = T.init)

Configuration settings that are required to be within a certain numeric range can be marked as such by wrapping them with this template.

MinMax
struct MinMax(T, T min, T max, T init = T.init)

Configuration settings that are required to be within a certain numeric range can be marked as such by wrapping them with this template.

Required
struct Required(T)

Configuration settings that are mandatory can be marked as such by wrapping them with this template. If the variable is not set, then an exception is thrown.

SetInfo
struct SetInfo(T)

Adds the information of whether the filler actually set the value or whether it was left untouched.

SolarSystemEntityStruct
struct SolarSystemEntityStruct
Undocumented in source.

Templates

BaseType
template BaseType(T)

Evaluates to the original type with which a Wrapper Struct was initialised

IsSupported
template IsSupported(T)

Template that evaluates to true when T is a supported type

Limit
template Limit(T, Set...)

Simplified version of LimitCmp that uses default comparison and default initializer

LimitInit
template LimitInit(T, T init = T.init, Set...)

Simplified version of LimitCmp that uses default comparison

WrapperStructCore
template WrapperStructCore(T, T init = T.init)

Contains methods used in all WrapperStructs to access and set the value variable

Variables

config_str
auto config_str;
Undocumented in source.

Examples

Required!(char[]) nodes_config; * MinMax — This numeric variable has to be within the specified range MinMax!(long, -10, 10) range; * Min — This numeric variable has to be >= the specified value Min!(int, -10) min_range; * Max — This numeric variable has to be <= the specified value Max!(int, 20) max_range; * LimitCmp — This variable must be one of the given values. To compare the config value with the given values, the given function will be used LimitCmp!(char[], "red", defComp!(char[]), "red", "green", "blue", "yellow") color; * LimitInit — This variable must be one of the given values, it will default to the given value. LimitInit!(char[], "red", "red", "green") color; * Limit — This variable must be one of the given values Limit!(char[], "up", "down", "left", "right") dir; * SetInfo — the 'set' member can be used to query whether this variable was set from the configuration file or not SetInfo!(bool) enable; // enable.set

Use debug=Config to get a printout of all the configuration options

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).