eina_list_03.c
//Compile with:
//gcc -g eina_list_03.c -o eina_list_03 `pkg-config --cflags --libs eina`
#include <stdio.h>
#include <Eina.h>
int
main(int argc, char **argv)
{
(void)argc;
(void)argv;
Eina_List *list = NULL, *r_list;
Eina_List *l;
Eina_Iterator *itr;
void *list_data;
eina_init();
list = eina_list_append(list, "caprica");
list = eina_list_append(list, "sagittarius");
list = eina_list_append(list, "aerilon");
list = eina_list_append(list, "gemenon");
list = eina_list_promote_list(list, eina_list_nth_list(list, 2));
list = eina_list_demote_list(list, eina_list_nth_list(list, 2));
list = eina_list_remove(list, "sagittarius");
l = eina_list_data_find_list(list, "aerilon");
eina_list_data_set(l, "aquarius");
printf("size: %d\n", eina_list_count(list));
r_list = eina_list_reverse_clone(list);
itr = eina_list_iterator_new(r_list);
EINA_ITERATOR_FOREACH(itr, list_data)
printf("%s\n", (char*)list_data);
eina_iterator_free(itr);
eina_list_free(list);
eina_list_free(r_list);
eina_shutdown();
return 0;
}
Eina.h
Eina Utility library.
eina_iterator_free
EINA_API void eina_iterator_free(Eina_Iterator *iterator)
Frees an iterator.
Definition eina_iterator.c:98
EINA_ITERATOR_FOREACH
#define EINA_ITERATOR_FOREACH(itr, data)
Definition for the macro to iterate over all elements easily.
Definition eina_iterator.h:448
Eina_Iterator
struct _Eina_Iterator Eina_Iterator
Abstract type for iterators.
Definition eina_iterator.h:126
eina_list_demote_list
EINA_API Eina_List * eina_list_demote_list(Eina_List *list, Eina_List *move_list)
Moves the specified data to the tail of the list.
Definition eina_list.c:889
eina_list_nth_list
EINA_API Eina_List * eina_list_nth_list(const Eina_List *list, unsigned int n)
Gets the nth member's list node in a list.
Definition eina_list.c:1006
eina_list_append
EINA_API Eina_List * eina_list_append(Eina_List *list, const void *data)
Appends the given data to the given linked list.
Definition eina_list.c:584
Eina_List
struct _Eina_List Eina_List
Type for a generic double linked list.
Definition eina_list.h:304
eina_list_remove
EINA_API Eina_List * eina_list_remove(Eina_List *list, const void *data)
Removes the first instance of the specified data from the given list.
Definition eina_list.c:773
eina_list_free
EINA_API Eina_List * eina_list_free(Eina_List *list)
Frees an entire list and all the nodes, ignoring the data contained.
Definition eina_list.c:823
eina_list_iterator_new
EINA_API Eina_Iterator * eina_list_iterator_new(const Eina_List *list)
Returns a new iterator associated with a list.
Definition eina_list.c:1574
eina_list_reverse_clone
EINA_API Eina_List * eina_list_reverse_clone(const Eina_List *list)
Clones (copies) all the elements in the list in reverse order.
Definition eina_list.c:1072
eina_list_promote_list
EINA_API Eina_List * eina_list_promote_list(Eina_List *list, Eina_List *move_list)
Moves the specified data to the head of the list.
Definition eina_list.c:845
eina_list_data_find_list
EINA_API Eina_List * eina_list_data_find_list(const Eina_List *list, const void *data)
Finds a member of a list and returns it as a list node.
Definition eina_list.c:975
eina_shutdown
EINA_API int eina_shutdown(void)
Shuts down the Eina library.
Definition eina_main.c:379
eina_init
EINA_API int eina_init(void)
Initializes the Eina library.
Definition eina_main.c:291