42#define STRV(NAME) CSTL_TOKCAT(cstl_STRING, _##NAME)
43#define STRF(NAME, ...) STRV(NAME)(__VA_ARGS__)
44#define STDSTRF(NAME, ...) CSTL_TOKCAT(STDSTRPFX, NAME)(__VA_ARGS__)
47#define cstl_STRING_char_t STRV(char_t)
53typedef STRCHAR STRV(char_t);
74static inline void STRF(init,
struct cstl_STRING *
const s)
87static inline size_t STRF(size,
const struct cstl_STRING *
const s)
103static inline size_t STRF(capacity,
const struct cstl_STRING *
const s)
121static inline void STRF(reserve,
struct cstl_STRING *
const s,
const size_t sz)
141void STRF(resize,
struct cstl_STRING * s,
size_t sz);
154cstl_STRING_char_t * STRF(at,
struct cstl_STRING * s,
size_t i);
166const cstl_STRING_char_t * STRF(at_const,
179static inline cstl_STRING_char_t * STRF(data,
struct cstl_STRING *
const s)
193const cstl_STRING_char_t * STRF(str,
const struct cstl_STRING * s);
207static inline int STRF(compare_str,
209 const cstl_STRING_char_t *
const str)
211 return STDSTRF(cmp, STRF(str, s), str);
225static inline int STRF(compare,
229 return STRF(compare_str, s1, STRF(str, s2));
237static inline void STRF(clear,
struct cstl_STRING *
const s)
255 struct cstl_STRING * s,
size_t pos,
size_t cnt, cstl_STRING_char_t ch);
268void STRF(insert_str_n,
270 const cstl_STRING_char_t * str,
size_t n);
282static inline void STRF(insert_str,
284 const cstl_STRING_char_t *
const str)
286 STRF(insert_str_n, s, pos, str, STDSTRF(len, str));
299static inline void STRF(insert,
303 STRF(insert_str_n, s, pos, STRF(str, ins), STRF(size, ins));
316static inline void STRF(append,
struct cstl_STRING *
const s1,
319 STRF(insert, s1, STRF(size, s1), s2);
333static inline void STRF(append_ch,
struct cstl_STRING *
const s,
334 const size_t cnt,
const cstl_STRING_char_t ch)
336 STRF(insert_ch, s, STRF(size, s), cnt, ch);
350static inline void STRF(append_str_n,
struct cstl_STRING *
const s,
351 const cstl_STRING_char_t *
const str,
354 STRF(insert_str_n, s, STRF(size, s), str, len);
367static inline void STRF(append_str,
struct cstl_STRING *
const s,
368 const cstl_STRING_char_t *
const str)
370 STRF(insert_str, s, STRF(size, s), str);
379static inline void STRF(set_str,
struct cstl_STRING *
const s,
380 const cstl_STRING_char_t *
const str)
383 STRF(append_str, s, str);
393void STRF(erase,
struct cstl_STRING * s,
size_t pos,
size_t n);
408 const struct cstl_STRING * s,
size_t pos,
size_t n,
422ssize_t STRF(find_ch,
const struct cstl_STRING * s, cstl_STRING_char_t ch,
435ssize_t STRF(find_str,
437 const cstl_STRING_char_t * ndl,
450static inline ssize_t STRF(find,
const struct cstl_STRING *
const hay,
454 return STRF(find_str, hay, STRF(str, ndl), pos);
466static inline void STRF(
475extern const cstl_STRING_char_t STRV(nul);
477#undef cstl_STRING_char_t
void cstl_vector_reserve(struct cstl_vector *v, size_t sz)
Request to increase the capacity of the vector.
static size_t cstl_vector_size(const struct cstl_vector *const v)
Get the number of elements in the vector.
static size_t cstl_vector_capacity(const struct cstl_vector *const v)
Get the number of elements the vector can hold.
void cstl_vector_swap(struct cstl_vector *a, struct cstl_vector *b)
Swap the vector objects at the two given locations.
static void * cstl_vector_data(struct cstl_vector *const v)
Get a pointer to the start of the vector data.
static void cstl_vector_init(struct cstl_vector *const v, const size_t sz)
Initialize a vector object.
void cstl_vector_clear(struct cstl_vector *v)
Return a vector to its initialized state.