Add templated function Async::Config::setValue
Add templated function Async::Config::setValue() so that generic types can be used without converting them to string first.
This commit is contained in:
parent
c04708004d
commit
047ca7a607
|
|
@ -34,6 +34,9 @@
|
|||
* The Pty::setLineBuffered method can now be used to enable line buffered mode
|
||||
where incoming chars are buffered until a <CR> or <LF> is received.
|
||||
|
||||
* Templated function Async::Config::setValue() so that generic types can be
|
||||
used without converting them to string first.
|
||||
|
||||
|
||||
|
||||
1.6.0 -- 01 Sep 2019
|
||||
|
|
|
|||
|
|
@ -421,6 +421,32 @@ class Config
|
|||
void setValue(const std::string& section, const std::string& tag,
|
||||
const std::string& value);
|
||||
|
||||
/**
|
||||
* @brief Set the value of a configuration variable (generic type)
|
||||
* @param section The name of the section where the configuration
|
||||
* variable is located
|
||||
* @param tag The name of the configuration variable to set.
|
||||
* @param value The value to set
|
||||
*
|
||||
* This function is used to set the value of a configuration variable.
|
||||
* The type of the value may be any type that support streaming to string.
|
||||
* If the given configuration section or variable does not exist, it
|
||||
* is created.
|
||||
* Note that this function will not write anything back to the
|
||||
* associated configuration file. It will only set the value in memory.
|
||||
*
|
||||
* The valueUpdated signal will be emitted so that subscribers can get
|
||||
* notified when the value of a configuration variable is changed.
|
||||
*/
|
||||
template <typename Rsp>
|
||||
void setValue(const std::string& section, const std::string& tag,
|
||||
const Rsp& value)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << value;
|
||||
setValue(section, tag, ss.str());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A signal that is emitted when a config value is updated
|
||||
* @param section The config section of the update
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ bool Logic::initialize(void)
|
|||
event_handler->playDtmf.connect(mem_fun(*this, &Logic::playDtmf));
|
||||
event_handler->injectDtmf.connect(mem_fun(*this, &Logic::injectDtmf));
|
||||
event_handler->setConfigValue.connect(
|
||||
sigc::mem_fun(cfg(), &Async::Config::setValue));
|
||||
sigc::mem_fun(cfg(), &Async::Config::setValue<std::string>));
|
||||
event_handler->setVariable("mycall", m_callsign);
|
||||
char str[256];
|
||||
sprintf(str, "%.1f", report_ctcss);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ QTEL=1.2.4
|
|||
LIBECHOLIB=1.3.3
|
||||
|
||||
# Version for the Async library
|
||||
LIBASYNC=1.6.0.99.11
|
||||
LIBASYNC=1.6.99.12
|
||||
|
||||
# SvxLink versions
|
||||
SVXLINK=1.7.99.29
|
||||
|
|
|
|||
Loading…
Reference in New Issue