00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD) 00019 #define XALAN_RESULTNAMESPACESSTACK_HEADER_GUARD 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/XSLT/XSLTDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/Include/XalanVector.hpp> 00029 00030 00031 00032 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00033 00034 00035 00036 #include <xalanc/XPath/XalanQName.hpp> 00037 00038 00039 00040 XALAN_CPP_NAMESPACE_BEGIN 00041 00042 00043 00044 class XALAN_XSLT_EXPORT ResultNamespacesStack 00045 { 00046 public: 00047 00048 00049 #if defined(XALAN_USE_DEQUE_FOR_VECTOR_BOOL) 00050 #if defined(XALAN_NO_STD_NAMESPACE) 00051 typedef deque<bool> BoolVectorType; 00052 #else 00053 typedef std::deque<bool> BoolVectorType; 00054 #endif 00055 #else 00056 typedef XalanVector<bool> BoolVectorType; 00057 #endif 00058 00059 typedef XalanQName::NamespaceVectorType NamespaceVectorType; 00060 typedef XalanQName::NamespacesStackType NamespacesStackType; 00061 00062 typedef NamespacesStackType::size_type size_type; 00063 00064 00065 explicit 00066 ResultNamespacesStack(MemoryManager& theManager); 00067 00068 ~ResultNamespacesStack(); 00069 00070 void 00071 addDeclaration( 00072 const XalanDOMString& thePrefix, 00073 const XalanDOMString& theNamespaceURI) 00074 { 00075 addDeclaration( 00076 thePrefix, 00077 theNamespaceURI.c_str(), 00078 theNamespaceURI.length()); 00079 } 00080 00081 void 00082 addDeclaration( 00083 const XalanDOMString& thePrefix, 00084 const XalanDOMChar* theNamespaceURI) 00085 { 00086 addDeclaration( 00087 thePrefix, 00088 theNamespaceURI, 00089 length(theNamespaceURI)); 00090 } 00091 00092 void 00093 addDeclaration( 00094 const XalanDOMString& thePrefix, 00095 const XalanDOMChar* theNamespaceURI, 00096 XalanDOMString::size_type theLength); 00097 00098 void 00099 pushContext(); 00100 00101 void 00102 popContext(); 00103 00104 const XalanDOMString* 00105 getNamespaceForPrefix(const XalanDOMString& thePrefix) const; 00106 00107 const XalanDOMString* 00108 getPrefixForNamespace(const XalanDOMString& theNamespaceURI) const; 00109 00110 /** 00111 * See if the prefix has been mapped to a namespace in the current 00112 * context, without looking down the stack of namespaces. 00113 */ 00114 bool 00115 prefixIsPresentLocal(const XalanDOMString& thePrefix); 00116 00117 void 00118 clear(); 00119 00120 size_type 00121 size() const 00122 { 00123 return m_resultNamespaces.size() - 1; 00124 } 00125 00126 bool 00127 empty() const 00128 { 00129 return NamespacesStackType::const_iterator(m_stackPosition) == m_resultNamespaces.begin() ? true : false; 00130 } 00131 00132 private: 00133 00134 // not implemented 00135 ResultNamespacesStack(const ResultNamespacesStack&); 00136 00137 bool 00138 operator==(const ResultNamespacesStack&) const; 00139 00140 ResultNamespacesStack& 00141 operator=(const ResultNamespacesStack&); 00142 00143 enum { eDefaultCreateNewContextStackSize = 25 }; 00144 00145 /** 00146 * A stack to keep track of the result tree namespaces. 00147 */ 00148 NamespacesStackType m_resultNamespaces; 00149 00150 NamespacesStackType::iterator m_stackBegin; 00151 00152 NamespacesStackType::iterator m_stackPosition; 00153 00154 BoolVectorType m_createNewContextStack; 00155 }; 00156 00157 00158 00159 XALAN_CPP_NAMESPACE_END 00160 00161 00162 00163 #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.11 |
|