EHM DAL 0.2.5
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
club_records.h
1#pragma once
2
3// Application headers
4#include "include/database/schema/club/club_records/club_record_index.h"
5#include "include/schema/abstract_id_table_item.h"
6
7// Qt headers
8class QDataStream;
9#include <memory>
10
11namespace ehm_dal::schema {
12
13// --- Retired numbers --- //
15{
16public:
19
20 // File i/o
21 bool read(QDataStream &in, ehm_dal::database::DatabaseVersion &version) override;
22 bool write(QDataStream &out, ehm_dal::database::DatabaseVersion &version) override;
23
24 // Get data
25 QVariant data(const QModelIndex &index,
26 qint32 role,
27 ehm_dal::column_data::ColumnData *column_data) const override;
28 constexpr size_t size() const { return ClubRecordIndex::TOTAL_CLUB_RECORDS_COUNT; }
29 QString text() const override;
30
31 // Initialisation
32 bool init() override;
33
34 // Operator overloading
35 bool operator<(const ClubRecords &rhs) const;
36
37 // Parent data
38 qint32 parentItemId() const override;
39
40 // Set data
41 bool setData(const QModelIndex &index,
42 const QVariant &value,
43 qint32 role,
44 std::vector<qint32> &modified_columns,
45 ehm_dal::column_data::ColumnData *column_data) override;
46
47private:
48 struct Data;
49 std::unique_ptr<Data> data_;
50
51 // Get data
52 QVariant internalData(const qint32 column, const qint32 role) const override;
53 QVariant nameData(const qint32 row, const qint32 role) const;
54 QString name(const qint32 row) const;
55
56 // Set data
57 bool setInternalData(const qint32 column,
58 const QVariant &value,
59 const qint32 role,
60 std::vector<qint32> &modified_columns) override;
61};
62
63} // namespace ehm_dal::schema
The ColumnData class represents a container of ehm_dal::column_data::Column and attributes relating t...
Definition: column_data.h:19
The DatabaseVersion class represents the database version number.
Definition: database_version.h:12
The AbstractIdTableItem class represents a row in a Table with an id field.
Definition: abstract_id_table_item.h:26
Definition: club_records.h:15
bool setData(const QModelIndex &index, const QVariant &value, qint32 role, std::vector< qint32 > &modified_columns, ehm_dal::column_data::ColumnData *column_data) override
Sets the role data for the item at index to value.
QVariant data(const QModelIndex &index, qint32 role, ehm_dal::column_data::ColumnData *column_data) const override
Returns the row's data stored under the given role for the column referred to by the index.
bool init() override
Initialises the table item members. This only needs to be called once per item.
QString text() const override
Returns the row's display text. This provides a convenient way to obtain a simple description of the ...
bool read(QDataStream &in, ehm_dal::database::DatabaseVersion &version) override
Reads a table row from the QDataStream.
qint32 parentItemId() const override
Returns the item id of the items parent item. Applies to tree structures only.
bool write(QDataStream &out, ehm_dal::database::DatabaseVersion &version) override
Writes a table row to the QDataStream.