|
|
|
@ -32,7 +32,7 @@ namespace groove { |
|
|
|
|
std::string value = pair.at(1); |
|
|
|
|
std::trim(key); |
|
|
|
|
std::trim(value); |
|
|
|
|
this->params.emplace(key, ConfigValue(value)); |
|
|
|
|
this->params->emplace(key, ConfigValue(value)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
@ -42,30 +42,30 @@ namespace groove { |
|
|
|
|
|
|
|
|
|
template<> |
|
|
|
|
std::string ConfigParser::get<std::string>(const std::string& key) { |
|
|
|
|
if (this->params.find(key) == this->params.end()) |
|
|
|
|
if (this->params->find(key) == this->params->end()) |
|
|
|
|
return ""; |
|
|
|
|
return this->params.at(key).strVal; |
|
|
|
|
return this->params->at(key).strVal; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> |
|
|
|
|
int ConfigParser::get<int>(const std::string& key) { |
|
|
|
|
if (this->params.find(key) == this->params.end()) |
|
|
|
|
if (this->params->find(key) == this->params->end()) |
|
|
|
|
return 0; |
|
|
|
|
return this->params.at(key).intVal; |
|
|
|
|
return this->params->at(key).intVal; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> |
|
|
|
|
float ConfigParser::get<float>(const std::string& key) { |
|
|
|
|
if (this->params.find(key) == this->params.end()) |
|
|
|
|
if (this->params->find(key) == this->params->end()) |
|
|
|
|
return 0.0f; |
|
|
|
|
return this->params.at(key).floatVal; |
|
|
|
|
return this->params->at(key).floatVal; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> |
|
|
|
|
bool ConfigParser::get<bool>(const std::string& key) { |
|
|
|
|
if (this->params.find(key) == this->params.end()) |
|
|
|
|
if (this->params->find(key) == this->params->end()) |
|
|
|
|
return false; |
|
|
|
|
return this->params.at(key).boolVal; |
|
|
|
|
return this->params->at(key).boolVal; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|