From 384517ddc1209ec56bc4d5fa4457ef6becb38a84 Mon Sep 17 00:00:00 2001 From: Enrico Zini Date: Thu, 18 Jun 2015 09:48:55 +0200 Subject: Removed unused functions and template-based functions --- ept/debtags/debtags.h | 34 --------------- ept/debtags/debtags.tcc | 101 --------------------------------------------- ept/debtags/debtags.test.h | 21 ---------- ept/debtags/utils.h | 66 ----------------------------- 4 files changed, 222 deletions(-) delete mode 100644 ept/debtags/debtags.tcc delete mode 100644 ept/debtags/utils.h diff --git a/ept/debtags/debtags.h b/ept/debtags/debtags.h index 06f3b64..f07d3b9 100644 --- a/ept/debtags/debtags.h +++ b/ept/debtags/debtags.h @@ -141,40 +141,6 @@ public: */ void sendPatch(const tagcoll::PatchList& patch); - /** - * Output the current Debian tags database to a consumer of - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template - void outputSystem(const OUT& cons); - - /** - * Output the given tag file to a consumer of - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template - void outputSystem(const std::string& filename, const OUT& out); - - /** - * Output the current Debian tags database, patched with local patch, - * to a Consumer of - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template - void outputPatched(const OUT& cons); - - /** - * Output the given tag file, patched with local patch, - * to a Consumer of - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template - void outputPatched(const std::string& filename, const OUT& out); - /** * Return the default pathname for the debtags tags. * diff --git a/ept/debtags/debtags.tcc b/ept/debtags/debtags.tcc deleted file mode 100644 index 37183a2..0000000 --- a/ept/debtags/debtags.tcc +++ /dev/null @@ -1,101 +0,0 @@ -/** -*- C++ -*- - * @file - * @author Enrico Zini (enrico) - */ - -/* - * libpkg Debtags data provider - * - * Copyright (C) 2003-2007 Enrico Zini - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EPT_DEBTAGS_DEBTAGS_TCC -#define EPT_DEBTAGS_DEBTAGS_TCC - -#include -#include -#include -#include -#include -#include - -namespace ept { -namespace debtags { - -template -void Debtags::outputSystem(const OUT& cons) -{ - string src = pathname(); - if (!wibble::sys::fs::exists(src)) - return; - - // Read uncompressed data - tagcoll::input::Stdio in(src); - - // Read the collection - tagcoll::textformat::parse(in, cons); -} - - -template -void Debtags::outputSystem(const std::string& filename, const OUT& out) -{ - if (filename == "-") - { - tagcoll::input::Stdio input(stdin, ""); - tagcoll::textformat::parse(input, out); - } - else - { - tagcoll::input::Stdio input(filename); - tagcoll::textformat::parse(input, out); - } -} - -template -void Debtags::outputPatched(const OUT& cons) -{ - output(cons); -} - -template -void Debtags::outputPatched(const std::string& filename, const OUT& out) -{ - const tagcoll::PatchList& patch = changes(); - if (filename == "-") - { - tagcoll::input::Stdio input(stdin, ""); - tagcoll::textformat::parse(input, patcher(patch, out)); - } - else - { - tagcoll::input::Stdio input(filename); - tagcoll::textformat::parse(input, patcher(patch, out)); - } -} - -} -} - -#include -#include -#include -#include - -#endif - -// vim:set ts=4 sw=4: diff --git a/ept/debtags/debtags.test.h b/ept/debtags/debtags.test.h index 60de7e0..a2c3dd4 100644 --- a/ept/debtags/debtags.test.h +++ b/ept/debtags/debtags.test.h @@ -55,23 +55,12 @@ struct TestDebtags : DebtagsTestEnvironment { EnvOverride eo("DEBTAGS_TAGS", testfile); Debtags debtags; - for (Debtags::const_iterator i = debtags.begin(); i != debtags.end(); ++i) { *i; i->first; i->second; } - int items = 0, tags = 0; - debtags.outputSystem(stream::countingSink(items, tags)); - - int pitems = 0, ptags = 0; - debtags.outputPatched(stream::countingSink(pitems, ptags)); - - assert(items > 10); - assert(tags > 10); - assert(items <= pitems); - assert(tags <= ptags); } Test _2() @@ -209,20 +198,10 @@ struct TestDebtags : DebtagsTestEnvironment res = empty.getAllTags(); assert(res.empty()); - - tagcoll::coll::Simple coll; - empty.outputSystem(tagcoll::coll::inserter(coll)); - assert_eq(coll.itemCount(), 0u); - - coll.clear(); - - empty.outputPatched(tagcoll::coll::inserter(coll)); - assert_eq(coll.itemCount(), 0u); } }; -#include #include #endif diff --git a/ept/debtags/utils.h b/ept/debtags/utils.h deleted file mode 100644 index d8a32c4..0000000 --- a/ept/debtags/utils.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Ready-made utility classes for Debtags - * - * Copyright (C) 2003--2007 Enrico Zini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EPT_DEBTAGS_UTILS_H -#define EPT_DEBTAGS_UTILS_H - -#include -#include - -namespace ept { -namespace debtags { - -/** - * Convert a collection of ITEMs tagged with Tags to a collection of - * ITEMs tagged with only the facets. - */ -template -class TagToFacet : public wibble::mixin::OutputIterator< TagToFacet > -{ -protected: - OUT out; - -public: - TagToFacet(const OUT& out) : out(out) {} - - template - TagToFacet& operator=(const std::pair& data) - { - std::set< Facet > facets; - for (typename TAGS::const_iterator i = data.second.begin(); - i != data.second.end(); ++i) - facets.insert(i->facet()); - *out = make_pair(data.first, facets); - ++out; - return *this; - } -}; - -template -static TagToFacet tagToFacet(const OUT& out) -{ - return TagToFacet(out); -} - -} -} - -// vim:set ts=4 sw=4: -#endif -- cgit v1.2.3