Blame src/libkeymap/keymap/array.h
|
Packit Service |
50ad14 |
#ifndef LK_ARRAY_H
|
|
Packit Service |
50ad14 |
#define LK_ARRAY_H
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/**
|
|
Packit Service |
50ad14 |
* @brief Basic structure for array implementation.
|
|
Packit Service |
50ad14 |
* @details The array is designed to store an arbitrary number of similar items.
|
|
Packit Service |
50ad14 |
*/
|
|
Packit Service |
50ad14 |
struct lk_array {
|
|
Packit Service |
50ad14 |
void *array; /**< Data pointer. */
|
|
Packit Service |
50ad14 |
size_t memb; /**< One element size. */
|
|
Packit Service |
50ad14 |
size_t count; /**< Number of elements. */
|
|
Packit Service |
50ad14 |
size_t total; /**< Total number of allocated elements. */
|
|
Packit Service |
50ad14 |
};
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int lk_array_init(struct lk_array *a, size_t memb, size_t size);
|
|
Packit Service |
50ad14 |
int lk_array_free(struct lk_array *a);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int lk_array_empty(struct lk_array *a);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int lk_array_append(struct lk_array *a, const void *e);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int lk_array_set(struct lk_array *a, unsigned int i, const void *e);
|
|
Packit Service |
50ad14 |
void *lk_array_get(struct lk_array *a, unsigned int i);
|
|
Packit Service |
50ad14 |
void *lk_array_get_ptr(struct lk_array *a, unsigned int i);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int lk_array_unset(struct lk_array *a, unsigned int i);
|
|
Packit Service |
50ad14 |
int lk_array_exists(struct lk_array *a, unsigned int i);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#endif /* LK_ARRAY_H */
|