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
44
45
46
47
48
|
#ifndef MLIB_UNICODE_STRING_H
#define MLIB_UNICODE_STRING_H
#include <stddef.h>
#include "_charN_t.h"
#include "_u8view.h"
#define mlib_warn_trunc nodiscard("don’t forget to check for truncation")
/* clang-format off */
enum [[clang::flag_enum]] caseflags {
CF_LANG_AZ = 1 << 0, /* Azeri; alias for CF_LANG_TR */
CF_LANG_TR = 1 << 0, /* Turkish; alias for CF_LANG_AZ */
CF_LANG_LT = 1 << 1, /* Lithuanian */
CF_LANG_NL = 1 << 2, /* Dutch */
CF_SS = 1 << 3, /* Use ‘ẞ’ as the uppercase of ‘ß’; alias for CF_ẞ */
CF_ẞ = 1 << 3, /* Use ‘ẞ’ as the uppercase of ‘ß’; alias for CF_SS */
};
/* clang-format on */
[[nodiscard]] size_t u8gcnt(struct u8view);
[[nodiscard]] size_t u8wcnt(struct u8view);
[[nodiscard]] size_t u8wcnt_human(struct u8view);
size_t u8gnext(struct u8view *, struct u8view *);
size_t u8wnext(struct u8view *, struct u8view *);
size_t u8wnext_human(struct u8view *, struct u8view *);
[[mlib_warn_trunc]] size_t u8casefold(char8_t *restrict, size_t, struct u8view,
enum caseflags);
[[mlib_warn_trunc]] size_t u8lower(char8_t *restrict, size_t, struct u8view,
enum caseflags);
[[mlib_warn_trunc]] size_t u8title(char8_t *restrict, size_t, struct u8view,
enum caseflags);
[[mlib_warn_trunc]] size_t u8upper(char8_t *restrict, size_t, struct u8view,
enum caseflags);
constexpr double U8LOWER_SCALE = 1.5;
constexpr double U8LOWER_SCALE_LT = 3;
constexpr double U8TITLE_SCALE = 3;
constexpr double U8UPPER_SCALE = 3;
#undef mlib_warn_trunc
#endif /* !MLIB_UNICODE_STRING_H */
|