simdutf 6.1.1
Unicode at GB/s.
Loading...
Searching...
No Matches
encoding_types.h
1#ifndef SIMDUTF_ENCODING_TYPES_H
2#define SIMDUTF_ENCODING_TYPES_H
3#include <string>
4
5namespace simdutf {
6
7enum encoding_type {
8 UTF8 = 1, // BOM 0xef 0xbb 0xbf
9 UTF16_LE = 2, // BOM 0xff 0xfe
10 UTF16_BE = 4, // BOM 0xfe 0xff
11 UTF32_LE = 8, // BOM 0xff 0xfe 0x00 0x00
12 UTF32_BE = 16, // BOM 0x00 0x00 0xfe 0xff
13 Latin1 = 32,
14
15 unspecified = 0
16};
17
18enum endianness { LITTLE = 0, BIG = 1 };
19
20bool match_system(endianness e);
21
22std::string to_string(encoding_type bom);
23
24// Note that BOM for UTF8 is discouraged.
25namespace BOM {
26
34encoding_type check_bom(const uint8_t *byte, size_t length);
35encoding_type check_bom(const char *byte, size_t length);
42size_t bom_byte_size(encoding_type bom);
43
44} // namespace BOM
45} // namespace simdutf
46#endif