#include <ini_type.h>
Public Member Functions | |
IniFile (const char *const *list_group_names=NULL) | |
Construct a new in-memory Ini file representation. | |
~IniFile () | |
Free everything we loaded. | |
IniGroup * | GetGroup (const char *name, size_t len=0) |
Get the group with the given name, and if it doesn't exist create a new group. | |
void | RemoveGroup (const char *name) |
Remove the group with the given name. | |
void | LoadFromDisk (const char *filename) |
Load the Ini file's data from the disk. | |
bool | SaveToDisk (const char *filename) |
Save the Ini file's data to the disk. | |
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. |
Definition at line 82 of file ini_type.h.
IniFile::IniFile | ( | const char *const * | list_group_names = NULL |
) |
Construct a new in-memory Ini file representation.
list_group_names | A NULL terminated list with groups that should be loaded as lists instead of variables. |
Definition at line 100 of file ini.cpp.
References group, and last_group.
IniFile::~IniFile | ( | ) |
IniGroup * IniFile::GetGroup | ( | const char * | name, | |
size_t | len = 0 | |||
) |
Get the group with the given name, and if it doesn't exist create a new group.
name | name of the group to find. | |
len | the maximum length of said name. |
Definition at line 111 of file ini.cpp.
References IniGroup::comment, group, IniGroup::name, and IniGroup::next.
Referenced by MusicSet::FillSetDetails(), GraphicsSet::FillSetDetails(), BaseSet< T, Tnum_files, Tsubdir >::FillSetDetails(), ini_load_setting_list(), ini_load_settings(), ini_save_setting_list(), ini_save_settings(), and SaveVersionInConfig().
void IniFile::RemoveGroup | ( | const char * | name | ) |
Remove the group with the given name.
name | name of the group to remove. |
Definition at line 128 of file ini.cpp.
References group, last_group, and IniGroup::next.
Referenced by SaveToConfig().
void IniFile::LoadFromDisk | ( | const char * | filename | ) |
Load the Ini file's data from the disk.
filename | the file to load. |
Definition at line 155 of file ini.cpp.
References IniItem::comment, IniGroup::comment, comment, DATA_DIR, FioFOpenFile(), group, last_group, max(), ReallocT(), ShowInfoF(), and IniItem::value.
Referenced by BaseMedia< Tbase_set >::AddFile().
bool IniFile::SaveToDisk | ( | const char * | filename | ) |
Save the Ini file's data to the disk.
filename | the file to save to. |
Definition at line 271 of file ini.cpp.
References comment, IniGroup::comment, group, IniGroup::item, lastof, MemSetT(), IniGroup::name, IniItem::next, IniGroup::next, OTTD2FS(), strecat(), and strecpy().
Referenced by SaveToConfig().