SourceForge.net Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Examples

XQException.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2008
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2008
00005  *     Oracle. All rights reserved.
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  *
00019  * $Id: XQException.hpp 475 2008-01-08 18:47:44Z jpcs $
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 

Generated on Fri Sep 25 06:55:26 2009 for XQilla Simple API by  doxygen 1.3.9.1