Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

XalanQName.hpp

Go to the documentation of this file.
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(XALANQNAME_HEADER_GUARD_1357924680) 00017 #define XALANQNAME_HEADER_GUARD_1357924680 00018 00019 00020 00021 // Base header file. Must be first. 00022 #include <xalanc/XPath/XPathDefinitions.hpp> 00023 00024 00025 00026 #include <deque> 00027 00028 00029 00030 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00031 00032 00033 00034 #include <xalanc/PlatformSupport/DOMStringHelper.hpp> 00035 #include <xalanc/PlatformSupport/PrefixResolver.hpp> 00036 #include <xalanc/PlatformSupport/XSLException.hpp> 00037 00038 00039 00040 #include <xalanc/XPath/NameSpace.hpp> 00041 00042 00043 00044 XALAN_CPP_NAMESPACE_BEGIN 00045 00046 00047 00048 class XalanElement; 00049 class XPathEnvSupport; 00050 00051 00052 00065 class XALAN_XPATH_EXPORT XalanQName 00066 { 00067 public: 00068 00069 #if defined(XALAN_NO_STD_NAMESPACE) 00070 typedef deque<NameSpace> NamespaceVectorType; 00071 typedef deque<NamespaceVectorType> NamespacesStackType; 00072 #else 00073 typedef std::deque<NameSpace> NamespaceVectorType; 00074 typedef std::deque<NamespaceVectorType> NamespacesStackType; 00075 #endif 00076 00081 explicit 00082 XalanQName() 00083 { 00084 } 00085 00086 virtual 00087 ~XalanQName() 00088 { 00089 } 00090 00096 virtual const XalanDOMString& 00097 getLocalPart() const = 0; 00098 00104 virtual const XalanDOMString& 00105 getNamespace() const = 0; 00106 00112 bool 00113 isValid() const 00114 { 00115 return isValidNCName(getLocalPart()); 00116 } 00117 00123 bool 00124 isEmpty() const 00125 { 00126 return getNamespace().empty() && getLocalPart().empty(); 00127 } 00128 00136 bool 00137 equals(const XalanQName& theRHS) const 00138 { 00139 // Note that we do not use our member variables here. See 00140 // class QNameReference for details... 00141 return getLocalPart() == theRHS.getLocalPart() && 00142 getNamespace() == theRHS.getNamespace(); 00143 } 00144 00145 XalanDOMString::size_type 00146 hash() const 00147 { 00148 return getLocalPart().hash() % getNamespace().hash(); 00149 } 00150 00151 class XALAN_XPATH_EXPORT PrefixResolverProxy : public PrefixResolver 00152 { 00153 public: 00154 00163 PrefixResolverProxy( 00164 const NamespacesStackType& theStack, 00165 const XalanDOMString& theURI); 00166 00167 virtual 00168 ~PrefixResolverProxy(); 00169 00170 virtual const XalanDOMString* 00171 getNamespaceForPrefix(const XalanDOMString& prefix) const; 00172 00173 virtual const XalanDOMString& 00174 getURI() const; 00175 00176 private: 00177 00178 const NamespacesStackType& m_stack; 00179 00180 const XalanDOMString& m_uri; 00181 }; 00182 00190 static const XalanDOMString* 00191 getNamespaceForPrefix( 00192 const NamespaceVectorType& namespaces, 00193 const XalanDOMString& prefix); 00194 00203 static const XalanDOMString* 00204 getNamespaceForPrefix( 00205 const NamespacesStackType& nsStack, 00206 const XalanDOMString& prefix); 00207 00218 static const XalanDOMString* 00219 getNamespaceForPrefix( 00220 NamespacesStackType::const_iterator theBegin, 00221 NamespacesStackType::const_iterator theEnd, 00222 const XalanDOMString& prefix); 00223 00232 static const XalanDOMString* 00233 getPrefixForNamespace( 00234 const NamespaceVectorType& namespaces, 00235 const XalanDOMString& uri); 00236 00245 static const XalanDOMString* 00246 getPrefixForNamespace( 00247 const NamespacesStackType& nsStack, 00248 const XalanDOMString& uri); 00249 00260 static const XalanDOMString* 00261 getPrefixForNamespace( 00262 NamespacesStackType::const_iterator theBegin, 00263 NamespacesStackType::const_iterator theEnd, 00264 const XalanDOMString& uri); 00265 00273 static bool 00274 isValidNCName(const XalanDOMString& theNCName); 00275 00284 static bool 00285 isValidNCName( 00286 const XalanDOMChar* theNCName, 00287 XalanDOMString::size_type theLength = XalanDOMString::npos); 00288 00297 static bool 00298 isValidQName(const XalanDOMString& theQName); 00299 00309 static bool 00310 isValidQName( 00311 const XalanDOMChar* theQName, 00312 XalanDOMString::size_type theLength = XalanDOMString::npos); 00313 00314 class InvalidQNameException : public XSLException 00315 { 00316 public: 00317 00328 InvalidQNameException( 00329 const XalanDOMChar* theQName, 00330 XalanDOMString::size_type theQNameLength, 00331 const XalanDOMString& theURI, 00332 int theLineNumber, 00333 int theColumnNumber); 00334 00343 InvalidQNameException( 00344 const LocatorType& theLocator, 00345 const XalanDOMChar* theQName, 00346 XalanDOMString::size_type theQNameLength); 00347 00355 InvalidQNameException( 00356 const XalanDOMChar* theQName, 00357 XalanDOMString::size_type theQNameLength); 00358 00359 virtual 00360 ~InvalidQNameException(); 00361 00362 private: 00363 00364 static const XalanDOMString 00365 format( 00366 const XalanDOMChar* theQName, 00367 XalanDOMString::size_type theQNameLength); 00368 }; 00369 00370 protected: 00371 00372 static const XalanDOMString s_emptyString; 00373 }; 00374 00375 00376 00377 inline bool 00378 operator==( 00379 const XalanQName& theLHS, 00380 const XalanQName& theRHS) 00381 { 00382 return theLHS.equals(theRHS); 00383 } 00384 00385 00386 00387 inline bool 00388 operator!=( 00389 const XalanQName& theLHS, 00390 const XalanQName& theRHS) 00391 { 00392 return !(theLHS == theRHS); 00393 } 00394 00395 00396 00397 inline bool 00398 operator<( 00399 const XalanQName& theLHS, 00400 const XalanQName& theRHS) 00401 { 00402 if (theLHS.getNamespace() < theRHS.getNamespace()) 00403 { 00404 return true; 00405 } 00406 else if (equals(theLHS.getNamespace(), theRHS.getNamespace())) 00407 { 00408 return theLHS.getLocalPart() < theRHS.getLocalPart(); 00409 } 00410 else 00411 { 00412 return false; 00413 } 00414 } 00415 00416 00417 00418 XALAN_CPP_NAMESPACE_END 00419 00420 00421 00422 #endif // XALANQNAME_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.