|
OpenTTD
|
Ini file that only supports loading. More...
#include <ini_type.h>
Public Member Functions | |
| IniLoadFile (const char *const *list_group_names=NULL, const char *const *seq_group_names=NULL) | |
| Construct a new in-memory Ini file representation. | |
| virtual | ~IniLoadFile () |
| Free everything we loaded. | |
| IniGroup * | GetGroup (const char *name, size_t len=0, bool create_new=true) |
| Get the group with the given name. | |
| void | RemoveGroup (const char *name) |
| Remove the group with the given name. | |
| void | LoadFromDisk (const char *filename, Subdirectory subdir) |
| Load the Ini file's data from the disk. | |
| virtual FILE * | OpenFile (const char *filename, Subdirectory subdir, size_t *size)=0 |
| Open the INI file. | |
| virtual void | ReportFileError (const char *const pre, const char *const buffer, const char *const post)=0 |
| Report an error about the file contents. | |
Data Fields | |
| IniGroup * | group |
| 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. | |
Ini file that only supports loading.
Definition at line 54 of file ini_type.h.
| IniLoadFile::IniLoadFile | ( | const char *const * | list_group_names = NULL, |
| const char *const * | seq_group_names = NULL |
||
| ) |
Construct a new in-memory Ini file representation.
| list_group_names | A NULL terminated list with group names that should be loaded as lists instead of variables. |
| seq_group_names | A NULL terminated list with group names that should be loaded as lists of names. |
Definition at line 132 of file ini_load.cpp.
References group, and last_group.
|
virtual |
Free everything we loaded.
Definition at line 142 of file ini_load.cpp.
| IniGroup * IniLoadFile::GetGroup | ( | const char * | name, |
| size_t | len = 0, |
||
| bool | create_new = true |
||
| ) |
Get the group with the given name.
If it doesn't exist and create_new is true create a new group.
| name | name of the group to find. |
| len | the maximum length of said name (0 means length of the string). |
| create_new | Allow creation of group if it does not exist. |
NULL. Definition at line 156 of file ini_load.cpp.
References IniGroup::comment, group, IniGroup::name, IniGroup::next, and stredup().
Referenced by DumpGroup(), DumpSections(), BaseSet< T, Tnum_files, Tsearch_in_tars >::FillSetDetails(), GRFLoadConfig(), IniLoadSettingList(), IniLoadSettings(), IniSaveSettingList(), IniSaveSettings(), HotkeyList::Load(), HotkeyList::Save(), and SaveVersionInConfig().
| void IniLoadFile::LoadFromDisk | ( | const char * | 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 212 of file ini_load.cpp.
References IniItem::comment, IniGroup::comment, comment, free(), group, IGT_SEQUENCE, last_group, max(), OpenFile(), ReallocT(), ReportFileError(), str_validate(), stredup(), IniGroup::type, and IniItem::value.
Referenced by WindowDesc::LoadFromConfig(), and LoadIniFile().
|
pure virtual |
Open the INI file.
| filename | Name of the INI file. |
| subdir | The subdir to load the file from. |
| size | [out] Size of the opened file. |
NULL. Implemented in SettingsIniFile, and IniFile.
Referenced by LoadFromDisk().
| void IniLoadFile::RemoveGroup | ( | const char * | name | ) |
Remove the group with the given name.
| name | name of the group to remove. |
Definition at line 179 of file ini_load.cpp.
References group, last_group, and IniGroup::next.
Referenced by DeleteGRFPresetFromConfig(), and SaveToConfig().
|
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().
1.8.1.2