42 lines
1.0 KiB
C
42 lines
1.0 KiB
C
#ifndef DSTR_H
|
|
#define DSTR_H
|
|
|
|
#include "aliases.h"
|
|
#include "mem_arena.h"
|
|
#include "misc_utils.h"
|
|
#include "platform.h"
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif // __cplusplus
|
|
|
|
typedef struct dstr String;
|
|
|
|
typedef struct string_update StringUpdate;
|
|
struct string_update {
|
|
String *str;
|
|
bool updated;
|
|
|
|
#ifdef WAPP_PLATFORM_WINDOWS
|
|
wapp_misc_utils_padding_size(sizeof(bool) + sizeof(String *));
|
|
#endif // WAPP_PLATFORM_WINDOWS
|
|
};
|
|
|
|
String *wapp_dstr_with_capacity(u64 capacity, Arena *arena);
|
|
String *wapp_dstr_from_string(const char *str, Arena *arena);
|
|
StringUpdate wapp_dstr_update(String **dst, const char *src, Arena *arena);
|
|
StringUpdate wapp_dstr_concat(String **dst, const char *src, Arena *arena);
|
|
void wapp_dstr_clear(String *str);
|
|
void wapp_dstr_print(const String *str);
|
|
i64 wapp_dstr_find(const String *str, const char *substr);
|
|
u64 wapp_dstr_length(const String *str);
|
|
u64 wapp_dstr_capacity(const String *str);
|
|
const char *wapp_dstr_to_cstr(const String *str);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif // __cplusplus
|
|
|
|
#endif // !DSTR_H
|