update stuff
This commit is contained in:
parent
6d36aa4442
commit
95d74c2ef4
13 changed files with 1196 additions and 48 deletions
13
str.h
13
str.h
|
|
@ -92,10 +92,7 @@ strview_t str_sub(str_t ctx, usize from, usize to);
|
|||
#define STRV_EMPTY (strview_t){0}
|
||||
|
||||
// needed for strv__init_literal _Generic implementation, it's never actually called
|
||||
inline strview_t strv__ignore(str_t s, size_t l) {
|
||||
COLLA_UNUSED(s); COLLA_UNUSED(l);
|
||||
return STRV_EMPTY;
|
||||
}
|
||||
strview_t strv__ignore(str_t s, size_t l);
|
||||
|
||||
#define strv__check(x, ...) ((#x)[0] == '"')
|
||||
#define strv__init_literal(x, ...) \
|
||||
|
|
@ -118,6 +115,8 @@ inline strview_t strv__ignore(str_t s, size_t l) {
|
|||
|
||||
#define strv(...) strv__check(__VA_ARGS__) ? strv__init_literal(__VA_ARGS__) : strv__impl(__VA_ARGS__, 2, 1, 0)(__VA_ARGS__)
|
||||
|
||||
#define cstrv(cstr) { cstr, sizeof(cstr) - 1, }
|
||||
|
||||
strview_t strv_init(const char *cstr);
|
||||
strview_t strv_init_len(const char *buf, usize size);
|
||||
strview_t strv_init_str(str_t str);
|
||||
|
|
@ -132,6 +131,9 @@ char strv_back(strview_t ctx);
|
|||
str16_t strv_to_str16(arena_t *arena, strview_t src);
|
||||
tstr_t strv_to_tstr(arena_t *arena, strview_t src);
|
||||
|
||||
str_t strv_to_upper(arena_t *arena, strview_t src);
|
||||
str_t strv_to_lower(arena_t *arena, strview_t src);
|
||||
|
||||
strview_t strv_remove_prefix(strview_t ctx, usize n);
|
||||
strview_t strv_remove_suffix(strview_t ctx, usize n);
|
||||
strview_t strv_trim(strview_t ctx);
|
||||
|
|
@ -162,6 +164,7 @@ usize strv_rfind_view(strview_t ctx, strview_t view, usize from_right);
|
|||
bool char_is_space(char c);
|
||||
bool char_is_alpha(char c);
|
||||
bool char_is_num(char c);
|
||||
char char_lower(char c);
|
||||
|
||||
// == INPUT STREAM =================================================
|
||||
|
||||
|
|
@ -273,4 +276,4 @@ bool ibstr_get_i16(ibstream_t *ib, i16 *out);
|
|||
bool ibstr_get_i32(ibstream_t *ib, i32 *out);
|
||||
bool ibstr_get_i64(ibstream_t *ib, i64 *out);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue