Exemple #1
0
void ParameterList::RemoveComplex(const std::string name){
	try{
		unsigned int id =  FindComplexParameter(name) - vComplex_.begin();
		RemoveComplex(id);
	} catch (BadParameter& ex){
		BOOST_LOG_TRIVIAL(error) <<" ParameterList::RemoveComplex() | Can not remove"
				"parameter "<<name<<": "<<ex.what();
		throw;
	}
}
Exemple #2
0
void ParameterList::RemoveDuplicates()
{
	//We loop over the list of parameters and delete some. Therefore the size
	//changes during to loop. We enclose GetParameter in try...catch
	for(int i=0; i<GetNParameter(); i++ ){
		std::string name;
		try{
			name = GetParameter(i)->GetName();
		} catch (...){
			continue;
		}
		for(int j=i+1; j<GetNParameter(); j++ ){
			std::string name2;
			std::shared_ptr<AbsParameter> delPar;
			try{
				delPar = GetParameter(j);
				name2 = GetParameter(j)->GetName();
			} catch (...){
				continue;
			}

			if( name == name2 ){
				auto type = delPar->type();
				switch(type){
				case ParType::BOOL:
					RemoveBool(j); break;
				case ParType::INTEGER:
					RemoveInteger(j-vBool_.size()); break;
				case ParType::DOUBLE:
					RemoveDouble(j-vBool_.size()-vInt_.size()); break;
				case ParType::COMPLEX:
					RemoveComplex(j-vBool_.size()-vInt_.size()-vComplex_.size());
					break;
				case ParType::MDOUBLE:
					RemoveMultiDouble(j-vBool_.size()-vInt_.size()-vComplex_.size()
							-vMultiDouble_.size());
					break;
				case ParType::MCOMPLEX:
					RemoveMultiComplex(j-vBool_.size()-vInt_.size()-vComplex_.size()
							-vMultiDouble_.size()-vMultiComplex_.size());
					break;
				case ParType::MUNSIGNEDINTEGER:
					RemoveMultiUnsignedInteger(
							j-vBool_.size()-vInt_.size()-vComplex_.size()
							-vMultiDouble_.size()-vMultiComplex_.size()
							-vMultiUnsignedInteger_.size()
					);
					break;
				}
				j--; //decrement if a parameter is removed
			}
		}
	}
}
void UIDaemonHandler::RemoveSearch(QString name)
{
    if(SubstitutionFileParser::IsSubstituted(((UIAppDesc*)appList[name])->getAppDesktopFile()))
    {
	RemoveComplex(name);
    }
    else
    {
#ifndef DBUSSETTINGS
	settings->RemoveSearch(name);
#endif
	dbus->call("RemoveSearch",name);
	((UIAppDesc*)appList[name])->OnLockChanged();
	emit appListChanged();
	//QDBusPendingCall result = dbus->asyncCall("RemoveSearch",name);
	//QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(result);
	//connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),this, SLOT(unlockFinished(QDBusPendingCallWatcher*)));
    }
}