MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / IniLoadSettingList

Function IniLoadSettingList

src/settings.cpp:835–846  ·  view source on GitHub ↗

* Loads all items from a 'grpname' section into a list * The list parameter can be a nullptr pointer, in this case nothing will be * saved and a callback function should be defined that will take over the * list-handling and store the data itself somewhere. * @param ini IniFile handle to the ini file with the source data * @param grpname character string identifying the section-header of the

Source from the content-addressed store, hash-verified

833 * @param list new list with entries of the given section
834 */
835static void IniLoadSettingList(IniFile &ini, std::string_view grpname, StringList &list)
836{
837 const IniGroup *group = ini.GetGroup(grpname);
838
839 if (group == nullptr) return;
840
841 list.clear();
842
843 for (const IniItem &item : group->items) {
844 if (!item.name.empty()) list.push_back(item.name);
845 }
846}
847
848/**
849 * Saves all items from a list into the 'grpname' section

Callers

nothing calls this directly

Calls 4

GetGroupMethod · 0.80
push_backMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected