|
||||
File indexing completed on 2025-01-18 10:15:01
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_RANGETOKEN_HPP) 0023 #define XERCESC_INCLUDE_GUARD_RANGETOKEN_HPP 0024 0025 // --------------------------------------------------------------------------- 0026 // Includes 0027 // --------------------------------------------------------------------------- 0028 #include <xercesc/util/PlatformUtils.hpp> 0029 #include <xercesc/util/regx/Token.hpp> 0030 0031 XERCES_CPP_NAMESPACE_BEGIN 0032 0033 // --------------------------------------------------------------------------- 0034 // Forward Declaration 0035 // --------------------------------------------------------------------------- 0036 class TokenFactory; 0037 0038 0039 class XMLUTIL_EXPORT RangeToken : public Token { 0040 public: 0041 // ----------------------------------------------------------------------- 0042 // Public Constructors and Destructor 0043 // ----------------------------------------------------------------------- 0044 RangeToken(const tokType tkType, 0045 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 0046 ~RangeToken(); 0047 0048 // ----------------------------------------------------------------------- 0049 // Public Constants 0050 // ----------------------------------------------------------------------- 0051 static const int MAPSIZE; 0052 static const unsigned int INITIALSIZE; 0053 0054 // ----------------------------------------------------------------------- 0055 // Getter methods 0056 // ----------------------------------------------------------------------- 0057 RangeToken* getCaseInsensitiveToken(TokenFactory* const tokFactory); 0058 0059 void setCaseInsensitiveToken(RangeToken* tok); 0060 0061 // ----------------------------------------------------------------------- 0062 // Setter methods 0063 // ----------------------------------------------------------------------- 0064 void setRangeValues(XMLInt32* const rangeValues, const unsigned int count); 0065 0066 // ----------------------------------------------------------------------- 0067 // Range manipulation methods 0068 // ----------------------------------------------------------------------- 0069 void addRange(const XMLInt32 start, const XMLInt32 end); 0070 void mergeRanges(const Token *const tok); 0071 void sortRanges(); 0072 void compactRanges(); 0073 void subtractRanges(RangeToken* const tok); 0074 void intersectRanges(RangeToken* const tok); 0075 static RangeToken* complementRanges(RangeToken* const tok, 0076 TokenFactory* const tokFactory, 0077 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 0078 0079 bool empty() const; 0080 0081 // ----------------------------------------------------------------------- 0082 // Match methods 0083 // ----------------------------------------------------------------------- 0084 bool match(const XMLInt32 ch); 0085 0086 // ----------------------------------------------------------------------- 0087 // Creates the map. This will happen automatically, 0088 // necessary. 0089 // ----------------------------------------------------------------------- 0090 void createMap(); 0091 0092 private: 0093 // ----------------------------------------------------------------------- 0094 // Unimplemented constructors and operators 0095 // ----------------------------------------------------------------------- 0096 RangeToken(const RangeToken&); 0097 RangeToken& operator=(const RangeToken&); 0098 0099 // ----------------------------------------------------------------------- 0100 // Private Helper methods 0101 // ----------------------------------------------------------------------- 0102 void expand(const unsigned int length); 0103 0104 void doCreateMap(); 0105 0106 // ----------------------------------------------------------------------- 0107 // Private data members 0108 // ----------------------------------------------------------------------- 0109 bool fSorted; 0110 bool fCompacted; 0111 int fNonMapIndex; 0112 unsigned int fElemCount; 0113 unsigned int fMaxCount; 0114 int* fMap; 0115 XMLInt32* fRanges; 0116 RangeToken* fCaseIToken; 0117 MemoryManager* fMemoryManager; 0118 }; 0119 0120 0121 inline void RangeToken::setCaseInsensitiveToken(RangeToken* tok) 0122 { 0123 fCaseIToken = tok; 0124 } 0125 0126 inline void RangeToken::createMap() 0127 { 0128 if (!fMap) 0129 { 0130 doCreateMap(); 0131 } 0132 } 0133 0134 inline bool RangeToken::empty() const 0135 { 0136 return fElemCount==0; 0137 } 0138 0139 XERCES_CPP_NAMESPACE_END 0140 0141 #endif 0142 0143 /** 0144 * End of file RangeToken.hpp 0145 */ 0146
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |