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