OpenTTD Source 20241224-master-gf74b0cf984
ByteReader Class Reference

Class to read from a NewGRF file. More...

Public Member Functions

 ByteReader (uint8_t *data, uint8_t *end)
 
uint8_t * ReadBytes (size_t size)
 
uint8_t ReadByte ()
 
uint16_t ReadWord ()
 
uint16_t ReadExtendedByte ()
 
uint32_t ReadDWord ()
 
uint32_t PeekDWord ()
 
uint32_t ReadVarSize (uint8_t size)
 
std::string_view ReadString ()
 
size_t Remaining () const
 
bool HasData (size_t count=1) const
 
void Skip (size_t len)
 

Protected Attributes

uint8_t * data
 
uint8_t * end
 

Detailed Description

Class to read from a NewGRF file.

Definition at line 216 of file newgrf.cpp.

Constructor & Destructor Documentation

◆ ByteReader()

ByteReader::ByteReader ( uint8_t *  data,
uint8_t *  end 
)
inline

Definition at line 222 of file newgrf.cpp.

Member Function Documentation

◆ HasData()

bool ByteReader::HasData ( size_t  count = 1) const
inline

Definition at line 295 of file newgrf.cpp.

◆ PeekDWord()

uint32_t ByteReader::PeekDWord ( )
inline

Definition at line 261 of file newgrf.cpp.

◆ ReadByte()

uint8_t ByteReader::ReadByte ( )
inline

Definition at line 237 of file newgrf.cpp.

◆ ReadBytes()

uint8_t * ByteReader::ReadBytes ( size_t  size)
inline

Definition at line 224 of file newgrf.cpp.

◆ ReadDWord()

uint32_t ByteReader::ReadDWord ( )
inline

Definition at line 255 of file newgrf.cpp.

◆ ReadExtendedByte()

uint16_t ByteReader::ReadExtendedByte ( )
inline

Definition at line 249 of file newgrf.cpp.

◆ ReadString()

std::string_view ByteReader::ReadString ( )
inline

Definition at line 279 of file newgrf.cpp.

◆ ReadVarSize()

uint32_t ByteReader::ReadVarSize ( uint8_t  size)
inline

Definition at line 267 of file newgrf.cpp.

◆ ReadWord()

uint16_t ByteReader::ReadWord ( )
inline

Definition at line 243 of file newgrf.cpp.

◆ Remaining()

size_t ByteReader::Remaining ( ) const
inline

Definition at line 290 of file newgrf.cpp.

◆ Skip()

void ByteReader::Skip ( size_t  len)
inline

Definition at line 300 of file newgrf.cpp.

Field Documentation

◆ data

uint8_t* ByteReader::data
protected

Definition at line 218 of file newgrf.cpp.

◆ end

uint8_t* ByteReader::end
protected

Definition at line 219 of file newgrf.cpp.


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