openPilotLog
OPL::Row Class Reference

The Row class provides an interface for retreiving and submitting entries from the database. More...

#include <row.h>

Inheritance diagram for OPL::Row:
OPL::AircraftEntry OPL::AirportEntry OPL::CurrencyEntry OPL::FlightEntry OPL::PilotEntry OPL::SimulatorEntry OPL::TailEntry

Public Member Functions

 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
 
Rowoperator= (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
 
 operator QString () const
 operator QString can be used for printing debug information to stdout
 

Protected Attributes

bool hasData
 
bool valid = true
 

Detailed Description

The Row class provides an interface for retreiving and submitting entries from the database.

The Row class is a base class and when instantiated, the appropriate subclass should be used.

The database holds all the data related to the logbook in different tables. Each of these tables is composed of rows. Each row has different columns and each column contains the data. As such, an entry can be thought of as a row in the database. The row class encapsulates the data contained in each row.

A row is uniquely identified by its position in the database, consisting of the table name (QString) and the row id (int). A new entry, which is not yet in the database has the row id 0. If a new row object is created, the hasData bool is set to false. Before submitting the entry to the database, setData() has to be called to fill the row with data and toggle the verification bit.

The Row Object holds all the necessary information the Database class needs to commit (create or update) it. The Identifying information can be accessed with getRowId and getTable() / getTableName().

For convenience and readabilty, subclasses exist that have the table property pre-set. These rows are then referred to as entries. See AircraftEntry, FlightEntry etc.


The documentation for this class was generated from the following files: