1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*======================================================================
3  FILE: icalarray.h
4  CREATOR: Damon Chaplin 07 March 2001
5 
6 
7  $Id: icalarray.h,v 1.5 2008-01-15 23:17:40 dothebart Exp $
8  $Locker:  $
9 
10  (C) COPYRIGHT 2001, Ximian, Inc.
11 
12  This program is free software; you can redistribute it and/or modify
13  it under the terms of either:
14 
15     The LGPL as published by the Free Software Foundation, version
16     2.1, available at: http://www.fsf.org/copyleft/lesser.html
17 
18   Or:
19 
20     The Mozilla Public License Version 1.0. You may obtain a copy of
21     the License at http://www.mozilla.org/MPL/
22 
23 
24 ======================================================================*/
25 
26 
27 #ifndef ICALARRAY_H
28 #define ICALARRAY_H
29 
30 /** @file icalarray.h
31  *
32  *  @brief An array of arbitrarily-sized elements which grows
33  *  dynamically as elements are added.
34  */
35 
36 typedef struct _icalarray icalarray;
37 struct _icalarray {
38     unsigned int	 element_size;
39     unsigned int	 increment_size;
40     unsigned int	 num_elements;
41     unsigned int	 space_allocated;
42     void		*data;
43 };
44 
45 
46 
47 icalarray *icalarray_new		(int		 element_size,
48 					 int		 increment_size);
49 icalarray *icalarray_copy		(icalarray	*array);
50 void	   icalarray_free		(icalarray	*array);
51 
52 void	   icalarray_append		(icalarray	*array,
53 					 const void		*element);
54 void	   icalarray_remove_element_at	(icalarray	*array,
55 					 int		 position);
56 
57 void	  *icalarray_element_at		(icalarray	*array,
58 					 int		 position);
59 
60 void	   icalarray_sort		(icalarray	*array,
61 					 int	       (*compare) (const void *, const void *));
62 
63 
64 #endif /* ICALARRAY_H */
65