libept  0.5.25
vocabularyindexer.h
Go to the documentation of this file.
1 #ifndef EPT_DEBTAGS_VOCABULARYINDEXER_H
2 #define EPT_DEBTAGS_VOCABULARYINDEXER_H
3 
9 /*
10  * Copyright (C) 2003,2004,2005,2006,2007 Enrico Zini <enrico@debian.org>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  */
26 
28 #include <string>
29 
30 namespace ept {
31 namespace debtags {
32 
37 {
40  time_t ts_main_src;
41  time_t ts_user_src;
42  time_t ts_main_voc;
43  time_t ts_main_idx;
44  time_t ts_user_voc;
45  time_t ts_user_idx;
46 
54  bool needsRebuild() const;
55 
63  bool rebuild(const std::string& vocfname, const std::string& idxfname);
64 
68  bool rebuildIfNeeded();
69 
77  bool getUpToDateVocabulary(std::string& vocfname, std::string& idxfname);
78 
85  bool userIndexIsRedundant() const;
86 
91 
95  void rescan();
96 
98 
108  static bool obtainWorkingVocabulary(std::string& vocfname, std::string& idxfname);
109 };
110 
111 
112 }
113 }
114 
115 // vim:set ts=4 sw=4:
116 #endif
bool rebuildIfNeeded()
Rebuild the vocabulary if needed.
Definition: vocabularyindexer.cc:104
bool deleteRedundantUserIndex()
Deletes the user index if it is redundant.
Definition: vocabularyindexer.cc:135
bool rebuild(const std::string &vocfname, const std::string &idxfname)
Rebuild the vocabulary index.
Definition: vocabularyindexer.cc:70
time_t ts_main_idx
Definition: vocabularyindexer.h:43
bool userIndexIsRedundant() const
Returns true if the index in the user home directory is redundant and can be deleted.
Definition: vocabularyindexer.cc:52
SourceDir mainSource
Definition: vocabularyindexer.h:38
time_t ts_main_src
Definition: vocabularyindexer.h:40
time_t sourceTimestamp() const
Get the timestamp of the newest vocabulary data source.
Definition: vocabularyindexer.h:50
time_t ts_user_src
Definition: vocabularyindexer.h:41
bool needsRebuild() const
Return true if the vocabulary index needs rebuilding.
Definition: vocabularyindexer.cc:28
Access a directory containing Debtags data files.
Definition: debtags/maint/sourcedir.h:38
void rescan()
Rescan the various timestamps.
Definition: vocabularyindexer.cc:18
time_t ts_user_voc
Definition: vocabularyindexer.h:44
SourceDir userSource
Definition: vocabularyindexer.h:39
bool getUpToDateVocabulary(std::string &vocfname, std::string &idxfname)
Get the names of the merged vocabulary and vocabulary index that can be used to access Debtags vocabu...
Definition: vocabularyindexer.cc:155
time_t ts_main_voc
Definition: vocabularyindexer.h:42
Infrastructure used to rebuild the vocabulary index when needed.
Definition: vocabularyindexer.h:36
static bool obtainWorkingVocabulary(std::string &vocfname, std::string &idxfname)
Get the names of the merged vocabulary and vocabulary index that can be used to access Debtags vocabu...
Definition: vocabularyindexer.cc:188
VocabularyIndexer()
Definition: vocabularyindexer.cc:12
time_t ts_user_idx
Definition: vocabularyindexer.h:45