| 1 | /* |
| 2 | * "$Id: array.h 10996 2013-05-29 11:51:34Z msweet $" |
| 3 | * |
| 4 | * Sorted array definitions for CUPS. |
| 5 | * |
| 6 | * Copyright 2007-2010 by Apple Inc. |
| 7 | * Copyright 1997-2007 by Easy Software Products. |
| 8 | * |
| 9 | * These coded instructions, statements, and computer programs are the |
| 10 | * property of Apple Inc. and are protected by Federal copyright |
| 11 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" |
| 12 | * which should have been included with this file. If this file is |
| 13 | * file is missing or damaged, see the license at "http://www.cups.org/". |
| 14 | * |
| 15 | * This file is subject to the Apple OS-Developed Software exception. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _CUPS_ARRAY_H_ |
| 19 | # define _CUPS_ARRAY_H_ |
| 20 | |
| 21 | /* |
| 22 | * Include necessary headers... |
| 23 | */ |
| 24 | |
| 25 | # include "versioning.h" |
| 26 | # include <stdlib.h> |
| 27 | |
| 28 | |
| 29 | /* |
| 30 | * C++ magic... |
| 31 | */ |
| 32 | |
| 33 | # ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | # endif /* __cplusplus */ |
| 36 | |
| 37 | |
| 38 | /* |
| 39 | * Types and structures... |
| 40 | */ |
| 41 | |
| 42 | typedef struct _cups_array_s cups_array_t; |
| 43 | /**** CUPS array type ****/ |
| 44 | typedef int (*cups_array_func_t)(void *first, void *second, void *data); |
| 45 | /**** Array comparison function ****/ |
| 46 | typedef int (*cups_ahash_func_t)(void *element, void *data); |
| 47 | /**** Array hash function ****/ |
| 48 | typedef void *(*cups_acopy_func_t)(void *element, void *data); |
| 49 | /**** Array element copy function ****/ |
| 50 | typedef void (*cups_afree_func_t)(void *element, void *data); |
| 51 | /**** Array element free function ****/ |
| 52 | |
| 53 | |
| 54 | /* |
| 55 | * Functions... |
| 56 | */ |
| 57 | |
| 58 | extern int cupsArrayAdd(cups_array_t *a, void *e) _CUPS_API_1_2; |
| 59 | extern void cupsArrayClear(cups_array_t *a) _CUPS_API_1_2; |
| 60 | extern int cupsArrayCount(cups_array_t *a) _CUPS_API_1_2; |
| 61 | extern void *cupsArrayCurrent(cups_array_t *a) _CUPS_API_1_2; |
| 62 | extern void cupsArrayDelete(cups_array_t *a) _CUPS_API_1_2; |
| 63 | extern cups_array_t *cupsArrayDup(cups_array_t *a) _CUPS_API_1_2; |
| 64 | extern void *cupsArrayFind(cups_array_t *a, void *e) _CUPS_API_1_2; |
| 65 | extern void *cupsArrayFirst(cups_array_t *a) _CUPS_API_1_2; |
| 66 | extern int cupsArrayGetIndex(cups_array_t *a) _CUPS_API_1_3; |
| 67 | extern int cupsArrayGetInsert(cups_array_t *a) _CUPS_API_1_3; |
| 68 | extern void *cupsArrayIndex(cups_array_t *a, int n) _CUPS_API_1_2; |
| 69 | extern int cupsArrayInsert(cups_array_t *a, void *e) _CUPS_API_1_2; |
| 70 | extern void *cupsArrayLast(cups_array_t *a) _CUPS_API_1_2; |
| 71 | extern cups_array_t *cupsArrayNew(cups_array_func_t f, void *d) _CUPS_API_1_2; |
| 72 | extern cups_array_t *cupsArrayNew2(cups_array_func_t f, void *d, |
| 73 | cups_ahash_func_t h, int hsize) _CUPS_API_1_3; |
| 74 | extern cups_array_t *cupsArrayNew3(cups_array_func_t f, void *d, |
| 75 | cups_ahash_func_t h, int hsize, |
| 76 | cups_acopy_func_t cf, |
| 77 | cups_afree_func_t ff) _CUPS_API_1_5; |
| 78 | extern void *cupsArrayNext(cups_array_t *a) _CUPS_API_1_2; |
| 79 | extern void *cupsArrayPrev(cups_array_t *a) _CUPS_API_1_2; |
| 80 | extern int cupsArrayRemove(cups_array_t *a, void *e) _CUPS_API_1_2; |
| 81 | extern void *cupsArrayRestore(cups_array_t *a) _CUPS_API_1_2; |
| 82 | extern int cupsArraySave(cups_array_t *a) _CUPS_API_1_2; |
| 83 | extern void *cupsArrayUserData(cups_array_t *a) _CUPS_API_1_2; |
| 84 | |
| 85 | # ifdef __cplusplus |
| 86 | } |
| 87 | # endif /* __cplusplus */ |
| 88 | #endif /* !_CUPS_ARRAY_H_ */ |
| 89 | |
| 90 | /* |
| 91 | * End of "$Id: array.h 10996 2013-05-29 11:51:34Z msweet $". |
| 92 | */ |
| 93 | |