diff --git a/src/async/ChangeLog b/src/async/ChangeLog index 9c114106..e010a82a 100644 --- a/src/async/ChangeLog +++ b/src/async/ChangeLog @@ -1,4 +1,4 @@ - 1.6.1 -- ?? ??? 2021 + 1.6.1 -- ?? ??? 2022 ---------------------- * ASYNC_AUDIO_ALSA_ZEROFILL is now enabled by default. @@ -44,6 +44,12 @@ will be written instead. Enable this behavior by setting the environment variable ASYNC_AUDIO_UDP_ZEROFILL=1. +* The Config class now also accept associative containers for getValue. This + for example make it possible to use a std::map to read a + configuration variable with a list of values on the form + VARNAME=88.5:-1,136.5:1. It is also possible to use other key/value + separators. + 1.6.0 -- 01 Sep 2019 diff --git a/src/async/core/AsyncConfig.h b/src/async/core/AsyncConfig.h index 98d1aa99..37115a51 100644 --- a/src/async/core/AsyncConfig.h +++ b/src/async/core/AsyncConfig.h @@ -325,6 +325,7 @@ class Config return true; } std::stringstream ssval(str_val); + ssval.imbue(std::locale(ssval.getloc(), new csv_whitespace)); while (!ssval.eof()) { Key tmp; @@ -342,6 +343,77 @@ class Config return true; } /* Config::getValue */ + /** + * @brief Get value of given config variable into associative container + * @param section The name of the section where the configuration + * variable is located + * @param tag The name of the configuration variable to get + * @param c The value is returned in this argument. + * Successful completion overwrites previous contents + * @param sep The character used to separate key and value + * @param missing_ok If set to \em true, return \em true if the + * configuration variable is missing + * @return Returns \em true on success or else \em false on failure. + * + * This function is used to get the value of a configuraiton variable. The + * config variable is read into an associative container (e.g. std::map or + * std::multimap). It's a template function meaning that it can take any + * key and value type that supports the operator>> function. + * Normally a missing configuration variable is seen as an error and the + * function returns \em false. If the missing_ok parameter is set to \em + * true, this function returns \em true for a missing variable but still + * returns \em false if an illegal value is specified. + */ + template