]> git.evergreen-ils.org Git - OpenSRF.git/blob - include/opensrf/string_array.h
Move nested headers into complation guard;
[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)\
17     if(arr) {osrfListFree(arr->list); free(arr);}
18         
19
20 struct string_array_struct {
21     osrfList* list;
22     int size;
23 };
24 typedef struct string_array_struct osrfStringArray;
25
26 osrfStringArray* osrfNewStringArray(int size);
27
28 void osrfStringArrayAdd(osrfStringArray*, char* str);
29
30 char* osrfStringArrayGetString(osrfStringArray* arr, int index);
31
32 /* returns true if this array contains the given string */
33 int osrfStringArrayContains( osrfStringArray* arr, char* string );
34
35 void osrfStringArrayFree(osrfStringArray*);
36
37 /* total size of all included strings */
38 int string_array_get_total_size(osrfStringArray* arr);
39
40 void osrfStringArrayRemove( osrfStringArray* arr, char* str);
41
42 #ifdef __cplusplus
43 }
44 #endif
45
46 #endif