3 @brief Header for osrfStringArray, a vector of strings.
5 An osrfStringArray manages an array of character pointers pointing to nul-terminated
6 strings. New entries are added at the end. When a string is removed, entries above
7 it are shifted down to fill in the gap.
10 #ifndef STRING_ARRAY_H
11 #define STRING_ARRAY_H
15 #include <opensrf/utils.h>
16 #include <opensrf/log.h>
17 #include <opensrf/osrf_list.h>
24 @brief Maximum number of strings in an osrfStringArray.
26 This ostensible limit is not enforced. If you exceed it, you'll get an error message,
27 but only as a slap on the wrist. You'll still get your big list of strings.
29 #define STRING_ARRAY_MAX_SIZE 4096
31 /** @brief Macro version of osrfStringArrayFree() */
32 #define OSRF_STRING_ARRAY_FREE(arr) osrfListFree( (osrfList*) (arr) )
35 @brief Structure of an osrfStringArray.
38 /** @brief The underlying container of pointers. */
40 /** @brief The number of strings stored. */
41 int size; // redundant with list.size
44 osrfStringArray* osrfNewStringArray( int size );
46 void osrfStringArrayAdd( osrfStringArray*, const char* str );
48 char* osrfStringArrayGetString( osrfStringArray* arr, int index );
50 int osrfStringArrayContains(
51 const osrfStringArray* arr, const char* string );
53 void osrfStringArrayFree( osrfStringArray* );
55 void osrfStringArrayRemove( osrfStringArray* arr, const char* str );
57 osrfStringArray* osrfStringArrayTokenize( const char* src, char delim );