Loading...
Searching...
No Matches
datastructures.h
Go to the documentation of this file.
/* SPDX-License-Identifier: Zlib */
#ifndef GIRARA_DATASTRUCTURES_H
#define GIRARA_DATASTRUCTURES_H
#include <stddef.h>
#include <stdbool.h>
#include <sys/types.h>
#include <glib.h>
#include "macros.h"
#include "types.h"
girara_list_t* girara_list_new(void) GIRARA_VISIBLE;
girara_list_t* girara_list_new_with_free(girara_free_function_t gfree) GIRARA_VISIBLE;
girara_list_t* girara_sorted_list_new(girara_compare_function_t cmp) GIRARA_VISIBLE;
girara_list_t* girara_sorted_list_new_with_free(girara_compare_function_t cmp,
girara_free_function_t gfree) GIRARA_VISIBLE;
void girara_list_set_free_function(girara_list_t* list, girara_free_function_t gfree) GIRARA_VISIBLE;
void girara_list_clear(girara_list_t* list) GIRARA_VISIBLE;
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(girara_list_t, girara_list_clear)
void girara_list_free(girara_list_t* list) GIRARA_VISIBLE;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(girara_list_t, girara_list_free)
void girara_list_append(girara_list_t* list, void* data) GIRARA_VISIBLE;
void girara_list_prepend(girara_list_t* list, void* data) GIRARA_VISIBLE;
void girara_list_remove(girara_list_t* list, void* data) GIRARA_VISIBLE;
void* girara_list_nth(girara_list_t* list, size_t n) GIRARA_VISIBLE;
void girara_list_set_nth(girara_list_t* list, size_t n, void* data) GIRARA_VISIBLE;
bool girara_list_contains(girara_list_t* list, void* data) GIRARA_VISIBLE;
size_t girara_list_size(girara_list_t* list) GIRARA_VISIBLE;
ssize_t girara_list_position(girara_list_t* list, void* data) GIRARA_VISIBLE;
void girara_list_sort(girara_list_t* list, girara_compare_function_t compare) GIRARA_VISIBLE;
void* girara_list_find(const girara_list_t* list, girara_compare_function_t compare, const void* data) GIRARA_VISIBLE;
girara_list_iterator_t* girara_list_iterator(girara_list_t* list) GIRARA_VISIBLE;
girara_list_iterator_t* girara_list_iterator_copy(girara_list_iterator_t* iter) GIRARA_VISIBLE;
girara_list_iterator_t* girara_list_iterator_next(girara_list_iterator_t* iter) GIRARA_VISIBLE;
bool girara_list_iterator_has_next(girara_list_iterator_t* iter) GIRARA_VISIBLE;
girara_list_iterator_t* girara_list_iterator_previous(girara_list_iterator_t* iter) GIRARA_VISIBLE;
bool girara_list_iterator_has_previous(girara_list_iterator_t* iter) GIRARA_VISIBLE;
void girara_list_iterator_remove(girara_list_iterator_t* iter) GIRARA_VISIBLE;
bool girara_list_iterator_is_valid(girara_list_iterator_t* iter) GIRARA_VISIBLE;
void* girara_list_iterator_data(girara_list_iterator_t* iter) GIRARA_VISIBLE;
void girara_list_iterator_set(girara_list_iterator_t* iter, void* data) GIRARA_VISIBLE;
void girara_list_iterator_free(girara_list_iterator_t* iter) GIRARA_VISIBLE;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(girara_list_iterator_t, girara_list_iterator_free)
void girara_list_foreach(girara_list_t* list, girara_list_callback_t callback, void* data) GIRARA_VISIBLE;
girara_list_t* girara_list_merge(girara_list_t* list, girara_list_t* other) GIRARA_VISIBLE;
girara_tree_node_t* girara_node_new(void* data) GIRARA_VISIBLE;
void girara_node_set_free_function(girara_tree_node_t* node, girara_free_function_t gfree) GIRARA_VISIBLE;
void girara_node_free(girara_tree_node_t* node) GIRARA_VISIBLE;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(girara_tree_node_t, girara_node_free)
void girara_node_append(girara_tree_node_t* parent, girara_tree_node_t* child) GIRARA_VISIBLE;
girara_tree_node_t* girara_node_append_data(girara_tree_node_t* parent, void* data) GIRARA_VISIBLE;
girara_tree_node_t* girara_node_get_parent(girara_tree_node_t* node) GIRARA_VISIBLE;
girara_tree_node_t* girara_node_get_root(girara_tree_node_t* node) GIRARA_VISIBLE;
girara_list_t* girara_node_get_children(girara_tree_node_t* node) GIRARA_VISIBLE;
size_t girara_node_get_num_children(girara_tree_node_t* node) GIRARA_VISIBLE;
void* girara_node_get_data(girara_tree_node_t* node) GIRARA_VISIBLE;
void girara_node_set_data(girara_tree_node_t* node, void* data) GIRARA_VISIBLE;
#endif
girara_list_clear
void girara_list_clear(girara_list_t *list) GIRARA_VISIBLE
girara_list_new_with_free
girara_list_t * girara_list_new_with_free(girara_free_function_t gfree) GIRARA_VISIBLE
girara_node_get_root
girara_tree_node_t * girara_node_get_root(girara_tree_node_t *node) GIRARA_VISIBLE
girara_node_append
void girara_node_append(girara_tree_node_t *parent, girara_tree_node_t *child) GIRARA_VISIBLE
girara_list_size
size_t girara_list_size(girara_list_t *list) GIRARA_VISIBLE
girara_list_iterator
girara_list_iterator_t * girara_list_iterator(girara_list_t *list) GIRARA_VISIBLE
girara_list_new
girara_list_t * girara_list_new(void) GIRARA_VISIBLE
girara_list_foreach
void girara_list_foreach(girara_list_t *list, girara_list_callback_t callback, void *data) GIRARA_VISIBLE
girara_list_merge
girara_list_t * girara_list_merge(girara_list_t *list, girara_list_t *other) GIRARA_VISIBLE
girara_list_nth
void * girara_list_nth(girara_list_t *list, size_t n) GIRARA_VISIBLE
girara_list_position
ssize_t girara_list_position(girara_list_t *list, void *data) GIRARA_VISIBLE
girara_node_get_parent
girara_tree_node_t * girara_node_get_parent(girara_tree_node_t *node) GIRARA_VISIBLE
girara_list_append
void girara_list_append(girara_list_t *list, void *data) GIRARA_VISIBLE
girara_node_append_data
girara_tree_node_t * girara_node_append_data(girara_tree_node_t *parent, void *data) GIRARA_VISIBLE
girara_list_iterator_has_next
bool girara_list_iterator_has_next(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_list_set_free_function
void girara_list_set_free_function(girara_list_t *list, girara_free_function_t gfree) GIRARA_VISIBLE
girara_list_free
void girara_list_free(girara_list_t *list) GIRARA_VISIBLE
girara_node_free
void girara_node_free(girara_tree_node_t *node) GIRARA_VISIBLE
girara_node_get_num_children
size_t girara_node_get_num_children(girara_tree_node_t *node) GIRARA_VISIBLE
girara_node_set_free_function
void girara_node_set_free_function(girara_tree_node_t *node, girara_free_function_t gfree) GIRARA_VISIBLE
girara_list_contains
bool girara_list_contains(girara_list_t *list, void *data) GIRARA_VISIBLE
girara_list_iterator_copy
girara_list_iterator_t * girara_list_iterator_copy(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_list_prepend
void girara_list_prepend(girara_list_t *list, void *data) GIRARA_VISIBLE
girara_list_iterator_next
girara_list_iterator_t * girara_list_iterator_next(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_list_iterator_data
void * girara_list_iterator_data(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_list_iterator_has_previous
bool girara_list_iterator_has_previous(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_node_new
girara_tree_node_t * girara_node_new(void *data) GIRARA_VISIBLE
girara_list_iterator_free
void girara_list_iterator_free(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_sorted_list_new_with_free
girara_list_t * girara_sorted_list_new_with_free(girara_compare_function_t cmp, girara_free_function_t gfree) GIRARA_VISIBLE
girara_node_get_children
girara_list_t * girara_node_get_children(girara_tree_node_t *node) GIRARA_VISIBLE
girara_list_iterator_remove
void girara_list_iterator_remove(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_list_sort
void girara_list_sort(girara_list_t *list, girara_compare_function_t compare) GIRARA_VISIBLE
girara_sorted_list_new
girara_list_t * girara_sorted_list_new(girara_compare_function_t cmp) GIRARA_VISIBLE
girara_node_set_data
void girara_node_set_data(girara_tree_node_t *node, void *data) GIRARA_VISIBLE
girara_list_remove
void girara_list_remove(girara_list_t *list, void *data) GIRARA_VISIBLE
girara_node_get_data
void * girara_node_get_data(girara_tree_node_t *node) GIRARA_VISIBLE
girara_list_iterator_set
void girara_list_iterator_set(girara_list_iterator_t *iter, void *data) GIRARA_VISIBLE
girara_list_set_nth
void girara_list_set_nth(girara_list_t *list, size_t n, void *data) GIRARA_VISIBLE
girara_list_iterator_previous
girara_list_iterator_t * girara_list_iterator_previous(girara_list_iterator_t *iter) GIRARA_VISIBLE
girara_list_find
void * girara_list_find(const girara_list_t *list, girara_compare_function_t compare, const void *data) GIRARA_VISIBLE
girara_list_iterator_is_valid
bool girara_list_iterator_is_valid(girara_list_iterator_t *iter) GIRARA_VISIBLE
macros.h
GIRARA_VISIBLE
#define GIRARA_VISIBLE
Definition macros.h:52
types.h
girara_compare_function_t
int(* girara_compare_function_t)(const void *data1, const void *data2)
Definition types.h:34
girara_list_iterator_t
struct girara_list_iterator_s girara_list_iterator_t
Definition types.h:11
girara_tree_node_t
struct girara_tree_node_s girara_tree_node_t
Definition types.h:9
girara_list_t
struct girara_list_s girara_list_t
Definition types.h:10
girara_free_function_t
void(* girara_free_function_t)(void *data)
Definition types.h:18
girara_list_callback_t
void(* girara_list_callback_t)(void *data, void *userdata)
Definition types.h:26