1 : /** -*- C++ -*-
2 : * @file
3 : * @author Enrico Zini (enrico) <enrico@enricozini.org>
4 : */
5 :
6 : /*
7 : * libpkg Debtags data provider
8 : *
9 : * Copyright (C) 2003-2007 Enrico Zini <enrico@debian.org>
10 : *
11 : * This library is free software; you can redistribute it and/or
12 : * modify it under the terms of the GNU Lesser General Public
13 : * License as published by the Free Software Foundation; either
14 : * version 2.1 of the License, or (at your option) any later version.
15 : *
16 : * This library is distributed in the hope that it will be useful,
17 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 : * Lesser General Public License for more details.
20 : *
21 : * You should have received a copy of the GNU Lesser General Public
22 : * License along with this library; if not, write to the Free Software
23 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 : */
25 :
26 : #ifndef EPT_DEBTAGS_DEBTAGS_TCC
27 : #define EPT_DEBTAGS_DEBTAGS_TCC
28 :
29 : #include <ept/debtags/debtags.h>
30 : #include <ept/debtags/maint/serializer.h>
31 :
32 : #include <tagcoll/input/stdio.h>
33 : #include <tagcoll/stream/patcher.h>
34 : #include <tagcoll/TextFormat.h>
35 :
36 : namespace ept {
37 : namespace debtags {
38 :
39 : template<typename OUT>
40 : void Debtags::outputSystem(const OUT& cons)
41 : {
42 2 : m_rocoll.output(intToPkg(m_pkgid, vocabulary(), cons));
43 2 : }
44 :
45 : template<typename OUT>
46 : void Debtags::outputSystem(const std::string& filename, const OUT& out)
47 : {
48 : if (filename == "-")
49 : {
50 : tagcoll::input::Stdio input(stdin, "<stdin>");
51 : tagcoll::textformat::parse(input, ept::debtags::stringToPkg(m_pkgid, m_voc, out));
52 : }
53 : else
54 : {
55 : tagcoll::input::Stdio input(filename);
56 : tagcoll::textformat::parse(input, ept::debtags::stringToPkg(m_pkgid, m_voc, out));
57 : }
58 : }
59 :
60 : template<typename OUT>
61 : void Debtags::outputPatched(const OUT& cons)
62 : {
63 2 : m_coll.output(intToPkg(m_pkgid, vocabulary(), cons));
64 2 : }
65 :
66 : template<typename OUT>
67 : void Debtags::outputPatched(const std::string& filename, const OUT& out)
68 : {
69 : const tagcoll::PatchList<string, Tag>& patch = m_coll.changes();
70 : if (filename == "-")
71 : {
72 : tagcoll::input::Stdio input(stdin, "<stdin>");
73 : tagcoll::textformat::parse(input, ept::debtags::stringToPkg(m_pkgid, m_voc, patcher(patch, out)));
74 : }
75 : else
76 : {
77 : tagcoll::input::Stdio input(filename);
78 : tagcoll::textformat::parse(input, ept::debtags::stringToPkg(m_pkgid, m_voc, patcher(patch, out)));
79 : }
80 : }
81 :
82 : }
83 : }
84 :
85 : #include <tagcoll/coll/patched.tcc>
86 :
87 : #endif
88 :
89 : // vim:set ts=4 sw=4:
|