Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


ResultNamespacesStack.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD)
19 #define XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
29 
30 
31 
33 
34 
35 
37 
38 
39 
40 XALAN_CPP_NAMESPACE_BEGIN
41 
42 
43 
45 {
46 public:
47 
48 
49 #if defined(XALAN_USE_DEQUE_FOR_VECTOR_BOOL)
50  #if defined(XALAN_NO_STD_NAMESPACE)
51  typedef deque<bool> BoolVectorType;
52  #else
53  typedef std::deque<bool> BoolVectorType;
54  #endif
55 #else
57 #endif
58 
61 
63 
64 
65  explicit
66  ResultNamespacesStack(MemoryManager& theManager);
67 
69 
70  void
72  const XalanDOMString& thePrefix,
73  const XalanDOMString& theNamespaceURI)
74  {
75  addDeclaration(
76  thePrefix,
77  theNamespaceURI.c_str(),
78  theNamespaceURI.length());
79  }
80 
81  void
83  const XalanDOMString& thePrefix,
84  const XalanDOMChar* theNamespaceURI)
85  {
86  addDeclaration(
87  thePrefix,
88  theNamespaceURI,
89  length(theNamespaceURI));
90  }
91 
92  void
93  addDeclaration(
94  const XalanDOMString& thePrefix,
95  const XalanDOMChar* theNamespaceURI,
96  XalanDOMString::size_type theLength);
97 
98  void
99  pushContext();
100 
101  void
102  popContext();
103 
104  const XalanDOMString*
105  getNamespaceForPrefix(const XalanDOMString& thePrefix) const;
106 
107  const XalanDOMString*
108  getPrefixForNamespace(const XalanDOMString& theNamespaceURI) const;
109 
110  /**
111  * See if the prefix has been mapped to a namespace in the current
112  * context, without looking down the stack of namespaces.
113  */
114  bool
115  prefixIsPresentLocal(const XalanDOMString& thePrefix);
116 
117  void
118  clear();
119 
120  size_type
121  size() const
122  {
123  return m_resultNamespaces.size() - 1;
124  }
125 
126  bool
127  empty() const
128  {
129  return NamespacesStackType::const_iterator(m_stackPosition) == m_resultNamespaces.begin() ? true : false;
130  }
131 
132 private:
133 
134  // not implemented
136 
137  bool
138  operator==(const ResultNamespacesStack&) const;
139 
141  operator=(const ResultNamespacesStack&);
142 
143  enum { eDefaultCreateNewContextStackSize = 25 };
144 
145  /**
146  * A stack to keep track of the result tree namespaces.
147  */
148  NamespacesStackType m_resultNamespaces;
149 
150  NamespacesStackType::iterator m_stackBegin;
151 
152  NamespacesStackType::iterator m_stackPosition;
153 
154  BoolVectorType m_createNewContextStack;
155 };
156 
157 
158 
159 XALAN_CPP_NAMESPACE_END
160 
161 
162 
163 #endif // XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD
XalanVector< bool > BoolVectorType
XalanQName::NamespaceVectorType NamespaceVectorType
void clear(XalanDOMString &theString)
Remove all elements from target string.
XalanSize_t size_type
const XalanDOMChar * c_str() const
size_t size_type
Definition: XalanDeque.hpp:204
size_type length() const
#define XALAN_XSLT_EXPORT
XalanQName::NamespacesStackType NamespacesStackType
bool operator==(const ElemAttributeSet &theLHS, const ElemAttributeSet &theRHS)
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
void addDeclaration(const XalanDOMString &thePrefix, const XalanDOMString &theNamespaceURI)
Xalan implementation of deque.
Definition: XalanDeque.hpp:200
NamespacesStackType::size_type size_type
void addDeclaration(const XalanDOMString &thePrefix, const XalanDOMChar *theNamespaceURI)

Interpreting class diagrams

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

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

Apache Logo