xine-lib  1.2.10
array.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2017 the xine project
3  *
4  * This file is part of xine, a free video player.
5  *
6  * xine is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * xine is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19  *
20  * Array that can grow automatically when you add elements.
21  * Inserting an element in the middle of the array implies memory moves.
22  */
23 #ifndef XINE_ARRAY_H
24 #define XINE_ARRAY_H
25 
26 #include <stddef.h> /* size_t */
27 #include <xine/attributes.h>
28 
29 /* Array type */
30 typedef struct xine_array_s xine_array_t;
31 
32 /* Constructor */
34 
35 /* Destructor */
37 
38 /* Returns the number of element stored in the array */
39 size_t xine_array_size(const xine_array_t *array) XINE_PROTECTED;
40 
41 /* Removes all elements from an array */
43 
44 /* Adds the element at the end of the array */
45 void xine_array_add(xine_array_t *array, void *value) XINE_PROTECTED;
46 
47 /* Inserts an element into an array at the position specified */
48 void xine_array_insert(xine_array_t *array, unsigned int position, void *value) XINE_PROTECTED;
49 
50 /* Removes one element from an array at the position specified */
51 void xine_array_remove(xine_array_t *array, unsigned int position) XINE_PROTECTED;
52 
53 /* Get the element at the position specified */
54 void *xine_array_get(const xine_array_t *array, unsigned int position) XINE_PROTECTED;
55 
56 /* Set the element at the position specified */
57 void xine_array_set(xine_array_t *array, unsigned int position, void *value) XINE_PROTECTED;
58 
59 #endif
60 
XINE_MALLOC
#define XINE_MALLOC
Definition: attributes.h:139
xine_array_delete
void xine_array_delete(xine_array_t *array)
Definition: array.c:72
xine_array_clear
void xine_array_clear(xine_array_t *array)
Definition: array.c:81
xine_array_new
xine_array_t * xine_array_new(size_t initial_size)
Definition: array.c:50
attributes.h
xine_array_remove
void xine_array_remove(xine_array_t *array, unsigned int position)
Definition: array.c:104
xine_array_insert
void xine_array_insert(xine_array_t *array, unsigned int position, void *value)
Definition: array.c:91
xine_array_s
Definition: array.c:33
xine_array_set
void xine_array_set(xine_array_t *array, unsigned int position, void *value)
Definition: array.c:122
xine_array_get
void * xine_array_get(const xine_array_t *array, unsigned int position)
Definition: array.c:115
xine_array_size
size_t xine_array_size(const xine_array_t *array)
Definition: array.c:77
XINE_PROTECTED
#define XINE_PROTECTED
Definition: attributes.h:73
xine_array_add
void xine_array_add(xine_array_t *array, void *value)
Definition: array.c:85