• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Sorted array definitions for CUPS.
3  *
4  * Copyright © 2020-2024 by OpenPrinting.
5  * Copyright 2007-2010 by Apple Inc.
6  * Copyright 1997-2007 by Easy Software Products.
7  *
8  * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
9  */
10 
11 #ifndef _CUPS_ARRAY_H_
12 #  define _CUPS_ARRAY_H_
13 
14 /*
15  * Include necessary headers...
16  */
17 
18 #  include "versioning.h"
19 #  include <stdlib.h>
20 
21 
22 /*
23  * C++ magic...
24  */
25 
26 #  ifdef __cplusplus
27 extern "C" {
28 #  endif /* __cplusplus */
29 
30 
31 /*
32  * Types and structures...
33  */
34 
35 typedef struct _cups_array_s cups_array_t;
36 					/**** CUPS array type ****/
37 typedef int (*cups_array_func_t)(void *first, void *second, void *data);
38 					/**** Array comparison function ****/
39 typedef int (*cups_ahash_func_t)(void *element, void *data);
40 					/**** Array hash function ****/
41 typedef void *(*cups_acopy_func_t)(void *element, void *data);
42 					/**** Array element copy function ****/
43 typedef void (*cups_afree_func_t)(void *element, void *data);
44 					/**** Array element free function ****/
45 
46 
47 /*
48  * Functions...
49  */
50 
51 extern int		cupsArrayAdd(cups_array_t *a, void *e) _CUPS_API_1_2;
52 extern void		cupsArrayClear(cups_array_t *a) _CUPS_API_1_2;
53 extern int		cupsArrayCount(cups_array_t *a) _CUPS_API_1_2;
54 extern void		*cupsArrayCurrent(cups_array_t *a) _CUPS_API_1_2;
55 extern void		cupsArrayDelete(cups_array_t *a) _CUPS_API_1_2;
56 extern cups_array_t	*cupsArrayDup(cups_array_t *a) _CUPS_API_1_2;
57 extern void		*cupsArrayFind(cups_array_t *a, void *e) _CUPS_API_1_2;
58 extern void		*cupsArrayFirst(cups_array_t *a) _CUPS_API_1_2;
59 extern int		cupsArrayGetIndex(cups_array_t *a) _CUPS_API_1_3;
60 extern int		cupsArrayGetInsert(cups_array_t *a) _CUPS_API_1_3;
61 extern void		*cupsArrayIndex(cups_array_t *a, int n) _CUPS_API_1_2;
62 extern int		cupsArrayInsert(cups_array_t *a, void *e) _CUPS_API_1_2;
63 extern void		*cupsArrayLast(cups_array_t *a) _CUPS_API_1_2;
64 extern cups_array_t	*cupsArrayNew(cups_array_func_t f, void *d) _CUPS_API_1_2;
65 extern cups_array_t	*cupsArrayNew2(cups_array_func_t f, void *d,
66 			               cups_ahash_func_t h, int hsize) _CUPS_API_1_3;
67 extern cups_array_t	*cupsArrayNew3(cups_array_func_t f, void *d,
68 			               cups_ahash_func_t h, int hsize,
69 				       cups_acopy_func_t cf,
70 				       cups_afree_func_t ff) _CUPS_API_1_5;
71 extern void		*cupsArrayNext(cups_array_t *a) _CUPS_API_1_2;
72 extern void		*cupsArrayPrev(cups_array_t *a) _CUPS_API_1_2;
73 extern int		cupsArrayRemove(cups_array_t *a, void *e) _CUPS_API_1_2;
74 extern void		*cupsArrayRestore(cups_array_t *a) _CUPS_API_1_2;
75 extern int		cupsArraySave(cups_array_t *a) _CUPS_API_1_2;
76 extern void		*cupsArrayUserData(cups_array_t *a) _CUPS_API_1_2;
77 
78 #  ifdef __cplusplus
79 }
80 #  endif /* __cplusplus */
81 #endif /* !_CUPS_ARRAY_H_ */
82