Libcroco
|
00001 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ 00002 00003 /* 00004 * This file is part of The Croco Library 00005 * 00006 * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> 00007 * 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of version 2.1 of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA 00021 */ 00022 00023 /* 00024 *$Id$ 00025 */ 00026 00027 /** 00028 *@file: 00029 *The declaration of the #CREncHandler class. 00030 * 00031 */ 00032 00033 #ifndef __CR_ENC_HANDLER_H__ 00034 #define __CR_ENC_HANDLER_H__ 00035 00036 #include "cr-utils.h" 00037 00038 G_BEGIN_DECLS 00039 00040 00041 typedef struct _CREncHandler CREncHandler ; 00042 00043 typedef enum CRStatus (*CREncInputFunc) (const guchar * a_in, 00044 gulong *a_in_len, 00045 guchar *a_out, 00046 gulong *a_out_len) ; 00047 00048 typedef enum CRStatus (*CREncOutputFunc) (const guchar * a_in, 00049 gulong *a_in_len, 00050 guchar *a_out, 00051 gulong *a_out_len) ; 00052 00053 typedef enum CRStatus (*CREncInputStrLenAsUtf8Func) 00054 (const guchar *a_in_start, 00055 const guchar *a_in_end, 00056 gulong *a_in_size); 00057 00058 typedef enum CRStatus (*CREncUtf8StrLenAsOutputFunc) 00059 (const guchar *a_in_start, 00060 const guchar *a_in_end, 00061 gulong *a_in_size) ; 00062 00063 /** 00064 *This class is responsible of the 00065 *the encoding conversions stuffs in 00066 *libcroco. 00067 */ 00068 00069 struct _CREncHandler 00070 { 00071 enum CREncoding encoding ; 00072 CREncInputFunc decode_input ; 00073 CREncInputFunc encode_output ; 00074 CREncInputStrLenAsUtf8Func enc_str_len_as_utf8 ; 00075 CREncUtf8StrLenAsOutputFunc utf8_str_len_as_enc ; 00076 } ; 00077 00078 CREncHandler * 00079 cr_enc_handler_get_instance (enum CREncoding a_enc) ; 00080 00081 enum CRStatus 00082 cr_enc_handler_resolve_enc_alias (const guchar *a_alias_name, 00083 enum CREncoding *a_enc) ; 00084 00085 enum CRStatus 00086 cr_enc_handler_convert_input (CREncHandler *a_this, 00087 const guchar *a_in, 00088 gulong *a_in_len, 00089 guchar **a_out, 00090 gulong *a_out_len) ; 00091 00092 G_END_DECLS 00093 00094 #endif /*__CR_ENC_HANDLER_H__*/