OpenTTD

Public Member Functions | Data Fields
FileWriter Struct Reference

Yes, simply writing to a file. More...

Inheritance diagram for FileWriter:

## Public Member Functions
| FileWriter (FILE *file)
| Create the file writer, so it writes to a specific file. More...
| ~FileWriter ()
| Make sure everything is cleaned up. More...
void | Write (byte *buf, size_t size)
| Write a given number of bytes into the savegame. More...
void | Finish ()
| Prepare everything to finish writing the savegame.
| FileWriter (const char *filename)
| Open a file to write to. More...
void | Finalise ()
| Finalise the writing. More...
virtual | ~FileWriter ()
| Make sure the file is closed. More...
Public Member Functions inherited from SaveFilter
| SaveFilter (SaveFilter *chain)
| Initialise this filter. More...
virtual | ~SaveFilter ()
| Make sure the writers are properly closed. More...

## Data Fields
FILE * | file
| The file to write to.
FILE * | fh
| The file handle we're writing to.
const char * | filename
| The file name we're writing to.
Data Fields inherited from SaveFilter
SaveFilter * | chain
| Chained to the (savegame) filters. More...

## Detailed Description

Yes, simply writing to a file.

Base class for writing data to disk.

Definition at line 1934 of file saveload.cpp.

## Constructor & Destructor Documentation

## ◆ FileWriter() [1/2]

FileWriter::FileWriter | ( | FILE * | file | ) |
| inline

Create the file writer, so it writes to a specific file.

Parameters

  file | The file to write to.

Definition at line 1941 of file saveload.cpp.

## ◆ ~FileWriter() [1/2]

FileWriter::~FileWriter | ( |  | ) |
| inline

Make sure everything is cleaned up.

Definition at line 1946 of file saveload.cpp.

References SaveLoadParams::sf.

## ◆ FileWriter() [2/2]

FileWriter::FileWriter | ( | const char * | filename | ) |
| inline

Open a file to write to.

Parameters

  filename | The file to open.

Definition at line 248 of file strgen.cpp.

References stredup().

## ◆ ~FileWriter() [2/2]

virtual FileWriter::~FileWriter | ( |  | ) |
| inline virtual

Make sure the file is closed.

Definition at line 266 of file strgen.cpp.

References free().

## Member Function Documentation

## ◆ Finalise()

void FileWriter::Finalise | ( |  | ) |
| inline

Finalise the writing.

Definition at line 259 of file strgen.cpp.

## ◆ Write()

void FileWriter::Write | ( | byte * | buf,
|  | size_t | len
| ) |  |
| inline virtual

Write a given number of bytes into the savegame.

Parameters

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

Implements SaveFilter.

Definition at line 1954 of file saveload.cpp.

References SlError().

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

- src/saveload/saveload.cpp
- src/strgen/strgen.cpp