Пример #1
0
double SimpleConfig::getFloat(const std::string &section, const std::string &key, double default_, bool set) {
	ConfigValue *v = _find(section, key);
	if (v) {
		return atof(v->getValue().c_str());
	} else
	if (set) {
		setFloat(section, key, default_);
	}
	return default_;
}
Пример #2
0
std::string SimpleConfig::getString(const std::string &section, const std::string &key, std::string default_, bool set) {
	ConfigValue *v = _find(section, key);
	if (v) {
		return v->getValue();
	} else
	if (set) {
		setString(section, key, default_);
	}
	return default_;
}
Пример #3
0
std::string SimpleConfig::getPath(const std::string &section, const std::string &key, std::string default_, bool set) {
	ConfigValue *v = _find(section, key);
	std::string native = ospath::filter(default_);
	if (v) {
		return ospath::filter(v->getValue());
	} else
	if (set) {
		setString(section, key, native);
	}
	return native;
}
Пример #4
0
bool SimpleConfig::getBool(const std::string &section, const std::string &key, bool default_, bool set) {
	ConfigValue *v = _find(section, key);
	if (v) {
		std::string const &value = v->getValue();
		if (value == "true" || atoi(value.c_str())) {
			return true;
		} else {
			return false;
		}
	} else
	if (set) {
		setBool(section, key, default_);
	}
	return default_;
}