|
OpenTTD Source 20251117-master-g7398d2e290
|
Ini file that supports both loading and saving. More...
#include <ini_type.h>
Public Member Functions | |
| IniFile (const IniGroupNameList &list_group_names={}) | |
| Create a new ini file with given group names. | |
| bool | SaveToDisk (const std::string &filename) |
| Save the Ini file's data to the disk. | |
| std::optional< FileHandle > | OpenFile (std::string_view filename, Subdirectory subdir, size_t *size) override |
| Open the INI file. | |
| void | ReportFileError (std::string_view message) override |
| Report an error about the file contents. | |
Public Member Functions inherited from IniLoadFile | |
| IniLoadFile (const IniGroupNameList &list_group_names={}, const IniGroupNameList &seq_group_names={}) | |
| Construct a new in-memory Ini file representation. | |
| const IniGroup * | GetGroup (std::string_view name) const |
| Get the group with the given name. | |
| IniGroup * | GetGroup (std::string_view name) |
| Get the group with the given name. | |
| IniGroup & | GetOrCreateGroup (std::string_view name) |
| Get the group with the given name, and if it doesn't exist create a new group. | |
| IniGroup & | CreateGroup (std::string_view name) |
| Create an group with the given name. | |
| void | RemoveGroup (std::string_view name) |
| Remove the group with the given name. | |
| void | LoadFromDisk (std::string_view filename, Subdirectory subdir) |
| Load the Ini file's data from the disk. | |
Additional Inherited Members | |
Public Types inherited from IniLoadFile | |
| using | IniGroupNameList = std::initializer_list< const std::string_view > |
Data Fields inherited from IniLoadFile | |
| std::list< IniGroup > | groups |
| all groups in the ini | |
| std::string | comment |
| last comment in file | |
| const IniGroupNameList | list_group_names |
| list of group names that are lists | |
| const IniGroupNameList | seq_group_names |
| list of group names that are sequences. | |
Ini file that supports both loading and saving.
Definition at line 86 of file ini_type.h.
| IniFile::IniFile | ( | const IniGroupNameList & | list_group_names = {} | ) |
|
overridevirtual |
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. |
std::nullopt. Implements IniLoadFile.
Definition at line 104 of file ini.cpp.
References FioFOpenFile().
|
overridevirtual |
Report an error about the file contents.
| message | The message to show. |
Implements IniLoadFile.
| 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 42 of file ini.cpp.
References IniLoadFile::comment, Debug, IniLoadFile::groups, and OTTD2FS().
Referenced by DeleteGRFPresetFromConfig(), SaveGRFPresetToConfig(), SaveToConfig(), and WindowDesc::SaveToConfig().