1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
3 /*
4 * This file is part of The Croco Library
5 *
6 * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of version 2.1 of the GNU Lesser General Public
10 * License as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 */
23 /*
24 *$Id: cr-enc-handler.h,v 1.5 2004/01/24 19:24:01 dodji Exp $
25 */
27 /**
28 *@file:
29 *The declaration of the #CREncHandler class.
30 *
31 */
33 #ifndef __CR_ENC_HANDLER_H__
34 #define __CR_ENC_HANDLER_H__
36 #include "cr-utils.h"
38 G_BEGIN_DECLS
41 typedef struct _CREncHandler CREncHandler ;
43 typedef enum CRStatus (*CREncInputFunc) (const guchar * a_in,
44 gulong *a_in_len,
45 guchar *a_out,
46 gulong *a_out_len) ;
48 typedef enum CRStatus (*CREncOutputFunc) (const guchar * a_in,
49 gulong *a_in_len,
50 guchar *a_out,
51 gulong *a_out_len) ;
53 typedef enum CRStatus (*CREncInputStrLenAsUtf8Func)
54 (const guchar *a_in_start,
55 const guchar *a_in_end,
56 gulong *a_in_size);
58 typedef enum CRStatus (*CREncUtf8StrLenAsOutputFunc)
59 (const guchar *a_in_start,
60 const guchar *a_in_end,
61 gulong *a_in_size) ;
63 /**
64 *This class is responsible of the
65 *the encoding conversions stuffs in
66 *libcroco.
67 */
69 struct _CREncHandler
70 {
71 enum CREncoding encoding ;
72 CREncInputFunc decode_input ;
73 CREncInputFunc encode_output ;
74 CREncInputStrLenAsUtf8Func enc_str_len_as_utf8 ;
75 CREncUtf8StrLenAsOutputFunc utf8_str_len_as_enc ;
76 } ;
78 CREncHandler *
79 cr_enc_handler_get_instance (enum CREncoding a_enc) ;
81 enum CRStatus
82 cr_enc_handler_resolve_enc_alias (const guchar *a_en_alias,
83 enum CREncoding *a_enc) ;
84 void
85 cr_enc_handler_destroy (CREncHandler * a_enc_hdlr) ;
87 enum CRStatus
88 cr_enc_handler_convert_input (CREncHandler *a_this,
89 const guchar *a_in,
90 gulong *a_in_len,
91 guchar **a_out,
92 gulong *a_out_len) ;
94 G_END_DECLS
96 #endif /*__CR_ENC_HANDLER_H__*/