1 : #ifndef EPT_DEBTAGS_SOURCEDIR_TCC
2 : #define EPT_DEBTAGS_SOURCEDIR_TCC
3 :
4 : /** @file
5 : * @author Enrico Zini <enrico@enricozini.org>
6 : * Debtags data source directory access
7 : */
8 : #include <ept/debtags/maint/sourcedir.h>
9 :
10 : #include <tagcoll/input/zlib.h>
11 : #include <tagcoll/input/stdio.h>
12 :
13 : namespace ept {
14 : namespace debtags {
15 :
16 : template<typename OUT>
17 : void SourceDir::readTags(OUT out)
18 : {
19 4 : if (!valid()) return;
20 :
21 28 : for (const_iterator d = begin(); d != end(); ++d)
22 : {
23 24 : FileType type = fileType(d->d_name);
24 24 : if (type == TAG)
25 : {
26 : // Read uncompressed data
27 2 : tagcoll::input::Stdio in(path() + "/" + d->d_name);
28 :
29 : // Read the collection
30 2 : tagcoll::textformat::parse(in, out);
31 : }
32 22 : else if (type == TAGGZ)
33 : {
34 : // Read compressed data
35 0 : tagcoll::input::Zlib in(path() + "/" + d->d_name);
36 :
37 : // Read the collection
38 4 : tagcoll::textformat::parse(in, out);
39 : }
40 : }
41 : }
42 :
43 : }
44 : }
45 :
46 : #include <tagcoll/TextFormat.tcc>
47 :
48 : #endif
49 :
50 : // -*- C++ -*-
51 : // vim:set ts=4 sw=4:
|