EHM DAL 0.2.5
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
contract_details.h
1#pragma once
2
3// Application headers
4#include "include/schema/abstract_id_table_item.h"
5
6// Qt headers
7class QDataStream;
8#include <memory>
9
10namespace ehm_dal::schema {
11// --- Contract Details --- //
13{
14public:
15 // Constructor
18
19 // File i/o
20 bool read(QDataStream &in, ehm_dal::database::DatabaseVersion &version) override;
21 bool write(QDataStream &out, ehm_dal::database::DatabaseVersion &version) override;
22
23 // Get data
24 QString text() const override;
25
26 // Initialisation
27 bool init() override;
28
29 // Operator overloading
30 auto operator<=>(const ContractDetails &rhs) const;
31
32 // Parent data
33 qint32 parentItemId() const override;
34
35 // Flags
36 enum ENUM_WEEKLY_WAGES { MAX_CONTRACT_YEARS = 10 };
37
38 enum ENUM_CLAUSES {
39 FOREIGN_RELEASE_CLAUSE, // non-NHL only
40 PLAYER_OPTION_CLAUSE, // any club
41 TEAM_OPTION_CLAUSE, // any club
42 NO_TRADE_CLAUSE, // if allowed in rules
43 TWO_WAY_CLAUSE, // if allowed in rules
44 RELEGATION_CLAUSE, // to be used in leagues with relegation only
45 PROFESSIONAL_OFFER_CLAUSE, // player is free to negotiate with teams in bigger leagues
46 MAX_NUM_OF_CLAUSES
47 };
48
49private:
50 struct Data;
51 std::unique_ptr<Data> data_;
52
53 // Get data
54 QVariant internalData(const qint32 column, const qint32 role) const override;
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} // namespace ehm_dal::schema
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: contract_details.h:13
bool write(QDataStream &out, ehm_dal::database::DatabaseVersion &version) override
Writes a table row to the QDataStream.
QString text() const override
Returns the row's display text. This provides a convenient way to obtain a simple description of the ...
bool init() override
Initialises the table item members. This only needs to be called once per item.
qint32 parentItemId() const override
Returns the item id of the items parent item. Applies to tree structures only.
bool read(QDataStream &in, ehm_dal::database::DatabaseVersion &version) override
Reads a table row from the QDataStream.