|
UFO: Alien Invasion
|
LINKED LIST interface. More...
#include "../shared/ufotypes.h"

Go to the source code of this file.
Data Structures | |
| struct | linkedList_t |
Macros | |
| #define | LIST_Foreach(list, type, var) |
| Iterates over a linked list, it's safe to delete the returned entry from the list while looping over it. More... | |
| #define | LIST_ForeachSorted(list, type, var, sorter, userdata, sortedlist) |
| Will sort the list before loop over the sorted list. Make sure to free the sortedList after you are done with the loop. More... | |
Typedefs | |
| typedef int(* | linkedListSort_t) (linkedList_t *entry1, linkedList_t *entry2, const void *userData) |
Functions | |
| void | LIST_PrependString (linkedList_t **listDest, const char *data) |
| Adds a string as first entry to a linked list. More... | |
| void | LIST_AddString (linkedList_t **list, const char *data) |
| Adds an string to a new or to an already existing linked list. The string is copied here. More... | |
| void | LIST_AddStringSorted (linkedList_t **listDest, const char *data) |
| void | LIST_AddPointer (linkedList_t **listDest, void *data) |
| Adds just a pointer to a new or to an already existing linked list. More... | |
| linkedList_t * | LIST_Add (linkedList_t **list, void const *data, size_t length) |
| Adds an entry to a new or to an already existing linked list. More... | |
| const linkedList_t * | LIST_ContainsString (const linkedList_t *list, const char *string) |
| Searches for the first occurrence of a given string. More... | |
| linkedList_t * | LIST_GetPointer (linkedList_t *list, const void *data) |
| Searches for the first occurrence of a given pointer. More... | |
| void | LIST_Delete (linkedList_t **list) |
| bool | LIST_RemoveEntry (linkedList_t **list, linkedList_t *entry) |
| Removes one entry from the linked list. More... | |
| bool | LIST_IsEmpty (const linkedList_t *list) |
| Checks whether the given list is empty. More... | |
| int | LIST_Count (const linkedList_t *list) |
| linkedList_t * | LIST_CopyStructure (linkedList_t *src) |
| Copies the list structure data - but not the content from the original list. We are only using pointers here. More... | |
| void * | LIST_GetByIdx (linkedList_t *list, int index) |
| Get an entry of a linked list by its index in the list. More... | |
| bool | LIST_Remove (linkedList_t **list, const void *data) |
| void | LIST_Sort (linkedList_t **list, linkedListSort_t sorter, const void *userData) |
| void * | LIST_GetRandom (linkedList_t *list) |
| template<typename T > | |
| T & | LIST_Add (linkedList_t **const list, T const &data) |
LINKED LIST interface.
Definition in file list.h.
| #define LIST_Foreach | ( | list, | |
| type, | |||
| var | |||
| ) |
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over it.
var must be a simple variable name, because it is declared in the loop macro and is also used to create the name of the internal variables. | #define LIST_ForeachSorted | ( | list, | |
| type, | |||
| var, | |||
| sorter, | |||
| userdata, | |||
| sortedlist | |||
| ) |
Will sort the list before loop over the sorted list. Make sure to free the sortedList after you are done with the loop.
| typedef int(* linkedListSort_t) (linkedList_t *entry1, linkedList_t *entry2, const void *userData) |
|
inline |
Add a copy of data to list and return a reference to the copied data.
Definition at line 75 of file list.h.
References data, linkedList_t::data, and LIST_Add().
| linkedList_t * LIST_Add | ( | linkedList_t ** | listDest, |
| void const * | data, | ||
| size_t | length | ||
| ) |
Adds an entry to a new or to an already existing linked list.
Definition at line 39 of file cl_game_campaign.cpp.
References cgi, com_genericPool, data, length, cgame_import_t::LIST_Add(), LIST_AllocateEntry(), LIST_AppendEntry(), and Mem_PoolAllocTypeN.
Referenced by AB_BuildBase(), AB_LoadXML(), AIR_Add(), CHAR_ParseData(), CITY_Parse(), CL_DisplayHomebasePopup(), CL_ParseNations(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseBodyTemplate(), Com_ParseFireDefinition(), Com_ParseItem(), CP_CreateNewMission(), E_CreateEmployee(), E_LoadXML(), GAME_GetImportData(), HUD_PopupFiremodeReservation(), INS_Build(), INS_LoadXML(), LIST_Add(), MIS_LoadXML(), TEST_F(), TR_LoadXML(), TR_TransferStart(), UI_AddLineChartLine(), US_LoadXML(), and US_StoreUFO().
| void LIST_AddPointer | ( | linkedList_t ** | listDest, |
| void * | data | ||
| ) |
Adds just a pointer to a new or to an already existing linked list.
Definition at line 153 of file list.cpp.
References data, LIST_AllocateEntry(), LIST_AppendEntry(), and linkedList_t::ptr.
Referenced by GAME_AppendTeamMember(), GAME_GetImportData(), GAME_LoadTeamInfo(), GAME_Spawn(), HUD_PopupFiremodeReservation(), LIST_CopyStructure(), and UI_CvarListenerNodeBind().
| void LIST_AddString | ( | linkedList_t ** | listDest, |
| const char * | data | ||
| ) |
Adds an string to a new or to an already existing linked list. The string is copied here.
Definition at line 139 of file list.cpp.
References data, LIST_AllocateString(), and LIST_AppendEntry().
Referenced by Com_LuaTableToStringList(), Com_ParseActorNames(), Com_ParseActorSounds(), Com_ParseList(), FS_GetModList(), GAME_GetImportData(), GAME_InitMissionBriefing(), HUD_PopupFiremodeReservation(), Irc_Client_Names_f(), Sys_ListFilteredFiles(), TEST_F(), UI_AddCvarListener_f(), UI_CvarListenerNodeCallback(), UI_ExecuteCallAction(), UI_MaterialEditorUpdate(), UI_PushWindow_f(), and UI_TextNodeGenerateLineSplit().
| void LIST_AddStringSorted | ( | linkedList_t ** | listDest, |
| const char * | data | ||
| ) |
Definition at line 107 of file list.cpp.
References data, LIST_AllocateString(), linkedList_t::next, and Q_StringSort().
Referenced by _AddToListBlock(), GAME_GetImportData(), and TEST_F().
| const linkedList_t * LIST_ContainsString | ( | const linkedList_t * | list, |
| const char * | string | ||
| ) |
Searches for the first occurrence of a given string.
nullptr nullptr, the function returns nullptr Definition at line 73 of file list.cpp.
References linkedList_t::data, linkedList_t::next, and Q_streq.
Referenced by _AddToListBlock(), GAME_ChangeEquip(), GAME_GetImportData(), TEST_F(), UI_AddCvarListener_f(), UI_RemoveCvarListener_f(), and UI_UpdateInvisOptions().
| linkedList_t * LIST_CopyStructure | ( | linkedList_t * | src | ) |
Copies the list structure data - but not the content from the original list. We are only using pointers here.
Definition at line 52 of file cl_game_campaign.cpp.
References cgi, data, dest, LIST_AddPointer(), cgame_import_t::LIST_CopyStructure(), and LIST_Foreach.
Referenced by GAME_GetImportData(), and TEST_F().
| int LIST_Count | ( | const linkedList_t * | list | ) |
Definition at line 344 of file list.cpp.
References count, and linkedList_t::next.
Referenced by Com_ParseActorModels(), Com_ParseBodyPart(), Com_ParseEquipment(), FS_BuildFileList(), GAME_GetImportData(), GAME_InitializeBattlescape(), GAME_SaveTeam(), GAME_SendCurrentTeamSpawningInfo(), GAME_UpdateActiveTeamList(), HUD_PopupFiremodeReservation(), HUD_ShotReserve_f(), LIST_GetRandom(), TEST_F(), and UI_ExecuteEventActionsEx().
| void LIST_Delete | ( | linkedList_t ** | list | ) |
Definition at line 195 of file list.cpp.
References linkedList_t::data, Mem_Free, linkedList_t::next, and linkedList_t::ptr.
Referenced by _wrap_push_window(), CL_ParseLanguages(), CL_ParseSequence(), Com_AddObjectLinks(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseBodyPart(), Com_ParseEquipment(), Com_ParseList(), Com_ParseTeam(), uiLineChartNode::deleteNode(), FS_BuildFileList(), GAME_GetImportData(), GAME_ResetCharacters(), GAME_SetMode(), HUD_PopupFiremodeReservation(), M_ParseMusic(), TEST_F(), UI_ClearLineChart(), UI_ExecuteCallAction(), UI_PushWindow_f(), UI_ResetData(), and UI_TextNodeGenerateLineSplit().
| void * LIST_GetByIdx | ( | linkedList_t * | list, |
| int | index | ||
| ) |
Get an entry of a linked list by its index in the list.
| [in] | list | Linked list to get the entry from. |
| [in] | index | The index of the entry in the linked list. |
Definition at line 362 of file list.cpp.
References linkedList_t::data, i, index, LIST_IsEmpty(), and linkedList_t::next.
Referenced by CL_ChangeSkin_f(), GAME_GetImportData(), HUD_ShotReserve_f(), LIST_GetRandom(), TEST_F(), UI_ExecuteLuaMethod(), and UI_GetTextFromList().
| linkedList_t * LIST_GetPointer | ( | linkedList_t * | list, |
| const void * | data | ||
| ) |
Searches for the first occurrence of a given pointer.
nullptr nullptr, the function returns nullptr Definition at line 91 of file list.cpp.
References data, linkedList_t::data, and linkedList_t::next.
Referenced by GAME_GetImportData(), LIST_Remove(), and UI_CvarListenerNodeBind().
| void * LIST_GetRandom | ( | linkedList_t * | list | ) |
Definition at line 381 of file list.cpp.
References LIST_Count(), and LIST_GetByIdx().
Referenced by GAME_GetImportData(), TEST_F(), and UI_MapInfo().
| bool LIST_IsEmpty | ( | const linkedList_t * | list | ) |
Checks whether the given list is empty.
| [in] | list | The linked list to check |
true if empty, false otherwise Definition at line 335 of file list.cpp.
Referenced by GAME_ChangeEquip(), GAME_GetCGameAPI(), GAME_GetImportData(), GAME_InitMissionBriefing(), GAME_IsTeamEmpty(), GAME_SaveTeam_f(), GAME_Spawn(), GAME_SpawnSoldiers(), GAME_StartMatch(), GAME_UpdateInventory(), LIST_GetByIdx(), LIST_Sort(), uiCvarNode::onWindowClosed(), TEST_F(), GameTest::testCountSpawnpointsForMap(), GameTest::testCountSpawnpointsForMapInMultiplayerMode(), GameTest::testCountSpawnpointsForMapWithAssembly(), GameTest::testCountSpawnpointsForMapWithAssemblyAndAircraft(), and UI_RemoveCvarListener_f().
| void LIST_PrependString | ( | linkedList_t ** | listDest, |
| const char * | data | ||
| ) |
Adds a string as first entry to a linked list.
| listDest | The linked list to add the string, too. If this is nullptr, a new list is created |
| data | The string to add to the list |
Definition at line 127 of file list.cpp.
References data, and LIST_AllocateString().
Referenced by GAME_GetImportData(), and TEST_F().
| bool LIST_Remove | ( | linkedList_t ** | list, |
| const void * | data | ||
| ) |
Definition at line 213 of file list.cpp.
References data, LIST_GetPointer(), and LIST_RemoveEntry().
Referenced by GAME_GetImportData(), GAME_SaveTeamState_f(), uiCvarNode::onWindowClosed(), and TEST_F().
| bool LIST_RemoveEntry | ( | linkedList_t ** | list, |
| linkedList_t * | entry | ||
| ) |
Removes one entry from the linked list.
true if the removal was successful, false otherwise. Definition at line 172 of file list.cpp.
References linkedList_t::data, Mem_Free, linkedList_t::next, and linkedList_t::ptr.
Referenced by GAME_GetImportData(), LIST_Remove(), TEST_F(), and UI_RemoveCvarListener_f().
| void LIST_Sort | ( | linkedList_t ** | list, |
| linkedListSort_t | sorter, | ||
| const void * | userData | ||
| ) |
Definition at line 48 of file cl_game_campaign.cpp.
References _LIST_Sort(), cgi, and LIST_IsEmpty().
Referenced by GAME_GetImportData(), and TEST_F().