EHM DAL 0.2.5
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
table_attributes.h
1#pragma once
2
3// Application headers
4#include "include/tables/table_index.h"
5#include "include/tables/table_type.h"
6
7// Qt headers
8class QDataStream;
9#include <QString>
10
11namespace ehm_dal::tables {
13{
14public:
15 TableAttributes(const QString &name = QString(),
16 const TableIndex table_id = TableIndex::NO_TABLE,
18 const qint16 minimum_supported_database_version = NO_DATABASE_VERSION);
19
20 // File i/o
21 quint32 readTableHeader(QDataStream &in);
22 bool writeTableHeader(QDataStream &out);
23
24 // Flags
25 static constexpr qint16 NO_DATABASE_VERSION{-1}; // No database version set
26
27 // Get data
32 inline qint16 gameTableId() const { return game_table_id_; }
38 inline TableIndex id() const { return ehm_dal_table_id_; }
43 inline qint16 minimumSupportedDatabaseVersion() const
44 {
45 return minimum_supported_database_version_;
46 }
51 inline QString name() const { return name_; }
52
53 // Get data - table type
54 bool isDatabaseTable() const;
55 bool isFlagBitmaskTable() const;
56 bool isFlagStandardTable() const;
57 bool isFlagTable() const;
62 inline TableType type() const { return type_; }
63
64private:
65 static constexpr qint16 NO_TABLE_ID{-1}; // Private magic number
66
67 // File/record attributes
68 qint64 file_position_{-1};
69 quint32 record_count_{0};
70
71 // Table attributes
72 TableIndex ehm_dal_table_id_; // Internal ehm_db table id
73 qint16 game_table_id_{NO_TABLE_ID}; // EHM database id used in database.db
74 qint16 minimum_supported_database_version_{NO_DATABASE_VERSION};
75 const QString name_;
76 const TableType type_;
77};
78
79} // namespace ehm_dal::tables
Definition: table_attributes.h:13
qint16 minimumSupportedDatabaseVersion() const
Returns the minimum supported database version number.
Definition: table_attributes.h:43
QString name() const
Returns the name of the table.
Definition: table_attributes.h:51
TableIndex id() const
Returns the id of the table. The id used to distinguish between tables in EHM DAL....
Definition: table_attributes.h:38
TableType type() const
Returns the type of the table.
Definition: table_attributes.h:62
qint16 gameTableId() const
Returns the internal EHM table id of the table.
Definition: table_attributes.h:32
namespace ehm_dal::tables
Definition: column.h:4
TableType
The TableType enum denotes different types of database table.
Definition: table_type.h:12
TableIndex
The TableIndex enum represents the id number of each table within the database.
Definition: table_index.h:14