CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_debug_error_ 00008 #define _lucene_debug_error_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #define CL_ERR_UNKNOWN -1 00015 #define CL_ERR_IO 1 00016 #define CL_ERR_NullPointer 2 00017 #define CL_ERR_Runtime 3 00018 #define CL_ERR_IllegalArgument 4 00019 #define CL_ERR_Parse 5 00020 #define CL_ERR_TokenMgr 6 00021 #define CL_ERR_UnsupportedOperation 7 00022 #define CL_ERR_InvalidState 8 00023 #define CL_ERR_IndexOutOfBounds 9 00024 #define CL_ERR_TooManyClauses 10 00025 #define CL_ERR_RAMTransaction 11 00026 #define CL_ERR_InvalidCast 12 00027 #define CL_ERR_IllegalState 13 00028 00029 00030 00032 //error try/throw/catch definitions 00034 #ifdef _CL_DISABLE_NATIVE_EXCEPTIONS 00035 /*#define try _jpr_Try 00036 #define _CLCATCH _jpr_Catch 00037 #define _CLFINALLY(x) xxxx 00038 #define _CLTHROWA(y) _jpr_Throw 00039 #define _THROWA_DEL(y) _jpr_Throw 00040 #define _RETHROW(x) _jpr_Throw 00041 #define _CLTHROWT(y) _jpr_Throw 00042 00043 #define _THROWS ,_jpr_Throws*/ 00044 #else 00045 class CLuceneError 00046 { 00047 int error_number; 00048 char* _awhat; 00049 TCHAR* _twhat; 00050 public: 00051 CLuceneError(const CLuceneError& clone); 00052 CLuceneError(int num, const char* str, bool ownstr); 00053 #ifdef _UCS2 00054 CLuceneError(int num, const TCHAR* str, bool ownstr); 00055 #endif 00056 int number(){return error_number;} 00057 char* what(); 00058 TCHAR* twhat(); 00059 ~CLuceneError() throw(); 00060 }; 00061 00062 //#define _THROWS //does nothing 00063 #define _CLFINALLY(x) catch(...){ x; throw; } x //note: code x is not run if return is called 00064 #define _CLTHROWA(number, str) throw CLuceneError(number, str,false) 00065 #define _CLTHROWT(number, str) throw CLuceneError(number, str,false) 00066 #define _CLTHROWA_DEL(number, str) throw CLuceneError(number, str,true) //throw a string ensures the value is deleted 00067 #define _CLTHROWT_DEL(number, str) throw CLuceneError(number, str,true) //throw a string ensures the value is deleted 00068 00069 00070 #endif //_LUCENE_DISABLE_EXCEPTIONS 00071 // 00073 00074 #endif