diff options
Diffstat (limited to 'cpp/src/Ice/PropertiesI.cpp')
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 58d4e2c123c..7da7efd958e 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -21,9 +21,13 @@ Ice::PropertiesI::getProperty(const string& key) { map<string, string>::const_iterator p = _properties.find(key); if (p != _properties.end()) + { return p->second; + } else + { return string(); + } } void @@ -32,6 +36,14 @@ Ice::PropertiesI::setProperty(const string& key, const string& value) _properties[key] = value; } +PropertiesPtr +Ice::PropertiesI::clone() +{ + PropertiesI* p = new PropertiesI; + p->_properties=_properties; + return p; +} + Ice::PropertiesI::PropertiesI() { } @@ -46,7 +58,9 @@ Ice::PropertiesI::load(const std::string& file) { ifstream in(file.c_str()); if (!in) + { throw SystemException(__FILE__, __LINE__); + } parse(in); } @@ -62,29 +76,41 @@ Ice::PropertiesI::parse(istream& in) string::size_type idx = s.find('#'); if (idx != string::npos) + { s.erase(idx); + } idx = s.find_last_not_of(delim); if (idx != string::npos && idx + 1 < s.length()) + { s.erase(idx + 1); + } string::size_type beg = s.find_first_not_of(delim); if (beg == string::npos) + { continue; + } string::size_type end = s.find_first_of(delim + "=", beg); if (end == string::npos) + { continue; + } string key = s.substr(beg, end - beg); end = s.find('=', end); if (end == string::npos) + { continue; + } beg = s.find_first_not_of(delim + "=", end); if (beg == string::npos) + { continue; + } end = s.length(); |