]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/UniConversion.h
704f162393c54cd73b56742196972255526d647e
[wxWidgets.git] / src / stc / scintilla / src / UniConversion.h
1 // Scintilla source code edit control
2 /** @file UniConversion.h
3 ** Functions to handle UTF-8 and UTF-16 strings.
4 **/
5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
7
8 const int UTF8MaxBytes = 4;
9
10 unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen);
11 void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len);
12 unsigned int UTF8CharLength(unsigned char ch);
13 unsigned int UTF16Length(const char *s, unsigned int len);
14 unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen);
15
16 extern int UTF8BytesOfLead[256];
17 void UTF8BytesOfLeadInitialise();
18
19 inline bool UTF8IsTrailByte(int ch) {
20 return (ch >= 0x80) && (ch < 0xc0);
21 }
22
23 inline bool UTF8IsAscii(int ch) {
24 return ch < 0x80;
25 }
26
27 enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 };
28 int UTF8Classify(const unsigned char *us, int len);