openPilotLog
adatabasetypes.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2021 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 DECLARATIONS_H
19 #define DECLARATIONS_H
20 
21 #include <QtCore>
22 #include "src/functions/alog.h"
23 
25 using RowId_T = int;
26 using PilotName_T = QString;
27 using PilotRowId_T = RowId_T;
28 using TailRegistration_T = QString;
29 using TailId_T = RowId_T;
30 using AirportICAO_T = QString;
31 using AirportIATA_T = QString;
32 using AirportName_T = QString;
33 using AirportId_T = RowId_T;
34 using ColName_T = QString;
35 using ColData_T = QVariant;
36 using TableName_T = QString;
37 
38 using TableNames_T = QStringList;
39 using RowData_T = QHash<ColName_T, ColData_T>;
40 using ColumnData_T = QPair<ColName_T, ColData_T>;
41 using ColumnNames_T = QStringList;
42 using TableColumns_T = QHash<TableName_T, ColumnNames_T>;
43 
44 struct DataPosition {
45  TableName_T tableName;
46  RowId_T rowId;
47  DataPosition()
48  : tableName(TableName_T())
49  {};
50  DataPosition(TableName_T table_name, RowId_T row_id)
51  : tableName(table_name), rowId(row_id)
52  {};
53 
54  DataPosition(const DataPosition& other) = default;
55  DataPosition& operator=(const DataPosition& other) = default;
56 
57  REPR(DataPosition,
58  "tableName=" + object.tableName
59  + ", rowId=" + QString::number(object.rowId)
60  )
61 };
62 
63 #endif // DECLARATIONS_H
Definition: adatabasetypes.h:44