openPilotLog

decl.h
1 #ifndef DECL_H
2 #define DECL_H
3
4 #include <QString>
5 #include <QPair>
6 #include <QMap>
7 #include <QObject>
8
15 namespace experimental {
16
17
25 using ColName = QString;
26 using ColData = QVariant;
27 using TableName = QString;
28 using RowId = int;
29
30 using TableNames = QStringList;
31 // [G]: May lead to some confusion. TableData suggest data for the entire table.
32 // but in reallity it is data per column *of single row* (unless i misunderstand)
33 // [F]: That's correct. We could maybe call it EntryData or RowData?
34 using TableData = QMap<ColName, ColData>;
35 using ColumnData = QPair<ColName, ColData>;
36 using ColumnNames = QStringList;
37 using TableColumns = QMap<TableName, ColumnNames>;
38
39 // [G]: Needs some work. Inheriting from QPair may be helpful but
40 // may also be overkill. Lets determine the specific uses of DataPosition
41 // and provide our own interface i would say.
42 // [F]: Good idea! Implementing something similar to first and second methods
43 // of QPair would be useful to carry over, or some other way of quickly and
44 // unambiguously accessing the elements.
45 struct DataPosition : QPair<TableName, RowId> {
46 TableName tableName;
47 RowId rowId;
48 DataPosition()
49 : tableName(first), rowId(second)
50 {}
51 DataPosition(TableName table_name, RowId row_id)
52 : QPair<TableName, RowId>::QPair(table_name, row_id),
53 tableName(first), rowId(second)
54 {}
55 DataPosition(const DataPosition& other) = default;
56 DataPosition& operator=(const DataPosition& other) = default;
57 };
58 auto const DEFAULT_PILOT_POSITION = DataPosition("pilots", 0);
59 auto const DEFAULT_TAIL_POSITION = DataPosition("tails", 0);
60 auto const DEFAULT_AIRCRAFT_POSITION = DataPosition("aircraft", 0);
61 auto const DEFAULT_FLIGHT_POSITION = DataPosition("flights", 0);
62
63 }
64
65 #endif // DECL_H
experimental::ColName
QString ColName
An alias for QString.
Definition: decl.h:25
experimental
Temporary namespace for experimental features. Will be removed in later versions.
Definition: aaircraftentry.cpp:20
experimental::DataPosition
Definition: decl.h:45