Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Romain De Laage De Bellefaye
LO21-projet
Commits
2e6aea22
Verified
Commit
2e6aea22
authored
Jun 08, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Add function to get enseEtats
parent
63b8ab07
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/autosql.cpp
View file @
2e6aea22
...
...
@@ -40,6 +40,30 @@ std::vector<QString> Database::getAutomates() const {
return
names
;
}
void
Database
::
initEnsEtat
(
const
QString
&
name
)
const
{
QSqlQuery
query
(
db
);
query
.
prepare
(
"SELECT indice, label, r, g, b FROM Etats INNER JOIN EnsembleEtats ON Etats.ensemble = EnsembleEtats.id WHERE automate = :nom"
);
query
.
bindValue
(
":nom"
,
name
);
query
.
exec
();
if
(
!
query
.
first
())
throw
"Unable to select this object"
;
EnsembleEtat
&
ens
=
EnsembleEtat
::
getInstance
();
ens
.
reset
()
do
{
unsigned
int
ind
=
static_cast
<
unsigned
int
>
(
query
.
value
(
"indice"
).
toInt
());
int
r
=
query
.
value
(
"r"
).
toInt
();
int
g
=
query
.
value
(
"g"
).
toInt
();
int
b
=
query
.
value
(
"b"
).
toInt
();
std
::
string
label
=
query
.
value
(
"label"
).
toString
().
toStdString
();
ens
.
ajouterEtat
(
ind
,
label
,
r
,
g
,
b
);
}
while
(
query
.
next
());
}
/// Retourne la fonction de transition d'un automate par son nom
///
/// Une règle prend en compte l'état courant seulement s'il est défini à non nul dans la BDD
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment