applied backgroundcolors.patch
[TortoiseGit.git] / ext / scintilla / src / UniConversion.h
blob28b491c8c624e6cbfd95ee99f98fc815b6849ee4
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.
8 const int UTF8MaxBytes = 4;
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);
16 extern int UTF8BytesOfLead[256];
17 void UTF8BytesOfLeadInitialise();
19 inline bool UTF8IsTrailByte(int ch) {
20 return (ch >= 0x80) && (ch < 0xc0);
23 inline bool UTF8IsAscii(int ch) {
24 return ch < 0x80;
27 enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 };
28 int UTF8Classify(const unsigned char *us, int len);