diff options
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r-- | src/configparser.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp index 624f3aea6..5ee86c811 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -496,6 +496,23 @@ long ConfigTag::getInt(const std::string &key, long def, long min, long max) return res; } +unsigned long ConfigTag::getUInt(const std::string& key, unsigned long def, unsigned long min, unsigned long max) +{ + std::string result; + if (!readString(key, result)) + return def; + + const char* res_cstr = result.c_str(); + char* res_tail = NULL; + unsigned long res = strtoul(res_cstr, &res_tail, 0); + if (res_tail == res_cstr) + return def; + + CheckMagnitude(tag, key, result, res, def, res_tail); + CheckRange(tag, key, res, def, min, max); + return res; +} + unsigned long ConfigTag::getDuration(const std::string& key, unsigned long def, unsigned long min, unsigned long max) { std::string duration; |