]> git.sesse.net Git - vlc/blob - modules/codec/cmml/xarray.h
x264 change that qcomp-parameter determinates rc-mode
[vlc] / modules / codec / cmml / xarray.h
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
7  *
8  * $Id$
9  *
10  * Authors: Andre Pang <Andre.Pang@csiro.au>
11  *
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.
16  *
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.
21  *
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  ************************************************************************/
26
27 #ifndef __XARRAY_H__
28 #define __XARRAY_H__
29
30 #define XARRAY_DEFAULT_SIZE 69
31
32 /* Error codes */
33 enum xarray_errors
34 {
35     XARRAY_SUCCESS, XARRAY_ENULLPOINTER, XARRAY_ENEGATIVEINDEX,
36     XARRAY_EINDEXTOOLARGE, XARRAY_ENOMEM, XARRAY_EEMPTYARRAY,
37     XARRAY_ECOUNTOUTOFBOUNDS
38 };
39
40
41 typedef struct
42 {
43     void **array;
44     int last_valid_element;
45     unsigned int size;
46     unsigned int last_error;
47 }
48 XArray;
49
50 /* Mutable methods */
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,
57                                        int count);
58 int      xarray_RemoveObjectsAfter (XArray *xarray, unsigned int index);
59 int      xarray_ReplaceObject (XArray *xarray, unsigned int index,
60                                        void *new_object);
61
62 /* Immutable methods */
63 XArray * xarray_New ();
64 int      xarray_ObjectAtIndex (XArray *xarray, unsigned int index,
65                                        void **out_object);
66 int      xarray_Count (XArray *xarray, unsigned int *out_count);
67
68 #endif /* __XARRAY_H__ */
69