rtxUTF8.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2010 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
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 /* UTF-8 string functions */
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 
00418 #ifndef _NO_INT64_SUPPORT
00419 
00428 EXTERNRT int rtxUTF8StrToInt64 (const OSUTF8CHAR* utf8str, OSINT64* pvalue);
00429 
00441 EXTERNRT int rtxUTF8StrnToInt64
00442    (const OSUTF8CHAR* utf8str, size_t nbytes, OSINT64* pvalue);
00443 
00453 EXTERNRT int rtxUTF8StrToUInt64 (const OSUTF8CHAR* utf8str, OSUINT64* pvalue);
00454 
00466 EXTERNRT int rtxUTF8StrnToUInt64
00467    (const OSUTF8CHAR* utf8str, size_t nbytes, OSUINT64* pvalue);
00468 
00469 #endif /* _NO_INT64_SUPPORT */
00470 
00483 EXTERNRT int rtxUTF8ToDynUniStr
00484    (OSCTXT* pctxt, const OSUTF8CHAR* utf8str,
00485     const OSUNICHAR** ppdata, OSUINT32* pnchars);
00486 
00497 EXTERNRT int rtxUTF8RemoveWhiteSpace
00498 (const OSUTF8CHAR* utf8instr, size_t nbytes, const OSUTF8CHAR** putf8outstr);
00499 
00506 #define RTUTF8STRCMPL(name,lstr) \
00507 rtxUTF8Strcmp(name,(const OSUTF8CHAR*)lstr)
00508 
00523 EXTERNRT int rtxUTF8StrToDynHexStr
00524 (OSCTXT* pctxt, const OSUTF8CHAR* utf8str, OSDynOctStr* pvalue);
00525 
00541 EXTERNRT int rtxUTF8StrnToDynHexStr
00542 (OSCTXT* pctxt, const OSUTF8CHAR* utf8str, size_t nbytes, OSDynOctStr* pvalue);
00543 
00559 EXTERNRT int rtxUTF8StrToNamedBits (OSCTXT* pctxt, const OSUTF8CHAR* utf8str,
00560    const OSBitMapItem* pBitMap, OSOCTET* pvalue, OSUINT32* pnbits,
00561    OSUINT32 bufsize);
00562 
00581 EXTERNRT const OSUTF8CHAR* rtxUTF8StrNextTok
00582 (OSUTF8CHAR* utf8str, OSUTF8CHAR** ppNext);
00583 
00587 #ifdef __cplusplus
00588 }
00589 #endif
00590 
00591 #endif