Class EnvFormat¶
Defined in File Env.h
Inheritance Relationships¶
Base Type¶
public uconfig::Format
(Class Format)
Class Documentation¶
-
class
uconfig
::
EnvFormat
: public uconfig::Format¶ Environment format.
Parsed values from env, emit into
std::map
.Public Types
-
using
source_type
= void¶ Env does’t have a source type.
-
using
dest_type
= std::map<std::string, std::string>¶ std::map<std::string, std::string>
to emit to.
Public Functions
-
template<typename
T
>
std::optional<T>Parse
(const source_type*, const std::string &path) const¶ Parse the value with name
path
from environment.- Template Parameters
T – Type to parse.
- Parameters
[in] path – Name of the value.
- Returns
Value wrapped in std::optional or std::nullopt.
-
template<typename
T
>
voidEmit
(dest_type *dest, const std::string &path, const T &value) const¶ Emit the (
path
,value
) pair intodest
.- Template Parameters
T – Type to emit.
- Parameters
[in] dest – Map to emit to.
[in] path – Key to emplace in the map.
[in] value – Value to emit.
-
inline virtual std::string
VectorElementPath
(const std::string &vector_path, std::size_t index) const noexcept override¶ Construct array element name using ‘_’ as delimiter.
- Parameters
[in] vector_path – Name array itself.
[in] index – Position in the array to make path to.
- Returns
‘_’ delimited name to the element at
index
, e.g. “ARRAY_0” forvector_path
= “ARRAY” andindex
= 0.
Public Static Attributes
-
static const std::string
name
= "[ENV]"¶ Name of the format. Used to form nice error-strings.
-
using