cpp-hocon
0.3.0
|
Static Public Member Functions | |
static shared_value | from_any_ref (unwrapped_value value, std::string origin_description="") |
Creates a config_value from a plain value, which may be a bool , long , string , unordered_map , vector or nullptr . More... | |
Definition at line 8 of file config_value_factory.hpp.
|
static |
Creates a config_value from a plain value, which may be a bool
, long
, string
, unordered_map
, vector
or nullptr
.
An unordered_map
must be a unordered_map
from string to more values that can be supplied to from_any_ref()
. An unordered_map
will become a config_object and a vector
will become a config_list.
In a unordered_map
passed to from_any_ref()
, the map's keys are plain keys, not path expressions. So if your unordered_map
has a key "foo.bar" then you will get one object with a key called "foo.bar", rather than an object with a key "foo" containing another object with a key "bar".
The origin_description will be used to set the origin() field on the config_value. It should normally be the name of the file the values came from, or something short describing the value such as "default settings". The origin_description is prefixed to error messages so users can tell where problematic values are coming from.
Supplying the result of config_value.unwrapped() to this function is guaranteed to work and should give you back a config_value that matches the one you unwrapped. The re-wrapped config_value will lose some information that was present in the original such as its origin, but it will have matching values.
unwrapped_value | object object to convert to config_value |
string | origin_description name of origin file or brief description of what the value is |