From ff83a1b745c4c679eb01c9db1f0a82ab613e2195 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 Mar 2013 22:05:51 +0300 Subject: Add method for incriment config variables. --- src/configuration.cpp | 8 ++++++++ src/configuration.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/configuration.cpp b/src/configuration.cpp index 34d301446..d43cca15e 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -226,6 +226,14 @@ void Configuration::setValue(const std::string &key, const std::string &value) } } +void Configuration::incValue(const std::string &key) +{ + GETLOG(); + const Options::const_iterator iter = mOptions.find(key); + setValue(key, (iter != mOptions.end()) + ? atoi(iter->second.c_str()) + 1 : 1); +} + void Configuration::setSilent(const std::string &key, const std::string &value) { ConfigurationObject::setValue(key, value); diff --git a/src/configuration.h b/src/configuration.h index d9e3af19a..1ac38e9aa 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -279,6 +279,8 @@ class Configuration final : public ConfigurationObject void setValue(const std::string &key, const std::string &value); + void incValue(const std::string &key); + void setSilent(const std::string &key, const std::string &value); inline void setValue(const std::string &key, const char *const value) -- cgit v1.2.3-60-g2f50