]> git.sur5r.net Git - openldap/blob - include/ldap_utf8.h
Update copyright (including with or without modification clarification)
[openldap] / include / ldap_utf8.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2001 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted only as authorized by the OpenLDAP
8  * Public License.  A copy of this license is available at
9  * http://www.OpenLDAP.org/license.html or in file LICENSE in the
10  * top-level directory of the distribution.
11  */
12 /* $Novell: /ldap/src/cldap/include/ldap_utf8.h,v 1.3 2000/12/04 20:23:20 dsteck Exp $ 
13 /******************************************************************************
14  * This notice applies to changes, created by or for Novell, Inc.,
15  * to preexisting works for which notices appear elsewhere in this file.
16  *
17  * Copyright (C) 2000 Novell, Inc. All Rights Reserved.
18  *
19  * THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
20  * USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO VERSION
21  * 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS AVAILABLE AT
22  * HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE" IN THE
23  * TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION OF THIS
24  * WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP PUBLIC
25  * LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT THE
26  * PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. 
27  ******************************************************************************/
28
29 #ifndef _LDAP_UTF8_H
30 #define _LDAP_UTF8_H
31
32 LDAP_BEGIN_DECL
33
34 /*  
35  * UTF-8 Utility Routines
36  */
37
38 #define LDAP_UCS4_INVALID (0x80000000U)
39
40 /* LDAP_MAX_UTF8_LEN is 3 or 6 depending on size of wchar_t */
41 #define LDAP_MAX_UTF8_LEN  ( sizeof(wchar_t) * 3/2 )
42
43 /*
44  * Wide Char / UTF-8 Conversion Routines
45  */
46
47 /* UTF-8 character to Wide Char */
48 LDAP_F(int)
49 ldap_x_utf8_to_wc ( wchar_t *wchar, const char *utf8char );
50
51 /* UTF-8 string to Wide Char string */
52 LDAP_F(int)
53 ldap_x_utf8s_to_wcs ( wchar_t *wcstr, const char *utf8str, size_t count );
54
55 /* Wide Char to UTF-8 character */
56 LDAP_F(int)
57 ldap_x_wc_to_utf8 ( char *utf8char, wchar_t wchar, size_t count );
58
59 /* Wide Char string to UTF-8 string */
60 LDAP_F(int)
61 ldap_x_wcs_to_utf8s ( char *utf8str, const wchar_t *wcstr, size_t count );
62
63 /*
64  * MultiByte Char / UTF-8 Conversion Routines
65  */
66
67 /* UTF-8 character to MultiByte character */
68 LDAP_F(int)
69 ldap_x_utf8_to_mb ( char *mbchar, const char *utf8char,
70                 int (*f_wctomb)(char *mbchar, wchar_t wchar) );
71
72 /* UTF-8 string to MultiByte string */
73 LDAP_F(int)
74 ldap_x_utf8s_to_mbs ( char *mbstr, const char *utf8str, size_t count,
75                 size_t (*f_wcstombs)(char *mbstr, const wchar_t *wcstr, size_t count) );
76
77 /* MultiByte character to UTF-8 character */
78 LDAP_F(int)
79 ldap_x_mb_to_utf8 ( char *utf8char, const char *mbchar, size_t mbsize,
80                 int (*f_mbtowc)(wchar_t *wchar, const char *mbchar, size_t count) );
81
82 /* MultiByte string to UTF-8 string */
83 LDAP_F(int)
84 ldap_x_mbs_to_utf8s ( char *utf8str, const char *mbstr, size_t count,
85                 size_t (*f_mbstowcs)(wchar_t *wcstr, const char *mbstr, size_t count) );
86
87 LDAP_END_DECL
88
89 #endif /* _LDAP_UTF8_H */