openPilotLog
row.h
1 #ifndef ROW_H
2 #define ROW_H
3 #include "src/opl.h"
4 
5 
6 namespace OPL {
7 
12 class Row
13 {
14 public:
15  Row() { valid = false;} // Require specifying position
16  Row(OPL::DbTable table_name, int row_id, const RowData_T &row_data);
17  Row(OPL::DbTable table_name, int row_id);
18  Row(OPL::DbTable table_name);
19 
20  Row(const Row&) = default;
21  Row& operator=(const Row&) = default;
22 
23  RowData_T getData() const;
24  void setData(const RowData_T &value);
25  int getRowId() const;
26  void setRowId(int value);
27  OPL::DbTable getTableName() const;
28 
29  bool isValid() const {return hasData && valid;}
30 
31  // For Debugging
32  operator QString() const;
33 
34 
35 private:
36  OPL::DbTable table;
37  int rowId;
38  RowData_T rowData;
39 protected:
40  bool hasData;
41  bool valid = true;
42 };
43 
44 class AircraftEntry : public Row
45 {
46 public:
47  AircraftEntry();
48  AircraftEntry(const RowData_T &row_data);
49  AircraftEntry(int row_id, const RowData_T &row_data);
50 };
51 
52 class TailEntry : public Row
53 {
54 public:
55  TailEntry();
56  TailEntry(const RowData_T &row_data);
57  TailEntry(int row_id, const RowData_T &row_data);
58 
59  const QString registration() const;
60  const QString type() const;
61 };
62 
63 class PilotEntry : public Row
64 {
65 public:
66  PilotEntry();
67  PilotEntry(const RowData_T &row_data);
68  PilotEntry(int row_id, const RowData_T &row_data);
69 
70 };
71 
72 class SimulatorEntry : public Row
73 {
74 public:
76  SimulatorEntry(const RowData_T &row_data);
77  SimulatorEntry(int row_id, const RowData_T &row_data);
78 };
79 
80 class FlightEntry : public Row
81 {
82 public:
83  FlightEntry();
84  FlightEntry(const RowData_T &row_data);
85  FlightEntry(int row_id, const RowData_T &row_data);
86 };
87 
88 class CurrencyEntry : public Row
89 {
90 public:
91  CurrencyEntry();
92  CurrencyEntry(const RowData_T &row_data);
93  CurrencyEntry(int row_id, const RowData_T &row_data);
94 };
95 
96 } // namespace OPL
97 #endif // ROW_H
Definition: row.h:45
Definition: row.h:89
Definition: row.h:81
Definition: row.h:64
The Row class provides an interface for retreiving and submitting entries from the database....
Definition: row.h:13
Definition: row.h:73
Definition: row.h:53
A namespace to collect constants and enums used throughout the application.
Definition: database.cpp:25
DbTable
Enumerates the tables in the database.
Definition: opl.h:122