STASIS
A pipeline delivery generator
Loading...
Searching...
No Matches
strlist.h
Go to the documentation of this file.
1
5#ifndef STASIS_STRLIST_H
6#define STASIS_STRLIST_H
7
8typedef int (ReaderFn)(size_t line, char **);
9
10#include <stdlib.h>
11#include "core.h"
12#include "utils.h"
13#include "str.h"
14
15
16struct StrList {
17 size_t num_alloc;
18 size_t num_inuse;
19 char **data;
20};
21
22struct StrList *strlist_init();
23void strlist_remove(struct StrList *pStrList, size_t index);
24long double strlist_item_as_long_double(struct StrList *pStrList, size_t index);
25double strlist_item_as_double(struct StrList *pStrList, size_t index);
26float strlist_item_as_float(struct StrList *pStrList, size_t index);
27unsigned long long strlist_item_as_ulong_long(struct StrList *pStrList, size_t index);
28long long strlist_item_as_long_long(struct StrList *pStrList, size_t index);
29unsigned long strlist_item_as_ulong(struct StrList *pStrList, size_t index);
30long strlist_item_as_long(struct StrList *pStrList, size_t index);
31unsigned int strlist_item_as_uint(struct StrList *pStrList, size_t index);
32int strlist_item_as_int(struct StrList *pStrList, size_t index);
33unsigned short strlist_item_as_ushort(struct StrList *pStrList, size_t index);
34short strlist_item_as_short(struct StrList *pStrList, size_t index);
35unsigned char strlist_item_as_uchar(struct StrList *pStrList, size_t index);
36char strlist_item_as_char(struct StrList *pStrList, size_t index);
37char *strlist_item_as_str(struct StrList *pStrList, size_t index);
38char *strlist_item(struct StrList *pStrList, size_t index);
39void strlist_set(struct StrList **pStrList, size_t index, char *value);
40size_t strlist_count(struct StrList *pStrList);
41void strlist_reverse(struct StrList *pStrList);
42void strlist_sort(struct StrList *pStrList, unsigned int mode);
43int strlist_contains(struct StrList *pStrList, const char *value, size_t *index_of);
44int strlist_append_file(struct StrList *pStrList, char *path, ReaderFn *readerFn);
45void strlist_append_strlist(struct StrList *pStrList1, struct StrList *pStrList2);
46void strlist_append(struct StrList **pStrList, char *str);
47void strlist_append_array(struct StrList *pStrList, char **arr);
48
49int strlist_append_tokenize(struct StrList *pStrList, char *str, char *delim);
50
51int strlist_append_tokenize_raw(struct StrList *pStrList, char *str, char *delim);
52int strlist_appendf(struct StrList **pStrList, const char *fmt, ...);
53struct StrList *strlist_copy(struct StrList *pStrList);
54int strlist_cmp(struct StrList *a, struct StrList *b);
55void strlist_free(struct StrList **pStrList);
56
57#define STRLIST_E_SUCCESS 0
58#define STRLIST_E_OUT_OF_RANGE 1
59#define STRLIST_E_INVALID_VALUE 2
60#define STRLIST_E_UNKNOWN 3
61extern int strlist_errno;
62const char *strlist_get_error(int flag);
63
64
65#endif //STASIS_STRLIST_H
void strlist_append(struct StrList **pStrList, char *str)
Definition strlist.c:38
short strlist_item_as_short(struct StrList *pStrList, size_t index)
Definition strlist.c:559
void strlist_free(struct StrList **pStrList)
Definition strlist.c:17
void strlist_set(struct StrList **pStrList, size_t index, char *value)
Definition strlist.c:433
unsigned char strlist_item_as_uchar(struct StrList *pStrList, size_t index)
Definition strlist.c:534
unsigned short strlist_item_as_ushort(struct StrList *pStrList, size_t index)
Definition strlist.c:583
void strlist_sort(struct StrList *pStrList, unsigned int mode)
Definition strlist.c:382
int strlist_append_file(struct StrList *pStrList, char *path, ReaderFn *readerFn)
Definition strlist.c:71
struct StrList * strlist_copy(struct StrList *pStrList)
Definition strlist.c:309
char * strlist_item_as_str(struct StrList *pStrList, size_t index)
Definition strlist.c:499
int strlist_contains(struct StrList *pStrList, const char *value, size_t *index_of)
Definition strlist.c:167
void strlist_remove(struct StrList *pStrList, size_t index)
Definition strlist.c:331
long long strlist_item_as_long_long(struct StrList *pStrList, size_t index)
Definition strlist.c:708
unsigned int strlist_item_as_uint(struct StrList *pStrList, size_t index)
Definition strlist.c:633
char * strlist_item(struct StrList *pStrList, size_t index)
Definition strlist.c:486
struct StrList * strlist_init()
Definition strlist.c:831
int strlist_append_tokenize(struct StrList *pStrList, char *str, char *delim)
Definition strlist.c:225
float strlist_item_as_float(struct StrList *pStrList, size_t index)
Definition strlist.c:758
int strlist_append_tokenize_raw(struct StrList *pStrList, char *str, char *delim)
Definition strlist.c:257
void strlist_append_array(struct StrList *pStrList, char **arr)
Definition strlist.c:210
long double strlist_item_as_long_double(struct StrList *pStrList, size_t index)
Definition strlist.c:808
size_t strlist_count(struct StrList *pStrList)
Definition strlist.c:416
unsigned long strlist_item_as_ulong(struct StrList *pStrList, size_t index)
Definition strlist.c:683
char strlist_item_as_char(struct StrList *pStrList, size_t index)
Definition strlist.c:509
int strlist_appendf(struct StrList **pStrList, const char *fmt,...)
Definition strlist.c:290
void strlist_append_strlist(struct StrList *pStrList1, struct StrList *pStrList2)
Definition strlist.c:191
unsigned long long strlist_item_as_ulong_long(struct StrList *pStrList, size_t index)
Definition strlist.c:733
double strlist_item_as_double(struct StrList *pStrList, size_t index)
Definition strlist.c:783
void strlist_reverse(struct StrList *pStrList)
Definition strlist.c:393
int strlist_item_as_int(struct StrList *pStrList, size_t index)
Definition strlist.c:608
long strlist_item_as_long(struct StrList *pStrList, size_t index)
Definition strlist.c:658
int strlist_cmp(struct StrList *a, struct StrList *b)
Definition strlist.c:353
Definition strlist.h:16