|
|
1.1 paf 1: /** @file
2: Parser: Transcoder decl.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
5: Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
6:
1.2 ! paf 7: $Id: pa_transcoder.h,v 1.1 2001/12/14 12:55:36 paf Exp $
1.1 paf 8: */
9:
10: #ifndef PA_TRANSCODER_H
11: #define PA_TRANSCODER_H
12:
13: namespace PCRE {
14: #include "pcre.h"
15: # include "internal.h"
16: }
17:
18: #include "pa_config_includes.h"
19: #include "pa_types.h"
20:
21: // defines
22:
23: #ifdef XML
24: # include <util/XercesDefs.hpp>
25: # include <util/TransService.hpp>
26: # define Transcoder_TransRec XMLTransService::TransRec
27: #else
28: # ifndef XMLCh
29: # define XMLCh unsigned int
30: # endif
31: # ifndef XMLByte
32: # define XMLByte unsigned char
33: # endif
34:
35: struct Transcoder_TransRec {
36: XMLCh intCh;
37: XMLByte extCh;
38: };
39: #endif
40:
41:
42: /** contains byte->unicode & unicode->byte tables
43: */
44: struct Transcoder {
45: unsigned char pcre_tables[tables_length];
46:
47: XMLCh fromTable[0x100];
48: Transcoder_TransRec *toTable;
49: uint toTableSize;
50:
51: void sort_ToTable();
52:
53: XMLByte xlatOneTo(const XMLCh toXlat) const;
54:
55: void transcodeToUTF8(Pool& pool,
56: const void *source_body, size_t source_content_length,
57: const void *& dest_body, size_t& dest_content_length) const;
58: void transcodeFromUTF8(Pool& pool,
59: const void *source_body, size_t source_content_length,
60: const void *& dest_body, size_t& dest_content_length) const;
61: void transcodeToTranscoder(Pool& pool,
62: const Transcoder& dest_transcoder,
63: const void *source_body, size_t source_content_length,
64: const void *& dest_body, size_t& dest_content_length) const;
65: };
66:
1.2 ! paf 67: void transcode(Pool& pool,
1.1 paf 68: const Transcoder *source_transcoder, const void *source_body, size_t source_content_length,
69: const Transcoder *dest_transcoder, const void *& dest_body, size_t& dest_content_length
70: );
71:
72: #endif