Moved some headers here so they can be included by Globals.cpp in the interface kit folder

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6092 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2004-01-15 07:15:37 +00:00
parent 023968853e
commit f1569dbb9e
3 changed files with 235 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
#ifndef __MOREUTF8
#define __MOREUTF8
static inline bool
IsInsideGlyph(uchar ch)
{
return (ch & 0xC0) == 0x80;
}
static inline uint32
UTF8NextCharLen(const char *text)
{
const char *ptr = text;
if (ptr == NULL || *ptr == 0)
return 0;
do {
ptr++;
} while (IsInsideGlyph(*ptr));
return ptr - text;
}
static inline uint32
UTF8PreviousCharLen(const char *text, const char *limit)
{
const char *ptr = text;
if (ptr == NULL || limit == NULL)
return 0;
do {
if (ptr == limit)
break;
ptr--;
} while (IsInsideGlyph(*ptr));
return text - ptr;
}
#endif