This structure provides low level functions to handle and store individual ACDD fields.
It is designed to retrieve ACDD values from configuration keys (including from a file pointed to by such a key), from a default value provided to the constructor or as provided by the user. Several modes of combining these different sources can be chosen from.
#include <libacdd.h>
Public Member Functions | |
ACDD_ATTR () | |
ACDD_ATTR (const std::string &i_name, const std::string &i_cfg_key, const std::string &i_default_value="") | |
ACDD_ATTR (const std::string &i_name, const std::string &i_value, const std::string &i_cfg_key, const std::string &i_default_value) | |
std::string | getValue () const |
std::string | getName () const |
void | setUserConfig (const mio::Config &cfg, const std::string §ion, const bool &allow_multi_line) |
Set the value of the attribute, either from a config file key, or from an environment variable of the same name or some hard-coded default value (in this order of priorities). The key "ACDD_SUMMARY" is handled in a special way: if an "ACDD_SUMMARY_FILE" key is found, the file pointed to by the later will be read and copied into ACDD_SUMMARY. Line breaks are either kept as such or converted to a single white space, depending on the parameter allow_multi_line More... | |
void | setValue (const std::string &i_value, const Mode &mode=MERGE) |
Set an ACDD value. More... | |
bool | isDefault () const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void mio::ACDD::acdd_attrs::setUserConfig | ( | const mio::Config & | cfg, |
const std::string & | section, | ||
const bool & | allow_multi_line | ||
) |
Set the value of the attribute, either from a config file key, or from an environment variable of the same name or some hard-coded default value (in this order of priorities). The key "ACDD_SUMMARY" is handled in a special way: if an "ACDD_SUMMARY_FILE" key is found, the file pointed to by the later will be read and copied into ACDD_SUMMARY. Line breaks are either kept as such or converted to a single white space, depending on the parameter allow_multi_line
[in] | cfg | The configuration file to read the keys from (for the attributes that can be set from such a config key) |
[in] | section | Section in the configuration file to read the keys from |
[in] | allow_multi_line | If an "ACDD_SUMMARY_FILE" is set, either keep line breaks in the file it points to or replace them by spaces. |
Set an ACDD value.
Several modes of setting a value can be configured: MERGE (only set the provided value if the variable was previously empty), APPEND, REPLACE (overwrite any previous value with the new one).
[in] | i_value | New value to set |
[in] | mode | Chosen mode, either MERGE, APPEND or REPLACE |