1 /*============================================================================ 2 epub2txt v2 3 wstring.h 4 Copyright (c)2020 Kevin Boone, GPL v3.0 5 ============================================================================*/ 6 7 #pragma once 8 9 #include 10 #include "defs.h" 11 12 struct _WString; 13 typedef struct _WString WString; 14 15 WString *wstring_create_empty (void); 16 WString *wstring_create_from_utf8 (const char *s); 17 BOOL wstring_create_from_utf8_file (const char *filename, 18 WString **result, char **error); 19 void wstring_destroy (WString *self); 20 const int wstring_length (const WString *self); 21 const int wstring_length_calc (const WString *self); 22 const uint32_t *wstring_wstr (const WString *self); 23 char *wstring_to_utf8 (const WString *self); 24 void wstring_append_c (WString *self, const uint32_t c); 25 void wstring_append (WString *self, const WString *other); 26 void wstring_clear (WString *self); 27 // Note the an empty string is _not_ whitespace 28 BOOL wstring_is_whitespace (const WString *self); 29 30 // Static method 31 uint32_t *wstring_convert_utf8_to_utf32 (const char *utf8); 32