OpenTTD Source
1.11.0-beta2
|
Ini file that supports both loading and saving. More...
#include <ini_type.h>
Public Member Functions | |
IniFile (const char *const *list_group_names=nullptr) | |
Create a new ini file with given group names. More... | |
bool | SaveToDisk (const std::string &filename) |
Save the Ini file's data to the disk. More... | |
virtual FILE * | OpenFile (const std::string &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... | |
![]() | |
IniLoadFile (const char *const *list_group_names=nullptr, const char *const *seq_group_names=nullptr) | |
Construct a new in-memory Ini file representation. More... | |
virtual | ~IniLoadFile () |
Free everything we loaded. | |
IniGroup * | GetGroup (const std::string &name, 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 std::string &filename, Subdirectory subdir) |
Load the Ini file's data from the disk. More... | |
Additional Inherited Members | |
![]() | |
IniGroup * | group |
the first group in the ini | |
IniGroup ** | last_group |
the last group in the ini | |
std::string | comment |
last comment in file | |
const char *const * | list_group_names |
nullptr terminated list with group names that are lists | |
const char *const * | seq_group_names |
nullptr terminated list with group names that are sequences. | |
Ini file that supports both loading and saving.
Definition at line 88 of file ini_type.h.
IniFile::IniFile | ( | const char *const * | list_group_names = nullptr | ) |
|
virtual |
Open the INI file.
filename | Name of the INI file. | |
subdir | The subdir to load the file from. | |
[out] | size | Size of the opened file. |
nullptr
. Implements IniLoadFile.
Definition at line 126 of file ini.cpp.
References FioFOpenFile().
|
virtual |
Report an error about the file contents.
pre | Prefix text of the buffer part. |
buffer | Part of the file with the error. |
post | Suffix text of the buffer part. |
Implements IniLoadFile.
Definition at line 133 of file ini.cpp.
References ShowInfoF().
bool IniFile::SaveToDisk | ( | const std::string & | filename | ) |
Save the Ini file's data to the disk.
filename | the file to save to. |
Definition at line 46 of file ini.cpp.
References IniGroup::comment, IniLoadFile::comment, IniLoadFile::group, IniGroup::item, IniGroup::name, IniItem::next, IniGroup::next, and OTTD2FS().
Referenced by WindowDesc::SaveToConfig().