Diffstat (limited to 'noncore/unsupported/qpdf/UTF8.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/UTF8.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/UTF8.h b/noncore/unsupported/qpdf/UTF8.h new file mode 100644 index 0000000..aacf663 --- a/dev/null +++ b/noncore/unsupported/qpdf/UTF8.h | |||
@@ -0,0 +1,24 @@ | |||
1 | //======================================================================== | ||
2 | // | ||
3 | // UTF8.h | ||
4 | // | ||
5 | // Copyright 2001 Derek B. Noonburg | ||
6 | // Modified for QPE by Robert Griebl | ||
7 | // | ||
8 | //======================================================================== | ||
9 | |||
10 | #include <qstring.h> | ||
11 | #include <string.h> | ||
12 | |||
13 | static int mapUTF8 ( Unicode u, char *buf, int bufSize ) | ||
14 | { | ||
15 | QCString utf = QString ( QChar ( u )). utf8 ( ); | ||
16 | int len = utf. length ( ); | ||
17 | |||
18 | if ( len <= bufSize ) { | ||
19 | ::memcpy ( buf, utf. data ( ), len ); | ||
20 | return len; | ||
21 | } | ||
22 | else | ||
23 | return 0; | ||
24 | } | ||