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_search_CachingWrapperFilter_ 00008 #define _lucene_search_CachingWrapperFilter_ 00009 00010 //#include "CLucene/util/BitSet.h" 00011 //#include "CLucene/index/IndexReader.h" 00012 #include "Filter.h" 00013 00014 CL_NS_DEF(search) 00020 class CLUCENE_EXPORT AbstractCachingFilter: public Filter 00021 { 00022 struct Internal; 00023 Internal* internal; 00024 void closeCallback(CL_NS(index)::IndexReader* reader, void* param); 00025 protected: 00026 AbstractCachingFilter( const AbstractCachingFilter& copy ); 00027 virtual CL_NS(util)::BitSet* doBits( CL_NS(index)::IndexReader* reader ) = 0; 00028 virtual bool doShouldDeleteBitSet( CL_NS(util)::BitSet* bits ){ return false; } 00029 AbstractCachingFilter(); 00030 public: 00031 virtual ~AbstractCachingFilter(); 00032 00035 CL_NS(util)::BitSet* bits( CL_NS(index)::IndexReader* reader ); 00036 00037 virtual Filter *clone() const = 0; 00038 virtual TCHAR *toString() = 0; 00039 00040 bool shouldDeleteBitSet( const CL_NS(util)::BitSet* bits ) const{ return false; } 00041 }; 00042 00048 class CachingWrapperFilter: public AbstractCachingFilter 00049 { 00050 private: 00051 Filter* filter; 00052 bool deleteFilter; 00053 protected: 00054 CachingWrapperFilter( const CachingWrapperFilter& copy ); 00055 CL_NS(util)::BitSet* doBits( CL_NS(index)::IndexReader* reader ); 00056 bool doShouldDeleteBitSet( CL_NS(util)::BitSet* bits ); 00057 public: 00058 CachingWrapperFilter( Filter* filter, bool deleteFilter=true ); 00059 ~CachingWrapperFilter(); 00060 00061 Filter *clone() const; 00062 TCHAR *toString(); 00063 }; 00064 00065 CL_NS_END 00066 #endif