openPilotLog
aentry.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 AENTRY_H
19 #define AENTRY_H
20 
21 #include <QString>
22 #include <QStringList>
23 #include <QMap>
24 #include <QPair>
25 #include <QVariant>
26 
27 #include "src/database/adatabasetypes.h"
28 
29 // [G]: Define what data is public and what not. For objects such as
30 // DataPosition which are consumable its no biggy. Are entries the same?
31 // If so we could avoid getters and setters
32 // [F]: In the way we are using the entries atm, we do access and edit the
33 // TableData quite frequently. Maybe the data could be public, but the
34 // position private? Except for creating a new entry, the position should
35 // never really be changed.
40 class AEntry {
41 protected:
42  DataPosition position;
43 public:
44  RowData_T tableData;
45 public:
46  AEntry() = delete; // Demand specificity from default constructor
47  AEntry(const AEntry&) = default;
48  AEntry& operator=(const AEntry&) = default;
49  AEntry(DataPosition position_);
50  AEntry(RowData_T table_data);
51  AEntry(DataPosition position_, RowData_T table_data);
52 
53  void setData(RowData_T table_data);
54  void setPosition(DataPosition position_);
55 
56  const DataPosition& getPosition();
57  const RowData_T& getData();
58 
59 };
60 
61 #endif // AENTRY_H
DataPosition
Definition: adatabasetypes.h:44
AEntry
The Entry class encapsulates table metadata(table name, row id) and data for new and existing entries...
Definition: aentry.h:40