|
RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
A buffer that can be used to read and store data from a file. More...
#include <buffer.h>
Public Member Functions | |
| Buffer (size_t size) | |
| Buffer (const std::vector< uint8_t > &data) | |
| offset_t | ImageSize () const override |
| Retrieves size of stored data. | |
| void | Resize (offset_t new_size) |
| Resize buffer. | |
| void | Append (std::vector< uint8_t > &additional_data) |
| Append data to buffer. | |
| virtual void | ReadFile (Reader &rd) |
| Overwrites buffer data with contents of reader. | |
| void | ReadFileRemaining (Reader &rd) |
| Overwrites buffer data with contents of reader. | |
| void | ReadFile (Reader &rd, offset_t count) |
| Overwrites buffer data with contents of reader. | |
| offset_t | WriteFile (Writer &wr, offset_t count, offset_t offset=0) const override |
| Writes data of non-zero filled sections. | |
| size_t | ReadData (size_t bytes, offset_t offset, void *buffer) const override |
| Attempts to fill a buffer with data. | |
| virtual offset_t | WriteFile (Writer &wr, offset_t count, offset_t offset=0) const=0 |
| Writes data of non-zero filled sections. | |
| virtual offset_t | WriteFile (Writer &wr) const |
| Writes data of non-zero filled sections. | |
Public Member Functions inherited from Linker::Image | |
| std::shared_ptr< const Image > | AsImage () const override |
| Retrieves a randomly accessible image. | |
| uint64_t | ReadUnsigned (size_t bytes, offset_t offset, EndianType endiantype) const |
| Reads an unsigned number at a specific offset. | |
| uint64_t | ReadUnsigned (size_t bytes, offset_t offset) const |
| Reads an unsigned number at a specific offset with the default endianness. | |
| int64_t | ReadSigned (size_t bytes, offset_t offset, EndianType endiantype) const |
| Reads a signed number at a specific offset. | |
| int64_t | ReadSigned (size_t bytes, offset_t offset) const |
| Reads a signed number at a specific offset with the default endianness. | |
| int | GetByte (offset_t offset) const |
| Retrieve byte at a certain offset (optional, might not be defined) | |
Public Member Functions inherited from Linker::Contents | |
| std::shared_ptr< Image > | AsImage () |
| Retrieves a randomly accessible image. | |
Static Public Member Functions | |
| static std::shared_ptr< Buffer > | ReadFromFile (Reader &rd) |
| Creates a buffer containing the remaining data in the reader. | |
| static std::shared_ptr< Buffer > | ReadFromFile (Reader &rd, offset_t count) |
| Creates a buffer containing the specified amount of bytes from the reader. | |
Protected Attributes | |
| std::vector< uint8_t > | data |
Friends | |
| class | Section |
| class | Contents |
A buffer that can be used to read and store data from a file.
|
overridevirtual |
Retrieves size of stored data.
Implements Linker::Contents.
|
overridevirtual |
Attempts to fill a buffer with data.
| bytes | The (maximum) number of bytes to place in buffer |
| offset | The offset in the image to start reading the data |
| buffer | A byte buffer |
Implements Linker::Image.
Reimplemented in Linker::Section.
|
virtual |
Overwrites buffer data with contents of reader.
Note that only as many bytes are read in as the size of the buffer.
Reimplemented in Linker::Section, Linker::Section, Linker::TableSection< TableEntryType >, and Linker::TableSection< GOTEntry >.
| void Buffer::ReadFile | ( | Reader & | rd, |
| offset_t | count ) |
Overwrites buffer data with contents of reader.
Exactly the specified amount is read, the buffer is expanded if needed but not shrank
| void Buffer::ReadFileRemaining | ( | Reader & | rd | ) |
Overwrites buffer data with contents of reader.
All the remaining bytes are read, the buffer is expanded if needed but not shrank
Creates a buffer containing the specified amount of bytes from the reader.
If less data is available, the buffer will be shorter
|
virtual |
Writes data of non-zero filled sections.
Reimplemented from Linker::Contents.
Reimplemented in Linker::Section, Linker::TableSection< TableEntryType >, and Linker::TableSection< GOTEntry >.
|
overridevirtual |
Writes data of non-zero filled sections.
Implements Linker::Contents.
Reimplemented in Linker::TableSection< TableEntryType >, Linker::TableSection< GOTEntry >, Linker::Section, Linker::TableSection< GOTEntry >, Linker::Section, Linker::TableSection< TableEntryType >, Linker::TableSection< GOTEntry >, and Linker::TableSection< TableEntryType >.
|
virtual |
Writes data of non-zero filled sections.
Implements Linker::Contents.
Reimplemented in Linker::TableSection< TableEntryType >, Linker::TableSection< GOTEntry >, Linker::Section, Linker::TableSection< GOTEntry >, Linker::Section, Linker::TableSection< TableEntryType >, Linker::TableSection< GOTEntry >, and Linker::TableSection< TableEntryType >.