diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-17 17:11:12 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-17 17:11:12 +0000 |
commit | 863e457e48fdd23a9f4222c888256ece84de9e7e (patch) | |
tree | c61a75055820c7b0700278c4cedc629c5cc84c94 /cpp/src | |
parent | interrupt fixes (diff) | |
download | ice-863e457e48fdd23a9f4222c888256ece84de9e7e.tar.bz2 ice-863e457e48fdd23a9f4222c888256ece84de9e7e.tar.xz ice-863e457e48fdd23a9f4222c888256ece84de9e7e.zip |
getPropertyAsInt
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(); |