00001 // -*- C++ -*- 00002 /* 00003 Phrasehunter - index and query text corpora 00004 Copyright (C) 2006 Torsten Marek (shlomme@gmx.de) & 00005 Armin Schmidt (armin.sch@gmail.com) 00006 00007 This program is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 as published by the Free Software Foundation; either version 2 00010 of the License, or (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef INDEXER_H 00023 #define INDEXER_H INDEXER_H 00024 00025 #include "sqlitepp/sqlitepp.h" 00026 00027 #include "ph_types.h" 00028 #include "phexception.h" 00029 00030 00031 namespace PhraseHunter { 00032 00033 //! Class for indexing and removing documents from the index. 00034 class IndexManager 00035 { 00036 SQLitePP::SqliteDB& m_db; 00037 00038 public: 00039 //! The Mode in which IndexManager should operate. 00040 enum Mode { 00041 New, //!< New index. 00042 Edit, //!< Edit existing index. 00043 }; 00044 00045 IndexManager(SQLitePP::SqliteDB& db): m_db(db) {} 00046 ~IndexManager(); 00047 00048 void removeFromIndex(DocID); 00049 void addToIndex(TextSaver&, DocID) 00050 throw(Exceptions::FileError); 00051 }; 00052 00053 } 00054 00055 #endif // INDEXER_H