DSC Engine
Loading...
Searching...
No Matches
readonly_data.hpp
1#pragma once
2
3namespace DSC
4{
34
36 {
37 public:
38 __attribute__ ((packed))
39 short header_size;
40 __attribute__ ((packed))
41 int data_length;
42 __attribute__ ((packed))
43 char* data_source;
46 __attribute__ ((packed))
47 unsigned short flags;
49
50 ReadOnlyData(int header_size = sizeof(ReadOnlyData));
51
55 void extract(void* destination) const;
56
62 void extract(void* destination, int offset, int length) const;
63
64 // prevent altering this object
65 ReadOnlyData(const ReadOnlyData&) = delete;
66 ReadOnlyData(ReadOnlyData&&) = delete;
67 ReadOnlyData operator = (const ReadOnlyData&) = delete;
68 ReadOnlyData operator = (ReadOnlyData&&) = delete;
69
73 bool is_file() const;
74
76 bool is_compressed() const;
77 int get_type() const;
78
79 static const int ROD_IS_FILE;
80 static const int ROD_IS_COMPRESSED;
81 static const int ROD_TYPE;
82
83 static const int ROD_TYPE_UNKNOWN;
84 static const int ROD_TYPE_ASSET;
85 static const int ROD_TYPE_FONT;
86
87 };
88}
Definition: readonly_data.hpp:36
__attribute__((packed)) short header_size
Some technical observations to account for during implementation:
__attribute__((packed)) int data_length
equilavent of sizeof(*this), but foresees class inheritance
__attribute__((packed)) unsigned short flags
void extract(void *destination) const
writes all binary data to the given address
ReadOnlyData(int header_size=sizeof(ReadOnlyData))
__attribute__((packed)) char *data_source
size in bytes of the actual data
void extract(void *destination, int offset, int length) const
writes binary data sequence to the given address
bool is_file() const
checks if data is written to file