12 #ifndef ARB_STRARRAY_H
13 #define ARB_STRARRAY_H
21 #ifndef _GLIBCXX_ALGORITHM
24 #ifndef _GLIBCXX_CSTDLIB
40 return elems == 0 && allocated == 0;
49 if (new_allocated != allocated) {
55 allocated = new_allocated;
61 if (allocated <= forElems) {
62 forElems = alloc_ahead ? (forElems>7 ? forElems*3/2 : 10) : forElems;
86 bool empty()
const {
return elems == 0; }
91 return elems ? str[i] :
NULp;
94 void swap(
int i1,
int i2) {
101 void move(
int from,
int to);
110 for (
int i =
size()-1; i >= newsize; i--) {
123 sort(compare, client_data);
124 uniq(compare, client_data);
127 int index_of(
const char *search_for)
const;
154 if (insert_before<
int(
size())) {
155 move(-1, insert_before);
188 void put(
const char *elem) {
192 str[i] =
const_cast<char*
>(elem);
201 if (insert_before<
int(
size())) {
202 move(-1, insert_before);
206 const char *
replace(
int i,
const char *elem) {
208 const char *old =
str[i];
209 str[i] =
const_cast<char*
>(elem);
239 #error arb_strarray.h included twice
240 #endif // ARB_STRARRAY_H
void set_space(size_t new_allocated)
void put(const char *elem)
int(* CharPtrArray_compare_fun)(const void *p0, const void *p1, void *client_data)
~ConstStrArray() OVERRIDE
char * ARB_strdup(const char *str)
void uniq(CharPtrArray_compare_fun compare, void *client_data)
const char * operator[](int i) const
void set_memblock(char *block)
bool allocated_index(int i) const
char * replace(int i, char *elem)
virtual void free_elem(int i)=0
void swap(int i1, int i2)
int index_of(const char *search_for) const
void GBT_splitNdestroy_string(ConstStrArray &names, char *&namelist, const char *separator, SplitMode mode)
CONSTEXPR_INLINE_Cxx14 void swap(unsigned char &c1, unsigned char &c2)
void ARB_recalloc(TYPE *&tgt, size_t oelem, size_t nelem)
void put_before(int insert_before, const char *elem)
void reserve_space(size_t forElems, bool alloc_ahead)
TYPE * ARB_calloc(size_t nelem)
void put_before(int insert_before, char *elem)
void move(int from, int to)
char * GBT_join_strings(const CharPtrArray &strings, char separator)
MARK_NONFINAL_CLASS(ConstStrArray)
void sort(CharPtrArray_compare_fun compare, void *client_data)
void reserve(size_t forElems)
void GBT_split_string(ConstStrArray &dest, const char *namelist, const char *separator, SplitMode mode)
bool elem_index(int i) const
const char * replace(int i, const char *elem)
PREPARE_MARK_NONFINAL_CLASS(ConstStrArray)
void sort_and_uniq(CharPtrArray_compare_fun compare, void *client_data)