OpenTTD
Public Member Functions | Data Fields
IniGroup Struct Reference

A group within an ini file. More...

#include <ini_type.h>

Public Member Functions

 IniGroup (struct IniLoadFile *parent, const char *name, const char *last=NULL)
 Construct a new in-memory group of an Ini file. More...
 
 ~IniGroup ()
 Free everything we loaded. More...
 
IniItemGetItem (const char *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. More...
 
void Clear ()
 Clear all items in the group.
 

Data Fields

IniGroupnext
 the next group within this file
 
IniGroupType type
 type of group
 
IniItemitem
 the first item in the group
 
IniItem ** last_item
 the last item in the group
 
char * name
 name of group
 
char * comment
 comment for group
 

Detailed Description

A group within an ini file.

Definition at line 38 of file ini_type.h.

Constructor & Destructor Documentation

◆ IniGroup()

IniGroup::IniGroup ( struct IniLoadFile parent,
const char *  name,
const char *  last = NULL 
)

Construct a new in-memory group of an Ini file.

Parameters
parentthe file we belong to
namethe name of the group
lastthe last element of the name of the group

Definition at line 61 of file ini_load.cpp.

References IGT_LIST, IGT_SEQUENCE, item, IniLoadFile::last_group, last_item, IniLoadFile::list_group_names, next, IniLoadFile::seq_group_names, str_validate(), stredup(), and type.

◆ ~IniGroup()

IniGroup::~IniGroup ( )

Free everything we loaded.

Definition at line 89 of file ini_load.cpp.

References comment, free(), item, name, and next.

Member Function Documentation

◆ GetItem()

IniItem * IniGroup::GetItem ( const char *  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.

Parameters
namename of the item to find.
createwhether to create an item when not found or not.
Returns
the requested item or NULL if not found.

Definition at line 105 of file ini_load.cpp.

References item, IniItem::name, and IniItem::next.

Referenced by DumpSections(), FindItemValue(), IniSaveSettingList(), HotkeyList::Load(), and HotkeyList::Save().


The documentation for this struct was generated from the following files: