cr-enc-handler.h 2.6 KB

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