OpenTTD: HeaderFileWriter Struct Reference

OpenTTD

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

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields
HeaderFileWriter Struct Reference
Inheritance diagram for HeaderFileWriter:

## Public Member Functions
| HeaderFileWriter (const char *filename)
| Open a file to write to.
| ~HeaderFileWriter ()
| Free the filename.
void | WriteStringID (const char *name, int stringid)
| Write the string ID.
void | Finalise (const StringData &data)
| Finalise writing the file.
Public Member Functions inherited from HeaderWriter
virtual | ~HeaderWriter ()
| Especially destroy the subclasses.
void | WriteHeader (const StringData &data)
| Write the header information.
Public Member Functions inherited from FileWriter
| 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
const char * | real_filename
| The real file name we eventually want to write to.
int | prev
| The previous string ID that was printed.
Data Fields inherited from FileWriter
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

Definition at line 277 of file strgen.cpp.

## Constructor & Destructor Documentation

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

Open a file to write to.

Parameters

  filename | The file to open.

Definition at line 287 of file strgen.cpp.

References FileWriter::fh.

HeaderFileWriter::~HeaderFileWriter | ( |  | ) |
| inline

Free the filename.

Definition at line 296 of file strgen.cpp.

References free(), and real_filename.

## Member Function Documentation

void HeaderFileWriter::Finalise | ( | const StringData & | data | ) |
| inlinevirtual

Finalise writing the file.

Parameters

  data | The data about the string.

Implements HeaderWriter.

Definition at line 308 of file strgen.cpp.

References _plural_forms, CompareFiles(), error(), FileWriter::fh, FileWriter::filename, FileWriter::Finalise(), lengthof, max(), real_filename, and StringData::Version().

void HeaderFileWriter::WriteStringID | ( | const char * | name,
|  | int | stringid
| ) |  |
| inlinevirtual

Write the string ID.

Parameters

  name | The name of the string.
  stringid | The ID of the string.

Implements HeaderWriter.

Definition at line 301 of file strgen.cpp.

References FileWriter::fh, and prev.

## Field Documentation

int HeaderFileWriter::prev

The previous string ID that was printed.

Definition at line 281 of file strgen.cpp.

Referenced by WriteStringID().

const char* HeaderFileWriter::real_filename

The real file name we eventually want to write to.

Definition at line 279 of file strgen.cpp.

Referenced by Finalise(), and ~HeaderFileWriter().

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

- src/strgen/strgen.cpp