refactor(config): Deduce return type from default value

This commit is contained in:
Michael Carlberg
2016-12-30 23:32:05 +01:00
parent a0f1d97c2b
commit 78bb3695e6
33 changed files with 184 additions and 196 deletions

View File

@ -15,15 +15,14 @@ namespace modules {
network_module::network_module(const bar_settings& bar, string name_)
: timer_module<network_module>(bar, move(name_)) {
// Load configuration values
REQ_CONFIG_VALUE(name(), m_interface, "interface");
GET_CONFIG_VALUE(name(), m_ping_nth_update, "ping-interval");
GET_CONFIG_VALUE(name(), m_udspeed_minwidth, "udspeed-minwidth");
GET_CONFIG_VALUE(name(), m_accumulate, "accumulate-stats");
m_interface = m_conf.get(name(), "interface", m_interface);
m_ping_nth_update = m_conf.get(name(), "ping-interval", m_ping_nth_update);
m_udspeed_minwidth = m_conf.get(name(), "udspeed-minwidth", m_udspeed_minwidth);
m_accumulate = m_conf.get(name(), "accumulate-stats", m_accumulate);
m_interval = m_conf.get(name(), "interval", 1s);
m_conf.warn_deprecated(name(), "udspeed-minwidth", "%downspeed:min:max% and %upspeed:min:max%");
m_interval = chrono::duration<double>(m_conf.get<float>(name(), "interval", 1));
// Add formats
m_formatter->add(FORMAT_CONNECTED, TAG_LABEL_CONNECTED, {TAG_RAMP_SIGNAL, TAG_RAMP_QUALITY, TAG_LABEL_CONNECTED});
m_formatter->add(FORMAT_DISCONNECTED, TAG_LABEL_DISCONNECTED, {TAG_LABEL_DISCONNECTED});