00001 /*---------------------------------------------------------------------* 00002 | Library QgarLib, graphics analysis and recognition | 00003 | Copyright (C) 2003 Qgar Project, LORIA | 00004 | | 00005 | This library is free software; you can redistribute it and/or | 00006 | modify it under the terms of the GNU Lesser General Public | 00007 | License version 2.1, as published by the Free Software Foundation. | 00008 | | 00009 | This library is distributed in the hope that it will be useful, | 00010 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00011 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 00012 | See the GNU Lesser General Public License for more details. | 00013 | | 00014 | The GNU Lesser General Public License is included in the file | 00015 | LICENSE.LGPL, in the root directory of the Qgar packaging. See | 00016 | http://www.gnu.org/licenses/lgpl.html for the terms of the license. | 00017 | To receive a paper copy, write to the Free Software Foundation, | 00018 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | 00019 | | 00020 | Contact Project Qgar for any information: | 00021 | LORIA - équipe Qgar | 00022 | B.P. 239, 54506 Vandoeuvre-lès-Nancy Cedex, France | 00023 | email: qgar-contact@loria.fr | 00024 | http://www.qgar.org/ | 00025 *---------------------------------------------------------------------*/ 00026 00027 00028 #ifndef __SAXPARSEEXCEPTION_H_INCLUDED__ 00029 #define __SAXPARSEEXCEPTION_H_INCLUDED__ 00030 00031 00032 /** 00033 * @file SAXParseException.H 00034 * @brief Header file of class qgxml::SAXParseException 00035 * 00036 * @author <a href="mailto:qgar-contact@loria.fr?subject=Qgar fwd Jan Rendek">Jan Rendek</a> 00037 * @date March 11, 2003 15:34 00038 * @since Qgar 2.1.1 00039 */ 00040 00041 00042 // For RCS/CVS use: Do not delete 00043 /* $Id: SAXParseException.H,v 1.5 2004/07/02 20:36:43 masini Exp $ */ 00044 00045 #include <string> 00046 #include <qgarlib/sax/Locator.H> 00047 #include <qgarlib/sax/SAXException.H> 00048 00049 namespace qgxml { 00050 00051 00052 /** 00053 * @class SAXParseException SAXParseException.H <qgarlib/sax/SAXParseException.H> 00054 * @ingroup XML 00055 * @brief Encapsulate an XML parse error or warning. 00056 * 00057 * This exception may include information for locating the error in 00058 * the original XML document, as if it came from a Locator object. 00059 * 00060 * <b> This class is an adaptation for C++ of the interface of the same 00061 * name implemented in the Java SAX API(http://www.saxproject.org). 00062 * </b> 00063 * 00064 * @author <a href="mailto:qgar-contact@loria.fr?subject=Qgar fwd Jan Rendek">Jan Rendek</a> (Adaptation) 00065 * @date March 11, 2003 15:34 00066 * @since Qgar 2.1.1 00067 */ 00068 class SAXParseException : public SAXException { 00069 00070 // ------------------------------------------------------------------- 00071 // P U B L I C M E M B E R S 00072 // ------------------------------------------------------------------- 00073 public: 00074 00075 00076 /** @name Constructors */ 00077 // ============ 00078 //@{ 00079 /** 00080 * @brief Default constructor 00081 */ 00082 SAXParseException() 00083 { /* EMPTY */ } 00084 00085 /** 00086 * @brief Create a new SAXParseException from a message and a 00087 * Locator. 00088 * 00089 * @param message The error or warning message. 00090 * @param locator The locator object for the error or warning. 00091 */ 00092 SAXParseException(const std::string & message, 00093 const Locator & locator) 00094 : SAXException(message), 00095 _publicId(locator.getPublicId()), 00096 _systemId(locator.getSystemId()), 00097 _lineNumber(locator.getLineNumber()), 00098 _columnNumber(locator.getColumnNumber()) 00099 { /* EMPTY */ } 00100 00101 /** 00102 * @brief Create a new SAXParseException. 00103 * 00104 * @param message The error or warning message. 00105 * @param publicId The public identifier of the entity that 00106 * generated the error or warning. 00107 * @param systemId The system identifier of the entity that 00108 * generated the error or warning. 00109 * @param lineNumber The line number of the end of the text that 00110 * caused the error or warning. 00111 * @param columnNumber The column number of the end of the text that 00112 * cause the error or warning. 00113 */ 00114 SAXParseException(const std::string & message, 00115 const std::string & publicId, 00116 const std::string & systemId, 00117 int lineNumber, 00118 int columnNumber) 00119 : SAXException(message), 00120 _publicId(publicId), 00121 _systemId(systemId), 00122 _lineNumber(lineNumber), 00123 _columnNumber(columnNumber) 00124 { /* EMPTY */ } 00125 00126 //@} 00127 00128 00129 /** @name Destructor */ 00130 // ========== 00131 //@{ 00132 /** 00133 * @brief Destructor 00134 */ 00135 virtual ~SAXParseException() throw() {} 00136 //@} 00137 00138 00139 /** @name Access */ 00140 // ====== 00141 //@{ 00142 00143 /** 00144 * @brief Get the public identifier of the entity where the exception 00145 * occurred. 00146 * 00147 * @return A string containing the public identifier, or an empty 00148 * string if none is available. 00149 */ 00150 std::string getPublicId() const 00151 { 00152 return _publicId; 00153 } 00154 00155 /** 00156 * @brief Get the system identifier of the entity where the exception 00157 * occurred. 00158 * 00159 * @return A string containing the system identifier, or an empty 00160 * string if none is available. 00161 */ 00162 std::string getSystemId() const 00163 { 00164 return _systemId; 00165 } 00166 00167 /** 00168 * @brief The line number of the end of the text where the exception 00169 * occurred. 00170 * 00171 * @return An integer representing the line number, or -1 if none is 00172 * available. 00173 */ 00174 int getLineNumber() const 00175 { 00176 return _lineNumber; 00177 } 00178 00179 /** 00180 * @brief The column number of the end of the text where the exception 00181 * occurred. 00182 * 00183 * @return An integer representing the column number, or -1 if none is 00184 * available. 00185 */ 00186 int getColumnNumber() const 00187 { 00188 return _columnNumber; 00189 } 00190 //@} 00191 00192 00193 00194 protected: 00195 00196 /// The public identifier of the entity where the exception occurred. 00197 std::string _publicId; 00198 00199 /// The system identifier of the entity where the exception occurred. 00200 std::string _systemId; 00201 00202 /** 00203 * The line number of the end of the text where the exception 00204 * occurred. 00205 */ 00206 int _lineNumber; 00207 00208 /** 00209 * The column number of the end of the text where the exception 00210 * occurred. 00211 */ 00212 int _columnNumber; 00213 00214 // ------------------------------------------------------------------- 00215 00216 }; // class SAXParseException 00217 00218 } // namespace qgxml 00219 00220 00221 #endif /* __SAXPARSEEXCEPTION_H_INCLUDED__ */