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