diff options
author | Enrico Zini <enrico@enricozini.org> | 2015-06-18 09:48:55 +0200 |
---|---|---|
committer | Enrico Zini <enrico@enricozini.org> | 2015-06-18 09:48:55 +0200 |
commit | 384517ddc1209ec56bc4d5fa4457ef6becb38a84 (patch) | |
tree | 0e8284652097ec28ed509633724c6771bab393bf | |
parent | b529e005ad2b2fb1351fbbe08bf4ef0ad5e07b08 (diff) | |
download | libept-384517ddc1209ec56bc4d5fa4457ef6becb38a84.tar.gz |
Removed unused functions and template-based functions
-rw-r--r-- | ept/debtags/debtags.h | 34 | ||||
-rw-r--r-- | ept/debtags/debtags.tcc | 101 | ||||
-rw-r--r-- | ept/debtags/debtags.test.h | 21 | ||||
-rw-r--r-- | ept/debtags/utils.h | 66 |
4 files changed, 0 insertions, 222 deletions
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<std::string, std::string>& patch); - /** - * Output the current Debian tags database to a consumer of <std::string, std::string> - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template<typename OUT> - void outputSystem(const OUT& cons); - - /** - * Output the given tag file to a consumer of <std::string, std::string> - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template<typename OUT> - void outputSystem(const std::string& filename, const OUT& out); - - /** - * Output the current Debian tags database, patched with local patch, - * to a Consumer of <std::string, std::string> - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template<typename OUT> - void outputPatched(const OUT& cons); - - /** - * Output the given tag file, patched with local patch, - * to a Consumer of <std::string, std::string> - * - * \note The collection is sent to 'cons' without merging repeated items - */ - template<typename OUT> - 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) <enrico@enricozini.org> - */ - -/* - * libpkg Debtags data provider - * - * Copyright (C) 2003-2007 Enrico Zini <enrico@debian.org> - * - * 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 <ept/debtags/debtags.h> -#include <tagcoll/coll/simple.h> -#include <tagcoll/input/stdio.h> -#include <tagcoll/stream/patcher.h> -#include <tagcoll/TextFormat.h> -#include <wibble/sys/fs.h> - -namespace ept { -namespace debtags { - -template<typename OUT> -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<typename OUT> -void Debtags::outputSystem(const std::string& filename, const OUT& out) -{ - if (filename == "-") - { - tagcoll::input::Stdio input(stdin, "<stdin>"); - tagcoll::textformat::parse(input, out); - } - else - { - tagcoll::input::Stdio input(filename); - tagcoll::textformat::parse(input, out); - } -} - -template<typename OUT> -void Debtags::outputPatched(const OUT& cons) -{ - output(cons); -} - -template<typename OUT> -void Debtags::outputPatched(const std::string& filename, const OUT& out) -{ - const tagcoll::PatchList<string, string>& patch = changes(); - if (filename == "-") - { - tagcoll::input::Stdio input(stdin, "<stdin>"); - tagcoll::textformat::parse(input, patcher(patch, out)); - } - else - { - tagcoll::input::Stdio input(filename); - tagcoll::textformat::parse(input, patcher(patch, out)); - } -} - -} -} - -#include <tagcoll/coll/simple.tcc> -#include <tagcoll/coll/fast.tcc> -#include <tagcoll/patch.tcc> -#include <tagcoll/TextFormat.tcc> - -#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<string, std::string> 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 <ept/debtags/debtags.tcc> #include <tagcoll/coll/simple.tcc> #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 <enrico@debian.org> - * - * 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 <wibble/mixin.h> -#include <ept/debtags/tag.h> - -namespace ept { -namespace debtags { - -/** - * Convert a collection of ITEMs tagged with Tags to a collection of - * ITEMs tagged with only the facets. - */ -template<typename OUT> -class TagToFacet : public wibble::mixin::OutputIterator< TagToFacet<OUT> > -{ -protected: - OUT out; - -public: - TagToFacet(const OUT& out) : out(out) {} - - template<typename ITEMS, typename TAGS> - TagToFacet<OUT>& operator=(const std::pair<ITEMS, TAGS>& 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<typename OUT> -static TagToFacet<OUT> tagToFacet(const OUT& out) -{ - return TagToFacet<OUT>(out); -} - -} -} - -// vim:set ts=4 sw=4: -#endif |