OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

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.
| ~FileWriter ()
| Make sure everything is cleaned up.
void | Write (byte *buf, size_t size)
| Write a given number of bytes into the savegame.
void | Finish ()
| Prepare everything to finish writing the savegame.
| FileWriter (const char *filename)
| Open a file to write to.
void | Finalise ()
| Finalise the writing.
virtual | ~FileWriter ()
| Make sure the file is closed.
Public Member Functions inherited from SaveFilter
| SaveFilter (SaveFilter *chain)
| Initialise this filter.
virtual | ~SaveFilter ()
| Make sure the writers are properly closed.

## 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.

## Detailed Description

Yes, simply writing to a file.

Base class for writing data to disk.

Definition at line 1933 of file saveload.cpp.

## Constructor & Destructor Documentation

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 1940 of file saveload.cpp.

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

Make sure everything is cleaned up.

Definition at line 1945 of file saveload.cpp.

References Finish(), and SaveLoadParams::sf.

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 error(), fh, and stredup().

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

Make sure the file is closed.

Definition at line 266 of file strgen.cpp.

References fh, filename, and free().

## Member Function Documentation

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

Finalise the writing.

Reimplemented in LanguageFileWriter.

Definition at line 259 of file strgen.cpp.

References fh.

Referenced by HeaderFileWriter::Finalise().

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 1953 of file saveload.cpp.

References file, and SlError().

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

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