summaryrefslogtreecommitdiff
path: root/src/config/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/config.cpp')
-rw-r--r--src/config/config.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/config/config.cpp b/src/config/config.cpp
index 412b170..2f64b9e 100644
--- a/src/config/config.cpp
+++ b/src/config/config.cpp
@@ -1,10 +1,12 @@
#include <config/config.hpp>
#include <utils/tolower.hpp>
+#include <utils/split.hpp>
-#include <iostream>
-#include <cstring>
-
+#include <algorithm>
#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <vector>
using namespace std::string_literals;
@@ -40,6 +42,15 @@ int Config::get_int(const std::string& option, const int& def)
return def;
}
+bool Config::is_in_list(const std::string& option, const std::string& value)
+{
+ std::string res = Config::get(option, "");
+ if (res.empty())
+ return false;
+ std::vector<std::string> list = utils::split(res, ':');
+ return std::find(list.cbegin(), list.cend(), value) != list.cend();
+}
+
void Config::set(const std::string& option, const std::string& value, bool save)
{
Config::values[option] = value;