Exemplo n.º 1
0
CLIOptions::Option CLIOptions::option(const QString& name, bool throw_exc) const throw(Exception)
{
	Option ret = m_options.value(name);
	if(ret.isNull() && throw_exc) {
		QString msg = "Key '"%name%"' not found.";
		qfWarning() << msg;
		throw Exception(msg);
	}
	return ret;
}
Exemplo n.º 2
0
bool CLIOptions::setValue(const QString& name, const QVariant val, bool throw_exc) throw(Exception)
{
	Option o = option(name, false);
	if(o.isNull()) {
		QString msg = "setValue():"%val.toString()%" Key '"%name%"' not found.";
		qfWarning() << msg;
		if(throw_exc) {
			throw Exception(msg);
		}
		return false;
	}
	else {
		Option &orf = optionRef(name);
		orf.setValue(val);
	}
	return true;
}