]> git.evergreen-ils.org Git - OpenSRF.git/blob - include/opensrf/string_array.h
89d9f32b3111b6f2817f43a01c98ef59067a2314
[OpenSRF.git] / include / opensrf / string_array.h
1 #ifndef STRING_ARRAY_H
2 #define STRING_ARRAY_H
3
4 #include <stdio.h>
5
6 #include <opensrf/utils.h>
7 #include <opensrf/log.h>
8 #include <opensrf/osrf_list.h>
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 #define STRING_ARRAY_MAX_SIZE 4096
15
16 #define OSRF_STRING_ARRAY_FREE(arr) osrfListFree( (osrfList*) (arr) )
17
18 typedef struct {
19     osrfList list;
20         int size;    // redundant with osrfList.size
21 } osrfStringArray;
22
23 osrfStringArray* osrfNewStringArray( int size );
24
25 void osrfStringArrayAdd( osrfStringArray*, const char* str );
26
27 char* osrfStringArrayGetString( osrfStringArray* arr, int index );
28
29 /* returns true if this array contains the given string */
30 int osrfStringArrayContains(
31         const osrfStringArray* arr, const char* string );
32
33 void osrfStringArrayFree( osrfStringArray* );
34
35 void osrfStringArrayRemove( osrfStringArray* arr, const char* str );
36
37 #ifdef __cplusplus
38 }
39 #endif
40
41 #endif