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*
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
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 
167  {
168  return reverse_iterator(end());
169  }
170 
172  rbegin() const
173  {
174  return const_reverse_iterator(end());
175  }
176 
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
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
240  const XalanDOMString& thePrefix,
241  const XalanDOMString& theURI)
242  {
243  addDeclaration(
244  thePrefix,
245  theURI.c_str(),
246  theURI.length());
247  }
248 
249  void
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*
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
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
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
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
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1111
NamespaceCollectionType::iterator iterator
Definition: XalanNamespacesStack.hpp:89
const_reverse_iterator rend() const
Definition: XalanNamespacesStack.hpp:184
size_type length() const
Definition: XalanDOMString.hpp:209
size_type size() const
Definition: XalanNamespacesStack.hpp:340
XalanDeque< value_type, ConstructWithMemoryManagerTraits< value_type > > NamespacesStackType
Definition: XalanNamespacesStack.hpp:220
iterator end()
Definition: XalanNamespacesStack.hpp:154
XalanNamespacesStackEntry value_type
Definition: XalanNamespacesStack.hpp:218
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType
Definition: XalanMemoryManagement.hpp:39
reverse_iterator rbegin()
Definition: XalanNamespacesStack.hpp:166
Definition: XalanNamespacesStack.hpp:47
iterator begin()
Definition: XalanNamespacesStack.hpp:142
const_iterator begin() const
Definition: XalanNamespacesStack.hpp:298
iterator begin()
Definition: XalanNamespacesStack.hpp:292
Definition: XalanNamespacesStack.hpp:79
const XalanDOMString *(value_type::* MemberFunctionType)(const XalanDOMString &) const
Definition: XalanNamespacesStack.hpp:230
NamespacesStackType::const_reverse_iterator const_reverse_iterator
Definition: XalanNamespacesStack.hpp:226
void clear(XalanDOMString &theString)
Remove all elements from target string.
Definition: DOMStringHelper.hpp:2291
const_iterator end() const
Definition: XalanNamespacesStack.hpp:310
const XalanDOMString * getPrefixForNamespace(const XalanDOMString &theURI) const
Definition: XalanNamespacesStack.hpp:276
NamespaceCollectionType::const_reverse_iterator const_reverse_iterator
Definition: XalanNamespacesStack.hpp:92
void reset()
Definition: XalanNamespacesStack.hpp:193
NamespacesStackType::reverse_iterator reverse_iterator
Definition: XalanNamespacesStack.hpp:224
virtual const XalanDOMString & getURI() const =0
Retrieve the base URI for the resolver.
iterator end()
Definition: XalanNamespacesStack.hpp:304
const_iterator begin() const
Definition: XalanNamespacesStack.hpp:148
size_t size_type
Definition: XalanDeque.hpp:165
#define XALAN_DOMSUPPORT_EXPORT
Definition: DOMSupportDefinitions.hpp:33
const XalanDOMString & getPrefix() const
Retrieve the thePrefix for namespace.
Definition: XalanNamespace.hpp:79
reverse_iterator_ reverse_iterator
Definition: XalanDeque.hpp:196
reverse_iterator rbegin()
Definition: XalanNamespacesStack.hpp:316
void swap(XalanVector< Type > &theLHS, XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1100
NamespacesStackType::iterator iterator
Definition: XalanNamespacesStack.hpp:223
reverse_iterator rend()
Definition: XalanNamespacesStack.hpp:178
XALAN_CPP_NAMESPACE_BEGIN typedef size_t size_type
Definition: XalanMap.hpp:44
const XalanDOMChar * c_str() const
Definition: XalanDOMString.hpp:314
const_reverse_iterator rbegin() const
Definition: XalanNamespacesStack.hpp:322
const XalanDOMString & getURI() const
Retrieve the URI for namespace.
Definition: XalanNamespace.hpp:101
XalanNamespace value_type
Definition: XalanNamespacesStack.hpp:83
bool empty() const
Definition: XalanNamespacesStack.hpp:346
This class defines an interface for classes that resolve namespace prefixes to their URIs...
Definition: PrefixResolver.hpp:37
const_reverse_iterator_ const_reverse_iterator
Definition: XalanDeque.hpp:197
bool isPrefixPresent(const XalanDOMString &thePrefix) const
Definition: XalanNamespacesStack.hpp:136
const_reverse_iterator rbegin() const
Definition: XalanNamespacesStack.hpp:172
Definition: XalanNamespacesStack.hpp:43
XalanVector< bool > BoolVectorType
Definition: XalanNamespacesStack.hpp:221
const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &thePrefix) const
Get the namespace for a prefix.
Definition: XalanNamespacesStack.hpp:118
void addDeclaration(const XalanDOMString &thePrefix, const XalanDOMChar *theURI)
Definition: XalanNamespacesStack.hpp:250
Definition: XalanDOMString.hpp:42
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
Definition: DOMStringHelper.hpp:277
NamespacesStackType::size_type size_type
Definition: XalanNamespacesStack.hpp:228
Definition: XalanNamespace.hpp:34
const_reverse_iterator rend() const
Definition: XalanNamespacesStack.hpp:334
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const =0
Retrieve a namespace corresponding to a prefix.
NamespacesStackType::const_iterator const_iterator
Definition: XalanNamespacesStack.hpp:225
unsigned int size_type
Definition: XalanDOMString.hpp:53
const XalanDOMString &(value_type::* MemberFunctionType)() const
Definition: XalanNamespacesStack.hpp:87
NamespaceCollectionType::const_iterator const_iterator
Definition: XalanNamespacesStack.hpp:91
void addDeclaration(const XalanDOMString &thePrefix, const XalanDOMString &theURI)
Definition: XalanNamespacesStack.hpp:239
NamespaceCollectionType::reverse_iterator reverse_iterator
Definition: XalanNamespacesStack.hpp:90
const XalanDOMString * getPrefixForNamespace(const XalanDOMString &theURI) const
Get the prefix for a namespace.
Definition: XalanNamespacesStack.hpp:130
reverse_iterator rend()
Definition: XalanNamespacesStack.hpp:328
const_iterator end() const
Definition: XalanNamespacesStack.hpp:160
XalanDeque< value_type > NamespaceCollectionType
Definition: XalanNamespacesStack.hpp:85
Definition: XalanDeque.hpp:59

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