39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
#ifndef BLUELIB_CORE_STRINGSTREAM_H_
|
|
#define BLUELIB_CORE_STRINGSTREAM_H_
|
|
|
|
#include <blue/core/misc.h>
|
|
#include <blue/core/status.h>
|
|
#include <blue/core/stream.h>
|
|
#include <stddef.h>
|
|
|
|
typedef struct b_stringstream {
|
|
b_stream ss_base;
|
|
char *ss_buf;
|
|
size_t ss_len;
|
|
size_t ss_max;
|
|
unsigned char ss_alloc;
|
|
int *ss_istack;
|
|
int ss_add_indent;
|
|
size_t ss_istack_ptr, ss_istack_size;
|
|
} b_stringstream;
|
|
|
|
BLUE_API void b_stringstream_begin(b_stringstream *strv, char *buf, size_t max);
|
|
BLUE_API void b_stringstream_begin_dynamic(b_stringstream *strv);
|
|
|
|
BLUE_API size_t b_stringstream_get_length(const b_stringstream *strv);
|
|
|
|
BLUE_API void b_stringstream_push_indent(b_stringstream *strv, int indent);
|
|
BLUE_API void b_stringstream_pop_indent(b_stringstream *strv);
|
|
|
|
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_addvf(
|
|
b_stringstream *strv, const char *format, va_list arg);
|
|
BLUE_API b_status b_stringstream_addvl(
|
|
b_stringstream *strv, const char **strs, size_t count);
|
|
BLUE_API b_status b_stringstream_add_many(b_stringstream *strv, ...);
|
|
BLUE_API char *b_stringstream_end(b_stringstream *strv);
|
|
|
|
#endif
|