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