r3/include/str_array.h

36 lines
695 B
C
Raw Normal View History

2014-05-14 23:52:45 -04:00
/*
2014-05-16 08:22:25 -04:00
* str_array.h
2014-05-14 23:52:45 -04:00
* Copyright (C) 2014 c9s <c9s@c9smba.local>
*
* Distributed under terms of the MIT license.
*/
#ifndef TOKEN_H
#define TOKEN_H
2014-05-16 06:03:52 -04:00
typedef struct _str_array {
2014-05-14 23:52:45 -04:00
char **tokens;
int len;
int cap;
2014-05-16 06:03:52 -04:00
} str_array;
2014-05-14 23:52:45 -04:00
2014-05-16 06:03:52 -04:00
str_array * str_array_create(int cap);
2014-05-14 23:52:45 -04:00
2014-05-16 06:03:52 -04:00
bool str_array_is_full(str_array * l);
2014-05-14 23:52:45 -04:00
2014-05-16 06:03:52 -04:00
bool str_array_resize(str_array *l, int new_cap);
2014-05-14 23:52:45 -04:00
2014-05-16 06:03:52 -04:00
bool str_array_append(str_array * list, char * token);
2014-05-14 23:52:45 -04:00
2014-05-16 06:03:52 -04:00
void str_array_free(str_array *l);
2014-05-14 23:52:45 -04:00
2014-05-16 06:03:52 -04:00
void str_array_dump(str_array *l);
2014-05-15 00:47:14 -04:00
2014-05-16 06:03:52 -04:00
str_array * split_route_pattern(char *pattern, int pattern_len);
2014-05-15 00:47:14 -04:00
2014-05-16 06:03:52 -04:00
#define str_array_fetch(t,i) t->tokens[i]
#define str_array_len(t) t->len
#define str_array_cap(t) t->cap
2014-05-15 01:39:50 -04:00
2014-05-14 23:52:45 -04:00
#endif /* !TOKEN_H */