|
||||
File indexing completed on 2025-01-18 10:15:14
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_XML256TABLETRANSCODER_HPP) 0023 #define XERCESC_INCLUDE_GUARD_XML256TABLETRANSCODER_HPP 0024 0025 #include <xercesc/util/TransService.hpp> 0026 0027 XERCES_CPP_NAMESPACE_BEGIN 0028 0029 // 0030 // This class implements the functionality of a common type of transcoder 0031 // for an 8 bit, single byte encoding based on a set of 'to' and 'from' 0032 // translation tables. Actual derived classes are trivial and just have to 0033 // provide us with pointers to their tables and we do all the work. 0034 // 0035 class XMLUTIL_EXPORT XML256TableTranscoder : public XMLTranscoder 0036 { 0037 public : 0038 // ----------------------------------------------------------------------- 0039 // Public constructors and destructor 0040 // ----------------------------------------------------------------------- 0041 virtual ~XML256TableTranscoder(); 0042 0043 0044 // ----------------------------------------------------------------------- 0045 // The virtual transcoding interface 0046 // ----------------------------------------------------------------------- 0047 virtual XMLSize_t transcodeFrom 0048 ( 0049 const XMLByte* const srcData 0050 , const XMLSize_t srcCount 0051 , XMLCh* const toFill 0052 , const XMLSize_t maxChars 0053 , XMLSize_t& bytesEaten 0054 , unsigned char* const charSizes 0055 ); 0056 0057 virtual XMLSize_t transcodeTo 0058 ( 0059 const XMLCh* const srcData 0060 , const XMLSize_t srcCount 0061 , XMLByte* const toFill 0062 , const XMLSize_t maxBytes 0063 , XMLSize_t& charsEaten 0064 , const UnRepOpts options 0065 ); 0066 0067 virtual bool canTranscodeTo 0068 ( 0069 const unsigned int toCheck 0070 ); 0071 0072 0073 protected : 0074 // ----------------------------------------------------------------------- 0075 // Hidden constructors 0076 // ----------------------------------------------------------------------- 0077 XML256TableTranscoder 0078 ( 0079 const XMLCh* const encodingName 0080 , const XMLSize_t blockSize 0081 , const XMLCh* const fromTable 0082 , const XMLTransService::TransRec* const toTable 0083 , const XMLSize_t toTableSize 0084 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0085 ); 0086 0087 0088 // ----------------------------------------------------------------------- 0089 // Protected helper methods 0090 // ----------------------------------------------------------------------- 0091 XMLByte xlatOneTo 0092 ( 0093 const XMLCh toXlat 0094 ) const; 0095 0096 0097 private : 0098 // ----------------------------------------------------------------------- 0099 // Unimplemented constructors and operators 0100 // ----------------------------------------------------------------------- 0101 XML256TableTranscoder(); 0102 XML256TableTranscoder(const XML256TableTranscoder&); 0103 XML256TableTranscoder& operator=(const XML256TableTranscoder&); 0104 0105 0106 // ----------------------------------------------------------------------- 0107 // Private data members 0108 // 0109 // fFromTable 0110 // This is the 'from' table that we were given during construction. 0111 // It is a 256 entry table of XMLCh chars. Each entry is the 0112 // Unicode code point for the external encoding point of that value. 0113 // So fFromTable[N] is the Unicode translation of code point N of 0114 // the source encoding. 0115 // 0116 // We don't own this table, we just refer to it. It is assumed that 0117 // the table is static, for performance reasons. 0118 // 0119 // fToSize 0120 // The 'to' table is variable sized. This indicates how many records 0121 // are in it. 0122 // 0123 // fToTable 0124 // This is a variable sized table of TransRec structures. It must 0125 // be sorted by the intCh field, i.e. the XMLCh field. It is searched 0126 // binarily to find the record for a particular Unicode char. Then 0127 // that record's extch field is the translation record. 0128 // 0129 // We don't own this table, we just refer to it. It is assumed that 0130 // the table is static, for performance reasons. 0131 // 0132 // NOTE: There may be dups of the extCh field, since there might be 0133 // multiple Unicode code points which map to the same external code 0134 // point. Normally this won't happen, since the parser assumes that 0135 // internalization is normalized, but we have to be prepared to do 0136 // the right thing if some client code gives us non-normalized data 0137 // itself. 0138 // ----------------------------------------------------------------------- 0139 const XMLCh* fFromTable; 0140 XMLSize_t fToSize; 0141 const XMLTransService::TransRec* fToTable; 0142 }; 0143 0144 XERCES_CPP_NAMESPACE_END 0145 0146 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |