diff options
author | David Robillard <d@drobilla.net> | 2021-06-30 13:34:31 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:07 -0500 |
commit | 469034ec4ae5c0b5230ca30c40aaa9b1432c13a2 (patch) | |
tree | b6d2c350e3eebb6a1ce0cdff740a8c488bfbb3bc /src/read_utf8.h | |
parent | 3d79b6ee36b250644e6cf70eee8e3076d94cbb7f (diff) | |
download | serd-469034ec4ae5c0b5230ca30c40aaa9b1432c13a2.tar.gz serd-469034ec4ae5c0b5230ca30c40aaa9b1432c13a2.tar.bz2 serd-469034ec4ae5c0b5230ca30c40aaa9b1432c13a2.zip |
Factor out UTF-8 reading utilities
Diffstat (limited to 'src/read_utf8.h')
-rw-r--r-- | src/read_utf8.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/read_utf8.h b/src/read_utf8.h new file mode 100644 index 00000000..ce1be85f --- /dev/null +++ b/src/read_utf8.h @@ -0,0 +1,24 @@ +// Copyright 2011-2021 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#ifndef SERD_SRC_READ_UTF8_H +#define SERD_SRC_READ_UTF8_H + +#include "serd/node.h" +#include "serd/reader.h" +#include "serd/status.h" + +#include <stdint.h> + +/// Read a UTF-8 character continuation (starting after the lead byte) +SerdStatus +read_utf8_continuation(SerdReader* reader, SerdNode* dest, uint8_t lead); + +/// Read a single UTF-8 character and parse it to a code point +SerdStatus +read_utf8_code_point(SerdReader* reader, + SerdNode* dest, + uint32_t* code, + uint8_t lead); + +#endif // SERD_SRC_READ_UTF8_H |