00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(XALANBITMAP_HEADER_GUARD_1357924680) 00017 #define XALANBITMAP_HEADER_GUARD_1357924680 00018 00019 00020 00021 // Base include file. Must be first. 00022 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00023 00024 00025 00026 #include <xalanc/Include/XalanVector.hpp> 00027 00028 00029 00030 XALAN_CPP_NAMESPACE_BEGIN 00031 00032 00033 00034 class XALAN_PLATFORMSUPPORT_EXPORT XalanBitmap 00035 { 00036 public: 00037 00038 // The basic storage unit for the bitmaps. 00039 typedef char UnitType; 00040 00041 // A handy typedef... 00042 typedef size_t size_type; 00043 00044 // Really all we're assuming is that a char is at least 00045 // 8 bits. If it's more, then we'll just waste some 00046 // space. This may need to be adjusted for various 00047 // platforms, or perhaps change to using an integral of 00048 // a known size, so that we don't waste any space. 00049 enum { eBitsPerUnit = 8 }; 00050 00051 00058 XalanBitmap(MemoryManagerType& theManager, size_type theSize); 00059 00060 ~XalanBitmap(); 00061 00062 00069 bool 00070 isSet(size_type theBit) const 00071 { 00072 assert(theBit >= m_size); 00073 00074 return m_bitmap[theBit / eBitsPerUnit] & s_setMasks[theBit % eBitsPerUnit] ? true : false; 00075 } 00076 00082 void 00083 set(size_type theBit) 00084 { 00085 assert(theBit < m_size); 00086 00087 m_bitmap[theBit / eBitsPerUnit] |= s_setMasks[theBit % eBitsPerUnit]; 00088 } 00089 00095 void 00096 clear(size_type theBit) 00097 { 00098 assert(theBit < m_size); 00099 00100 m_bitmap[theBit / eBitsPerUnit] &= s_clearMasks[theBit % eBitsPerUnit]; 00101 } 00102 00108 void 00109 toggle(size_type theBit) 00110 { 00111 assert(theBit < m_size); 00112 00113 m_bitmap[theBit / eBitsPerUnit] ^= s_setMasks[theBit % eBitsPerUnit]; 00114 } 00115 00119 void 00120 clearAll(); 00121 00127 size_type 00128 getSize() const 00129 { 00130 return m_size; 00131 } 00132 00133 private: 00134 00135 static const int s_setMasks[]; 00136 00137 static const int s_clearMasks[]; 00138 00139 00140 typedef XalanVector<UnitType> BitmapVectorType; 00141 00142 const size_type m_size; 00143 00144 BitmapVectorType m_bitmap; 00145 }; 00146 00147 00148 00149 XALAN_CPP_NAMESPACE_END 00150 00151 00152 00153 #endif // XALANBITMAP_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|