EHM DAL 0.2.3
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
saved_game_sub_file.h
1#pragma once
2
3
4// Application headers
5#include "include/data_types/string.h"
6
7// Qt headers
8class QDataStream;
9#include <QString>
10
11namespace ehm_dal::saved_game {
16{
17public:
26
27 // File i/o
32 void readHeader(QDataStream &in);
37 void readTable(QDataStream &in);
38
39 // Get data - attributes
44 inline bool isDatabaseTable() const { return is_database_table_; }
49 inline qint32 estimatedBytesPerRow() const { return estimated_bytes_per_row_; }
55 inline qint32 estimatedRowCount() const { return estimated_row_count_; }
60 inline QString fileName() const { return file_name_.get(); }
65 inline quint32 filePosition() const { return file_position_; }
70 double fileSizeKilobytes() const;
71
72 // Get data - sub-file data
77 QByteArray *data();
78
84 = 260
85 };
86
87private:
88 // Attributes
89 bool is_database_table_{false};
90 data_types::String file_name_;
91 quint32 file_position_;
92 quint32 file_size_;
93
94 // Data
95 QByteArray raw_data_;
96
97 // Estimated attributes
98 qint32 estimated_row_count_{0};
99 double estimated_bytes_per_row_{0.0};
100
101 // Set data
102 void initEstimatedData();
103};
104
105} // namespace ehm_dal::saved_game
106
107
The String class acts as a QString wrapper for EHM text strings.
Definition: string.h:22
QString get() const
Returns the current text string.
Definition: string.h:108
The SavedGameSubFile class represents a sub-file of a saved game and provides access to the binary da...
Definition: saved_game_sub_file.h:16
qint32 estimatedRowCount() const
Returns the estimated row count based on the integer or short value of the first four or two bytes of...
Definition: saved_game_sub_file.h:55
quint32 filePosition() const
Returns the sub-file position (i.e. offset) within the saved game file.
Definition: saved_game_sub_file.h:65
void readTable(QDataStream &in)
Reads the raw binary data relating to the SavedGameTable.
void readHeader(QDataStream &in)
Reads the saved game header relating to the SavedGameTable.
~SavedGameSubFile()
Default destructor.
qint32 estimatedBytesPerRow() const
Returns the estimated size of each row in bytes. This is based on the estimated record count.
Definition: saved_game_sub_file.h:49
double fileSizeKilobytes() const
Returns the file size in KB (kilobytes). 1 KB = 1024 bytes.
bool isDatabaseTable() const
Returns whether or not the SavedGameTable is the saved game's Database table (i.e....
Definition: saved_game_sub_file.h:44
SavedGameSubFile()
Default constructor.
QString fileName() const
Returns the file name.
Definition: saved_game_sub_file.h:60
ENUM_FLAGS
The ENUM_TEXT_LENGTH enum denotes the fixed length of 8-bit char arrays of table names in the saved g...
Definition: saved_game_sub_file.h:82
@ TABLE_NAME_LENGTH
Definition: saved_game_sub_file.h:83
QByteArray * data()
Returns a pointer to the raw data of the sub-file.
namespace ehm_dal::saved_game
Definition: saved_game_data.h:13