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 XARRAY_DEFAULT_SIZE 69
35 XARRAY_SUCCESS, XARRAY_ENULLPOINTER, XARRAY_ENEGATIVEINDEX,
36 XARRAY_EINDEXTOOLARGE, XARRAY_ENOMEM, XARRAY_EEMPTYARRAY,
37 XARRAY_ECOUNTOUTOFBOUNDS
44 int last_valid_element;
46 unsigned int last_error;
51 int xarray_AddObject (XArray *xarray, void *object);
52 int xarray_InsertObject (XArray *xarray, void *object,
53 unsigned int at_index);
54 int xarray_RemoveLastObject (XArray *xarray);
55 int xarray_RemoveObject (XArray *xarray, unsigned int at_index);
56 int xarray_RemoveObjects (XArray *xarray, unsigned int at_index,
58 int xarray_RemoveObjectsAfter (XArray *xarray, unsigned int index);
59 int xarray_ReplaceObject (XArray *xarray, unsigned int index,
62 /* Immutable methods */
63 XArray * xarray_New ();
64 int xarray_ObjectAtIndex (XArray *xarray, unsigned int index,
66 int xarray_Count (XArray *xarray, unsigned int *out_count);
68 #endif /* __XARRAY_H__ */