|
OpenTTD Source
14.0-beta1
|
Ini file that only supports loading. More...
#include <ini_type.h>
Public Types | |
| using | IniGroupNameList = std::initializer_list< std::string_view > |
Public Member Functions | |
| IniLoadFile (const IniGroupNameList &list_group_names={}, const IniGroupNameList &seq_group_names={}) | |
| Construct a new in-memory Ini file representation. More... | |
| const IniGroup * | GetGroup (const std::string &name) const |
| Get the group with the given name. More... | |
| IniGroup * | GetGroup (const std::string &name) |
| Get the group with the given name. More... | |
| IniGroup & | GetOrCreateGroup (const std::string &name) |
| Get the group with the given name, and if it doesn't exist create a new group. More... | |
| IniGroup & | CreateGroup (const std::string &name) |
| Create an group with the given name. More... | |
| void | RemoveGroup (const std::string &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... | |
| virtual FILE * | OpenFile (const std::string &filename, Subdirectory subdir, size_t *size)=0 |
| Open the INI file. More... | |
| virtual void | ReportFileError (const char *const pre, const char *const buffer, const char *const post)=0 |
| Report an error about the file contents. More... | |
Data Fields | |
| 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 only supports loading.
Definition at line 50 of file ini_type.h.
| IniLoadFile::IniLoadFile | ( | const IniGroupNameList & | list_group_names = {}, |
| const IniGroupNameList & | seq_group_names = {} |
||
| ) |
Construct a new in-memory Ini file representation.
| list_group_names | A list with group names that should be loaded as lists instead of variables. |
| seq_group_names | A list with group names that should be loaded as lists of names. |
Definition at line 108 of file ini_load.cpp.
| IniGroup & IniLoadFile::CreateGroup | ( | const std::string & | name | ) |
Create an group with the given name.
This does not reuse an existing group of the same name.
| name | name of the group to create. |
Definition at line 162 of file ini_load.cpp.
References groups, IGT_LIST, IGT_SEQUENCE, IGT_VARIABLES, list_group_names, and seq_group_names.
Referenced by GetOrCreateGroup(), and LoadFromDisk().
| IniGroup * IniLoadFile::GetGroup | ( | const std::string & | name | ) |
Get the group with the given name.
| name | name of the group to find. |
nullptr if not found. Definition at line 133 of file ini_load.cpp.
References groups.
| const IniGroup * IniLoadFile::GetGroup | ( | const std::string & | name | ) | const |
Get the group with the given name.
| name | name of the group to find. |
nullptr if not found. Definition at line 119 of file ini_load.cpp.
References groups.
Referenced by DumpGroup(), DumpSections(), BaseSet< GraphicsSet, MAX_GFT, true >::FillSetDetails(), GraphicsSetLoadConfig(), GRFLoadConfig(), IniLoadSettingList(), IniLoadSettings(), IsConversionNeeded(), HotkeyList::Load(), and RemoveEntriesFromIni().
| IniGroup & IniLoadFile::GetOrCreateGroup | ( | const std::string & | name | ) |
Get the group with the given name, and if it doesn't exist create a new group.
| name | name of the group to find. |
Definition at line 147 of file ini_load.cpp.
References CreateGroup(), and groups.
Referenced by GraphicsSetSaveConfig(), IniSaveSettingList(), IniSaveSettings(), HotkeyList::Save(), and SaveVersionInConfig().
| void IniLoadFile::LoadFromDisk | ( | const std::string & | filename, |
| Subdirectory | subdir | ||
| ) |
Load the Ini file's data from the disk.
| filename | the file to load. |
| subdir | the sub directory to load the file from. |
Definition at line 187 of file ini_load.cpp.
References IniItem::comment, IniGroup::comment, comment, CreateGroup(), IniGroup::CreateItem(), free(), groups, IGT_SEQUENCE, OpenFile(), ReallocT(), ReportFileError(), StrMakeValid(), IniGroup::type, and IniItem::value.
Referenced by BaseMedia< GraphicsSet >::AddFile(), WindowDesc::LoadFromConfig(), ProcessIniFile(), and WindowDesc::SaveToConfig().
|
pure 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. Implemented in SettingsIniFile, and IniFile.
Referenced by LoadFromDisk().
| void IniLoadFile::RemoveGroup | ( | const std::string & | name | ) |
Remove the group with the given name.
| name | name of the group to remove. |
Definition at line 175 of file ini_load.cpp.
References groups, and IniGroup::name.
Referenced by DeleteGRFPresetFromConfig().
|
pure 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. |
Implemented in SettingsIniFile, and IniFile.
Referenced by LoadFromDisk().