Fix build with updated hash table

This commit is contained in:
Dennis Luxen 2013-08-06 16:58:31 +02:00
parent 3151197471
commit db7d4f56b3

View File

@ -24,6 +24,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "OSRMException.h"
#include "../DataStructures/HashTable.h"
#include <boost/algorithm/string.hpp>
#include <exception>
#include <fstream>
#include <iostream>
@ -44,17 +46,13 @@ public:
std::vector<std::string> 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) {
std::string GetParameter(const std::string & key){
return parameters.Find(key);
}
@ -62,8 +60,8 @@ public:
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<std::string, std::string> parameters;
};