OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #ifndef RANDOM_ACCESS_FILE_TYPE_H
11 #define RANDOM_ACCESS_FILE_TYPE_H
static constexpr int BUFFER_SIZE
The number of bytes to allocate for the buffer.
byte * buffer
Current position within the local buffer.
size_t pos
Position in the file of the end of the read buffer.
const std::string & GetFilename() const
Get the filename of the opened file with the path from the SubDirectory and the extension.
byte * buffer_end
Last valid byte of buffer.
void ReadBlock(void *ptr, size_t size)
Read a block.
byte ReadByte()
Read a byte from the file.
void SkipBytes(int n)
Skip n bytes ahead in the file.
std::string simplified_filename
Simplified lowecase name of the file; only the name, no path or extension.
FILE * file_handle
File handle of the open file.
virtual ~RandomAccessFile()
Close the file's file handle.
std::string filename
Full name of the file; relative path to subdir plus the extension of the file.
uint16 ReadWord()
Read a word (16 bits) from the file (in low endian format).
uint32 ReadDword()
Read a double word (32 bits) from the file (in low endian format).
size_t GetPos() const
Get position in the file.
RandomAccessFile(const std::string &filename, Subdirectory subdir)
Create the RandomAccesFile.
byte buffer_start[BUFFER_SIZE]
Local buffer when read from file.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
const std::string & GetSimplifiedFilename() const
Get the simplified filename of the opened file.
void SeekTo(size_t pos, int mode)
Seek in the current file.
A file from which bytes, words and double words are read in (potentially) a random order.