|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
19 * contributor license agreements. See the NOTICE file distributed with |
|
20 * this work for additional information regarding copyright ownership. |
|
21 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
22 * (the "License"); you may not use this file except in compliance with |
|
23 * the License. You may obtain a copy of the License at |
|
24 * |
|
25 * http://www.apache.org/licenses/LICENSE-2.0 |
|
26 * |
|
27 * Unless required by applicable law or agreed to in writing, software |
|
28 * distributed under the License is distributed on an "AS IS" BASIS, |
|
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
30 * See the License for the specific language governing permissions and |
|
31 * limitations under the License. |
|
32 */ |
|
33 |
|
34 #ifndef XMLASCIITRANSCODER_HPP |
|
35 #define XMLASCIITRANSCODER_HPP |
|
36 |
|
37 #include <xercesc/util/XercesDefs.hpp> |
|
38 #include <xercesc/util/TransService.hpp> |
|
39 |
|
40 XERCES_CPP_NAMESPACE_BEGIN |
|
41 |
|
42 // |
|
43 // This class provides an implementation of the XMLTranscoder interface |
|
44 // for a simple ASCII transcoder. The parser does some encodings |
|
45 // intrinsically without depending upon external transcoding services. |
|
46 // To make everything more orthagonal, we implement these internal |
|
47 // transcoders using the same transcoder abstraction as the pluggable |
|
48 // transcoding services do. |
|
49 // |
|
50 class XMLUTIL_EXPORT XMLASCIITranscoder : public XMLTranscoder |
|
51 { |
|
52 public : |
|
53 // ----------------------------------------------------------------------- |
|
54 // Constructors and destructor |
|
55 // ----------------------------------------------------------------------- |
|
56 XMLASCIITranscoder |
|
57 ( |
|
58 const XMLCh* const encodingName |
|
59 , const unsigned int blockSize |
|
60 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
|
61 ); |
|
62 |
|
63 virtual ~XMLASCIITranscoder(); |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------- |
|
67 // Implementation of the XMLTranscoder interface |
|
68 // ----------------------------------------------------------------------- |
|
69 virtual unsigned int transcodeFrom |
|
70 ( |
|
71 const XMLByte* const srcData |
|
72 , const unsigned int srcCount |
|
73 , XMLCh* const toFill |
|
74 , const unsigned int maxChars |
|
75 , unsigned int& bytesEaten |
|
76 , unsigned char* const charSizes |
|
77 ); |
|
78 |
|
79 virtual unsigned int transcodeTo |
|
80 ( |
|
81 const XMLCh* const srcData |
|
82 , const unsigned int srcCount |
|
83 , XMLByte* const toFill |
|
84 , const unsigned int maxBytes |
|
85 , unsigned int& charsEaten |
|
86 , const UnRepOpts options |
|
87 ); |
|
88 |
|
89 virtual bool canTranscodeTo |
|
90 ( |
|
91 const unsigned int toCheck |
|
92 ) const; |
|
93 |
|
94 |
|
95 private : |
|
96 // ----------------------------------------------------------------------- |
|
97 // Unimplemented constructors and operators |
|
98 // ----------------------------------------------------------------------- |
|
99 XMLASCIITranscoder(const XMLASCIITranscoder&); |
|
100 XMLASCIITranscoder& operator=(const XMLASCIITranscoder&); |
|
101 }; |
|
102 |
|
103 XERCES_CPP_NAMESPACE_END |
|
104 |
|
105 #endif |