row.h
/*
*openPilotLog - A FOSS Pilot Logbook Application
*Copyright (C) 2020-2022 Felix Turowsky
*
*This program is free software: you can redistribute it and/or modify
*it under the terms of the GNU General Public License as published by
*the Free Software Foundation, either version 3 of the License, or
*(at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef ROW_H
#define ROW_H
#include "src/opl.h"
namespace OPL {
class Row
{
public:
Row() { valid = false;} // Require specifying position
Row(OPL::DbTable table_name, int row_id, const RowData_T &row_data);
Row(OPL::DbTable table_name, int row_id);
Row(OPL::DbTable table_name);
Row(const Row&) = default;
Row& operator=(const Row&) = default;
RowData_T getData() const;
void setData(const RowData_T &value);
int getRowId() const;
void setRowId(int value);
OPL::DbTable getTable() const;
const QString getTableName() const;
const QString getPosition() const;
bool isValid() const {return hasData && valid;}
operator QString() const;
private:
OPL::DbTable table;
int rowId;
RowData_T rowData;
protected:
bool hasData;
bool valid = true;
};
class AircraftEntry : public Row
{
public:
AircraftEntry();
AircraftEntry(const RowData_T &row_data);
AircraftEntry(int row_id, const RowData_T &row_data);
};
class TailEntry : public Row
{
public:
TailEntry();
TailEntry(const RowData_T &row_data);
TailEntry(int row_id, const RowData_T &row_data);
const QString registration() const;
const QString type() const;
};
class PilotEntry : public Row
{
public:
PilotEntry();
PilotEntry(const RowData_T &row_data);
PilotEntry(int row_id, const RowData_T &row_data);
};
class SimulatorEntry : public Row
{
public:
SimulatorEntry();
SimulatorEntry(const RowData_T &row_data);
SimulatorEntry(int row_id, const RowData_T &row_data);
};
class FlightEntry : public Row
{
public:
FlightEntry();
FlightEntry(const RowData_T &row_data);
FlightEntry(int row_id, const RowData_T &row_data);
};
class CurrencyEntry : public Row
{
public:
CurrencyEntry();
CurrencyEntry(const RowData_T &row_data);
CurrencyEntry(int row_id, const RowData_T &row_data);
};
class AirportEntry : public Row
{
public:
AirportEntry();
AirportEntry(const RowData_T &row_data);
AirportEntry(int row_id, const RowData_T &row_data);
};
} // namespace OPL
#endif // ROW_H
OPL::AircraftEntry
A Row representing an Aircraft entry. See Row class for details.
Definition: row.h:85
OPL::AirportEntry
A Row representing an Airport entry. See Row class for details.
Definition: row.h:155
OPL::CurrencyEntry
A Row representing a Currency entry. See Row class for details.
Definition: row.h:144
OPL::FlightEntry
A Row representing a Flight entry. See Row class for details.
Definition: row.h:133
OPL::PilotEntry
A Row representing a Pilot entry. See Row class for details.
Definition: row.h:110
OPL::Row
The Row class provides an interface for retreiving and submitting entries from the database.
Definition: row.h:46
OPL::SimulatorEntry
A Row representing a Simulator entry. See Row class for details.
Definition: row.h:122
OPL::TailEntry
A Row representing a Tail (Registration) entry. See Row class for details.
Definition: row.h:96
OPL
A namespace to collect constants and enums used throughout the application.
Definition: paths.cpp:3
OPL::DbTable
DbTable
Enumerates the tables in the database.
Definition: opl.h:122