]> git.stg.codes - stg.git/blobdiff - include/stg/module_settings.h
Public interfaces: part 1
[stg.git] / include / stg / module_settings.h
index a1baf33c80f1aba03e8d698c3e7422cfdccb2714..a4de453979a1ba19bac320e6e02b0b47a1c9fa6a 100644 (file)
@@ -1,51 +1,64 @@
- /*
- $Revision: 1.5 $
- $Date: 2010/03/04 11:49:52 $
- $Author: faust $
- */
+#pragma once
 
-#ifndef MODULE_SETTINGS_H
-#define MODULE_SETTINGS_H
-
-#include <cstring> // strcasecmp
 #include <string>
 #include <vector>
+#include <cstring> // strcasecmp
+
+namespace STG
+{
 
 //-----------------------------------------------------------------------------
-struct PARAM_VALUE
+struct ParamValue
 {
-    PARAM_VALUE()
-        : param(),
-          value()
+    ParamValue() = default;
+    ParamValue(const std::string& p, const std::vector<std::string>& vs) noexcept
+        : param(p),
+          value(vs)
+    {}
+    ParamValue(const std::string& p, const std::vector<std::string>& vs, const std::vector<ParamValue>& ss) noexcept
+        : param(p),
+          value(vs),
+          sections(ss)
     {}
-    bool operator==(const PARAM_VALUE & rhs) const
-        { return !strcasecmp(param.c_str(), rhs.param.c_str()); }
 
-    bool operator<(const PARAM_VALUE & rhs) const
-        { return strcasecmp(param.c_str(), rhs.param.c_str()) < 0; }
+    ParamValue(const ParamValue&) = default;
+    ParamValue& operator=(const ParamValue&) = default;
+    ParamValue(ParamValue&&) = default;
+    ParamValue& operator=(ParamValue&&) = default;
+
+    bool operator==(const ParamValue & rhs) const noexcept
+    { return !strcasecmp(param.c_str(), rhs.param.c_str()); }
+
+    bool operator<(const ParamValue & rhs) const noexcept
+    { return strcasecmp(param.c_str(), rhs.param.c_str()) < 0; }
 
     std::string param;
     std::vector<std::string> value;
+    std::vector<ParamValue> sections;
 };
 //-----------------------------------------------------------------------------
-struct MODULE_SETTINGS
+struct ModuleSettings
 {
-    MODULE_SETTINGS()
-        : moduleName(),
-          moduleParams()
-    {}
-    MODULE_SETTINGS(const MODULE_SETTINGS & rvalue)
-        : moduleName(rvalue.moduleName),
-          moduleParams(rvalue.moduleParams)
+    ModuleSettings() = default;
+    ModuleSettings(const std::string& name, const std::vector<ParamValue>& params) noexcept
+        : moduleName(name),
+          moduleParams(params)
     {}
-    bool operator==(const MODULE_SETTINGS & rhs) const
-        { return !strcasecmp(moduleName.c_str(), rhs.moduleName.c_str()); }
 
-    bool operator<(const MODULE_SETTINGS & rhs) const
-        { return strcasecmp(moduleName.c_str(), rhs.moduleName.c_str()) < 0; }
+    ModuleSettings(const ModuleSettings&) = default;
+    ModuleSettings& operator=(const ModuleSettings&) = default;
+    ModuleSettings(ModuleSettings&&) = default;
+    ModuleSettings& operator=(ModuleSettings&&) = default;
 
-    std::string              moduleName;
-    std::vector<PARAM_VALUE> moduleParams;
+    bool operator==(const ModuleSettings & rhs) const noexcept
+    { return !strcasecmp(moduleName.c_str(), rhs.moduleName.c_str()); }
+
+    bool operator<(const ModuleSettings & rhs) const noexcept
+    { return strcasecmp(moduleName.c_str(), rhs.moduleName.c_str()) < 0; }
+
+    std::string             moduleName;
+    std::vector<ParamValue> moduleParams;
 };
 //-----------------------------------------------------------------------------
-#endif
+
+}