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_stdheader_h 00008 #define lucene_stdheader_h 00009 00010 #include "CLucene/clucene-config.h" 00011 #include "CLucene/CLConfig.h" 00012 00014 // EXPORTS definition 00015 #ifdef MAKE_CLUCENE_CORE_LIB 00016 #ifdef CLUCENE_EXPORT_SYMBOLS 00017 #if defined(_WIN32) 00018 #define CLUCENE_EXPORT __declspec(dllexport) 00019 #elif defined(_CL_HAVE_GCCVISIBILITYPATCH) 00020 #define CLUCENE_EXPORT __attribute__ ((visibility("default"))) 00021 #define CLUCENE_LOCAL __attribute__ ((visibility("hidden")) 00022 #endif 00023 #endif 00024 #else 00025 #if defined(_WIN32) && defined(CLUCENE_IMPORT_SYMBOLS) 00026 #define CLUCENE_EXPORT __declspec(dllimport) 00027 #endif 00028 #endif 00029 #ifndef CLUCENE_EXPORT 00030 #define CLUCENE_EXPORT 00031 #endif 00032 #ifndef CLUCENE_LOCAL 00033 #define CLUCENE_LOCAL 00034 #endif 00036 00037 00039 //namespace helper 00041 #if defined(_LUCENE_DONTIMPLEMENT_NS_MACROS) 00042 //do nothing 00043 #elif !defined(DISABLE_NAMESPACE) && defined(_CL_HAVE_NAMESPACES) 00044 #define CL_NS_DEF(sub) namespace lucene{ namespace sub{ 00045 #define CL_NS_DEF2(sub,sub2) namespace lucene{ namespace sub{ namespace sub2 { 00046 00047 #define CL_NS_END }} 00048 #define CL_NS_END2 }}} 00049 00050 #define CL_NS_USE(sub) using namespace lucene::sub; 00051 #define CL_NS_USE2(sub,sub2) using namespace lucene::sub::sub2; 00052 00053 #define CL_NS(sub) lucene::sub 00054 #define CL_NS2(sub,sub2) lucene::sub::sub2 00055 00056 #define CL_STRUCT_DEF(sub,clazz) namespace lucene { namespace sub{ struct clazz; } } 00057 #define CL_CLASS_DEF(sub,clazz) namespace lucene { namespace sub{ class clazz; } } 00058 #define CL_CLASS_DEF1(sub,clazz) namespace sub{ class clazz; } 00059 #else 00060 #define CL_NS_DEF(sub) 00061 #define CL_NS_DEF2(sub, sub2) 00062 #define CL_NS_END 00063 #define CL_NS_END2 00064 #define CL_NS_USE(sub) 00065 #define CL_NS_USE2(sub,sub2) 00066 #define CL_NS(sub) 00067 #define CL_NS2(sub,sub2) 00068 #define CL_CLASS_DEF(sub,clazz) class clazz; 00069 #endif 00070 00071 #if defined(LUCENE_NO_STDC_NAMESPACE) 00072 //todo: haven't actually tested this on a non-stdc compliant compiler 00073 #define CL_NS_STD(func) ::func 00074 #else 00075 #define CL_NS_STD(func) std::func 00076 #endif 00077 // 00079 00080 00082 //Class interfaces 00084 #include "CLucene/debug/lucenebase.h" 00086 00087 //Are we in unicode? 00088 #if defined(_MBCS) || defined(_ASCII) 00089 #undef _ASCII 00090 #undef _UCS2 00091 #define _ASCII 00092 #elif defined(_UNICODE) 00093 #define _UCS2 00094 #elif !defined(_UCS2) 00095 #define _UCS2 00096 #endif 00097 00098 //msvc needs unicode define so that it uses unicode library 00099 #ifdef _UCS2 00100 #undef _UNICODE 00101 #define _UNICODE 00102 #undef _ASCII 00103 #else 00104 #undef _UNICODE 00105 #undef _UCS2 00106 #endif 00107 00108 00109 #define cl_min(a,b) (a>b?b:a) 00110 #define cl_max(a,b) (a>b?a:b) 00111 00112 #define LUCENE_INT32_MAX_SHOULDBE 0x7FFFFFFFL 00113 #define __CONST_CAST(typ,var) const_cast<typ>(var) 00114 #define __REINTERPRET_CAST(typ,var) reinterpret_cast<typ>(var) 00115 00116 #if _MSC_FULL_VER >= 140050320 00117 #define _CL_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text)) 00118 #elif _MSC_VER >= 1300 00119 #define _CL_DEPRECATE_TEXT(_Text) __declspec(deprecated) 00120 #elif _MSC_VER 00121 #pragma warning(disable : 4786) 00122 #pragma warning(disable : 4150)//todo:re-enable this 00123 #define _CL_DEPRECATE_TEXT(_Text) 00124 #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) 00125 #define _CL_DEPRECATE_TEXT(_Text) __attribute__((__deprecated__)) 00126 #else 00127 #define _CL_DEPRECATE_TEXT(_Text) 00128 #endif 00129 #define _CL_DEPRECATED(_NewItem) _CL_DEPRECATE_TEXT("This function or variable has been superceded by newer library or operating system functionality. Consider using" #_NewItem "instead. See online help for details.") 00130 00131 00132 //need this for wchar_t, size_t, NULL 00133 #include <cstddef> 00134 //need this for int32_t, etc 00135 #ifdef _CL_HAVE_STDINT_H 00136 #include <stdint.h> 00137 #endif 00138 #include <math.h> //required for float_t 00139 #include <string> //need to include this early... 00140 00141 #include "CLucene/config/repl_tchar.h" 00142 #include "CLucene/debug/error.h" 00143 #include "CLucene/debug/mem.h" 00144 00145 #define StringArrayWithDeletor CL_NS(util)::CLVector<TCHAR*, CL_NS(util)::Deletor::tcArray > 00146 #define StringArray CL_NS(util)::CLVector<TCHAR*> 00147 #define StringArrayWithDeletor CL_NS(util)::CLVector<TCHAR*, CL_NS(util)::Deletor::tcArray > 00148 #define StringArrayConst CL_NS(util)::CLVector<const TCHAR*> 00149 #define StringArrayConstWithDeletor CL_NS(util)::CLVector<const TCHAR*, CL_NS(util)::Deletor::tcArray > 00150 00151 #define AStringArray CL_NS(util)::CLVector<char*> 00152 #define AStringArrayWithDeletor CL_NS(util)::CLVector<char*, CL_NS(util)::Deletor::acArray > 00153 #define AStringArrayConst CL_NS(util)::CLVector<const char*> 00154 #define AStringArrayConstWithDeletor CL_NS(util)::CLVector<const char*, CL_NS(util)::Deletor::acArray > 00155 00156 //some replacement functions... 00157 int64_t lucene_filelength(int handle); 00158 00159 //call this at the end of running to clean up memory. 00160 extern CLUCENE_EXPORT void _lucene_shutdown(); 00161 00162 #endif // lucene_apiheader_h