OpenTTD
Public Member Functions
IniFile Struct Reference

Ini file that supports both loading and saving. More...

#include <ini_type.h>

Inheritance diagram for IniFile:
IniLoadFile

Public Member Functions

 IniFile (const char *const *list_group_names=NULL)
 Create a new ini file with given group names. More...
 
bool SaveToDisk (const char *filename)
 Save the Ini file's data to the disk. More...
 
virtual FILE * OpenFile (const char *filename, Subdirectory subdir, size_t *size)
 Open the INI file. More...
 
virtual void ReportFileError (const char *const pre, const char *const buffer, const char *const post)
 Report an error about the file contents. More...
 
- Public Member Functions inherited from IniLoadFile
 IniLoadFile (const char *const *list_group_names=NULL, const char *const *seq_group_names=NULL)
 Construct a new in-memory Ini file representation. More...
 
virtual ~IniLoadFile ()
 Free everything we loaded. More...
 
IniGroupGetGroup (const char *name, size_t len=0, bool create_new=true)
 Get the group with the given name. More...
 
void RemoveGroup (const char *name)
 Remove the group with the given name. More...
 
void LoadFromDisk (const char *filename, Subdirectory subdir)
 Load the Ini file's data from the disk. More...
 

Additional Inherited Members

- Data Fields inherited from IniLoadFile
IniGroupgroup
 the first group in the ini
 
IniGroup ** last_group
 the last group in the ini
 
char * comment
 last comment in file
 
const char *const * list_group_names
 NULL terminated list with group names that are lists.
 
const char *const * seq_group_names
 NULL terminated list with group names that are sequences.
 

Detailed Description

Ini file that supports both loading and saving.

Definition at line 88 of file ini_type.h.

Constructor & Destructor Documentation

◆ IniFile()

IniFile::IniFile ( const char *const *  list_group_names = NULL)

Create a new ini file with given group names.

Parameters
list_group_namesA NULL terminated list with group names that should be loaded as lists instead of variables.
See also
IGT_LIST

Definition at line 34 of file ini.cpp.

Member Function Documentation

◆ OpenFile()

FILE * IniFile::OpenFile ( const char *  filename,
Subdirectory  subdir,
size_t *  size 
)
virtual

Open the INI file.

Parameters
filenameName of the INI file.
subdirThe subdir to load the file from.
size[out] Size of the opened file.
Returns
File handle of the opened file, or NULL.

Implements IniLoadFile.

Definition at line 120 of file ini.cpp.

References FioFOpenFile().

◆ ReportFileError()

void IniFile::ReportFileError ( const char *const  pre,
const char *const  buffer,
const char *const  post 
)
virtual

Report an error about the file contents.

Parameters
prePrefix text of the buffer part.
bufferPart of the file with the error.
postSuffix text of the buffer part.

Implements IniLoadFile.

Definition at line 127 of file ini.cpp.

References ShowInfoF().

◆ SaveToDisk()

bool IniFile::SaveToDisk ( const char *  filename)

Save the Ini file's data to the disk.

Parameters
filenamethe file to save to.
Returns
true if saving succeeded.

Definition at line 43 of file ini.cpp.


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