Xalan-C++ API Reference  1.12.0
OutputContextStack.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_OUTPUTCONTEXTSTACK_HEADER_GUARD)
19 #define XALAN_OUTPUTCONTEXTSTACK_HEADER_GUARD
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
29 
30 
31 
33 
34 
35 
38 
39 
40 
41 namespace XALAN_CPP_NAMESPACE {
42 
43 
44 
45 class FormatterListener;
46 
47 
48 
50 {
51 public:
52 
54  {
55  OutputContext(MemoryManager& theManager,
56  FormatterListener* theListener = 0) :
57  m_flistener(theListener),
58  m_pendingAttributes(theManager),
59  m_pendingElementName(theManager),
60  m_hasPendingStartDocument(false),
61  m_mustFlushPendingStartDocument(false)
62  {
63  }
64 
65  OutputContext( const OutputContext& other,
66  MemoryManager& theManager) :
67  m_flistener(other.m_flistener),
68  m_pendingAttributes(other.m_pendingAttributes , theManager),
69  m_pendingElementName(other.m_pendingElementName , theManager),
70  m_hasPendingStartDocument(other.m_hasPendingStartDocument),
71  m_mustFlushPendingStartDocument(other.m_mustFlushPendingStartDocument)
72  {
73  }
74 
76  {
77  }
78 
79  void
81  {
82  m_flistener = 0;
83 
84  m_pendingAttributes.clear();
85 
86  m_pendingElementName.clear();
87 
88  m_hasPendingStartDocument = false;
89 
90  m_mustFlushPendingStartDocument = false;
91  }
92 
94 
96 
98 
100 
102  };
103 
105 
107 
108  explicit
109  OutputContextStack(MemoryManager& theManager);
110 
112 
113  void
114  pushContext(FormatterListener* theListener = 0);
115 
116  void
117  popContext();
118 
121  {
122  return (*m_stackPosition).m_flistener;
123  }
124 
127  {
128  return (*m_stackPosition).m_flistener;
129  }
130 
131  const AttributeListImpl&
133  {
134  return (*m_stackPosition).m_pendingAttributes;
135  }
136 
139  {
140  return (*m_stackPosition).m_pendingAttributes;
141  }
142 
143  const XalanDOMString&
145  {
146  return (*m_stackPosition).m_pendingElementName;
147  }
148 
151  {
152  return (*m_stackPosition).m_pendingElementName;
153  }
154 
155  const bool&
157  {
158  return (*m_stackPosition).m_hasPendingStartDocument;
159  }
160 
161  bool&
163  {
164  return (*m_stackPosition).m_hasPendingStartDocument;
165  }
166 
167  const bool&
169  {
170  return (*m_stackPosition).m_mustFlushPendingStartDocument;
171  }
172 
173  bool&
175  {
176  return (*m_stackPosition).m_mustFlushPendingStartDocument;
177  }
178 
179  size_type
180  size() const
181  {
182  // Since we always keep one dummy entry at the beginning,
183  // subtract one from the size
184  assert(m_stackSize == size_type(OutputContextStackType::const_iterator(m_stackPosition) - m_stack.begin()));
185 
186  return m_stackSize;
187  }
188 
189  bool
190  empty() const
191  {
192  return size() == 0 ? true : false;
193  }
194 
195  void
196  clear();
197 
198  void
199  reset();
200 
201 private:
202 
203  // not implemented
205 
206  bool
207  operator==(const OutputContextStack&) const;
208 
210  operator=(const OutputContextStack&);
211 
212  /**
213  * A stack to hold the output contexts...
214  */
215  OutputContextStackType m_stack;
216 
217  OutputContextStackType::iterator m_stackPosition;
218 
219  size_type m_stackSize;
220 };
221 
222 
223 
224 }
225 
226 
227 
228 #endif // XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD
xalanc::OutputContextStack::getPendingElementName
XalanDOMString & getPendingElementName()
Definition: OutputContextStack.hpp:150
xalanc::OutputContextStack::getPendingAttributes
AttributeListImpl & getPendingAttributes()
Definition: OutputContextStack.hpp:138
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanDequeIterator
Definition: XalanDeque.hpp:57
xalanc::clear
void clear(XalanDOMString &theString)
Remove all elements from target string.
Definition: DOMStringHelper.hpp:2475
XalanDOMString.hpp
xalanc::OutputContextStack::OutputContext::OutputContext
OutputContext(const OutputContext &other, MemoryManager &theManager)
Definition: OutputContextStack.hpp:65
XALAN_XSLT_EXPORT
#define XALAN_XSLT_EXPORT
Definition: XSLTDefinitions.hpp:27
XalanDeque.hpp
xalanc::size_type
size_t size_type
Definition: XalanMap.hpp:46
xalanc::OutputContextStack::getPendingElementName
const XalanDOMString & getPendingElementName() const
Definition: OutputContextStack.hpp:144
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xalanc::OutputContextStack::getMustFlushPendingStartDocument
bool & getMustFlushPendingStartDocument()
Definition: OutputContextStack.hpp:174
xalanc::OutputContextStack::OutputContext
Definition: OutputContextStack.hpp:53
DOMStringHelper.hpp
xalanc::XalanDeque
Xalan implementation of deque.
Definition: XalanDeque.hpp:200
xalanc::OutputContextStack::size
size_type size() const
Definition: OutputContextStack.hpp:180
xalanc::OutputContextStack::OutputContext::m_pendingAttributes
AttributeListImpl m_pendingAttributes
Definition: OutputContextStack.hpp:95
xalanc::OutputContextStack::getPendingAttributes
const AttributeListImpl & getPendingAttributes() const
Definition: OutputContextStack.hpp:132
xalanc::OutputContextStack::OutputContext::m_hasPendingStartDocument
bool m_hasPendingStartDocument
Definition: OutputContextStack.hpp:99
xalanc::OutputContextStack::OutputContext::m_mustFlushPendingStartDocument
bool m_mustFlushPendingStartDocument
Definition: OutputContextStack.hpp:101
xalanc::OutputContextStack::getFormatterListener
FormatterListener * getFormatterListener() const
Definition: OutputContextStack.hpp:120
xalanc::OutputContextStack
Definition: OutputContextStack.hpp:49
xalanc::OutputContextStack::OutputContext::m_pendingElementName
XalanDOMString m_pendingElementName
Definition: OutputContextStack.hpp:97
AttributeListImpl.hpp
xalanc::OutputContextStack::OutputContext::OutputContext
OutputContext(MemoryManager &theManager, FormatterListener *theListener=0)
Definition: OutputContextStack.hpp:55
xalanc::OutputContextStack::getHasPendingStartDocument
const bool & getHasPendingStartDocument() const
Definition: OutputContextStack.hpp:156
xalanc::AttributeListImpl
Definition: AttributeListImpl.hpp:49
XSLTDefinitions.hpp
xalanc::FormatterListener
A SAX-based formatter interface for the XSL processor.
Definition: FormatterListener.hpp:56
xalanc::OutputContextStack::OutputContextStackType
XalanDeque< OutputContext, ConstructWithMemoryManagerTraits< OutputContext > > OutputContextStackType
Definition: OutputContextStack.hpp:104
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
xalanc::OutputContextStack::getMustFlushPendingStartDocument
const bool & getMustFlushPendingStartDocument() const
Definition: OutputContextStack.hpp:168
xalanc::OutputContextStack::getHasPendingStartDocument
bool & getHasPendingStartDocument()
Definition: OutputContextStack.hpp:162
xalanc::OutputContextStack::size_type
OutputContextStackType::size_type size_type
Definition: OutputContextStack.hpp:106
xalanc::OutputContextStack::OutputContext::m_flistener
FormatterListener * m_flistener
Definition: OutputContextStack.hpp:93
xalanc::OutputContextStack::OutputContext::reset
void reset()
Definition: OutputContextStack.hpp:80
xalanc::OutputContextStack::empty
bool empty() const
Definition: OutputContextStack.hpp:190
xalanc::OutputContextStack::OutputContext::~OutputContext
~OutputContext()
Definition: OutputContextStack.hpp:75
xalanc::OutputContextStack::getFormatterListener
FormatterListener *& getFormatterListener()
Definition: OutputContextStack.hpp:126