2024-08-03 07:54:28 +01:00
|
|
|
#ifndef BLUELIB_CORE_STRINGSTREAM_H_
|
|
|
|
|
#define BLUELIB_CORE_STRINGSTREAM_H_
|
|
|
|
|
|
|
|
|
|
#include <blue/core/status.h>
|
2024-11-14 16:56:12 +00:00
|
|
|
#include <blue/core/misc.h>
|
2024-08-03 07:54:28 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
|
typedef struct b_stringstream {
|
|
|
|
|
char *ss_buf;
|
|
|
|
|
size_t ss_len;
|
|
|
|
|
size_t ss_max;
|
|
|
|
|
unsigned char ss_alloc;
|
2024-10-24 19:24:54 +01:00
|
|
|
int *ss_istack;
|
|
|
|
|
int ss_add_indent;
|
|
|
|
|
size_t ss_istack_ptr, ss_istack_size;
|
2024-08-03 07:54:28 +01:00
|
|
|
} b_stringstream;
|
|
|
|
|
|
2024-11-14 16:56:12 +00:00
|
|
|
BLUE_API void b_stringstream_begin(b_stringstream *strv, char *buf, size_t max);
|
|
|
|
|
BLUE_API void b_stringstream_begin_dynamic(b_stringstream *strv);
|
2024-08-03 07:54:28 +01:00
|
|
|
|
2024-11-14 16:56:12 +00:00
|
|
|
BLUE_API void b_stringstream_push_indent(b_stringstream *strv, int indent);
|
|
|
|
|
BLUE_API void b_stringstream_pop_indent(b_stringstream *strv);
|
2024-10-24 19:24:54 +01:00
|
|
|
|
2024-11-14 16:56:12 +00:00
|
|
|
BLUE_API b_status b_stringstream_add(b_stringstream *strv, const char *str);
|
|
|
|
|
BLUE_API b_status b_stringstream_addf(b_stringstream *strv, const char *format, ...);
|
|
|
|
|
BLUE_API b_status b_stringstream_addv(b_stringstream *strv, const char **strs);
|
|
|
|
|
BLUE_API b_status b_stringstream_addvl(
|
2024-10-24 19:24:54 +01:00
|
|
|
b_stringstream *strv, const char **strs, size_t count);
|
2024-11-14 16:56:12 +00:00
|
|
|
BLUE_API b_status b_stringstream_add_many(b_stringstream *strv, ...);
|
|
|
|
|
BLUE_API char *b_stringstream_end(b_stringstream *strv);
|
2024-08-03 07:54:28 +01:00
|
|
|
|
|
|
|
|
#endif
|