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

Reader subclass whose source is a C++ input stream. More...

#include <reader.h>

Inheritance diagram for Linker::StreamReader:
Linker::Reader

Public Member Functions

 StreamReader (EndianType endiantype, std::istream *in=nullptr)
 
 StreamReader (EndianType endiantype, std::istream &in)
 
size_t Read (void *data, size_t max_count=size_t(-1)) override
 Read in as many bytes as possible.
 
void Seek (offset_t offset) override
 Jump to a specific location in the input stream.
 
void Skip (relative_offset_t offset) override
 Jump to a distance in the input stream.
 
void SeekEnd (relative_offset_t offset=0) override
 Jump to end of the input stream.
 
offset_t Tell () override
 Retrieve the current location.
 
- Public Member Functions inherited from Linker::Reader
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)
 
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 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

std::istream * in
 The input stream.
 
- Public Attributes inherited from Linker::Reader
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.
 

Additional Inherited Members

- Public Types inherited from Linker::Reader
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...
 
- Static Public Attributes inherited from Linker::Reader
static OverflowHandlingRequest global_overflow_behavior = Reader::OverflowHandlingRequest::Default
 Global flag to control how reading overflow should be handled.
 

Detailed Description

Reader subclass whose source is a C++ input stream.

Member Function Documentation

◆ Read()

size_t StreamReader::Read ( void *  data,
size_t  max_count = size_t(-1) 
)
overridevirtual

Read in as many bytes as possible.

Implements Linker::Reader.

◆ Seek()

void StreamReader::Seek ( offset_t  offset)
overridevirtual

Jump to a specific location in the input stream.

Implements Linker::Reader.

◆ SeekEnd()

void StreamReader::SeekEnd ( relative_offset_t  offset = 0)
overridevirtual

Jump to end of the input stream.

Implements Linker::Reader.

◆ Skip()

void StreamReader::Skip ( relative_offset_t  offset)
overridevirtual

Jump to a distance in the input stream.

Implements Linker::Reader.

◆ Tell()

offset_t StreamReader::Tell ( )
overridevirtual

Retrieve the current location.

Implements Linker::Reader.


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