00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(XALAN_OUTPUTCONTEXTSTACK_HEADER_GUARD) 00017 #define XALAN_OUTPUTCONTEXTSTACK_HEADER_GUARD 00018 00019 00020 00021 // Base include file. Must be first. 00022 #include <xalanc/XSLT/XSLTDefinitions.hpp> 00023 00024 00025 00026 #include <xalanc/Include/XalanDeque.hpp> 00027 00028 00029 00030 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00031 00032 00033 00034 #include <xalanc/PlatformSupport/AttributeListImpl.hpp> 00035 #include <xalanc/PlatformSupport/DOMStringHelper.hpp> 00036 00037 00038 00039 XALAN_CPP_NAMESPACE_BEGIN 00040 00041 00042 00043 class FormatterListener; 00044 00045 00046 00047 class XALAN_XSLT_EXPORT OutputContextStack 00048 { 00049 public: 00050 00051 struct OutputContext 00052 { 00053 OutputContext(MemoryManagerType& theManager, 00054 FormatterListener* theListener = 0) : 00055 m_flistener(theListener), 00056 m_pendingAttributes(theManager), 00057 m_pendingElementName(theManager), 00058 m_hasPendingStartDocument(false), 00059 m_mustFlushPendingStartDocument(false) 00060 { 00061 } 00062 00063 OutputContext( const OutputContext& other, 00064 MemoryManagerType& theManager) : 00065 m_flistener(other.m_flistener), 00066 m_pendingAttributes(other.m_pendingAttributes , theManager), 00067 m_pendingElementName(other.m_pendingElementName , theManager), 00068 m_hasPendingStartDocument(other.m_hasPendingStartDocument), 00069 m_mustFlushPendingStartDocument(other.m_mustFlushPendingStartDocument) 00070 { 00071 } 00072 00073 ~OutputContext() 00074 { 00075 } 00076 00077 void 00078 reset() 00079 { 00080 m_flistener = 0; 00081 00082 m_pendingAttributes.clear(); 00083 00084 m_pendingElementName.clear(); 00085 00086 m_hasPendingStartDocument = false; 00087 00088 m_mustFlushPendingStartDocument = false; 00089 } 00090 00091 FormatterListener* m_flistener; 00092 00093 AttributeListImpl m_pendingAttributes; 00094 00095 XalanDOMString m_pendingElementName; 00096 00097 bool m_hasPendingStartDocument; 00098 00099 bool m_mustFlushPendingStartDocument; 00100 }; 00101 00102 typedef XalanDeque<OutputContext, ConstructWithMemoryManagerTraits<OutputContext> > OutputContextStackType; 00103 00104 typedef OutputContextStackType::size_type size_type; 00105 00106 explicit 00107 OutputContextStack(MemoryManagerType& theManager); 00108 00109 ~OutputContextStack(); 00110 00111 void 00112 pushContext(FormatterListener* theListener = 0); 00113 00114 void 00115 popContext(); 00116 00117 FormatterListener* 00118 getFormatterListener() const 00119 { 00120 return (*m_stackPosition).m_flistener; 00121 } 00122 00123 FormatterListener*& 00124 getFormatterListener() 00125 { 00126 return (*m_stackPosition).m_flistener; 00127 } 00128 00129 const AttributeListImpl& 00130 getPendingAttributes() const 00131 { 00132 return (*m_stackPosition).m_pendingAttributes; 00133 } 00134 00135 AttributeListImpl& 00136 getPendingAttributes() 00137 { 00138 return (*m_stackPosition).m_pendingAttributes; 00139 } 00140 00141 const XalanDOMString& 00142 getPendingElementName() const 00143 { 00144 return (*m_stackPosition).m_pendingElementName; 00145 } 00146 00147 XalanDOMString& 00148 getPendingElementName() 00149 { 00150 return (*m_stackPosition).m_pendingElementName; 00151 } 00152 00153 const bool& 00154 getHasPendingStartDocument() const 00155 { 00156 return (*m_stackPosition).m_hasPendingStartDocument; 00157 } 00158 00159 bool& 00160 getHasPendingStartDocument() 00161 { 00162 return (*m_stackPosition).m_hasPendingStartDocument; 00163 } 00164 00165 const bool& 00166 getMustFlushPendingStartDocument() const 00167 { 00168 return (*m_stackPosition).m_mustFlushPendingStartDocument; 00169 } 00170 00171 bool& 00172 getMustFlushPendingStartDocument() 00173 { 00174 return (*m_stackPosition).m_mustFlushPendingStartDocument; 00175 } 00176 00177 size_type 00178 size() const 00179 { 00180 // Since we always keep one dummy entry at the beginning, 00181 // subtract one from the size 00182 assert(m_stackSize == size_type(OutputContextStackType::const_iterator(m_stackPosition) - m_stack.begin())); 00183 00184 return m_stackSize; 00185 } 00186 00187 bool 00188 empty() const 00189 { 00190 return size() == 0 ? true : false; 00191 } 00192 00193 void 00194 clear(); 00195 00196 void 00197 reset(); 00198 00199 private: 00200 00201 // not implemented 00202 OutputContextStack(const OutputContextStack&); 00203 00204 bool 00205 operator==(const OutputContextStack&) const; 00206 00207 OutputContextStack& 00208 operator=(const OutputContextStack&); 00209 00213 OutputContextStackType m_stack; 00214 00215 OutputContextStackType::iterator m_stackPosition; 00216 00217 size_type m_stackSize; 00218 }; 00219 00220 00221 00222 XALAN_CPP_NAMESPACE_END 00223 00224 00225 00226 #endif // XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|