diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index 7003a73a4..636906c9b 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -303,6 +303,14 @@ namespace BSPF } } + // Trim leading and trailing whitespace from a string + inline string trim(const string& str) + { + string::size_type first = str.find_first_not_of(' '); + return (first == string::npos) ? EmptyString : + str.substr(first, str.find_last_not_of(' ')-first+1); + } + // C++11 way to get local time // Equivalent to the C-style localtime() function, but is thread-safe inline std::tm localTime() diff --git a/src/common/repository/KeyValueRepositoryConfigfile.cxx b/src/common/repository/KeyValueRepositoryConfigfile.cxx index b0e6ae725..1e325a08c 100644 --- a/src/common/repository/KeyValueRepositoryConfigfile.cxx +++ b/src/common/repository/KeyValueRepositoryConfigfile.cxx @@ -18,15 +18,6 @@ #include "KeyValueRepositoryConfigfile.hxx" #include "Logger.hxx" -namespace { - string trim(const string& str) - { - string::size_type first = str.find_first_not_of(' '); - return (first == string::npos) ? EmptyString : - str.substr(first, str.find_last_not_of(' ')-first+1); - } -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FilesystemNode& file) : myFile{file} @@ -67,8 +58,8 @@ std::map KeyValueRepositoryConfigfile::load() continue; // Split the line into key/value pairs and trim any whitespace - key = trim(line.substr(0, equalPos)); - value = trim(line.substr(equalPos + 1, line.length() - key.length() - 1)); + key = BSPF::trim(line.substr(0, equalPos)); + value = BSPF::trim(line.substr(equalPos + 1, line.length() - key.length() - 1)); // Skip absent key if(key.length() == 0) diff --git a/src/emucore/Settings.hxx b/src/emucore/Settings.hxx index 7c129a392..decc70a24 100644 --- a/src/emucore/Settings.hxx +++ b/src/emucore/Settings.hxx @@ -116,20 +116,6 @@ class Settings void setPermanent(const string& key, const Variant& value); void setTemporary(const string& key, const Variant& value); - // Trim leading and following whitespace from a string - static string trim(const string& str) - { - string::size_type first = str.find_first_not_of(' '); - return (first == string::npos) ? EmptyString : - str.substr(first, str.find_last_not_of(' ')-first+1); - } - - // FIXME - Rework so that these aren't needed; hence no commenting added - const Options& getPermanentSettings() const - { return myPermanentSettings; } - const Options& getTemporarySettings() const - { return myTemporarySettings; } - private: /** This method must be called *after* settings have been fully loaded