2018-01-17 19:22:57 +01:00
|
|
|
#ifndef STRING_BUFFER_H
|
|
|
|
#define STRING_BUFFER_H
|
|
|
|
|
2018-05-06 15:36:53 +02:00
|
|
|
#include "fort_utils.h"
|
2018-01-17 19:22:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* STRING BUFFER
|
|
|
|
* ***************************************************************************/
|
2018-03-05 19:08:14 +01:00
|
|
|
|
2019-08-27 14:04:54 +02:00
|
|
|
struct f_string_buffer {
|
2018-03-05 19:08:14 +01:00
|
|
|
union {
|
|
|
|
char *cstr;
|
2019-08-14 21:01:57 +02:00
|
|
|
#ifdef FT_HAVE_WCHAR
|
2018-03-05 19:08:14 +01:00
|
|
|
wchar_t *wstr;
|
2019-08-14 21:01:57 +02:00
|
|
|
#endif
|
|
|
|
#ifdef FT_HAVE_UTF8
|
|
|
|
void *u8str;
|
|
|
|
#endif
|
2018-03-05 19:08:14 +01:00
|
|
|
void *data;
|
2018-05-06 16:04:34 +02:00
|
|
|
} str;
|
2018-03-05 19:08:14 +01:00
|
|
|
size_t data_sz;
|
2019-08-27 14:04:54 +02:00
|
|
|
enum f_string_type type;
|
2018-01-17 19:22:57 +01:00
|
|
|
};
|
|
|
|
|
2018-09-01 14:37:01 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
f_string_buffer_t *create_string_buffer(size_t number_of_chars, enum f_string_type type);
|
2018-09-01 14:37:01 +02:00
|
|
|
|
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
void destroy_string_buffer(f_string_buffer_t *buffer);
|
2018-09-01 14:37:01 +02:00
|
|
|
|
2018-11-02 22:16:20 +01:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
f_string_buffer_t *copy_string_buffer(const f_string_buffer_t *buffer);
|
2018-11-02 22:16:20 +01:00
|
|
|
|
2018-09-01 14:37:01 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
f_status realloc_string_buffer_without_copy(f_string_buffer_t *buffer);
|
2018-03-05 19:08:14 +01:00
|
|
|
|
2018-09-01 14:37:01 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
f_status fill_buffer_from_string(f_string_buffer_t *buffer, const char *str);
|
2018-03-05 19:08:14 +01:00
|
|
|
|
2018-09-01 14:37:01 +02:00
|
|
|
#ifdef FT_HAVE_WCHAR
|
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
f_status fill_buffer_from_wstring(f_string_buffer_t *buffer, const wchar_t *str);
|
2018-09-01 14:37:01 +02:00
|
|
|
#endif /* FT_HAVE_WCHAR */
|
2018-01-17 19:22:57 +01:00
|
|
|
|
2019-08-14 21:01:57 +02:00
|
|
|
#ifdef FT_HAVE_UTF8
|
2018-09-01 14:37:01 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
f_status fill_buffer_from_u8string(f_string_buffer_t *buffer, const void *str);
|
2019-08-14 21:01:57 +02:00
|
|
|
#endif /* FT_HAVE_UTF8 */
|
2018-09-01 14:37:01 +02:00
|
|
|
|
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
size_t buffer_text_visible_width(const f_string_buffer_t *buffer);
|
2018-01-17 19:22:57 +01:00
|
|
|
|
2018-09-01 14:37:01 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
size_t buffer_text_visible_height(const f_string_buffer_t *buffer);
|
2018-01-17 19:22:57 +01:00
|
|
|
|
2018-09-01 14:37:01 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
size_t string_buffer_cod_width_capacity(const f_string_buffer_t *buffer);
|
2018-09-01 14:37:01 +02:00
|
|
|
|
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
size_t string_buffer_raw_capacity(const f_string_buffer_t *buffer);
|
2018-09-01 14:37:01 +02:00
|
|
|
|
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
size_t string_buffer_width_capacity(const f_string_buffer_t *buffer);
|
2019-08-14 21:01:57 +02:00
|
|
|
|
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
void *buffer_get_data(f_string_buffer_t *buffer);
|
2019-08-14 21:01:57 +02:00
|
|
|
|
2019-08-25 09:01:47 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
int buffer_check_align(f_string_buffer_t *buffer);
|
2019-08-25 09:01:47 +02:00
|
|
|
|
2019-08-14 21:01:57 +02:00
|
|
|
FT_INTERNAL
|
2019-08-27 14:04:54 +02:00
|
|
|
int buffer_printf(f_string_buffer_t *buffer, size_t buffer_row, f_conv_context_t *cntx, size_t cod_width,
|
2019-08-14 21:01:57 +02:00
|
|
|
const char *content_style_tag, const char *reset_content_style_tag);
|
2018-03-05 19:08:14 +01:00
|
|
|
|
2018-03-09 10:44:16 +01:00
|
|
|
#endif /* STRING_BUFFER_H */
|