diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 16 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 78cd88b4d18..5805c2a4a98 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -69,6 +69,22 @@ Ice::PropertiesI::getProperties(const string& prefix) return result; } +Int +Ice::PropertiesI::getPropertyAsInt(const string& key) +{ + IceUtil::Mutex::Lock sync(*this); + + map<string, string>::const_iterator p = _properties.find(key); + if (p != _properties.end()) + { + return static_cast<Int>(atoi(p->second.c_str())); + } + else + { + return 0; + } +} + void Ice::PropertiesI::setProperty(const string& key, const string& value) { diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h index f97e368bad8..73f770d3920 100644 --- a/cpp/src/Ice/PropertiesI.h +++ b/cpp/src/Ice/PropertiesI.h @@ -24,6 +24,7 @@ public: virtual std::string getProperty(const std::string&); virtual std::string getPropertyWithDefault(const std::string&, const std::string&); + virtual Ice::Int getPropertyAsInt(const std::string&); virtual StringSeq getProperties(const std::string&); virtual void setProperty(const std::string&, const std::string&); virtual StringSeq getCommandLineOptions(); |