aboutsummaryrefslogtreecommitdiff
path: root/src/configparser.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-04-12 05:52:10 +0100
committerGravatar Sadie Powell2020-04-12 06:04:42 +0100
commitd99ee13f292b2232a452ff5360ac7052e1d8a368 (patch)
treea8102dfd4f9c3ed3959b00585bc7363639352923 /src/configparser.cpp
parentMove the oper and snomask modes to core_oper. (diff)
Mark all config parsing methods as const.
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r--src/configparser.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 2f124dee2..46abfa061 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -306,14 +306,14 @@ struct Parser
}
else if (stdalgo::string::equalsci(name, "files"))
{
- for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
+ for(ConfigItems::const_iterator i = items->begin(); i != items->end(); i++)
{
stack.DoReadFile(i->first, i->second, flags, false);
}
}
else if (stdalgo::string::equalsci(name, "execfiles"))
{
- for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
+ for(ConfigItems::const_iterator i = items->begin(); i != items->end(); i++)
{
stack.DoReadFile(i->first, i->second, flags, true);
}
@@ -486,9 +486,9 @@ bool ParseStack::ParseFile(const std::string& path, int flags, const std::string
return ok;
}
-bool ConfigTag::readString(const std::string& key, std::string& value, bool allow_lf)
+bool ConfigTag::readString(const std::string& key, std::string& value, bool allow_lf) const
{
- for(ConfigItems::iterator j = items.begin(); j != items.end(); ++j)
+ for(ConfigItems::const_iterator j = items.begin(); j != items.end(); ++j)
{
if(j->first != key)
continue;
@@ -506,7 +506,7 @@ bool ConfigTag::readString(const std::string& key, std::string& value, bool allo
return false;
}
-std::string ConfigTag::getString(const std::string& key, const std::string& def, const std::function<bool(const std::string&)>& validator)
+std::string ConfigTag::getString(const std::string& key, const std::string& def, const std::function<bool(const std::string&)>& validator) const
{
std::string res;
if (!readString(key, res))
@@ -521,7 +521,7 @@ std::string ConfigTag::getString(const std::string& key, const std::string& def,
return res;
}
-std::string ConfigTag::getString(const std::string& key, const std::string& def, size_t minlen, size_t maxlen)
+std::string ConfigTag::getString(const std::string& key, const std::string& def, size_t minlen, size_t maxlen) const
{
std::string res;
if (!readString(key, res))
@@ -598,7 +598,7 @@ namespace
}
}
-long ConfigTag::getInt(const std::string &key, long def, long min, long max)
+long ConfigTag::getInt(const std::string& key, long def, long min, long max) const
{
std::string result;
if(!readString(key, result))
@@ -615,7 +615,7 @@ 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)
+unsigned long ConfigTag::getUInt(const std::string& key, unsigned long def, unsigned long min, unsigned long max) const
{
std::string result;
if (!readString(key, result))
@@ -632,7 +632,7 @@ unsigned long ConfigTag::getUInt(const std::string& key, unsigned long def, unsi
return res;
}
-unsigned long ConfigTag::getDuration(const std::string& key, unsigned long def, unsigned long min, unsigned long max)
+unsigned long ConfigTag::getDuration(const std::string& key, unsigned long def, unsigned long min, unsigned long max) const
{
std::string duration;
if (!readString(key, duration))
@@ -650,7 +650,7 @@ unsigned long ConfigTag::getDuration(const std::string& key, unsigned long def,
return ret;
}
-double ConfigTag::getFloat(const std::string& key, double def, double min, double max)
+double ConfigTag::getFloat(const std::string& key, double def, double min, double max) const
{
std::string result;
if (!readString(key, result))
@@ -661,7 +661,7 @@ double ConfigTag::getFloat(const std::string& key, double def, double min, doubl
return res;
}
-bool ConfigTag::getBool(const std::string &key, bool def)
+bool ConfigTag::getBool(const std::string& key, bool def) const
{
std::string result;
if(!readString(key, result))
@@ -678,7 +678,7 @@ bool ConfigTag::getBool(const std::string &key, bool def)
return def;
}
-std::string ConfigTag::getTagLocation()
+std::string ConfigTag::getTagLocation() const
{
return src_name + ":" + ConvToStr(src_line);
}