1 | /*
|
---|
2 | * Copyright 1999-2000,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef XMLASCIITRANSCODER_HPP
|
---|
18 | #define XMLASCIITRANSCODER_HPP
|
---|
19 |
|
---|
20 | #include <xercesc/util/XercesDefs.hpp>
|
---|
21 | #include <xercesc/util/TransService.hpp>
|
---|
22 |
|
---|
23 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
24 |
|
---|
25 | //
|
---|
26 | // This class provides an implementation of the XMLTranscoder interface
|
---|
27 | // for a simple ASCII transcoder. The parser does some encodings
|
---|
28 | // intrinsically without depending upon external transcoding services.
|
---|
29 | // To make everything more orthagonal, we implement these internal
|
---|
30 | // transcoders using the same transcoder abstraction as the pluggable
|
---|
31 | // transcoding services do.
|
---|
32 | //
|
---|
33 | class XMLUTIL_EXPORT XMLASCIITranscoder : public XMLTranscoder
|
---|
34 | {
|
---|
35 | public :
|
---|
36 | // -----------------------------------------------------------------------
|
---|
37 | // Constructors and destructor
|
---|
38 | // -----------------------------------------------------------------------
|
---|
39 | XMLASCIITranscoder
|
---|
40 | (
|
---|
41 | const XMLCh* const encodingName
|
---|
42 | , const unsigned int blockSize
|
---|
43 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
44 | );
|
---|
45 |
|
---|
46 | virtual ~XMLASCIITranscoder();
|
---|
47 |
|
---|
48 |
|
---|
49 | // -----------------------------------------------------------------------
|
---|
50 | // Implementation of the XMLTranscoder interface
|
---|
51 | // -----------------------------------------------------------------------
|
---|
52 | virtual unsigned int transcodeFrom
|
---|
53 | (
|
---|
54 | const XMLByte* const srcData
|
---|
55 | , const unsigned int srcCount
|
---|
56 | , XMLCh* const toFill
|
---|
57 | , const unsigned int maxChars
|
---|
58 | , unsigned int& bytesEaten
|
---|
59 | , unsigned char* const charSizes
|
---|
60 | );
|
---|
61 |
|
---|
62 | virtual unsigned int transcodeTo
|
---|
63 | (
|
---|
64 | const XMLCh* const srcData
|
---|
65 | , const unsigned int srcCount
|
---|
66 | , XMLByte* const toFill
|
---|
67 | , const unsigned int maxBytes
|
---|
68 | , unsigned int& charsEaten
|
---|
69 | , const UnRepOpts options
|
---|
70 | );
|
---|
71 |
|
---|
72 | virtual bool canTranscodeTo
|
---|
73 | (
|
---|
74 | const unsigned int toCheck
|
---|
75 | ) const;
|
---|
76 |
|
---|
77 |
|
---|
78 | private :
|
---|
79 | // -----------------------------------------------------------------------
|
---|
80 | // Unimplemented constructors and operators
|
---|
81 | // -----------------------------------------------------------------------
|
---|
82 | XMLASCIITranscoder(const XMLASCIITranscoder&);
|
---|
83 | XMLASCIITranscoder& operator=(const XMLASCIITranscoder&);
|
---|
84 | };
|
---|
85 |
|
---|
86 | XERCES_CPP_NAMESPACE_END
|
---|
87 |
|
---|
88 | #endif
|
---|