Exemplo n.º 1
0
void Vars::append(Variable *arg)
{
    Variable *t = findVarByName(arg->name);
    if(t){
        qDebug()<<"try override variable "<<arg->name<<endl;
        EXCEPTION(true,Vars::append);
    }
    QList<Variable *>::append(arg);
}
Exemplo n.º 2
0
UserConfigVar* UserConfig::createVar(const std::string& name,
		const std::string& defaultValue)
{
	if (findVarByName(name)) return NULL;
	UserConfigVar *var = new UserConfigVar;
	var->Name = name;
	var->DefaultValue = var->Value = defaultValue;
	mVars.push_back(var);
	return var;
}
Exemplo n.º 3
0
std::string UserConfig::getValue(const std::string& name)
{
	UserConfigVar *var = findVarByName(name);
	if (!var)
	{
		std::cerr << "Warning: impossible to get value of " <<
			"unknown configuration variable " << name << std::endl;
		return "";
	}
	return var->Value;
}
Exemplo n.º 4
0
void UserConfig::setValue(const std::string& name, const std::string& value)
{
	UserConfigVar *var = findVarByName(name);
	if (!var)
	{
		std::cerr << "Warning: impossible to set value of " <<
			"unknown configuration variable " << name <<
			"\n Creating new variable" << std::endl;
		var = createVar(name, value);
		mChangeFlag = true;
		return;
	}

	if (var->Value != value) mChangeFlag = true;
	var->Value = value;
}
Exemplo n.º 5
0
Decl_AST*
findVarById(Env* p, IdExpr_AST* Id)
{
    std::string name_Str(Id->Addr());
    return findVarByName(p, name_Str);
}