RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
Linker::Reader Class Reference

A helper class, encapsulating functionality needed to import binary data. More...

#include <reader.h>

Public Types

enum  OverflowHandlingMode { IgnoreOnOverflow , ReportOnOverflow , TerminateOnOverflow }
 

Public Member Functions

 Reader (EndianType endiantype, std::istream *in=nullptr)
 
 Reader (offset_t start_offset, offset_t maximum_size, EndianType endiantype, std::istream *in=nullptr)
 
Reader CreateWindow (offset_t new_start_offset, offset_t new_maximum_size=offset_t(-1))
 
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.
 
void Seek (offset_t offset)
 Jump to a specific location in the input stream.
 
void Skip (offset_t offset)
 Jump to a distance in the input stream.
 
void SeekEnd (relative_offset_t offset=0)
 Jump to end of the input stream.
 
offset_t Tell ()
 Retrieve the current location.
 
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.
 
std::istream * in
 The input stream.
 
OverflowHandlingMode on_overflow = TerminateOnOverflow
 
const offset_t start_offset
 
const offset_t maximum_size
 

Detailed Description

A helper class, encapsulating functionality needed to import binary data.


The documentation for this class was generated from the following files: