261e672237
API: Fixed CMAKELISTS.txt to work without the encapsulation as it will not work or be viable right now
98 lines
1.5 KiB
C
98 lines
1.5 KiB
C
/*
|
|
* Andrew Haynes
|
|
* dmm.dev@icloud.com
|
|
* No LICENSE
|
|
* Vector Library For C
|
|
*/
|
|
|
|
#ifndef CHAR_H
|
|
#define CHAR_H
|
|
|
|
#define CAPACITY 1024
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
typedef struct
|
|
{
|
|
char* arr;
|
|
size_t size;
|
|
size_t capacity;
|
|
} Vec8_t;
|
|
|
|
__attribute__((overloadable)) Vec8_t
|
|
create(const Vec8_t* input);
|
|
|
|
__attribute__((overloadable)) Vec8_t
|
|
create(const _Bool init);
|
|
|
|
Vec8_t
|
|
reserve(Vec8_t* ptr, size_t max_size);
|
|
|
|
Vec8_t
|
|
shrink_to_fit(Vec8_t* ptr);
|
|
|
|
int
|
|
swap(Vec8_t* ptr, Vec8_t* ptr_other);
|
|
|
|
char*
|
|
data(const Vec8_t* ptr);
|
|
|
|
size_t
|
|
max_size(const Vec8_t* ptr);
|
|
|
|
void delete (Vec8_t* vec);
|
|
|
|
Vec8_t
|
|
clear(Vec8_t* vec);
|
|
|
|
char
|
|
at(const Vec8_t* vec, int idx);
|
|
|
|
__attribute__((overloadable)) Vec8_t*
|
|
erase(Vec8_t* vec, size_t iter);
|
|
|
|
__attribute__((overloadable)) Vec8_t*
|
|
erase(Vec8_t* vec, size_t iter_start, size_t iter_end);
|
|
|
|
void
|
|
print_vec(const Vec8_t* vec);
|
|
|
|
int
|
|
begin(const Vec8_t* vec);
|
|
|
|
int
|
|
end(const Vec8_t* vec);
|
|
|
|
char
|
|
front(const Vec8_t* vec);
|
|
|
|
char
|
|
back(const Vec8_t* vec);
|
|
|
|
int
|
|
empty(const Vec8_t* vec);
|
|
|
|
Vec8_t
|
|
add_back(Vec8_t* vec, char val);
|
|
|
|
Vec8_t
|
|
pop_back(Vec8_t* vec);
|
|
|
|
__attribute__((overloadable)) Vec8_t
|
|
resize(Vec8_t* vec, size_t size);
|
|
|
|
__attribute__((overloadable)) Vec8_t
|
|
resize(Vec8_t* vec, size_t size, char val);
|
|
|
|
__attribute__((overloadable)) Vec8_t
|
|
assign(Vec8_t* vec, const Vec8_t* iterator, size_t iter_start, size_t iter_end);
|
|
|
|
__attribute__((overloadable)) Vec8_t
|
|
assign(Vec8_t* vec, const size_t amount, char val);
|
|
|
|
#endif
|