00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028 #ifndef _RTXUTF8_H_
00029 #define _RTXUTF8_H_
00030
00031 #include "rtxsrc/rtxContext.h"
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037
00060 EXTERNRT long rtxUTF8ToUnicode (OSCTXT* pctxt, const OSUTF8CHAR* inbuf,
00061 OSUNICHAR* outbuf, size_t outbufsiz);
00062
00073 EXTERNRT int rtxValidateUTF8 (OSCTXT* pctxt, const OSUTF8CHAR* inbuf);
00074
00084 EXTERNRT size_t rtxUTF8Len (const OSUTF8CHAR* inbuf);
00085 EXTERNRT size_t rtxCalcUTF8Len (const OSUTF8CHAR* inbuf, size_t inbufBytes);
00086
00094 EXTERNRT size_t rtxUTF8LenBytes (const OSUTF8CHAR* inbuf);
00095
00103 EXTERNRT int rtxUTF8CharSize (OS32BITCHAR wc);
00104
00115 EXTERNRT int rtxUTF8EncodeChar (OS32BITCHAR wc, OSOCTET* buf, size_t bufsiz);
00116
00127 EXTERNRT int rtxUTF8DecodeChar
00128 (OSCTXT* pctxt, const OSUTF8CHAR* pinbuf, int* pInsize);
00129
00139 EXTERNRT OS32BITCHAR rtxUTF8CharToWC (const OSUTF8CHAR* buf, OSUINT32* len);
00140
00150 EXTERNRT OSUTF8CHAR* rtxUTF8StrChr (OSUTF8CHAR* utf8str,
00151 OS32BITCHAR utf8char);
00152
00162 EXTERNRT OSUTF8CHAR* rtxUTF8Strdup (OSCTXT* pctxt, const OSUTF8CHAR* utf8str);
00163
00175 EXTERNRT OSUTF8CHAR* rtxUTF8Strndup
00176 (OSCTXT* pctxt, const OSUTF8CHAR* utf8str, size_t nbytes);
00177
00189 EXTERNRT OSUTF8CHAR* rtxUTF8StrRefOrDup
00190 (OSCTXT* pctxt, const OSUTF8CHAR* utf8str);
00191
00199 EXTERNRT OSBOOL rtxUTF8StrEqual
00200 (const OSUTF8CHAR* utf8str1, const OSUTF8CHAR* utf8str2);
00201
00212 EXTERNRT OSBOOL rtxUTF8StrnEqual (const OSUTF8CHAR* utf8str1,
00213 const OSUTF8CHAR* utf8str2,
00214 size_t count);
00215
00227 EXTERNRT int rtxUTF8Strcmp (const OSUTF8CHAR* utf8str1,
00228 const OSUTF8CHAR* utf8str2);
00229
00243 EXTERNRT int rtxUTF8Strncmp (const OSUTF8CHAR* utf8str1,
00244 const OSUTF8CHAR* utf8str2,
00245 size_t count);
00256 EXTERNRT OSUTF8CHAR* rtxUTF8Strcpy
00257 (OSUTF8CHAR* dest, size_t bufsiz, const OSUTF8CHAR* src);
00258
00271 EXTERNRT OSUTF8CHAR* rtxUTF8Strncpy
00272 (OSUTF8CHAR* dest, size_t bufsiz, const OSUTF8CHAR* src, size_t nchars);
00273
00280 EXTERNRT OSUINT32 rtxUTF8StrHash (const OSUTF8CHAR* str);
00281
00298 EXTERNRT const OSUTF8CHAR* rtxUTF8StrJoin
00299 (OSCTXT* pctxt, const OSUTF8CHAR* str1, const OSUTF8CHAR* str2,
00300 const OSUTF8CHAR* str3, const OSUTF8CHAR* str4, const OSUTF8CHAR* str5);
00301
00311 EXTERNRT int rtxUTF8StrToBool (const OSUTF8CHAR* utf8str, OSBOOL* pvalue);
00312
00323 EXTERNRT int rtxUTF8StrnToBool
00324 (const OSUTF8CHAR* utf8str, size_t nbytes, OSBOOL* pvalue);
00325
00339 EXTERNRT int rtxUTF8StrToDouble (const OSUTF8CHAR* utf8str, OSREAL* pvalue);
00340
00355 EXTERNRT int rtxUTF8StrnToDouble
00356 (const OSUTF8CHAR* utf8str, size_t nbytes, OSREAL* pvalue);
00357
00370 EXTERNRT int rtxUTF8StrToInt (const OSUTF8CHAR* utf8str, OSINT32* pvalue);
00371
00372 #define rtxUTF8StrToInt32 rtxUTF8StrToInt
00373
00388 EXTERNRT int rtxUTF8StrnToInt
00389 (const OSUTF8CHAR* utf8str, size_t nbytes, OSINT32* pvalue);
00390
00400 EXTERNRT int rtxUTF8StrToUInt (const OSUTF8CHAR* utf8str, OSUINT32* pvalue);
00401
00402 #define rtxUTF8StrToUInt32 rtxUTF8StrToUInt
00403
00415 EXTERNRT int rtxUTF8StrnToUInt
00416 (const OSUTF8CHAR* utf8str, size_t nbytes, OSUINT32* pvalue);
00417
00427 EXTERNRT int rtxUTF8StrToSize (const OSUTF8CHAR* utf8str, size_t* pvalue);
00428
00440 EXTERNRT int rtxUTF8StrnToSize
00441 (const OSUTF8CHAR* utf8str, size_t nbytes, size_t* pvalue);
00442
00443 #ifndef _NO_INT64_SUPPORT
00444
00453 EXTERNRT int rtxUTF8StrToInt64 (const OSUTF8CHAR* utf8str, OSINT64* pvalue);
00454
00466 EXTERNRT int rtxUTF8StrnToInt64
00467 (const OSUTF8CHAR* utf8str, size_t nbytes, OSINT64* pvalue);
00468
00478 EXTERNRT int rtxUTF8StrToUInt64 (const OSUTF8CHAR* utf8str, OSUINT64* pvalue);
00479
00491 EXTERNRT int rtxUTF8StrnToUInt64
00492 (const OSUTF8CHAR* utf8str, size_t nbytes, OSUINT64* pvalue);
00493
00494 #endif
00495
00508 EXTERNRT int rtxUTF8ToDynUniStr
00509 (OSCTXT* pctxt, const OSUTF8CHAR* utf8str,
00510 const OSUNICHAR** ppdata, OSUINT32* pnchars);
00511
00522 EXTERNRT int rtxUTF8RemoveWhiteSpace
00523 (const OSUTF8CHAR* utf8instr, size_t nbytes, const OSUTF8CHAR** putf8outstr);
00524
00531 #define RTUTF8STRCMPL(name,lstr) \
00532 rtxUTF8Strcmp(name,(const OSUTF8CHAR*)lstr)
00533
00548 EXTERNRT int rtxUTF8StrToDynHexStr
00549 (OSCTXT* pctxt, const OSUTF8CHAR* utf8str, OSDynOctStr* pvalue);
00550
00566 EXTERNRT int rtxUTF8StrnToDynHexStr
00567 (OSCTXT* pctxt, const OSUTF8CHAR* utf8str, size_t nbytes, OSDynOctStr* pvalue);
00568
00584 EXTERNRT int rtxUTF8StrToNamedBits (OSCTXT* pctxt, const OSUTF8CHAR* utf8str,
00585 const OSBitMapItem* pBitMap, OSOCTET* pvalue, OSUINT32* pnbits,
00586 OSUINT32 bufsize);
00587
00606 EXTERNRT const OSUTF8CHAR* rtxUTF8StrNextTok
00607 (OSUTF8CHAR* utf8str, OSUTF8CHAR** ppNext);
00608
00609 #define OSRTCHKUTF8LEN(str,lower,upper,stat) \
00610 do { size_t nchars = rtxUTF8Len (str); \
00611 stat = (nchars >= lower && nchars <= upper) ? 0 : RTERR_CONSVIO; } while(0)
00612
00616 #ifdef __cplusplus
00617 }
00618 #endif
00619
00620 #endif