Beispiel #1
0
std::string AbstractConfiguration::uncheckedExpand(const std::string& value) const
{
	std::string result;
	std::string::const_iterator it  = value.begin();
	std::string::const_iterator end = value.end();
	while (it != end)
	{
		if (*it == '$')
		{
			++it;
			if (it != end && *it == '{')
			{
				++it;
				std::string prop;
				while (it != end && *it != '}') prop += *it++;
				if (it != end) ++it;
				std::string value;
				if (getRaw(prop, value))
				{
					result.append(internalExpand(value));
				}
				else
				{
					result.append("${");
					result.append(prop);
					result.append("}");
				}
			}
			else result += '$';
		}
		else result += *it++;
	}
	return result;
}
Beispiel #2
0
std::string AbstractConfiguration::getString(const std::string& key) const
{
	Mutex::ScopedLock lock(_mutex);

	std::string value;
	if (getRaw(key, value))
		return internalExpand(value);
	else
		throw NotFoundException(key);
}
Beispiel #3
0
double AbstractConfiguration::getDouble(const std::string& key, double defaultValue) const
{
	Mutex::ScopedLock lock(_mutex);

	std::string value;
	if (getRaw(key, value))
		return NumberParser::parseFloat(internalExpand(value));
	else
		return defaultValue;
}
Beispiel #4
0
bool AbstractConfiguration::getBool(const std::string& key, bool defaultValue) const
{
	Mutex::ScopedLock lock(_mutex);

	std::string value;
	if (getRaw(key, value))
		return parseBool(internalExpand(value));
	else
		return defaultValue;
}
Beispiel #5
0
double AbstractConfiguration::getDouble(const std::string& key) const
{
	Mutex::ScopedLock lock(_mutex);

	std::string value;
	if (getRaw(key, value))
		return NumberParser::parseFloat(internalExpand(value));
	else
		throw NotFoundException(key);
}
Beispiel #6
0
UInt64 AbstractConfiguration::getUInt64(const std::string& key, UInt64 defaultValue) const
{
	Mutex::ScopedLock lock(_mutex);

	std::string value;
	if (getRaw(key, value))
		return NumberParser::parseUnsigned64(internalExpand(value));
	else
		return defaultValue;
}
Beispiel #7
0
std::string AbstractConfiguration::getString(const std::string& key, const std::string& defaultValue) const
{
	Mutex::ScopedLock lock(_mutex);

	std::string value;
	if (getRaw(key, value))
		return internalExpand(value);
	else
		return defaultValue;
}
bool AbstractConfiguration::getBool(const std::string& key) const
{
    FastMutex::ScopedLock lock(_mutex);

    std::string value;
    if (getRaw(key, value))
        return parseBool(internalExpand(value));
    else
        throw NotFoundException(key);
}
int AbstractConfiguration::getInt(const std::string& key, int defaultValue) const
{
    FastMutex::ScopedLock lock(_mutex);

    std::string value;
    if (getRaw(key, value))
        return parseInt(internalExpand(value));
    else
        return defaultValue;
}
Beispiel #10
0
std::string AbstractConfiguration::expand(const std::string& value) const
{
	Mutex::ScopedLock lock(_mutex);

	return internalExpand(value);
}