core: rope: add bstr support
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
|
||||
#include <blue/core/hash.h>
|
||||
#include <blue/core/misc.h>
|
||||
#include <blue/core/stream.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
struct b_string;
|
||||
struct b_bstr;
|
||||
|
||||
#define B_ROPE_TYPE(f) ((f) & 0xFF)
|
||||
|
||||
@@ -17,7 +19,7 @@ struct b_string;
|
||||
.r_v = {.v_char = (c) } \
|
||||
}
|
||||
|
||||
#define B_ROPE_CSTR(str) \
|
||||
#define B_ROPE_CSTR(str) \
|
||||
{ \
|
||||
.r_flags = B_ROPE_F_CSTR_BORROWED, \
|
||||
.r_len_total = strlen(str), \
|
||||
@@ -29,7 +31,7 @@ struct b_string;
|
||||
}, \
|
||||
}
|
||||
|
||||
#define B_ROPE_CSTR_STATIC(str) \
|
||||
#define B_ROPE_CSTR_STATIC(str) \
|
||||
{ \
|
||||
.r_flags = B_ROPE_F_CSTR_STATIC, \
|
||||
.r_len_total = strlen(str), \
|
||||
@@ -94,10 +96,14 @@ BLUE_API void b_rope_init_uint(b_rope *rope, uintptr_t v);
|
||||
|
||||
BLUE_API void b_rope_destroy(b_rope *rope);
|
||||
|
||||
BLUE_API void b_rope_iterate(
|
||||
const b_rope *rope, void (*func)(const b_rope *, void *), void *arg);
|
||||
BLUE_API size_t b_rope_get_size(const b_rope *rope);
|
||||
BLUE_API void b_rope_concat(b_rope *result, const b_rope *left, const b_rope *right);
|
||||
BLUE_API void b_rope_join(b_rope *result, const b_rope **ropes, size_t nr_ropes);
|
||||
|
||||
BLUE_API void b_rope_to_cstr(const b_rope *rope, char *out, size_t max);
|
||||
BLUE_API b_status b_rope_to_cstr(const b_rope *rope, char *out, size_t max);
|
||||
BLUE_API b_status b_rope_to_bstr(const b_rope *rope, struct b_bstr *str);
|
||||
BLUE_API b_status b_rope_to_string(const b_rope *rope, b_stream *out);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user