1 /*************************************************************************
2 * xarray.h: Mutable (dynamically growable) array (header file)
3 *************************************************************************
4 * Copyright (C) 2004 Commonwealth Scientific and Industrial Research
5 * Organisation (CSIRO) Australia
6 * Copyright (C) 2004 the VideoLAN team
10 * Authors: Andre Pang <Andre.Pang@csiro.au>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 ************************************************************************/
30 /* define this to 'static' for static linkage */
33 #define XARRAY_DEFAULT_SIZE 69
34 #define xarray_malloc malloc
39 XARRAY_SUCCESS, XARRAY_ENULLPOINTER, XARRAY_ENEGATIVEINDEX,
40 XARRAY_EINDEXTOOLARGE, XARRAY_ENOMEM, XARRAY_EEMPTYARRAY,
41 XARRAY_ECOUNTOUTOFBOUNDS
48 int last_valid_element;
50 unsigned int last_error;
55 XSTATIC int xarray_AddObject (XArray *xarray, void *object);
56 XSTATIC int xarray_InsertObject (XArray *xarray, void *object,
57 unsigned int at_index);
58 XSTATIC int xarray_RemoveLastObject (XArray *xarray);
59 XSTATIC int xarray_RemoveObject (XArray *xarray, unsigned int at_index);
60 XSTATIC int xarray_RemoveObjects (XArray *xarray, unsigned int at_index,
62 XSTATIC int xarray_RemoveObjectsAfter (XArray *xarray, unsigned int index);
63 XSTATIC int xarray_ReplaceObject (XArray *xarray, unsigned int index,
66 /* Immutable methods */
67 XSTATIC XArray * xarray_New ();
68 XSTATIC int xarray_ObjectAtIndex (XArray *xarray, unsigned int index,
70 XSTATIC int xarray_Count (XArray *xarray, unsigned int *out_count);
72 #endif /* __XARRAY_H__ */