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(XALANLOCATOR_HEADER_GUARD_1357924680) 00019 #define XALANLOCATOR_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00025 00026 00027 00028 #include <xercesc/sax/Locator.hpp> 00029 00030 00031 00032 XALAN_CPP_NAMESPACE_BEGIN 00033 00034 00035 00036 XALAN_USING_XERCES(Locator) 00037 00038 00039 00040 /** 00041 * This class defines a base class for Locator derivations in Xalan. It was defined 00042 * because Xerces made changes in their Locator class which caused turbulence. 00043 */ 00044 class XALAN_PLATFORMSUPPORT_EXPORT XalanLocator : public Locator 00045 { 00046 public: 00047 00048 typedef Locator ParentType; 00049 00050 XalanLocator() {} 00051 00052 virtual 00053 ~XalanLocator() {} 00054 00055 virtual const XMLCh* 00056 getPublicId() const = 0; 00057 00058 virtual const XMLCh* 00059 getSystemId() const = 0; 00060 00061 virtual XalanFileLoc 00062 getLineNumber() const = 0; 00063 00064 virtual XalanFileLoc 00065 getColumnNumber() const = 0; 00066 00067 /** 00068 * Get the public identifier from a locator object. 00069 * @param theLocator A locator object inherited from Xerces. 00070 * @param theAlternateId A default name for a public identifier. 00071 * @return a null terminated XalanDOMChar string. 00072 */ 00073 static const XalanDOMChar* 00074 getPublicId( 00075 const Locator* theLocator, 00076 const XalanDOMChar* theAlternateId = getEmptyPtr()) 00077 { 00078 return theLocator == 0 ? theAlternateId : (theLocator->getPublicId() ? 00079 theLocator->getPublicId() : theAlternateId); 00080 } 00081 00082 /** 00083 * Get the system identifier from a locator object. 00084 * @param theLocator A locator object inherited from Xerces. 00085 * @param theAlternateId A default name for a public identifier. 00086 * @return a null terminated XalanDOMChar string. 00087 */ 00088 static const XalanDOMChar* 00089 getSystemId( 00090 const Locator* theLocator, 00091 const XalanDOMChar* theAlternateId = getEmptyPtr()) 00092 { 00093 return theLocator == 0 ? theAlternateId : (theLocator->getSystemId() ? 00094 theLocator->getPublicId() : theAlternateId); 00095 } 00096 00097 /** 00098 * Get the line number from a locator object. 00099 */ 00100 static XalanFileLoc 00101 getLineNumber(const ParentType* theLocator) 00102 { 00103 return theLocator == 0 ? getUnknownValue() : theLocator->getLineNumber(); 00104 } 00105 00106 /** 00107 * Get the column number from a locator object. 00108 */ 00109 static XalanFileLoc 00110 getColumnNumber(const ParentType* theLocator) 00111 { 00112 return theLocator == 0 ? getUnknownValue() : theLocator->getColumnNumber(); 00113 } 00114 00115 static XalanFileLoc 00116 getUnknownValue() 00117 { 00118 // The parser reports the maximum value of the XalanFileLoc 00119 // type for an unknown value. 00120 return ~static_cast<XalanFileLoc>(0); 00121 } 00122 00123 static XalanFileLoc 00124 getUnknownDisplayValue() 00125 { 00126 // The parser reports the maximum value of the XalanFileLoc 00127 // type for an unknown value, but that is really non-sensical 00128 // for display purposes, so we use 0 instead. 00129 return static_cast<XalanFileLoc>(0); 00130 } 00131 00132 static bool 00133 isUnknownValue(XalanFileLoc theLocation) 00134 { 00135 return theLocation == getUnknownValue(); 00136 } 00137 00138 private: 00139 00140 // Not defined... 00141 XalanLocator(const XalanLocator&); 00142 00143 XalanLocator& 00144 operator=(const XalanLocator&); 00145 00146 /** 00147 * Return static pointer to null XalanDOMChar. 00148 * This is crafted to overcome issues with compilers/linkers that 00149 * have problems initializing static integer members within a class. 00150 * 00151 * Replaces: static const int s_zero = 0; 00152 * Reference: &s_zero; 00153 */ 00154 static const XalanDOMChar * getEmptyPtr() 00155 { 00156 static const XalanDOMChar theZero = 0; 00157 static const XalanDOMChar * theEmpty = &theZero; 00158 return theEmpty; 00159 } 00160 }; 00161 00162 XALAN_CPP_NAMESPACE_END 00163 00164 00165 00166 #endif // PREFIXRESOLVER_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 |
|