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(XSLEXCEPTION_HEADER_GUARD_1357924680) 00019 #define XSLEXCEPTION_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/PlatformSupport/DOMStringHelper.hpp> 00029 #include <xalanc/PlatformSupport/XalanLocator.hpp> 00030 00031 00032 00033 XALAN_CPP_NAMESPACE_BEGIN 00034 00035 00036 00037 typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType; 00038 XALAN_USING_XERCES(Locator) 00039 00040 00041 00042 class XALAN_PLATFORMSUPPORT_EXPORT XSLException 00043 { 00044 public: 00045 00046 /** 00047 * Constructor 00048 * 00049 * @param theMessage The message to display when exception thrown 00050 * @param theManager The MemoryManager instance to use. 00051 * @param theLocator The locator instance for error reporting, if any. 00052 */ 00053 XSLException( 00054 const XalanDOMString& theMessage, 00055 MemoryManager& theManager, 00056 const Locator* theLocator); 00057 00058 /** 00059 * Constructor. Use this constructor when the message has 00060 * already been formatted. 00061 * 00062 * @param theMessage The message to display when exception thrown 00063 * @param theManager The MemoryManager instance to use. 00064 */ 00065 XSLException( 00066 const XalanDOMString& theMessage, 00067 MemoryManager& theManager); 00068 00069 XSLException(const XSLException& other); 00070 00071 virtual 00072 ~XSLException(); 00073 00074 /** 00075 * Retrieve type of exception 00076 * 00077 * @return type of exception 00078 */ 00079 virtual const XalanDOMChar* 00080 getType() const = 0; 00081 00082 /** 00083 * Retrieve message for exception 00084 * 00085 * @return exception message 00086 */ 00087 const XalanDOMString& 00088 getMessage() const 00089 { 00090 return m_message; 00091 } 00092 00093 /** 00094 * Get the URI for the associated document, if any 00095 * 00096 * @return The URI. 00097 */ 00098 const XalanDOMString& 00099 getURI() const 00100 { 00101 return m_uri; 00102 } 00103 00104 /** 00105 * Retrieve the line number. 00106 * 00107 * @return the line number 00108 */ 00109 XalanFileLoc 00110 getLineNumber() const 00111 { 00112 return m_lineNumber; 00113 } 00114 00115 /** 00116 * Retrieve the column number. 00117 * 00118 * @return the column number 00119 */ 00120 XalanFileLoc 00121 getColumnNumber() const 00122 { 00123 return m_columnNumber; 00124 } 00125 00126 const MemoryManager& 00127 getMemoryManager() const 00128 { 00129 return m_memoryManager; 00130 } 00131 00132 MemoryManager& 00133 getMemoryManager() 00134 { 00135 return m_memoryManager; 00136 } 00137 00138 XalanDOMString& 00139 defaultFormat(XalanDOMString& theBuffer) const; 00140 00141 static XalanDOMString& 00142 defaultFormat( 00143 const XalanDOMString& theMessage, 00144 const XalanDOMString& theURI, 00145 XalanFileLoc theLineNumber, 00146 XalanFileLoc theColumnNumber, 00147 const XalanDOMChar* theType, 00148 XalanDOMString& theBuffer) 00149 { 00150 return defaultFormat( 00151 theMessage.c_str(), 00152 theMessage.size(), 00153 theURI.c_str(), 00154 theURI.size(), 00155 theLineNumber, 00156 theColumnNumber, 00157 theType, 00158 XalanDOMString::length(theType), 00159 theBuffer); 00160 } 00161 00162 static XalanDOMString& 00163 defaultFormat( 00164 const XalanDOMChar* theMessage, 00165 const XalanDOMChar* theURI, 00166 XalanFileLoc theLineNumber, 00167 XalanFileLoc theColumnNumber, 00168 const XalanDOMChar* theType, 00169 XalanDOMString& theBuffer) 00170 { 00171 assert(theMessage != 0); 00172 00173 return defaultFormat( 00174 theMessage, 00175 XalanDOMString::length(theMessage), 00176 theURI, 00177 theURI == 0 ? 0 : XalanDOMString::length(theURI), 00178 theLineNumber, 00179 theColumnNumber, 00180 theType, 00181 theType == 0 ? 0 : XalanDOMString::length(theType), 00182 theBuffer); 00183 } 00184 00185 static XalanDOMString& 00186 defaultFormat( 00187 const XalanDOMChar* theMessage, 00188 const XalanDOMString::size_type theMessageLength, 00189 const XalanDOMChar* theURI, 00190 const XalanDOMString::size_type theURILength, 00191 XalanFileLoc theLineNumber, 00192 XalanFileLoc theColumnNumber, 00193 const XalanDOMChar* theType, 00194 const XalanDOMString::size_type theTypeLength, 00195 XalanDOMString& theBuffer); 00196 00197 protected: 00198 00199 MemoryManager& m_memoryManager; 00200 00201 private: 00202 00203 const XalanDOMString m_message; 00204 const XalanDOMString m_uri; 00205 00206 const XalanFileLoc m_lineNumber; 00207 const XalanFileLoc m_columnNumber; 00208 00209 // When true, the message has already formatted. 00210 const bool m_formatted; 00211 }; 00212 00213 00214 00215 XALAN_CPP_NAMESPACE_END 00216 00217 00218 00219 #endif // XSLEXCEPTION_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 |
|