• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!****************************************************************************
2 
3  @file         PVRTUnicode.h
4  @copyright    Copyright (c) Imagination Technologies Limited.
5  @brief        A small collection of functions used to decode Unicode formats to
6                individual code points.
7 
8 ******************************************************************************/
9 #ifndef _PVRTUNICODE_H_
10 #define _PVRTUNICODE_H_
11 
12 #include "PVRTGlobal.h"
13 #include "PVRTError.h"
14 #include "PVRTArray.h"
15 
16 /****************************************************************************
17 ** Functions
18 ****************************************************************************/
19 
20 /*!***************************************************************************
21  @brief      		Decodes a UTF8-encoded string in to Unicode code points
22 					(UTF32). If pUTF8 is not null terminated, the results are
23 					undefined.
24  @param[in]			pUTF8			A UTF8 string, which is null terminated.
25  @param[out]		aUTF32			An array of Unicode code points.
26  @return 			Success or failure.
27 *****************************************************************************/
28 EPVRTError PVRTUnicodeUTF8ToUTF32(	const PVRTuint8* const pUTF8, CPVRTArray<PVRTuint32>& aUTF32);
29 
30 /*!***************************************************************************
31  @brief      		Decodes a UTF16-encoded string in to Unicode code points
32 					(UTF32). If pUTF16 is not null terminated, the results are
33 					undefined.
34  @param[in]			pUTF16			A UTF16 string, which is null terminated.
35  @param[out]		aUTF32			An array of Unicode code points.
36  @return 			Success or failure.
37 *****************************************************************************/
38 EPVRTError PVRTUnicodeUTF16ToUTF32(const PVRTuint16* const pUTF16, CPVRTArray<PVRTuint32>& aUTF32);
39 
40 /*!***************************************************************************
41  @brief      		Calculates the length of a UTF8 string. If pUTF8 is
42 					not null terminated, the results are undefined.
43  @param[in]			pUTF8			A UTF8 string, which is null terminated.
44  @return 			The length of the string, in Unicode code points.
45 *****************************************************************************/
46 unsigned int PVRTUnicodeUTF8Length(const PVRTuint8* const pUTF8);
47 
48 /*!***************************************************************************
49  @brief      		Calculates the length of a UTF16 string.
50 					If pUTF16 is not null terminated, the results are
51 					undefined.
52  @param[in]			pUTF16			A UTF16 string, which is null terminated.
53  @return 			The length of the string, in Unicode code points.
54 *****************************************************************************/
55 unsigned int PVRTUnicodeUTF16Length(const PVRTuint16* const pUTF16);
56 
57 /*!***************************************************************************
58  @brief      		Checks whether the encoding of a UTF8 string is valid.
59 					If pUTF8 is not null terminated, the results are undefined.
60  @param[in]			pUTF8			A UTF8 string, which is null terminated.
61  @return 			true or false
62 *****************************************************************************/
63 bool PVRTUnicodeValidUTF8(const PVRTuint8* const pUTF8);
64 
65 #endif /* _PVRTUNICODE_H_ */
66 
67 /*****************************************************************************
68  End of file (PVRTUnicode.h)
69 *****************************************************************************/
70 
71