OpenTTD Source: FileReader Struct Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Data Fields
FileReader Struct Reference

Yes, simply reading from a file. More...

Inheritance diagram for FileReader:

## Public Member Functions
| FileReader (FileHandle &&file)
| Create the file reader, so it reads from a specific file.
| ~FileReader ()
| Make sure everything is cleaned up.
size_t | Read (uint8_t *buf, size_t size) override
| Read a given number of bytes from the savegame.
void | Reset () override
| Reset this filter to read from the beginning of the file.
Public Member Functions inherited from LoadFilter
| LoadFilter (std::shared_ptr< LoadFilter > chain)
| Initialise this filter.
virtual | ~LoadFilter ()=default
| Make sure the writers are properly closed.

## Data Fields
std::optional< FileHandle > | file
| The file to read from.
long | begin
| The begin of the file.
Data Fields inherited from LoadFilter
std::shared_ptr< LoadFilter > | chain
| Chained to the (savegame) filters.

## Detailed Description

Yes, simply reading from a file.

Definition at line 2242 of file saveload.cpp.

## Constructor & Destructor Documentation

## ◆ FileReader()

FileReader::FileReader | ( | FileHandle && | file | ) |
| inline

Create the file reader, so it reads from a specific file.

Parameters

  file | The file to read from.

Definition at line 2250 of file saveload.cpp.

## ◆ ~FileReader()

FileReader::~FileReader | ( |  | ) |
| inline

Make sure everything is cleaned up.

Definition at line 2255 of file saveload.cpp.

References _game_session_stats, begin, and GameSessionStats::savegame_size.

## Member Function Documentation

## ◆ Read()

size_t FileReader::Read | ( | uint8_t * | buf,
|  | size_t | len
| ) |  |
| inlineoverridevirtual

Read a given number of bytes from the savegame.

Parameters

  buf | The bytes to read.
  len | The number of bytes to read.

Returns
  The number of actually read bytes.

Implements LoadFilter.

Definition at line 2262 of file saveload.cpp.

## ◆ Reset()

void FileReader::Reset | ( |  | ) |
| inlineoverridevirtual

Reset this filter to read from the beginning of the file.

Reimplemented from LoadFilter.

Definition at line 2270 of file saveload.cpp.

References Debug.

## Field Documentation

## ◆ begin

long FileReader::begin

The begin of the file.

Definition at line 2244 of file saveload.cpp.

Referenced by ~FileReader().

## ◆ file

std::optional<FileHandle> FileReader::file

The file to read from.

Definition at line 2243 of file saveload.cpp.

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

- src/saveload/saveload.cpp