-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArchFile.h
86 lines (63 loc) · 2.04 KB
/
ArchFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef ARCHFILE_H
#define ARCHFILE_H
// -------------------------------------------------------------------------------------
const char* const FilesFilters[] =
{
"*.*",
"*.bmp",
"*.barch",
};
const int FilesFiltersCount = sizeof(FilesFilters)/sizeof(FilesFilters[0]);
const int FileFilters_All = 0,
FileFilters_Bmp = 1,
FileFilters_Barch = 2;
namespace Arch
{
// -------------------------------------------------------------------------------------
union RowIndex
{
struct
{
uint32_t offset = 0;
uint32_t bitsCount = 0;
};
uint64_t whole;
};
struct RowData
{
RowIndex index;
std::vector<uint8_t> data;
};
// -------------------------------------------------------------------------------------
class File
{
public:
File();
explicit File(const QString& fileName);
virtual ~File();
const QString& fileName() const { return m_fileName; }
void setFileName(const QString& fileName) { m_fileName = fileName; }
QByteArray& data() { return m_data; }
// Addional Params
//
void calcAddionalParams(uint32_t width);
uint32_t realRowWidth() { return m_realRowWidth; }
uint32_t paddingSize() { return m_paddingSize; }
uint32_t blockCount() { return m_blockCount; }
protected:
//
//
QString m_fileName;
QByteArray m_data;
// Addional Params
//
uint32_t m_realRowWidth = 0;
uint32_t m_paddingSize = 0;
uint32_t m_blockCount = 0;
};
// -------------------------------------------------------------------------------------
std::string removeExtension(std::string const& filename);
std::string getWorkDir(int &argc, char** argv);
// -------------------------------------------------------------------------------------
}
#endif // ARCHFILE_H