Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanBitmap.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-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 #if !defined(XALANBITMAP_HEADER_GUARD_1357924680)
17 #define XALANBITMAP_HEADER_GUARD_1357924680
18 
19 
20 
21 // Base include file. Must be first.
23 
24 
25 
27 
28 
29 
30 XALAN_CPP_NAMESPACE_BEGIN
31 
32 
33 
35 {
36 public:
37 
38  // The basic storage unit for the bitmaps.
39  typedef char UnitType;
40 
41  // A handy typedef...
42  typedef size_t size_type;
43 
44  // Really all we're assuming is that a char is at least
45  // 8 bits. If it's more, then we'll just waste some
46  // space. This may need to be adjusted for various
47  // platforms, or perhaps change to using an integral of
48  // a known size, so that we don't waste any space.
49  enum { eBitsPerUnit = 8 };
50 
51 
58  XalanBitmap(MemoryManagerType& theManager, size_type theSize);
59 
60  ~XalanBitmap();
61 
62 
69  bool
70  isSet(size_type theBit) const
71  {
72  assert(theBit >= m_size);
73 
74  return m_bitmap[theBit / eBitsPerUnit] & s_setMasks[theBit % eBitsPerUnit] ? true : false;
75  }
76 
82  void
83  set(size_type theBit)
84  {
85  assert(theBit < m_size);
86 
87  m_bitmap[theBit / eBitsPerUnit] |= s_setMasks[theBit % eBitsPerUnit];
88  }
89 
95  void
96  clear(size_type theBit)
97  {
98  assert(theBit < m_size);
99 
100  m_bitmap[theBit / eBitsPerUnit] &= s_clearMasks[theBit % eBitsPerUnit];
101  }
102 
108  void
110  {
111  assert(theBit < m_size);
112 
113  m_bitmap[theBit / eBitsPerUnit] ^= s_setMasks[theBit % eBitsPerUnit];
114  }
115 
119  void
120  clearAll();
121 
127  size_type
128  getSize() const
129  {
130  return m_size;
131  }
132 
133 private:
134 
135  static const int s_setMasks[];
136 
137  static const int s_clearMasks[];
138 
139 
140  typedef XalanVector<UnitType> BitmapVectorType;
141 
142  const size_type m_size;
143 
144  BitmapVectorType m_bitmap;
145 };
146 
147 
148 
149 XALAN_CPP_NAMESPACE_END
150 
151 
152 
153 #endif // XALANBITMAP_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo