]> git.stg.codes - stg.git/blobdiff - stglibs/conffiles.lib/conffiles.cpp
Merge pull request #2 from bobr-kun/MySQL_custom_port
[stg.git] / stglibs / conffiles.lib / conffiles.cpp
index ed2e4447744679b8e9bc2928018198b5f03c9ec8..9578e24f298791daad4e3923ae948bde7da9cf62 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <cerrno> // E*
 #include <cstring>
+#include <sstream>
 #include <cstdlib>
 #include <cstdio>
 
@@ -69,7 +70,7 @@ if (pos != std::string::npos)
 return val;
 }
 //---------------------------------------------------------------------------
-std::string Trim(std::string val)
+std::string Trim(const std::string& val)
 {
 return TrimR(TrimL(val));
 }
@@ -345,6 +346,14 @@ param_val[param] = buf;
 changed = true;
 }
 //---------------------------------------------------------------------------
+void CONFIGFILE::WriteTime(const std::string & param, time_t val)
+{
+std::stringstream ss;
+ss<<val;
+param_val[param] = ss.str();
+changed = true;
+}
+//---------------------------------------------------------------------------
 int CONFIGFILE::ReadDouble(const std::string & param, double * val, double defaultVal) const
 {
 const std::map<std::string, std::string, StringCaseCmp_t>::const_iterator it(param_val.find(param));