1 /*
2   LibRCC - interface to iconv library
3 
4   Copyright (C) 2005-2008 Suren A. Chilingaryan <csa@dside.dyndns.org>
5 
6   This library is free software; you can redistribute it and/or modify it
7   under the terms of the GNU Lesser General Public License version 2.1 or later
8   as published by the Free Software Foundation.
9 
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
13   for more details.
14 
15   You should have received a copy of the GNU Lesser General Public License
16   along with this program; if not, write to the Free Software Foundation, Inc.,
17   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #ifndef _RCC_ICONV_H
21 #define _RCC_ICONV_H
22 
23 #include <iconv.h>
24 
25 struct rcc_iconv_t {
26     iconv_t icnv;
27 };
28 typedef struct rcc_iconv_t rcc_iconv_s;
29 
30 int rccIConvGetError(rcc_iconv icnv);
31 
32 size_t rccIConvInternal(rcc_context ctx, rcc_iconv icnv, const char *buf, size_t len);
33 
34 /**
35   * Recodes chunk of data.
36   *
37   * @param icnv is recoding context
38   * @param outbuf is preallocated output buffer
39   * @param outsize is size of output buffer (striped string will be returned if buffer to small)
40   * @param buf is data for recoding
41   * @param size is size of the data
42   * @return number of recoded bytes in output buffer or -1 in the case of error
43   */
44 size_t rccIConvRecode(rcc_iconv icnv, char *outbuf, size_t outsize, const char *buf, size_t size);
45 
46 #endif /* _RCC_ICONV_H */
47