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(NAMESPACE_HEADER_GUARD_1357924680) 00019 #define NAMESPACE_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base header file. Must be first. 00024 #include <xalanc/XPath/XPathDefinitions.hpp> 00025 00026 #include <xalanc/Include/XalanMemMgrAutoPtr.hpp> 00027 00028 #include <xalanc/PlatformSupport/DOMStringHelper.hpp> 00029 00030 00031 00032 XALAN_CPP_NAMESPACE_BEGIN 00033 00034 00035 00036 /** 00037 * A representation of a namespace. One of these will be pushed on the 00038 * namespace stack for each element. 00039 */ 00040 class XALAN_XPATH_EXPORT NameSpace 00041 { 00042 public: 00043 00044 explicit 00045 NameSpace(MemoryManager& theManager) : 00046 m_prefix(theManager), 00047 m_uri(theManager) 00048 { 00049 } 00050 00051 /** 00052 * Construct a namespace for placement on the 00053 * result tree namespace stack. 00054 * 00055 * @param prefix namespace prefix 00056 * @param uri URI of namespace 00057 */ 00058 NameSpace( 00059 const XalanDOMString& prefix, 00060 const XalanDOMString& uri, 00061 MemoryManager& theManager) : 00062 m_prefix(prefix, theManager), 00063 m_uri(uri, theManager) 00064 { 00065 } 00066 00067 static NameSpace* 00068 create( 00069 const XalanDOMString& prefix, 00070 const XalanDOMString& uri, 00071 MemoryManager& theManager) 00072 { 00073 typedef NameSpace ThisType; 00074 00075 XalanAllocationGuard theGuard(theManager, theManager.allocate(sizeof(ThisType))); 00076 00077 ThisType* const theResult = 00078 new (theGuard.get()) ThisType( 00079 prefix, 00080 uri, 00081 theManager); 00082 00083 theGuard.release(); 00084 00085 return theResult; 00086 } 00087 00088 NameSpace( 00089 const NameSpace& other, 00090 MemoryManager& theManager) : 00091 m_prefix(other.m_prefix, theManager), 00092 m_uri(other.m_uri, theManager) 00093 { 00094 } 00095 00096 ~NameSpace() 00097 { 00098 } 00099 00100 /** 00101 * Retrieve the prefix for namespace 00102 * 00103 * @return prefix string 00104 */ 00105 const XalanDOMString& 00106 getPrefix() const 00107 { 00108 return m_prefix; 00109 } 00110 00111 /** 00112 * Set the prefix for namespace 00113 * 00114 * @param prefix The new prefix value 00115 */ 00116 void 00117 setPrefix(const XalanDOMString& prefix) 00118 { 00119 m_prefix = prefix; 00120 } 00121 00122 /** 00123 * Retrieve the URI for namespace 00124 * 00125 * @return URI string 00126 */ 00127 const XalanDOMString& 00128 getURI() const 00129 { 00130 return m_uri; 00131 } 00132 00133 /** 00134 * Set the URI for namespace 00135 * 00136 * @param uri The new uri value 00137 */ 00138 void 00139 setURI(const XalanDOMString& uri) 00140 { 00141 m_uri = uri; 00142 } 00143 00144 /** 00145 * Set the URI for namespace 00146 * 00147 * @param uri The new uri value 00148 */ 00149 void 00150 setURI(const XalanDOMChar* uri) 00151 { 00152 assert(uri != 0); 00153 00154 m_uri = uri; 00155 } 00156 00157 /** 00158 * Set the URI for namespace 00159 * 00160 * @param uri The new uri value 00161 * @param len The length of the uri 00162 */ 00163 void 00164 setURI( 00165 const XalanDOMChar* uri, 00166 XalanDOMString::size_type len) 00167 { 00168 assert(uri != 0); 00169 00170 m_uri.assign(uri, len); 00171 } 00172 00173 bool 00174 empty() const 00175 { 00176 return m_prefix.empty() && m_uri.empty(); 00177 } 00178 00179 void 00180 clear() 00181 { 00182 m_prefix.clear(); 00183 00184 m_uri.clear(); 00185 } 00186 00187 /** 00188 * Equality operator 00189 * 00190 * @param theRHS namespace to compare 00191 */ 00192 bool 00193 operator==(const NameSpace& theRHS) const 00194 { 00195 return equals(m_prefix, theRHS.m_prefix) && 00196 equals(m_uri, theRHS.m_uri); 00197 } 00198 00199 private: 00200 NameSpace(const NameSpace&); 00201 00202 XalanDOMString m_prefix; 00203 00204 XalanDOMString m_uri; 00205 }; 00206 00207 XALAN_USES_MEMORY_MANAGER(NameSpace) 00208 00209 XALAN_CPP_NAMESPACE_END 00210 00211 00212 00213 #endif // NAMESPACE_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.11 |
|