OSDN Git Service

stop using trunk directory in rectool
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / utf.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005 \r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / common tools sub-project\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 #ifndef _GF_UTF_H_\r
26 #define _GF_UTF_H_\r
27 \r
28 #ifdef __cplusplus\r
29 extern "C" {\r
30 #endif\r
31 \r
32 /*!\r
33  *      \file <gpac/utf.h>\r
34  *      \brief UTF functions.\r
35  */\r
36 \r
37 /*!\r
38  *      \addtogroup utf_grp UTF\r
39  *      \ingroup utils_grp\r
40  *      \brief UTF encoding functions\r
41  *\r
42  *This section documents the UTF functions of the GPAC framework.\n\r
43  *The wide characters in GPAC are unsignad shorts, in other words GPAC only supports UTF8 and UTF16 coding styles.\r
44  *\note these functions are just ports of libutf8 library tools into GPAC.\r
45  *      @{\r
46  */\r
47 \r
48 #include <gpac/tools.h>\r
49 \r
50 /*!\r
51  *\brief wide-char to multibyte conversion\r
52  *\r
53  *Converts a wide-char string to a multibyte string\r
54  *\param dst multibyte destination buffer\r
55  *\param dst_len multibyte destination buffer size\r
56  *\param srcp address of the wide-char string. This will be set to the next char to be converted in the input buffer if not enough space in the destination, or NULL if conversion was completed.\r
57  *\return length (in byte) of the multibyte string or -1 if error.\r
58  */\r
59 size_t gf_utf8_wcstombs(char* dst, size_t dst_len, const unsigned short** srcp);\r
60 /*converts UTF8 string to wide char string - returns (-1) if error. set @srcp to next char to be\r
61 converted if not enough space*/\r
62 /*!\r
63  *\brief multibyte to wide-char conversion\r
64  *\r
65  *Converts a multibyte string to a wide-char string \r
66  *\param dst wide-char destination buffer\r
67  *\param dst_len wide-char destination buffer size\r
68  *\param srcp address of the multibyte character buffer. This will be set to the next char to be converted in the input buffer if not enough space in the destination, or NULL if conversion was completed.\r
69  *\return length (in unsigned short) of the wide-char string or -1 if error.\r
70  */\r
71 size_t gf_utf8_mbstowcs(unsigned short* dst, size_t dst_len, const char** srcp);\r
72 /*!\r
73  *\brief wide-char string length\r
74  *\r
75  *Returns the length in character of a wide-char string\r
76  *\param s the wide-char string\r
77  *\return the wide-char string length\r
78  */\r
79 size_t gf_utf8_wcslen(const unsigned short *s);\r
80 \r
81 /*!\r
82  *\brief string bidi reordering\r
83  *\r
84  *Performs a simple reordering of words in the string based on each word direction, so that glyphs are sorted in display order.\r
85  *\param utf_string the wide-char string\r
86  *\param len the len of the wide-char string\r
87  *\return 1 if the main direction is right-to-left, 0 otherwise\r
88  */\r
89 Bool gf_utf8_reorder_bidi(u16 *utf_string, u32 len);\r
90 \r
91 /*! @} */\r
92 \r
93 #ifdef __cplusplus\r
94 }\r
95 #endif\r
96 \r
97 \r
98 #endif          /*_GF_UTF_H_*/\r
99 \r