12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stddef.h>
- #include <stdint.h>
- extern size_t utf8EncodeRune(uint32_t rune, char *encoded);
- extern const char *utf8DecodeRune(const char *s, size_t nElem, uint32_t *rune);
- extern size_t utf16EncodeRune(uint32_t rune, uint16_t *encoded);
- extern const uint16_t *utf16DecodeRune(const uint16_t *s, size_t nElem, uint32_t *rune);
- extern size_t utf8RuneCount(const char *s, size_t nElem);
- extern size_t utf8UTF16Count(const char *s, size_t nElem);
- extern size_t utf16RuneCount(const uint16_t *s, size_t nElem);
- extern size_t utf16UTF8Count(const uint16_t *s, size_t nElem);
- #ifdef __cplusplus
- }
- #if defined(_MSC_VER)
- inline size_t utf16EncodeRune(uint32_t rune, __wchar_t *encoded)
- {
- return utf16EncodeRune(rune, reinterpret_cast<uint16_t *>(encoded));
- }
- inline const __wchar_t *utf16DecodeRune(const __wchar_t *s, size_t nElem, uint32_t *rune)
- {
- const uint16_t *ret;
- ret = utf16DecodeRune(reinterpret_cast<const uint16_t *>(s), nElem, rune);
- return reinterpret_cast<const __wchar_t *>(ret);
- }
- inline size_t utf16RuneCount(const __wchar_t *s, size_t nElem)
- {
- return utf16RuneCount(reinterpret_cast<const uint16_t *>(s), nElem);
- }
- inline size_t utf16UTF8Count(const __wchar_t *s, size_t nElem)
- {
- return utf16UTF8Count(reinterpret_cast<const uint16_t *>(s), nElem);
- }
- #endif
- #endif
|