openPilotLog

entry_deprecated.h
1 /*
2 *openPilot Log - A FOSS Pilot Logbook Application
3 *Copyright (C) 2020 Felix Turowsky
4 *
5 *This program is free software: you can redistribute it and/or modify
6 *it under the terms of the GNU General Public License as published by
7 *the Free Software Foundation, either version 3 of the License, or
8 *(at your option) any later version.
9 *
10 *This program is distributed in the hope that it will be useful,
11 *but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *GNU General Public License for more details.
14 *
15 *You should have received a copy of the GNU General Public License
16 *along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef ENTRY1_H
19 #define ENTRY1_H
20
21 #include <QCoreApplication>
22 #include "db.h"
23 #include "dbinfo.h"
29 class Entry_deprecated
30 {
31 public:
32 Entry_deprecated();
33 Entry_deprecated(QString table, int row);
34 Entry_deprecated(QString table, QMap<QString, QString> newData);
35
36 QPair <QString, int> position = QPair<QString, int>(); // Position within the database, i.e. <table,row>
37 QVector <QString> columns = QVector<QString>(); // The columns within the table
38 QMap <QString, QString> data = QMap<QString, QString>(); // Tha data to fill that table, <column,value>
39 QString error = QString(); // holds sql errors (if they ocurred)
40
41 void setData(QMap<QString, QString> &value);
42
43 bool commit();
44 bool remove();
45 bool exists();
46
47 // Debug functionality
48 void print();
49 QString debug();
50 operator QString()
51 {
52 return debug(); //overload for compatibility with qDebug()
53 }
54
55 private:
56 bool insert();
57 bool update();
58 };
59
60 #endif // ENTRY_H
Entry_deprecated
The Entry class is the base class for database entries. It can be seen as a row in a table within the...
Definition: entry_deprecated.h:30