]> git.stg.codes - stg.git/blobdiff - include/stg/module_settings.h
Allow to have multi-leveled module settings.
[stg.git] / include / stg / module_settings.h
index a1baf33c80f1aba03e8d698c3e7422cfdccb2714..5af5eefcd23149796711ce76d81bc7d5d45d21e3 100644 (file)
 //-----------------------------------------------------------------------------
 struct PARAM_VALUE
 {
-    PARAM_VALUE()
-        : param(),
-          value()
+    PARAM_VALUE() {}
+    PARAM_VALUE(const std::string& p, const std::vector<std::string>& vs)
+        : param(p),
+          value(vs)
+    {}
+    PARAM_VALUE(const std::string& p, const std::vector<std::string>& vs, const std::vector<PARAM_VALUE>& ss)
+        : param(p),
+          value(vs),
+          sections(ss)
     {}
     bool operator==(const PARAM_VALUE & rhs) const
         { return !strcasecmp(param.c_str(), rhs.param.c_str()); }
@@ -26,6 +32,7 @@ struct PARAM_VALUE
 
     std::string param;
     std::vector<std::string> value;
+    std::vector<PARAM_VALUE> sections;
 };
 //-----------------------------------------------------------------------------
 struct MODULE_SETTINGS
@@ -34,9 +41,9 @@ struct MODULE_SETTINGS
         : moduleName(),
           moduleParams()
     {}
-    MODULE_SETTINGS(const MODULE_SETTINGS & rvalue)
-        : moduleName(rvalue.moduleName),
-          moduleParams(rvalue.moduleParams)
+    MODULE_SETTINGS(const std::string& name, const std::vector<PARAM_VALUE>& params)
+        : moduleName(name),
+          moduleParams(params)
     {}
     bool operator==(const MODULE_SETTINGS & rhs) const
         { return !strcasecmp(moduleName.c_str(), rhs.moduleName.c_str()); }