OpenTTD Source  14.0-beta1
IniGroup Struct Reference

A group within an ini file. More...

#include <ini_type.h>

Public Member Functions

 IniGroup (const std::string &name, IniGroupType type)
 Construct a new in-memory group of an Ini file. More...
 
const IniItemGetItem (const std::string &name) const
 Get the item with the given name. More...
 
IniItemGetOrCreateItem (const std::string &name)
 Get the item with the given name, and if it doesn't exist create a new item. More...
 
IniItemCreateItem (const std::string &name)
 Create an item with the given name. More...
 
void RemoveItem (const std::string &name)
 Remove the item with the given name. More...
 
void Clear ()
 Clear all items in the group.
 

Data Fields

std::list< IniItemitems
 all items in the group
 
IniGroupType type
 type of group
 
std::string name
 name of group
 
std::string comment
 comment for group
 

Detailed Description

A group within an ini file.

Definition at line 34 of file ini_type.h.

Constructor & Destructor Documentation

◆ IniGroup()

IniGroup::IniGroup ( const std::string &  name,
IniGroupType  type 
)

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

Parameters
parentthe file we belong to
namethe name of the group

Definition at line 42 of file ini_load.cpp.

References name, and StrMakeValid().

Member Function Documentation

◆ CreateItem()

IniItem & IniGroup::CreateItem ( const std::string &  name)

Create an item with the given name.

This does not reuse an existing item of the same name.

Parameters
namename of the item to create.
Returns
the created item.

Definition at line 81 of file ini_load.cpp.

References items.

Referenced by GetOrCreateItem(), and IniLoadFile::LoadFromDisk().

◆ GetItem()

const IniItem * IniGroup::GetItem ( const std::string &  name) const

Get the item with the given name.

Parameters
namename of the item to find.
Returns
the requested item or nullptr if not found.

Definition at line 52 of file ini_load.cpp.

References items, and name.

Referenced by DumpSections(), BaseSet< GraphicsSet, MAX_GFT, true >::FillSetDetails(), FindItemValue(), GraphicsSetLoadConfig(), IniLoadSettings(), IsConversionNeeded(), and HotkeyList::Load().

◆ GetOrCreateItem()

IniItem & IniGroup::GetOrCreateItem ( const std::string &  name)

Get the item with the given name, and if it doesn't exist create a new item.

Parameters
namename of the item to find.
Returns
the requested item.

Definition at line 66 of file ini_load.cpp.

References CreateItem(), items, and name.

Referenced by GraphicsSetSaveConfig(), IniSaveSettingList(), HotkeyList::Save(), and SaveVersionInConfig().

◆ RemoveItem()

void IniGroup::RemoveItem ( const std::string &  name)

Remove the item with the given name.

Parameters
nameName of the item to remove.

Definition at line 90 of file ini_load.cpp.

References items, IniItem::name, and name.

Referenced by RemoveEntriesFromIni().


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