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(MUTABLENODEREFLIST_HEADER_GUARD_1357924680) 00017 #define MUTABLENODEREFLIST_HEADER_GUARD_1357924680 00018 00019 00020 00021 // Base include file. Must be first. 00022 #include <xalanc/XPath/XPathDefinitions.hpp> 00023 00024 00025 00026 #include <xalanc/XPath/NodeRefList.hpp> 00027 00028 00029 00030 XALAN_CPP_NAMESPACE_BEGIN 00031 00032 00033 00034 class XPathExecutionContext; 00035 class XalanDocument; 00036 class XalanNodeList; 00037 00038 00039 00044 class XALAN_XPATH_EXPORT MutableNodeRefList : public NodeRefList 00045 { 00046 public: 00047 00051 explicit 00052 MutableNodeRefList(MemoryManagerType& theManager); 00053 00054 static MutableNodeRefList* 00055 create(MemoryManagerType& theManager); 00061 MutableNodeRefList(const MutableNodeRefList& theSource, 00062 MemoryManagerType& theManager); 00063 00069 explicit 00070 MutableNodeRefList(const NodeRefListBase& theSource, 00071 MemoryManagerType& theManager); 00072 00073 virtual 00074 ~MutableNodeRefList(); 00075 00076 MutableNodeRefList& 00077 operator=(const MutableNodeRefList& theRHS); 00078 00079 MutableNodeRefList& 00080 operator=(const NodeRefList& theRHS); 00081 00082 MutableNodeRefList& 00083 operator=(const NodeRefListBase& theRHS); 00084 00085 MutableNodeRefList& 00086 operator=(const XalanNodeList* theRHS); 00087 00093 void 00094 addNode(XalanNode* n); 00095 00102 void 00103 insertNode( 00104 XalanNode* n, 00105 size_type pos); 00106 00112 void 00113 removeNode(const XalanNode* n); 00114 00120 void 00121 removeNode(size_type pos); 00122 00126 void 00127 clear(); 00128 00135 void 00136 setNode( 00137 size_type pos, 00138 XalanNode* n = 0); 00139 00146 void 00147 addNodes(const XalanNodeList& nodelist); 00148 00155 void 00156 addNodes(const NodeRefListBase& nodelist); 00157 00164 void 00165 addNodesInDocOrder( 00166 const XalanNodeList& nodelist, 00167 XPathExecutionContext& executionContext); 00168 00175 void 00176 addNodesInDocOrder( 00177 const NodeRefListBase& nodelist, 00178 XPathExecutionContext& executionContext); 00179 00186 void 00187 addNodesInDocOrder( 00188 const MutableNodeRefList& nodelist, 00189 XPathExecutionContext& executionContext); 00190 00197 void 00198 addNodeInDocOrder( 00199 XalanNode* node, 00200 XPathExecutionContext& executionContext); 00201 00205 void 00206 clearNulls(); 00207 00211 void 00212 reverse(); 00213 00228 void 00229 reserve(size_type theCount) 00230 { 00231 m_nodeList.reserve(theCount); 00232 } 00233 00237 bool 00238 getUnknownOrder() const 00239 { 00240 return m_order == eUnknownOrder ? true : false; 00241 } 00242 00243 void 00244 setUnknownOrder() 00245 { 00246 m_order = eUnknownOrder; 00247 } 00248 00252 bool 00253 getDocumentOrder() const 00254 { 00255 return m_order == eDocumentOrder ? true : false; 00256 } 00257 00263 void 00264 setDocumentOrder() 00265 { 00266 m_order = eDocumentOrder; 00267 } 00268 00272 bool 00273 getReverseDocumentOrder() const 00274 { 00275 return m_order == eReverseDocumentOrder ? true : false; 00276 } 00277 00283 void 00284 setReverseDocumentOrder() 00285 { 00286 m_order = eReverseDocumentOrder; 00287 } 00288 00289 typedef NodeListVectorType::iterator NodeListIteratorType; 00290 00291 class addNodeInDocOrderFunctor 00292 { 00293 public: 00294 00295 addNodeInDocOrderFunctor( 00296 MutableNodeRefList& theList, 00297 XPathExecutionContext& theExecutionContext) : 00298 m_list(theList), 00299 m_executionContext(theExecutionContext) 00300 { 00301 } 00302 00303 void 00304 operator()(XalanNode* theNode) const 00305 { 00306 m_list.addNodeInDocOrder(theNode, m_executionContext); 00307 } 00308 00309 private: 00310 00311 MutableNodeRefList& m_list; 00312 00313 XPathExecutionContext& m_executionContext; 00314 }; 00315 00316 void 00317 swap(MutableNodeRefList& theOther) 00318 { 00319 NodeRefList::swap(theOther); 00320 00321 const eOrder temp = m_order; 00322 00323 m_order = theOther.m_order; 00324 00325 theOther.m_order = temp; 00326 } 00327 00328 private: 00329 //not defined 00330 MutableNodeRefList(const MutableNodeRefList& theSource); 00331 00332 // An enum to determine what the order of the nodes is... 00333 enum eOrder { eUnknownOrder, eDocumentOrder, eReverseDocumentOrder }; 00334 00335 eOrder m_order; 00336 }; 00337 00338 XALAN_USES_MEMORY_MANAGER(MutableNodeRefList) 00339 00340 XALAN_CPP_NAMESPACE_END 00341 00342 00343 00344 #endif // MUTABLENODEREFLIST_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.9 |
|