File tree Expand file tree Collapse file tree 5 files changed +21
-35
lines changed
Expand file tree Collapse file tree 5 files changed +21
-35
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ common_sources = [
3535 ' writer/clusterWorker.cpp' ,
3636 ' writer/titleListingHandler.cpp' ,
3737 ' writer/counterHandler.cpp' ,
38- ' writer/tools.cpp' ,
3938 ' suggestion.cpp' ,
4039 ' suggestion_iterator.cpp' ,
4140 ' version.cpp'
Original file line number Diff line number Diff line change 2222#include " tools.h"
2323#include " zim/tools.h"
2424#include " fs.h"
25+ #include " writer/_dirent.h"
2526
2627#include < sys/types.h>
2728#include < string.h>
@@ -218,6 +219,20 @@ zim::MimeCounterType zim::parseMimetypeCounter(const std::string& counterData)
218219 return counters;
219220}
220221
222+ bool zim::writer::isFrontArticle (const zim::writer::Dirent* dirent, const zim::writer::Hints& hints)
223+ {
224+ // By definition, dirent not in `C` namespace are not FRONT_ARTICLE
225+ if (dirent->getNamespace () != NS::C) {
226+ return false ;
227+ }
228+ try {
229+ return bool (hints.at (FRONT_ARTICLE));
230+ } catch (std::out_of_range&) {
231+ return false ;
232+ }
233+ }
234+
235+
221236// Xapian based tools
222237#if defined(ENABLE_XAPIAN)
223238
Original file line number Diff line number Diff line change 2929#include " config.h"
3030
3131#include < zim/item.h>
32+ #include " zim/writer/item.h"
3233
3334#if defined(ENABLE_XAPIAN)
3435namespace Xapian {
@@ -70,6 +71,11 @@ namespace zim {
7071 return count;
7172 }
7273
74+ namespace writer {
75+ class Dirent ;
76+ bool isFrontArticle (const Dirent* dirent, const Hints& hints);
77+ }
78+
7379// Xapian based tools
7480#if defined(ENABLE_XAPIAN)
7581 std::string LIBZIM_PRIVATE_API removeAccents (const std::string& text);
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments