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
72aaa648
Commit
72aaa648
authored
Jun 09, 2021
by
Leon Do Castelo
Browse files
singleton database
parent
b1033c38
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/autosql.h
View file @
72aaa648
...
...
@@ -16,8 +16,19 @@
class
Database
{
private:
QSqlDatabase
db
;
static
std
::
unique_ptr
<
Database
>
instance
;
Database
&
operator
=
(
const
Database
&
a
)
=
delete
;
Database
(
const
Database
&
a
)
=
delete
;
Database
(
std
::
string
path
);
public:
Database
(
std
::
string
path
);
static
Database
&
getInstance
()
{
if
(
instance
==
nullptr
)
{
instance
.
reset
(
new
Database
(
"application.db"
));
}
return
*
instance
;
}
~
Database
()
{
db
.
close
();
}
std
::
vector
<
QString
>
getAutomates
()
const
;
Fonction
*
getFonction
(
Automate
&
a
)
const
;
...
...
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