1/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 2 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 */ 22 23/* 24 *$Id: cr-enc-handler.h,v 1.6 2005/05/10 19:48:56 dodji Exp $ 25 */ 26 27/** 28 *@file: 29 *The declaration of the #CREncHandler class. 30 * 31 */ 32 33#ifndef __CR_ENC_HANDLER_H__ 34#define __CR_ENC_HANDLER_H__ 35 36#include "cr-utils.h" 37 38G_BEGIN_DECLS 39 40 41typedef struct _CREncHandler CREncHandler ; 42 43typedef enum CRStatus (*CREncInputFunc) (const guchar * a_in, 44 gulong *a_in_len, 45 guchar *a_out, 46 gulong *a_out_len) ; 47 48typedef enum CRStatus (*CREncOutputFunc) (const guchar * a_in, 49 gulong *a_in_len, 50 guchar *a_out, 51 gulong *a_out_len) ; 52 53typedef enum CRStatus (*CREncInputStrLenAsUtf8Func) 54(const guchar *a_in_start, 55 const guchar *a_in_end, 56 gulong *a_in_size); 57 58typedef enum CRStatus (*CREncUtf8StrLenAsOutputFunc) 59(const guchar *a_in_start, 60 const guchar *a_in_end, 61 gulong *a_in_size) ; 62 63/** 64 *This class is responsible of the 65 *the encoding conversions stuffs in 66 *libcroco. 67 */ 68 69struct _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} ; 77 78CREncHandler * 79cr_enc_handler_get_instance (enum CREncoding a_enc) ; 80 81enum CRStatus 82cr_enc_handler_resolve_enc_alias (const guchar *a_alias_name, 83 enum CREncoding *a_enc) ; 84 85enum CRStatus 86cr_enc_handler_convert_input (CREncHandler *a_this, 87 const guchar *a_in, 88 gulong *a_in_len, 89 guchar **a_out, 90 gulong *a_out_len) ; 91 92G_END_DECLS 93 94#endif /*__CR_ENC_HANDLER_H__*/ 95