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