diff --git a/common/utilities/config_utility.cpp b/common/utilities/config_utility.cpp index 02970b1..7fb174b 100644 --- a/common/utilities/config_utility.cpp +++ b/common/utilities/config_utility.cpp @@ -25,25 +25,25 @@ #include #include -using namespace std; - -void ConfigUtility::Load(string fname) { - ifstream is(fname); +void ConfigUtility::Load(std::string fname) { + std::ifstream is(fname); if (!is.is_open()) { - throw(runtime_error("Failed to open config file")); + throw(std::runtime_error("Failed to open config file")); } - string key, val; + std::string key, val; - for (;;) { //forever + while(true) { //forever //eat whitespace - while(isspace(is.peek())) + while(isspace(is.peek())) { is.ignore(); + } //end of file - if (is.eof()) + if (is.eof()) { break; + } //skip comment lines if (is.peek() == '#') { @@ -64,7 +64,7 @@ void ConfigUtility::Load(string fname) { while(key.size() && isspace(*(key.end()-1))) key.erase(key.end() - 1); while(val.size() && isspace(*(val.end()-1))) val.erase(val.end() - 1); - //allow empty/wiped values + //disallow empty/wiped values if (key.size() == 0) { continue; } diff --git a/common/utilities/config_utility.hpp b/common/utilities/config_utility.hpp index 6e944ef..3ea8448 100644 --- a/common/utilities/config_utility.hpp +++ b/common/utilities/config_utility.hpp @@ -39,15 +39,9 @@ public: bool Boolean(std::string); //shorthand - std::string& operator[](std::string s) { - return String(s); - } - int Int(std::string s) { - return Integer(s); - } - bool Bool(std::string s) { - return Boolean(s); - } + inline std::string& operator[](std::string s) { return String(s); } + inline int Int(std::string s) { return Integer(s); } + inline bool Bool(std::string s) { return Boolean(s); } //OO breaker std::map* GetMap() {