Skip to content
GitLab
Menu
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
660006e5
Verified
Commit
660006e5
authored
Jun 12, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Unique return at the end
parent
f5093613
Pipeline
#79761
passed with stage
in 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/autosql.cpp
View file @
660006e5
...
...
@@ -166,23 +166,20 @@ RegleVoisinage* Database::getRegleVoisinage(const QString& name) const {
int
type
=
query
.
value
(
"type"
).
toInt
();
RegleVoisinage
*
regle
=
nullptr
;
if
(
type
==
1
)
{
if
(
query
.
isNull
(
"rayon"
))
throw
"Error: r can't be undefined here"
;
RegleVoisinageNeumann
*
regle
=
new
RegleVoisinageNeumann
;
regle
->
setr
(
query
.
value
(
"rayon"
).
toInt
());
return
regle
;
regle
=
new
RegleVoisinageNeumann
;
dynamic_cast
<
RegleVoisinageNeumann
*>
(
regle
)
->
setr
(
query
.
value
(
"rayon"
).
toInt
());
}
else
if
(
type
==
2
)
{
if
(
query
.
isNull
(
"rayon"
))
throw
"Error: r can't be undefined here"
;
RegleVoisinageMoore
*
regle
=
new
RegleVoisinageMoore
;
regle
->
setr
(
query
.
value
(
"rayon"
).
toInt
());
return
regle
;
regle
=
new
RegleVoisinageMoore
;
dynamic_cast
<
RegleVoisinageMoore
*>
(
regle
)
->
setr
(
query
.
value
(
"rayon"
).
toInt
());
}
else
if
(
type
!=
3
)
{
query
.
prepare
(
"SELECT x, y FROM coord_voisinage WHERE id = :id"
);
...
...
@@ -192,20 +189,20 @@ RegleVoisinage* Database::getRegleVoisinage(const QString& name) const {
if
(
!
query
.
first
())
throw
"There must be at least one coord in this rule"
;
RegleVoisinageArbitraire
*
regle
=
new
RegleVoisinageArbitraire
;
regle
=
new
RegleVoisinageArbitraire
;
Coordonnees
coord
;
do
{
coord
.
x
=
query
.
value
(
0
).
toUInt
();
coord
.
y
=
query
.
value
(
1
).
toUInt
();
regle
->
coordonnees
.
push_back
(
coord
);
dynamic_cast
<
RegleVoisinageArbitraire
*>
(
regle
)
->
coordonnees
.
push_back
(
coord
);
}
while
(
query
.
next
());
query
.
prepare
(
"SELECT COUNT(*) FROM coord_voisinage WHERE id = :id"
);
query
.
bindValue
(
":id"
,
name
);
query
.
exec
();
return
regle
;
}
return
regle
;
}
/// Retourne un descriptif des réseaux ("id", "nom", "id", "nom", etc.) liés à un automate
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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