This repository was archived by the owner on Aug 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConditionChecker.cpp
More file actions
47 lines (40 loc) · 1.35 KB
/
ConditionChecker.cpp
File metadata and controls
47 lines (40 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "ConditionChecker.h"
#include "Dossier.h"
bool ConditionChecker::evaluate()//évalue toutes les conditions du checker et retourne vrai si elles le sont toutes
{
bool allChecked=true;
QObject *cc = this;
QScriptValue objectValue = engine.newQObject(cc);
engine.globalObject().setProperty(name, objectValue);
typedef std::vector<Condition>::iterator Cond_iter;
for(Cond_iter it=cond.begin();it != cond.end() ;it++)
{
if(!engine.evaluate(it->getCond()).toBool())
{
allChecked=false;
break;
}
if(engine.hasUncaughtException())
{
throw ConditionCheckerException ("Erreur ConditionChecker :"+ engine.uncaughtException().toString().toStdString());
}
}
return allChecked;
}
bool ConditionChecker::isUvValidated(QString u)
{
//qDebug()<<"#####################inside : ";//<<dossier.isUvValidated(u);
TemplateManager<UV>& tUV=TemplateManager<UV>::getInstance();
if(tUV.alreadyExist(u.toStdString()))
{
return dossier.isUvValidated(StringToUV(u));
}
else
{
throw ConditionCheckerException ("Erreur ConditionChecker : l'UV "+ u.toStdString() +" n'éxiste pas");
}
}
unsigned int ConditionChecker::getValidatedCredits(QString c)
{
return dossier.getValidatedCredits(c);
}