24 std::vector<uint8_t> data;
34 Buffer(
const std::vector<uint8_t>& data)
43 void Resize(offset_t new_size);
50 virtual offset_t
Expand(offset_t new_size);
56 virtual offset_t
WriteData(
size_t bytes, offset_t offset,
const void * buffer);
66 virtual offset_t
WriteWord(
size_t bytes, offset_t offset, uint64_t value, EndianType endiantype);
73 offset_t
WriteWord(
size_t bytes, offset_t offset, uint64_t value);
80 offset_t
WriteWord(
size_t bytes, uint64_t value, EndianType endiantype);
87 offset_t
WriteWord(
size_t bytes, uint64_t value);
96 virtual offset_t
Append(
const void * new_data,
size_t length);
101 offset_t
Append(
const char * new_data);
106 offset_t
Append(std::vector<uint8_t>& additional_data);
113 virtual void ReadFile(
const std::shared_ptr<Reader>& rd);
125 void ReadFile(
const std::shared_ptr<Reader>& rd, offset_t count);
129 static std::shared_ptr<Buffer>
ReadFromFile(
const std::shared_ptr<Reader>& rd);
135 static std::shared_ptr<Buffer>
ReadFromFile(
const std::shared_ptr<Reader>& rd, offset_t count);
137 offset_t
WriteFile(
const std::shared_ptr<Writer>& wr, offset_t count, offset_t offset = 0)
const override;
138 size_t ReadData(
size_t bytes, offset_t offset,
void * buffer)
const override;
A buffer that can be used to read and store data from a file.
Definition buffer.h:22
static std::shared_ptr< Buffer > ReadFromFile(const std::shared_ptr< Reader > &rd)
Creates a buffer containing the remaining data in the reader.
Definition buffer.cc:94
void Resize(offset_t new_size)
Resize buffer.
Definition buffer.cc:14
virtual offset_t WriteData(size_t bytes, offset_t offset, const void *buffer)
Writes data into the buffer image.
Definition buffer.cc:33
virtual void ReadFile(const std::shared_ptr< Reader > &rd)
Overwrites buffer data with contents of reader.
Definition buffer.cc:79
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition buffer.cc:9
virtual offset_t Append(const void *new_data, size_t length)
Appends data at the end of a buffer.
Definition buffer.cc:62
void ReadFileRemaining(const std::shared_ptr< Reader > &rd)
Overwrites buffer data with contents of reader.
Definition buffer.cc:84
size_t ReadData(size_t bytes, offset_t offset, void *buffer) const override
Attempts to fill a buffer with data.
Definition buffer.cc:113
virtual offset_t Expand(offset_t new_size)
Increases the size of the buffer by the specified amount.
Definition buffer.cc:19
virtual offset_t WriteWord(size_t bytes, offset_t offset, uint64_t value, EndianType endiantype)
Append data to buffer.
Definition buffer.cc:40
offset_t WriteFile(const std::shared_ptr< Writer > &wr, offset_t count, offset_t offset=0) const override
Writes data of non-zero filled sections.
Definition buffer.cc:108
Represents abstract data contents whose data can be written to a file.
Definition image.h:17
virtual offset_t WriteFile(const std::shared_ptr< Writer > &wr) const =0
Writes data of non-zero filled sections.
A section of data as read from an object file.
Definition section.h:28