diff --git a/lib/libconfigfile/configfile.cpp b/lib/libconfigfile/configfile.cpp index 354d5ec97..651562335 100644 --- a/lib/libconfigfile/configfile.cpp +++ b/lib/libconfigfile/configfile.cpp @@ -51,7 +51,7 @@ void CConfigFile::clear() // // public file operation methods // -bool CConfigFile::loadConfig(const char * const filename) +bool CConfigFile::loadConfig(const char * const filename, char _delimiter) { std::ifstream configFile(filename); @@ -67,7 +67,7 @@ bool CConfigFile::loadConfig(const char * const filename) if (configFile.fail()) break; - std::string::size_type i = s.find('='); + std::string::size_type i = s.find(_delimiter); if (i != std::string::npos) { std::string::size_type j = s.find('#'); @@ -86,12 +86,12 @@ bool CConfigFile::loadConfig(const char * const filename) } } -bool CConfigFile::loadConfig(const std::string & filename) +bool CConfigFile::loadConfig(const std::string & filename, char _delimiter) { - return loadConfig(filename.c_str()); + return loadConfig(filename.c_str(), _delimiter); } -bool CConfigFile::saveConfig(const char * const filename) +bool CConfigFile::saveConfig(const char * const filename, char _delimiter) { std::string tmpname = std::string(filename) + ".tmp"; unlink(tmpname.c_str()); @@ -102,7 +102,7 @@ bool CConfigFile::saveConfig(const char * const filename) std::cout << "[ConfigFile] saving " << filename << std::endl; for (ConfigDataMap::const_iterator it = configData.begin(); it != configData.end(); ++it) { - configFile << it->first << "=" << it->second << std::endl; + configFile << it->first << _delimiter << it->second << std::endl; } configFile.sync(); @@ -123,9 +123,9 @@ bool CConfigFile::saveConfig(const char * const filename) } } -bool CConfigFile::saveConfig(const std::string & filename) +bool CConfigFile::saveConfig(const std::string & filename, char _delimiter) { - return saveConfig(filename.c_str()); + return saveConfig(filename.c_str(), _delimiter); } diff --git a/lib/libconfigfile/configfile.h b/lib/libconfigfile/configfile.h index 5a247a556..6f1e052e7 100644 --- a/lib/libconfigfile/configfile.h +++ b/lib/libconfigfile/configfile.h @@ -50,11 +50,11 @@ class CConfigFile public: CConfigFile(const char p_delimiter, const bool p_saveDefaults = true); - bool loadConfig(const char * const filename); - bool loadConfig(const std::string & filename); + bool loadConfig(const char * const filename, char _delimiter = '='); + bool loadConfig(const std::string & filename, char _delimiter = '='); - bool saveConfig(const char * const filename); - bool saveConfig(const std::string & filename); + bool saveConfig(const char * const filename, char _delimiter = '='); + bool saveConfig(const std::string & filename, char _delimiter = '='); void clear();