Public Member Functions | Data Fields

# FileStringReader Struct Reference

A reader that simply reads using fopen. More...

Inheritance diagram for FileStringReader:

## Public Member Functions
| FileStringReader (StringData &data, const char *file, bool master, bool translation)
| Create the reader.
virtual | ~FileStringReader ()
| Free/close the file.
char * | ReadLine (char *buffer, size_t size)
| Read a single line from the source of strings.
void | HandlePragma (char *str)
| Handle the pragma of the file.
void | ParseFile ()
| Start parsing the file.
## Data Fields
FILE * | fh
| The file we are reading.

## Detailed Description

A reader that simply reads using fopen.

Definition at line 100 of file strgen.cpp.

## Constructor & Destructor Documentation

FileStringReader::FileStringReader | ( | StringData & | data,
|  | const char * | file,
|  | bool | master,
|  | bool | translation |
| ) |  |  | `[inline]`

Create the reader.

Parameters:

  | data | The data to fill during reading.
  | file | The file we are reading.
  | master | Are we reading the master file?
  | translation | Are we reading a translation?

Definition at line 110 of file strgen.cpp.

References error(), and fh.

virtual FileStringReader::~FileStringReader | ( |  | ) | `[inline, virtual]`

Free/close the file.

Definition at line 118 of file strgen.cpp.

References fh.

## Member Function Documentation

void FileStringReader::HandlePragma | ( | char * | str | ) | `[virtual]`

Handle the pragma of the file.

Parameters:

  | str | The pragma string to parse.

Reimplemented from StringReader.

Definition at line 140 of file strgen.cpp.

References _lang, LanguagePackHeader::cases, StringReader::data, LanguagePackHeader::digit_decimal_separator, LanguagePackHeader::digit_group_separator, LanguagePackHeader::digit_group_separator_currency, error(), LanguagePackHeader::genders, LanguagePackHeader::isocode, lastof, StringReader::master, MAX_NUM_CASES, MAX_NUM_GENDERS, LanguagePackHeader::name, NBSP, LanguagePackHeader::newgrflangid, StringData::next_string_id, LanguagePackHeader::num_cases, LanguagePackHeader::num_genders, LanguagePackHeader::own_name, strecpy(), LanguagePackHeader::text_dir, and LanguagePackHeader::winlangid.

char* FileStringReader::ReadLine | ( | char * | buffer,
|  | size_t | size |
| ) |  |  | `[inline, virtual]`

Read a single line from the source of strings.

Parameters:

  | buffer | The buffer to read the data in to.
  | size | The size of the buffer.

Returns:
  The buffer, or NULL if at the end of the file.

Implements StringReader.

Definition at line 123 of file strgen.cpp.

References ClampToU16(), and fh.

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

- src/strgen/strgen.cpp