|
Archeus 0.0.0
A C library and game engine that focuses on documentation
|
#include "arc/std/vector.h"#include "arc/std/bool.h"#include "arc/std/errno.h"#include <stdint.h>#include <stdlib.h>Go to the source code of this file.
Data Structures | |
| struct | ARC_Vector |
Functions | |
| ARC_Bool | ARC_Vector_CompareDataDefaultFn (void *dataA, void *dataB) |
| void | ARC_Vector_Create (ARC_Vector **vector, ARC_Vector_CompareDataFn *compareDataFn, ARC_Vector_DestroyDataFn *destroyDataFn) |
| creates an ARC_Vector which is an "expandable" array | |
| void | ARC_Vector_Destroy (ARC_Vector *vector) |
| destroys an ARC_Vector | |
| void | ARC_Vector_Add (ARC_Vector *vector, void *data) |
| adds an item to an ARC_Vector | |
| void | ARC_Vector_Remove (ARC_Vector *vector, void *data) |
| removes an item from a matching item in an ARC_Vector | |
| void | ARC_Vector_RemoveIndex (ARC_Vector *vector, uint32_t index) |
| removes an item from an ARC_Vector at an index | |
| void | ARC_Vector_Clear (ARC_Vector *vector) |
| clears all items from a vector | |
| uint32_t | ARC_Vector_GetSize (ARC_Vector *vector) |
| gets the current size of an ARC_Vector as an unsigned 32 bit integer | |
| void * | ARC_Vector_Get (ARC_Vector *vector, uint32_t index) |
| gets an item from an ARC_Vector at a position index | |
| void ARC_Vector_Add | ( | ARC_Vector * | vector, |
| void * | data ) |
adds an item to an ARC_Vector
| [in] | vector | ARC_Vector to add to |
| [in] | data | data that is being added |
Definition at line 67 of file vector.c.
References ARC_DEBUG_LOG_ERROR, arc_errno, ARC_ERRNO_OVERFLOW, ARC_Vector::currentCapacity, ARC_Vector::currentSize, and ARC_Vector::data.
Referenced by ARC_Handler_Add(), ARC_Handler_Remove(), ARC_Handler_RemoveIndex(), ARC_Lexer_LexString(), ARC_Lexer_RegisterTokenRule(), ARC_Parser_ParseTag(), ARC_ParserCSVData_CreateFn(), ARC_ParserCSVData_GetDataTag(), ARC_ParserCSVData_RunLineTag(), ARC_ParserLangParsedData_CreateBodyTag(), ARC_ParserLangParsedData_GetArgumentsTag(), ARC_ParserLangParsedData_GetArgumentTag(), and ARC_ParserLangParsedData_RunLineTag().
| void ARC_Vector_Clear | ( | ARC_Vector * | vector | ) |
clears all items from a vector
| [in] | vector | ARC_Vector to clear |
Definition at line 139 of file vector.c.
References ARC_Vector_GetSize(), and ARC_Vector_RemoveIndex().
Referenced by ARC_Lexer_Clear(), ARC_Parser_ParseTag(), and ARC_Vector_Destroy().
| ARC_Bool ARC_Vector_CompareDataDefaultFn | ( | void * | dataA, |
| void * | dataB ) |
| void ARC_Vector_Create | ( | ARC_Vector ** | vector, |
| ARC_Vector_CompareDataFn * | compareDataFn, | ||
| ARC_Vector_DestroyDataFn * | destroyDataFn ) |
creates an ARC_Vector which is an "expandable" array
| [out] | vector | ARC_Vector to initialize |
| [in] | compareDataFn | a callback that checks if data stored in the array matches, if set to NULL and ARC_Vector_Remove is called, the pointer addresses will be compared |
| [in] | destroyDataFn | a callback that frees an item on remove or clear, can be set to NULL to do nothing |
Definition at line 28 of file vector.c.
References ARC_Vector_CompareDataDefaultFn(), and ARC_Vector::data.
Referenced by ARC_Handler_Create(), ARC_Lexer_Create(), ARC_Parser_ParseTag(), ARC_ParserCSVData_CreateFn(), ARC_ParserCSVData_RunLineTag(), ARC_ParserLang_CreateDataFn(), ARC_ParserLangParsedData_CreateBodyTag(), and ARC_ParserLangParsedData_GetArgumentsTag().
| void ARC_Vector_Destroy | ( | ARC_Vector * | vector | ) |
destroys an ARC_Vector
| [in] | vector | ARC_Vector to free |
Definition at line 51 of file vector.c.
References ARC_Vector_Clear(), ARC_Vector::data, and ARC_Vector::destroyDataFn.
Referenced by ARC_Handler_Destroy(), ARC_Lexer_Destroy(), ARC_Parser_ParseTag(), ARC_ParserCSVData_CreateFn(), ARC_ParserCSVData_VectorDestroyVectorFn(), ARC_ParserLang_DestroyDataFn(), ARC_ParserLang_VectorDestroyVectorFn(), ARC_ParserLangParsedData_CreateBodyTag(), and ARC_ParserTagToken_Destroy().
| void * ARC_Vector_Get | ( | ARC_Vector * | vector, |
| uint32_t | index ) |
gets an item from an ARC_Vector at a position index
| [in] | vector | ARC_Vector to get data from |
| [in] | index | position of data to get |
Definition at line 150 of file vector.c.
References ARC_DEBUG_LOG_ERROR_WITH_VARIABLES, arc_errno, ARC_ERRNO_DATA, ARC_Vector::currentSize, and ARC_Vector::data.
Referenced by ARC_Handler_Clean(), ARC_Handler_Iterate(), ARC_Handler_RemoveIndex(), ARC_Lexer_GetToken(), ARC_Lexer_IsTokenId(), ARC_Lexer_LexString(), ARC_Lexer_PrintTokenRules(), ARC_Lexer_RegisterTokenRule(), ARC_Parser_CreateFromVector(), ARC_ParserCSVData_CreateFn(), ARC_ParserCSVData_GetDataTag(), ARC_ParserCSVData_RunLineTag(), ARC_ParserData_HelperRecurseStringAdd(), ARC_ParserLangParsedData_CreateBodyTag(), ARC_ParserLangParsedData_CreateTagString(), ARC_ParserLangParsedData_GetArgumentsTag(), ARC_ParserLangParsedData_GetArgumentTag(), ARC_ParserLangParsedData_RecurseStringAdd(), and ARC_ParserLangParsedData_RunLineTag().
| uint32_t ARC_Vector_GetSize | ( | ARC_Vector * | vector | ) |
gets the current size of an ARC_Vector as an unsigned 32 bit integer
| [in] | vector | ARC_Vector to get current size from |
Definition at line 146 of file vector.c.
References ARC_Vector::currentSize.
Referenced by ARC_Handler_Clean(), ARC_Handler_Clear(), ARC_Handler_GetSize(), ARC_Handler_Iterate(), ARC_Handler_RemoveIndex(), ARC_Lexer_GetTokensSize(), ARC_Lexer_IsTokenId(), ARC_Lexer_LexString(), ARC_Lexer_PrintTokenRules(), ARC_Lexer_RegisterTokenRule(), ARC_Parser_CreateFromVector(), ARC_ParserCSVData_CreateFn(), ARC_ParserCSVData_GetDataTag(), ARC_ParserCSVData_RunLineTag(), ARC_ParserData_HelperRecurseStringAdd(), ARC_ParserLangParsedData_CreateBodyTag(), ARC_ParserLangParsedData_CreateTagString(), ARC_ParserLangParsedData_GetArgumentsTag(), ARC_ParserLangParsedData_GetArgumentTag(), ARC_ParserLangParsedData_RecurseStringAdd(), ARC_ParserLangParsedData_RunLineTag(), and ARC_Vector_Clear().
| void ARC_Vector_Remove | ( | ARC_Vector * | vector, |
| void * | data ) |
removes an item from a matching item in an ARC_Vector
| [in] | vector | ARC_Vector to remove from |
| [in] | data | matching data to remove |
Definition at line 94 of file vector.c.
References ARC_True, ARC_Vector_RemoveIndex(), ARC_Vector::compareDataFn, ARC_Vector::currentSize, and ARC_Vector::data.
Referenced by ARC_Handler_Remove().
| void ARC_Vector_RemoveIndex | ( | ARC_Vector * | vector, |
| uint32_t | index ) |
removes an item from an ARC_Vector at an index
| [in] | vector | ARC_Vector to remove from |
| [in] | index | position of data to remove |
Definition at line 107 of file vector.c.
References ARC_DEBUG_LOG_ERROR, arc_errno, ARC_ERRNO_DATA, ARC_Vector::currentCapacity, ARC_Vector::currentSize, ARC_Vector::data, and ARC_Vector::destroyDataFn.
Referenced by ARC_Handler_Clean(), ARC_Handler_RemoveIndex(), ARC_Vector_Clear(), and ARC_Vector_Remove().