OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
28 std::optional<std::string>
value;
84 virtual void ReportFileError(
const char *
const pre,
const char *
const buffer,
const char *
const post) = 0;
94 virtual void ReportFileError(
const char *
const pre,
const char *
const buffer,
const char *
const post);
void RemoveGroup(const char *name)
Remove the group with the given name.
virtual ~IniLoadFile()
Free everything we loaded.
std::string comment
last comment in file
IniItem * next
The next item in this group.
@ IGT_LIST
A list of values, separated by and terminated by the next group block.
A single "line" in an ini file.
A group within an ini file.
void Clear()
Clear all items in the group.
Ini file that only supports loading.
IniFile(const char *const *list_group_names=nullptr)
Create a new ini file with given group names.
virtual FILE * OpenFile(const std::string &filename, Subdirectory subdir, size_t *size)=0
Open the INI file.
std::optional< std::string > value
The value of this item.
bool SaveToDisk(const std::string &filename)
Save the Ini file's data to the disk.
IniGroupType
Types of groups.
IniGroupType type
type of group
@ IGT_VARIABLES
Values of the form "landscape = hilly".
IniItem ** last_item
the last item in the group
virtual void ReportFileError(const char *const pre, const char *const buffer, const char *const post)
Report an error about the file contents.
const char *const * list_group_names
nullptr terminated list with group names that are lists
IniGroup * group
the first group in the ini
std::string comment
comment for group
std::string name
name of group
Ini file that supports both loading and saving.
~IniItem()
Free everything we loaded.
virtual void ReportFileError(const char *const pre, const char *const buffer, const char *const post)=0
Report an error about the file contents.
~IniGroup()
Free everything we loaded.
IniItem(struct IniGroup *parent, const std::string &name)
Construct a new in-memory item of an Ini file.
virtual FILE * OpenFile(const std::string &filename, Subdirectory subdir, size_t *size)
Open the INI file.
@ IGT_SEQUENCE
A list of uninterpreted lines, terminated by the next group block.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
IniGroup ** last_group
the last group in the ini
void SetValue(const char *value)
Replace the current value with another value.
std::string name
The name of this item.
IniItem * item
the first item in the group
IniLoadFile(const char *const *list_group_names=nullptr, const char *const *seq_group_names=nullptr)
Construct a new in-memory Ini file representation.
const char *const * seq_group_names
nullptr terminated list with group names that are sequences.
std::string comment
The comment associated with this item.
IniItem * GetItem(const std::string &name, bool create)
Get the item with the given name, and if it doesn't exist and create is true it creates a new item.
IniGroup(struct IniLoadFile *parent, const std::string &name)
Construct a new in-memory group of an Ini file.
void LoadFromDisk(const std::string &filename, Subdirectory subdir)
Load the Ini file's data from the disk.
IniGroup * GetGroup(const std::string &name, bool create_new=true)
Get the group with the given name.
IniGroup * next
the next group within this file