Fix build with updated hash table
This commit is contained in:
parent
3151197471
commit
db7d4f56b3
@ -24,6 +24,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include "OSRMException.h"
|
#include "OSRMException.h"
|
||||||
#include "../DataStructures/HashTable.h"
|
#include "../DataStructures/HashTable.h"
|
||||||
|
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -44,26 +46,22 @@ public:
|
|||||||
std::vector<std::string> tokens;
|
std::vector<std::string> tokens;
|
||||||
Tokenize(line, tokens);
|
Tokenize(line, tokens);
|
||||||
if(2 == tokens.size() )
|
if(2 == tokens.size() )
|
||||||
parameters.Add(tokens[0], tokens[1]);
|
parameters.insert(std::make_pair(tokens[0], tokens[1]));
|
||||||
}
|
}
|
||||||
config.close();
|
config.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetParameter(const char * key){
|
std::string GetParameter(const std::string & key){
|
||||||
return GetParameter(std::string(key));
|
return parameters.Find(key);
|
||||||
}
|
|
||||||
|
|
||||||
std::string GetParameter(std::string key) {
|
|
||||||
return parameters.Find(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetParameter(const char* key, const char* value) {
|
void SetParameter(const char* key, const char* value) {
|
||||||
SetParameter(std::string(key), std::string(value));
|
SetParameter(std::string(key), std::string(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetParameter(std::string key, std::string value) {
|
void SetParameter(const std::string key, std::string value) {
|
||||||
parameters.Set(key, value);
|
parameters[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -77,32 +75,13 @@ private:
|
|||||||
|
|
||||||
while (std::string::npos != pos || std::string::npos != lastPos) {
|
while (std::string::npos != pos || std::string::npos != lastPos) {
|
||||||
std::string temp = str.substr(lastPos, pos - lastPos);
|
std::string temp = str.substr(lastPos, pos - lastPos);
|
||||||
TrimStringRight(temp);
|
boost::trim(temp);
|
||||||
TrimStringLeft(temp);
|
|
||||||
tokens.push_back( temp );
|
tokens.push_back( temp );
|
||||||
lastPos = str.find_first_not_of(delimiters, pos);
|
lastPos = str.find_first_not_of(delimiters, pos);
|
||||||
pos = str.find_first_of(delimiters, lastPos);
|
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;
|
HashTable<std::string, std::string> parameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user