XQException.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2006
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2006
00005  *     Progress Software Corporation. All rights reserved.
00006  * Copyright (c) 2004-2006
00007  *     Oracle. All rights reserved.
00008  *
00009  * See the file LICENSE for redistribution information.
00010  *
00011  * $Id: XQException.hpp,v 1.10 2006/11/01 16:37:12 jpcs Exp $
00012  */
00013 
00015 // XQException.h: interface for the XQException class.
00017 
00018 #if !defined(AFXQ_XQEXCEPTION_H__446AD191_E9D0_4658_BD8C_032D29DA123E__INCLUDED_)
00019 #define AFXQ_XQEXCEPTION_H__446AD191_E9D0_4658_BD8C_032D29DA123E__INCLUDED_
00020 
00021 #include <xqilla/framework/XQillaExport.hpp>
00022 #include <xqilla/utils/XStr.hpp>
00023 
00024 #define XQThrow(type, function, reason) throw type(function, reason, this, __FILE__, __LINE__)
00025 #define XQThrow2(type, function, reason) throw type(function, reason, 0, __FILE__, __LINE__)
00026 #define XQThrow3(type, function, reason, location) throw type(function, reason, location, __FILE__, __LINE__)
00027 #define XQSimpleThrow(reason, xqfile, xqline, xqcolumn) throw XQException(reason, xqfile, xqline, (unsigned int)xqcolumn, __FILE__, __LINE__)
00028 
00029 class LocationInfo;
00030 
00031 class XQILLA_API XQException
00032 {
00033 public:
00034   XQException(const XMLCh *reason, const XMLCh* file, unsigned int line, unsigned int column, const char *cppFile, unsigned int cppLine);
00035   XQException(const XQException &);
00036   virtual ~XQException();
00037 
00038   const XMLCh *getType() const { return m_type; }
00039   const XMLCh *getError() const { return m_error; }
00040 
00041   const XMLCh *getXQueryFile() const { return m_xqFile; }
00042   unsigned int getXQueryLine() const { return m_xqLine; }
00043   unsigned int getXQueryColumn() const { return m_xqColumn; }
00044 
00045   void setXQueryPosition(const XMLCh *file, unsigned int line, unsigned int column);
00046   void setXQueryPosition(const LocationInfo *info);
00047 
00048   const XMLCh *getCppFunction() const { return m_cppFunction; }
00049   const char *getCppFile() const { return m_cppFile; }
00050   unsigned int getCppLine() const { return m_cppLine; }
00051 
00053   bool isErrorReported() const { return m_errorReported; }
00054   void setErrorReported(bool value = true) { m_errorReported = value; }
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* m_type;
00065   XMLCh* m_error;
00066 
00067   XMLCh* m_cppFunction;
00068   const char *m_cppFile;
00069   unsigned int m_cppLine;
00070 
00071   unsigned int m_xqLine, m_xqColumn;
00072   XMLCh* m_xqFile;
00073 
00074   bool m_errorReported;
00075 };
00076 
00077 #endif // !defined(AFXQ_XQEXCEPTION_H__446AD191_E9D0_4658_BD8C_032D29DA123E__INCLUDED_)
00078 

Generated on Fri Jan 19 15:30:53 2007 for XQilla Simple API by  doxygen 1.4.6