Files
cKit/Foundation/c_ArrayList.h
T
2026-08-29 11:39:28 +08:00

37 lines
940 B
C

#ifndef INCLUDED_C_ARRAYLIST_H
#define INCLUDED_C_ARRAYLIST_H
#ifndef INCLUDED_C_TYPES_H
#include <c_Types.h>
#endif /*INCLUDED_C_TYPES_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
void* array;
int obj_size;
c_size_t capacity;
c_size_t size;
}c_ArrayList_t;
#define c_ArrayList(obj_size) ((c_ArrayList_t) { 0, (obj_size), 0, 0 })
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
c_err_t c_ArrayList_Init(c_ArrayList_t* self, c_size_t obj_size, c_size_t capacity);
void c_ArrayList_Destroy(c_ArrayList_t* self);
c_err_t c_ArrayList_Add(c_ArrayList_t* self, void* obj);
void* c_ArrayList_Get(c_ArrayList_t* self, c_size_t index);
c_err_t c_ArrayList_Remove(c_ArrayList_t* self, c_size_t index);
#endif /*INCLUDED_C_ARRAYLIST_H*/