2 * Sorted array definitions for CUPS.
4 * Copyright 2007-2010 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products.
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
10 #ifndef _CUPS_ARRAY_H_
11 # define _CUPS_ARRAY_H_
14 * Include necessary headers...
17 # include "versioning.h"
27 # endif /* __cplusplus */
31 * Types and structures...
34 typedef struct _cups_array_s cups_array_t
;
35 /**** CUPS array type ****/
36 typedef int (*cups_array_func_t
)(void *first
, void *second
, void *data
);
37 /**** Array comparison function ****/
38 typedef int (*cups_ahash_func_t
)(void *element
, void *data
);
39 /**** Array hash function ****/
40 typedef void *(*cups_acopy_func_t
)(void *element
, void *data
);
41 /**** Array element copy function ****/
42 typedef void (*cups_afree_func_t
)(void *element
, void *data
);
43 /**** Array element free function ****/
50 extern int cupsArrayAdd(cups_array_t
*a
, void *e
) _CUPS_API_1_2
;
51 extern void cupsArrayClear(cups_array_t
*a
) _CUPS_API_1_2
;
52 extern int cupsArrayCount(cups_array_t
*a
) _CUPS_API_1_2
;
53 extern void *cupsArrayCurrent(cups_array_t
*a
) _CUPS_API_1_2
;
54 extern void cupsArrayDelete(cups_array_t
*a
) _CUPS_API_1_2
;
55 extern cups_array_t
*cupsArrayDup(cups_array_t
*a
) _CUPS_API_1_2
;
56 extern void *cupsArrayFind(cups_array_t
*a
, void *e
) _CUPS_API_1_2
;
57 extern void *cupsArrayFirst(cups_array_t
*a
) _CUPS_API_1_2
;
58 extern int cupsArrayGetIndex(cups_array_t
*a
) _CUPS_API_1_3
;
59 extern int cupsArrayGetInsert(cups_array_t
*a
) _CUPS_API_1_3
;
60 extern void *cupsArrayIndex(cups_array_t
*a
, int n
) _CUPS_API_1_2
;
61 extern int cupsArrayInsert(cups_array_t
*a
, void *e
) _CUPS_API_1_2
;
62 extern void *cupsArrayLast(cups_array_t
*a
) _CUPS_API_1_2
;
63 extern cups_array_t
*cupsArrayNew(cups_array_func_t f
, void *d
) _CUPS_API_1_2
;
64 extern cups_array_t
*cupsArrayNew2(cups_array_func_t f
, void *d
,
65 cups_ahash_func_t h
, int hsize
) _CUPS_API_1_3
;
66 extern cups_array_t
*cupsArrayNew3(cups_array_func_t f
, void *d
,
67 cups_ahash_func_t h
, int hsize
,
69 cups_afree_func_t ff
) _CUPS_API_1_5
;
70 extern void *cupsArrayNext(cups_array_t
*a
) _CUPS_API_1_2
;
71 extern void *cupsArrayPrev(cups_array_t
*a
) _CUPS_API_1_2
;
72 extern int cupsArrayRemove(cups_array_t
*a
, void *e
) _CUPS_API_1_2
;
73 extern void *cupsArrayRestore(cups_array_t
*a
) _CUPS_API_1_2
;
74 extern int cupsArraySave(cups_array_t
*a
) _CUPS_API_1_2
;
75 extern void *cupsArrayUserData(cups_array_t
*a
) _CUPS_API_1_2
;
79 # endif /* __cplusplus */
80 #endif /* !_CUPS_ARRAY_H_ */