SF:# 3522084 : AbstractConfiguration does not support 64-bit integers

This commit is contained in:
Marian Krivos
2012-05-26 17:25:36 +00:00
parent 484510dec5
commit 7eb7176397
5 changed files with 111 additions and 1 deletions

View File

@@ -160,6 +160,32 @@ int AbstractConfiguration::getInt(const std::string& key, int defaultValue) cons
}
#if defined(POCO_HAVE_INT64)
Int64 AbstractConfiguration::getInt64(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
return NumberParser::parse64(internalExpand(value));
else
throw NotFoundException(key);
}
Int64 AbstractConfiguration::getInt64(const std::string& key, Int64 defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
return NumberParser::tryParse64(internalExpand(value), defaultValue);
}
#endif // defined(POCO_HAVE_INT64)
double AbstractConfiguration::getDouble(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
@@ -220,6 +246,17 @@ void AbstractConfiguration::setInt(const std::string& key, int value)
}
#if defined(POCO_HAVE_INT64)
void AbstractConfiguration::setInt64(const std::string& key, Int64 value)
{
FastMutex::ScopedLock lock(_mutex);
setRaw(key, NumberFormatter::format(value));
}
#endif // defined(POCO_HAVE_INT64)
void AbstractConfiguration::setDouble(const std::string& key, double value)
{
setRawWithEvent(key, NumberFormatter::format(value));