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_util_BitSet_ 00008 #define _lucene_util_BitSet_ 00009 00010 00011 CL_CLASS_DEF(store,Directory) 00012 00013 CL_NS_DEF(util) 00014 class CLUCENE_EXPORT BitSet:LUCENE_BASE { 00015 int32_t _size; 00016 int32_t _count; 00017 uint8_t *bits; 00018 00019 protected: 00020 BitSet( const BitSet& copy ); 00021 00022 public: 00024 BitSet ( int32_t size ); 00025 BitSet(CL_NS(store)::Directory* d, const char* name); 00026 void write(CL_NS(store)::Directory* d, const char* name); 00027 00029 ~BitSet(); 00030 00032 inline bool get(const int32_t bit) const{ 00033 return (bits[bit >> 3] & (1 << (bit & 7))) != 0; 00034 } 00035 00037 void set(const int32_t bit, bool val=true); 00038 00040 int32_t size() const; 00041 00045 int32_t count(); 00046 BitSet *clone() const; 00047 }; 00048 CL_NS_END 00049 #endif