00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef XQEXCEPTION_HPP
00021 #define XQEXCEPTION_HPP
00022
00023 #include <xqilla/framework/XQillaExport.hpp>
00024 #include <xqilla/utils/XStr.hpp>
00025
00026 #define XQThrow(type, function, reason) throw type(function, reason, this, __FILE__, __LINE__)
00027 #define XQThrow2(type, function, reason) throw type(function, reason, 0, __FILE__, __LINE__)
00028 #define XQThrow3(type, function, reason, location) throw type(function, reason, location, __FILE__, __LINE__)
00029 #define XQSimpleThrow(reason, xqfile, xqline, xqcolumn) throw XQException(reason, xqfile, xqline, (unsigned int)xqcolumn, __FILE__, __LINE__)
00030
00031 class LocationInfo;
00032
00033 class XQILLA_API XQException
00034 {
00035 public:
00036 XQException(const XMLCh *reason, const XMLCh* file, unsigned int line, unsigned int column, const char *cppFile, unsigned int cppLine);
00037 XQException(const XQException &);
00038 virtual ~XQException();
00039
00040 const XMLCh *getType() const { return type_; }
00041 const XMLCh *getError() const { return error_; }
00042
00043 const XMLCh *getXQueryFile() const { return xqFile_; }
00044 unsigned int getXQueryLine() const { return xqLine_; }
00045 unsigned int getXQueryColumn() const { return xqColumn_; }
00046
00047 void setXQueryPosition(const XMLCh *file, unsigned int line, unsigned int column);
00048 void setXQueryPosition(const LocationInfo *info);
00049
00050 const XMLCh *getCppFunction() const { return cppFunction_; }
00051 const char *getCppFile() const { return cppFile_; }
00052 unsigned int getCppLine() const { return cppLine_; }
00053
00054 void printDebug(const XMLCh* const context) const;
00055
00056 protected:
00057 XQException(const XMLCh* const type, const XMLCh* const functionName, const XMLCh* const reason, const LocationInfo *info, const char *cppFile, unsigned int cppLine);
00058
00059 private:
00060 XQException &operator=(const XQException &);
00061
00062 XMLCh* type_;
00063 XMLCh* error_;
00064
00065 XMLCh* cppFunction_;
00066 const char *cppFile_;
00067 unsigned int cppLine_;
00068
00069 unsigned int xqLine_, xqColumn_;
00070 XMLCh* xqFile_;
00071 };
00072
00073 #endif
00074