OpenTTD Source 20260206-master-g4d4e37dbf1
IniGroup Struct Reference

A group within an ini file. More...

#include <ini_type.h>

Public Member Functions

 IniGroup (std::string_view name, IniGroupType type)
 Construct a new in-memory group of an Ini file.
const IniItemGetItem (std::string_view name) const
 Get the item with the given name.
IniItemGetOrCreateItem (std::string_view name)
 Get the item with the given name, and if it doesn't exist create a new item.
IniItemCreateItem (std::string_view name)
 Create an item with the given name.
void RemoveItem (std::string_view name)
 Remove the item with the given name.
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 ( std::string_view name,
IniGroupType type )

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

Parameters
namethe name of the group
typeThe type of group.

Definition at line 40 of file ini_load.cpp.

References comment, name, StrMakeValid(), and type.

Member Function Documentation

◆ Clear()

void IniGroup::Clear ( )

Clear all items in the group.

Definition at line 96 of file ini_load.cpp.

References items.

Referenced by BadgeClassSaveConfigFeature(), GraphicsSetSaveConfig(), IniSaveSettingList(), and PickerSaveConfig().

◆ CreateItem()

IniItem & IniGroup::CreateItem ( std::string_view 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 79 of file ini_load.cpp.

References items, and name.

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

◆ GetItem()

const IniItem * IniGroup::GetItem ( std::string_view 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 50 of file ini_load.cpp.

References items, and name.

Referenced by DumpSections(), BaseSet< T >::FillSetDetails(), FindItemValue(), BaseSet< T >::GetMandatoryItem(), GraphicsSetLoadConfig(), IniLoadSettings(), IsConversionNeeded(), HotkeyList::Load(), and LoadFromConfig().

◆ GetOrCreateItem()

IniItem & IniGroup::GetOrCreateItem ( std::string_view 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 64 of file ini_load.cpp.

References CreateItem(), items, and name.

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

◆ RemoveItem()

void IniGroup::RemoveItem ( std::string_view name)

Remove the item with the given name.

Parameters
nameName of the item to remove.

Definition at line 88 of file ini_load.cpp.

References items, name, and IniItem::name.

Referenced by RemoveEntriesFromIni(), and SaveToConfig().

Field Documentation

◆ comment

std::string IniGroup::comment

comment for group

Definition at line 38 of file ini_type.h.

Referenced by IniGroup(), IniLoadFile::LoadFromDisk(), and SaveToConfig().

◆ items

◆ name

◆ type

IniGroupType IniGroup::type

type of group

Definition at line 36 of file ini_type.h.

Referenced by DumpGroup(), IniGroup(), and IniLoadFile::LoadFromDisk().


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