Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanNamespacesStack.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(XALAN_XALANNAMESPACESSTACK_HEADER_GUARD)
17 #define XALAN_XALANNAMESPACESSTACK_HEADER_GUARD
18 
19 
20 
21 // Base include file. Must be first.
23 
24 
25 
28 
29 
30 
33 
34 
35 
36 XALAN_CPP_NAMESPACE_BEGIN
37 
38 
39 class XalanDOMString;
40 
41 
42 
44 {
45 public:
46 
48  {
49  public:
50 
60  const XalanNamespacesStack& theStack,
61  const XalanDOMString& theURI);
62 
63  virtual
65 
66  virtual const XalanDOMString*
67  getNamespaceForPrefix(const XalanDOMString& prefix) const;
68 
69  virtual const XalanDOMString&
70  getURI() const;
71 
72  private:
73 
74  const XalanNamespacesStack& m_stack;
75 
76  const XalanDOMString& m_uri;
77  };
78 
80  {
81  public:
82 
84 
86 
87  typedef const XalanDOMString& (value_type::*MemberFunctionType)() const;
88 
93 
95 
97  MemoryManagerType& theManager);
98 
100 
102  set(const XalanNamespacesStackEntry& theRHS,
103  MemoryManagerType& theManager);
104 
105  void
106  addDeclaration(
107  const XalanDOMString& thePrefix,
108  const XalanDOMChar* theNamespaceURI,
109  XalanDOMString::size_type theLength);
110 
117  const XalanDOMString*
118  getNamespaceForPrefix(const XalanDOMString& thePrefix) const
119  {
120  return findEntry(thePrefix, &XalanNamespace::getPrefix, &XalanNamespace::getURI);
121  }
122 
129  const XalanDOMString*
130  getPrefixForNamespace(const XalanDOMString& theURI) const
131  {
132  return findEntry(theURI, &XalanNamespace::getURI, &XalanNamespace::getPrefix);
133  }
134 
135  bool
136  isPrefixPresent(const XalanDOMString& thePrefix) const
137  {
138  return getNamespaceForPrefix(thePrefix) == 0 ? false : true;
139  }
140 
141  iterator
142  begin()
143  {
144  return m_namespaces.begin();
145  }
146 
148  begin() const
149  {
150  return m_namespaces.begin();
151  }
152 
153  iterator
154  end()
155  {
156  return m_position;
157  }
158 
160  end() const
161  {
162  return const_iterator(m_position);
163  }
164 
166  rbegin()
167  {
168  return reverse_iterator(end());
169  }
170 
172  rbegin() const
173  {
174  return const_reverse_iterator(end());
175  }
176 
178  rend()
179  {
180  return reverse_iterator(begin());
181  }
182 
184  rend() const
185  {
186  return const_reverse_iterator(begin());
187  }
188 
189  void
190  clear();
191 
192  void
193  reset()
194  {
195  m_position = m_namespaces.begin();
196  }
197 
198  void
199  swap(XalanNamespacesStackEntry& theOther);
200 
201  private:
202  //Not implemented
205 
206  const XalanDOMString*
207  findEntry(
208  const XalanDOMString& theKey,
209  MemberFunctionType theKeyFunction,
210  MemberFunctionType theValueFunction) const;
211 
212  NamespaceCollectionType m_namespaces;
213 
214  iterator m_position;
215  };
216 
217 
219 
222 
227 
229 
230  typedef const XalanDOMString* (value_type::*MemberFunctionType)(const XalanDOMString&) const;
231 
232 
233  explicit
235 
237 
238  void
239  addDeclaration(
240  const XalanDOMString& thePrefix,
241  const XalanDOMString& theURI)
242  {
243  addDeclaration(
244  thePrefix,
245  theURI.c_str(),
246  theURI.length());
247  }
248 
249  void
250  addDeclaration(
251  const XalanDOMString& thePrefix,
252  const XalanDOMChar* theURI)
253  {
254  addDeclaration(
255  thePrefix,
256  theURI,
257  length(theURI));
258  }
259 
260  void
261  addDeclaration(
262  const XalanDOMString& thePrefix,
263  const XalanDOMChar* theURI,
264  XalanDOMString::size_type theLength);
265 
266  void
267  pushContext();
268 
269  void
270  popContext();
271 
272  const XalanDOMString*
273  getNamespaceForPrefix(const XalanDOMString& thePrefix) const;
274 
275  const XalanDOMString*
276  getPrefixForNamespace(const XalanDOMString& theURI) const
277  {
278  return findEntry(theURI, &value_type::getPrefixForNamespace);
279  }
280 
285  bool
286  prefixIsPresentLocal(const XalanDOMString& thePrefix);
287 
288  void
289  clear();
290 
291  iterator
292  begin()
293  {
294  return m_stackBegin + 1;
295  }
296 
297  const_iterator
298  begin() const
299  {
300  return const_iterator(m_stackBegin + 1);
301  }
302 
303  iterator
304  end()
305  {
306  return m_stackPosition + 1;
307  }
308 
309  const_iterator
310  end() const
311  {
312  return const_iterator(m_stackPosition + 1);
313  }
314 
315  reverse_iterator
316  rbegin()
317  {
318  return reverse_iterator(end());
319  }
320 
321  const_reverse_iterator
322  rbegin() const
323  {
324  return const_reverse_iterator(end());
325  }
326 
327  reverse_iterator
328  rend()
329  {
330  return reverse_iterator(begin());
331  }
332 
333  const_reverse_iterator
334  rend() const
335  {
336  return const_reverse_iterator(begin());
337  }
338 
339  size_type
340  size() const
341  {
342  return m_resultNamespaces.size() - 1;
343  }
344 
345  bool
346  empty() const
347  {
348  return NamespacesStackType::const_iterator(m_stackPosition) == m_resultNamespaces.begin() ? true : false;
349  }
350 
351 private:
352 
353  // not implemented
356  XalanNamespacesStackEntry&
357  operator=(const XalanNamespacesStackEntry& theRHS);
358 
359  bool
360  operator==(const XalanNamespacesStack&) const;
361 
363  operator=(const XalanNamespacesStack&);
364 
365  enum { eDefaultCreateNewContextStackSize = 25 };
366 
367  const XalanDOMString*
368  findEntry(
369  const XalanDOMString& theKey,
370  MemberFunctionType theFunction) const;
371 
375  NamespacesStackType m_resultNamespaces;
376 
377  NamespacesStackType::iterator m_stackBegin;
378 
379  NamespacesStackType::iterator m_stackPosition;
380 
381  BoolVectorType m_createNewContextStack;
382 };
383 
384 
385 
386 XALAN_CPP_NAMESPACE_END
387 
388 
389 
390 #endif // XALAN_XALANNAMESPACESSTACK_HEADER_GUARD

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