|
RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
Abstract base class that encapsulates functionality needed to import binary data. More...
#include <reader.h>
Public Types | |
| enum | OverflowHandlingMode { IgnoreOnOverflow , ReportOnOverflow , TerminateOnOverflow } |
| Describes how ReadData and all other reading routines should behave when reading exceeds limits (end of file or dynamic boundary) More... | |
| enum class | OverflowHandlingRequest { Default , Force , Report } |
| Describes how the user expects the parser to behave on read overflow. More... | |
Public Member Functions | |
| OverflowHandlingMode | GetActionOnOverflow () |
| Reader (EndianType endiantype) | |
| std::shared_ptr< Reader > | CreateWindow (offset_t new_start_offset, offset_t new_maximum_size=offset_t(-1), offset_t displacement=0) |
| virtual size_t | Read (void *data, size_t max_count=size_t(-1))=0 |
| Read in as many bytes as possible. | |
| void | ReadData (size_t count, void *data) |
| Read in a sequence of bytes. | |
| void | ReadData (size_t count, std::vector< uint8_t > &data, size_t offset=0) |
| Read in a sequence of bytes, resize the vector. | |
| void | ReadData (std::vector< uint8_t > &data, size_t offset=0) |
| Read in a sequence of bytes, filling the vector. | |
| std::string | ReadData (size_t count, bool terminate_at_null=false) |
| Read in a sequence of bytes. | |
| std::string | ReadUTF16Data (size_t count, bool terminate_at_null=false) |
| Read in a sequence of 16-bit words. | |
| template<class T , std::size_t N> | |
| void | ReadData (std::array< T, N > &data, size_t offset=0) |
| Read in a sequence of bytes. | |
| std::string | ReadASCII (char terminator, size_t maximum=size_t(-1)) |
| Read an ASCII string up to a terminator. | |
| std::string | ReadASCIIZ (size_t maximum=size_t(-1)) |
| Read a zero terminated ASCII string. | |
| std::string | ReadUTF16Data (const char terminator[2], size_t maximum=size_t(-1)) |
| Read a string of 16-bit words up to a terminator. | |
| std::string | ReadUTF16Data (char16_t terminator, size_t maximum, EndianType endiantype) |
| Read a string of 16-bit words up to a terminator. | |
| std::string | ReadUTF16Data (char16_t terminator, size_t maximum=size_t(-1)) |
| Read a string of 16-bit words up to a terminator. | |
| std::string | ReadUTF16Data (char16_t terminator, EndianType endiantype) |
| Read a string of 16-bit words up to a terminator. | |
| std::string | ReadUTF16ZData (size_t maximum=size_t(-1)) |
| Read a zero terminated string of 16-bit words. | |
| uint64_t | ReadUnsigned (size_t bytes, EndianType endiantype) |
| Read an unsigned word. | |
| uint64_t | ReadUnsigned (size_t bytes) |
| Read an unsigned word. | |
| uint64_t | ReadSigned (size_t bytes, EndianType endiantype) |
| Read a signed word. | |
| uint64_t | ReadSigned (size_t bytes) |
| Read a signed word. | |
| template<typename Clock > | |
| Timestamp< Clock > | ReadTimestamp (EndianType endiantype) |
| Read a date-time value according to some epoch. | |
| template<typename Clock > | |
| Timestamp< Clock > | ReadTimestamp () |
| Read a date-time value according to some epoch. | |
| virtual void | Seek (offset_t offset)=0 |
| Jump to a specific location in the input stream. | |
| virtual void | Skip (relative_offset_t offset)=0 |
| Jump to a distance in the input stream. | |
| virtual void | SeekEnd (relative_offset_t offset=0)=0 |
| Jump to end of the input stream. | |
| virtual offset_t | Tell ()=0 |
| Retrieve the current location. | |
| virtual offset_t | GetImageEnd () |
| Returns the last location that can be read. | |
| offset_t | GetRemainingCount () |
| Returns the byte count until the last location that can be read. | |
Public Attributes | |
| EndianType | endiantype |
| The default endianness of the binary format, used for reading multibyte numeric data. | |
| OverflowHandlingMode | on_overflow = TerminateOnOverflow |
| Intended behavior of reading routines on read overflow. | |
Static Public Attributes | |
| static OverflowHandlingRequest | global_overflow_behavior = Reader::OverflowHandlingRequest::Default |
| Global flag to control how reading overflow should be handled. | |
Abstract base class that encapsulates functionality needed to import binary data.
Describes how ReadData and all other reading routines should behave when reading exceeds limits (end of file or dynamic boundary)
| Enumerator | |
|---|---|
| IgnoreOnOverflow | Display error message, continue parsing. This is intended for data structures that have a static size, permitting the user to view contents even in malformed binary files. |
| ReportOnOverflow | Throw a ReadOverflow exception. This is useful when the parse routine can manage overflow errors and continue parsing. |
| TerminateOnOverflow | Execution immediately stops. Only use when a read error makes it impossible to continue with parsing. Intended for dynamically sized data structures that are crucial for a complete parsing of the file (such as a section header table). |
|
strong |
|
virtual |
Returns the last location that can be read.
Reimplemented in Linker::WindowReader, and Linker::ImageReader.
|
pure virtual |
Read in as many bytes as possible.
Implemented in Linker::StreamReader, Linker::WindowReader, and Linker::ImageReader.
|
pure virtual |
Jump to a specific location in the input stream.
Implemented in Linker::StreamReader, Linker::WindowReader, and Linker::ImageReader.
|
pure virtual |
Jump to end of the input stream.
Implemented in Linker::StreamReader, Linker::WindowReader, and Linker::ImageReader.
|
pure virtual |
Jump to a distance in the input stream.
Implemented in Linker::StreamReader, Linker::WindowReader, and Linker::ImageReader.
|
pure virtual |
Retrieve the current location.
Implemented in Linker::StreamReader, Linker::WindowReader, and Linker::ImageReader.