EHM DAL 0.2.5
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
finance_info.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// --- Finance Info --- //
13{
14public:
15 // Constructor
18
19 // Calculation
20 static qint32 scaledSalary(const qint16 financial_rep_200,
21 const qint32 min_salary,
22 const qint32 max_salary,
23 const float spread_factor);
24
25 // File i/o
26 bool read(QDataStream &in, ehm_dal::database::DatabaseVersion &version) override;
27 bool write(QDataStream &out, ehm_dal::database::DatabaseVersion &version) override;
28
29 // Get data
30 QString text() const override;
31
32 // Initialisation
33 bool init() override;
34
35 // Operator overloading
36 auto operator<=>(const FinanceInfo &rhs) const;
37
38private:
39 struct Data;
40 std::unique_ptr<Data> data_;
41
42 // Calculation
43 enum ENUM_PRIVATE_FLAGS {
44 MEDIAN_REPUTATION = 100 // 0-200 rep -> median = 100
45 };
46
47 // Get data
48 QVariant internalData(const qint32 column, const qint32 role) const override;
49
50 // Set data
51 bool setInternalData(const qint32 column,
52 const QVariant &value,
53 const qint32 role,
54 std::vector<qint32> &modified_columns) override;
55};
56} // 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: finance_info.h:13
bool read(QDataStream &in, ehm_dal::database::DatabaseVersion &version) override
Reads a table row from the QDataStream.
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 write(QDataStream &out, ehm_dal::database::DatabaseVersion &version) override
Writes a table row to the QDataStream.