r3/include/str_array.h

44 lines
968 B
C
Raw Normal View History

2014-05-28 09:08:06 -04:00
/*
* str_array.h
2014-06-27 01:24:40 -04:00
* Copyright (C) 2014 c9s <yoanlin93@gmail.com>
2014-05-28 09:08:06 -04:00
*
* Distributed under terms of the MIT license.
*/
#ifndef STR_ARRAY_H
#define STR_ARRAY_H
#include "r3.h"
#include "memory.h"
2014-05-28 09:08:06 -04:00
typedef struct _str_array {
R3_VECTOR(r3_iovec_t) slugs;
R3_VECTOR(r3_iovec_t) tokens;
2014-05-28 09:08:06 -04:00
} str_array;
// str_array * str_array_create(int cap);
2014-05-28 09:08:06 -04:00
bool str_array_slugs_full(const str_array * l);
// bool str_array_tokens_full(const str_array * l);
2014-05-28 09:08:06 -04:00
// bool str_array_resize(str_array *l, int new_cap);
2014-05-28 09:08:06 -04:00
// bool str_array_append_slug(str_array * l, char * slug);
2018-02-20 12:18:43 -05:00
bool str_array_append(str_array * l, const char * token, unsigned int len);
2014-05-28 09:08:06 -04:00
void str_array_free(str_array *l);
void str_array_dump_slugs(const str_array *l);
2014-05-28 09:08:06 -04:00
void str_array_dump(const str_array *l);
str_array * split_route_pattern(char *pattern, int pattern_len);
#define str_array_fetch(t,i) t->tokens[i]
#define str_array_len(t) t->len
#define str_array_cap(t) t->cap
#endif /* !STR_ARRAY_H */