summaryrefslogtreecommitdiff
path: root/src/mcpp-text.h
blob: dce651cc941893c1f33fe4e40135aa43c6585213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef __MCPU_CPP_TEXT_H__
#define __MCPU_CPP_TEXT_H__ 1

#include <defs.h>

typedef struct mcpu_text mcpu_text;
struct mcpu_text
{
  __mpu_char16_t *data;
  size_t          length;
  size_t          capacity;
};

void mcpu_text_init( mcpu_text *text );
void mcpu_text_free( mcpu_text *text );
int  mcpu_text_reserve( mcpu_text *text, size_t need );
int  mcpu_text_append( mcpu_text *text,
                       const __mpu_char16_t *data, size_t length );
int  mcpu_text_append_char( mcpu_text *text, __mpu_char16_t ch );
int  mcpu_text_append_ascii( mcpu_text *text, const char *s );
int  mcpu_text_append_utf8( mcpu_text *text, const char *s );
int  mcpu_text_from_utf8( mcpu_text *text, const char *s );
char *mcpu_text_to_utf8( const __mpu_char16_t *data, size_t length );
int  mcpu_text_equal_ascii( const __mpu_char16_t *data,
                            size_t length, const char *s );

#endif /* __MCPU_CPP_TEXT_H__ */