aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/include/mbstring.h
blob: 29c74218910f0c8cada75554a7ed255233e8d238 (plain) (blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef RUNE_MBSTRING_H
#define RUNE_MBSTRING_H

#include "internal/qmacros.h"
#define _RUNE_NEEDS_U8VIEW 1
#include "internal/types.h" /* IWYU pragma: export */

#define U8_LEN_MAX (4)

int u8tor(rune *, const char8_t *);
int u8tor_uc(rune *, const char8_t *);

int rtou8(char8_t *, rune, size_t);
size_t u8set(char8_t *, rune, size_t);

char8_t *u8chk(const char8_t *, size_t);
[[unsequenced]] bool u8chkr(rune);

[[unsequenced]] int u8wdth(rune);

int u8rlen(const char8_t *);
size_t u8len(const char8_t *, size_t);

int u8next(rune *, const char8_t **, size_t *);
int u8prev(rune *, const char8_t **, const char8_t *);

char8_t *u8chr(const char8_t *, rune, size_t);
char8_t *u8rchr(const char8_t *, rune, size_t);

size_t u8spn(const char8_t *, size_t, const rune *, size_t);
size_t u8bspn(const char8_t *, size_t, const rune *, size_t);
size_t u8cspn(const char8_t *, size_t, const rune *, size_t);
size_t u8cbspn(const char8_t *, size_t, const rune *, size_t);

int u8cmp(struct u8view, struct u8view);

#if !_RUNE_NO_MACRO_WRAPPER
#	define u8chk(s, n)      _RUNE_Q_PTR(u8chk, (s), (s), (n))
#	define u8chr(s, ch, n)  _RUNE_Q_PTR(u8chr, (s), (s), (ch), (n))
#	define u8rchr(s, ch, n) _RUNE_Q_PTR(u8rchr, (s), (s), (ch), (n))
#endif

#endif /* !RUNE_MBSTRING_H */