refactoring done, small bugfixes included, vectors and lists of non-primitive types are not working though
This commit is contained in:
+16
-28
@@ -4,51 +4,39 @@
|
||||
#include <odweta/util.h>
|
||||
|
||||
typedef struct {
|
||||
dataType_e type;
|
||||
type_e type;
|
||||
size_t size;
|
||||
size_t capacity;
|
||||
size_t elementSize;
|
||||
void* data;
|
||||
size_t element_size;
|
||||
void *data;
|
||||
} vector_t;
|
||||
|
||||
vector_t*
|
||||
vectorInit(dataType_e dataType); // size gets determined by the dataType and the capacity starts at 1 and x1.5 every time the vector gets filled up
|
||||
vector_t *vector_new(type_e type); // size gets determined by the dataType and the capacity starts at 1 and x1.5 every time the vector gets filled up
|
||||
|
||||
void
|
||||
vectorReset(vector_t* v); // sets the vector to its original state
|
||||
void vector_reset(vector_t *this); // sets the vector to its original state
|
||||
|
||||
void*
|
||||
vectorPop(vector_t* v); // remove one value from the end of the vector and return it
|
||||
void *vector_pop(vector_t *this); // remove one value from the end of the vector and return it
|
||||
|
||||
void
|
||||
vectorPush(vector_t* v, void* element); // push one value at the end of the vector
|
||||
void vector_push(vector_t *this, void *element); // push one value at the end of the vector
|
||||
|
||||
void
|
||||
vectorCleanup(vector_t* v); // freeing pointers
|
||||
void vector_cleanup(vector_t *this); // freeing pointers
|
||||
|
||||
void
|
||||
vectorPrint(vector_t* v); // shows the vector
|
||||
void vector_print(vector_t *this); // shows the vector
|
||||
|
||||
void
|
||||
vectorPrintAsString(vector_t* v); // show the vector as a string if the v->type is CHAR
|
||||
void vector_print_as_string(vector_t *this); // show the vector as a string if the v->type is CHAR
|
||||
|
||||
void
|
||||
vectorInsertAt(vector_t* v, int index, void* element); // inserts an element 'element' at index 'index'
|
||||
void vector_insert_at(vector_t *this, int index, void *element); // inserts an element 'element' at index 'index'
|
||||
|
||||
void
|
||||
vectorSetAt(vector_t* v, int index, void* element); // set an element's value at a given index
|
||||
void vector_set_at(vector_t *this, int index, void *element); // set an element's value at a given index
|
||||
|
||||
char*
|
||||
vectorToString(vector_t* v); // convert the vector into a regular string
|
||||
char *vector_to_string(vector_t *this); // convert the vector into a regular string
|
||||
|
||||
void*
|
||||
vectorGetAt(vector_t* v, int index); // get an element at the given index
|
||||
void *vector_get_at(vector_t *this, int index); // get an element at the given index
|
||||
|
||||
void
|
||||
vectorRemoveAt(vector_t* v, int index);
|
||||
void vector_remove_at(vector_t *this, int index);
|
||||
|
||||
|
||||
|
||||
void _printVectorRecursive(vector_t* v, int depth);
|
||||
void _vector_print_recursive(vector_t *this, int depth);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user