libept
0.5.25
|
00001 #ifndef EPT_DEBTAGS_VOCABULARYINDEXER_H 00002 #define EPT_DEBTAGS_VOCABULARYINDEXER_H 00003 00009 /* 00010 * Copyright (C) 2003,2004,2005,2006,2007 Enrico Zini <enrico@debian.org> 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 */ 00026 00027 #include <ept/debtags/maint/sourcedir.h> 00028 #include <string> 00029 00030 namespace ept { 00031 namespace debtags { 00032 00036 struct VocabularyIndexer 00037 { 00038 SourceDir mainSource; 00039 SourceDir userSource; 00040 time_t ts_main_src; 00041 time_t ts_user_src; 00042 time_t ts_main_voc; 00043 time_t ts_main_idx; 00044 time_t ts_user_voc; 00045 time_t ts_user_idx; 00046 00050 time_t sourceTimestamp() const { return ts_main_src < ts_user_src ? ts_user_src : ts_main_src; } 00054 bool needsRebuild() const; 00055 00063 bool rebuild(const std::string& vocfname, const std::string& idxfname); 00064 00068 bool rebuildIfNeeded(); 00069 00077 bool getUpToDateVocabulary(std::string& vocfname, std::string& idxfname); 00078 00085 bool userIndexIsRedundant() const; 00086 00090 bool deleteRedundantUserIndex(); 00091 00095 void rescan(); 00096 00097 VocabularyIndexer(); 00098 00108 static bool obtainWorkingVocabulary(std::string& vocfname, std::string& idxfname); 00109 }; 00110 00111 00112 } 00113 } 00114 00115 // vim:set ts=4 sw=4: 00116 #endif