From db7d4f56b31a3e75275c3f011a9a324ae6ec89d8 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 6 Aug 2013 16:58:31 +0200 Subject: [PATCH] Fix build with updated hash table --- Util/BaseConfiguration.h | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/Util/BaseConfiguration.h b/Util/BaseConfiguration.h index 0ff634c82..8a3d95907 100644 --- a/Util/BaseConfiguration.h +++ b/Util/BaseConfiguration.h @@ -24,6 +24,8 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "OSRMException.h" #include "../DataStructures/HashTable.h" +#include + #include #include #include @@ -44,26 +46,22 @@ public: std::vector tokens; Tokenize(line, tokens); if(2 == tokens.size() ) - parameters.Add(tokens[0], tokens[1]); + parameters.insert(std::make_pair(tokens[0], tokens[1])); } config.close(); } } - std::string GetParameter(const char * key){ - return GetParameter(std::string(key)); - } - - std::string GetParameter(std::string key) { - return parameters.Find(key); + std::string GetParameter(const std::string & key){ + return parameters.Find(key); } void SetParameter(const char* key, const char* value) { SetParameter(std::string(key), std::string(value)); } - void SetParameter(std::string key, std::string value) { - parameters.Set(key, value); + void SetParameter(const std::string key, std::string value) { + parameters[key] = value; } private: @@ -77,32 +75,13 @@ private: while (std::string::npos != pos || std::string::npos != lastPos) { std::string temp = str.substr(lastPos, pos - lastPos); - TrimStringRight(temp); - TrimStringLeft(temp); + boost::trim(temp); tokens.push_back( temp ); lastPos = str.find_first_not_of(delimiters, pos); pos = str.find_first_of(delimiters, lastPos); } } - void TrimStringRight(std::string& str) { - std::string::size_type pos = str.find_last_not_of(" "); - if (pos != std::string::npos) { - str.erase(pos+1); - } else { - str.erase( str.begin() , str.end() ); - } - } - - void TrimStringLeft(std::string& str) { - std::string::size_type pos = str.find_first_not_of(" "); - if (pos != std::string::npos) { - str.erase(0, pos); - } else { - str.erase( str.begin() , str.end() ); - } - } - HashTable parameters; };