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; }
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); }
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; }
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; }
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); }
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; }
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; }
std::string AbstractConfiguration::expand(const std::string& value) const { Mutex::ScopedLock lock(_mutex); return internalExpand(value); }