aboutsummaryrefslogtreecommitdiff
path: root/0.8.0/paludis/dep_tag.cc
diff options
context:
space:
mode:
Diffstat (limited to '0.8.0/paludis/dep_tag.cc')
-rw-r--r--0.8.0/paludis/dep_tag.cc199
1 files changed, 199 insertions, 0 deletions
diff --git a/0.8.0/paludis/dep_tag.cc b/0.8.0/paludis/dep_tag.cc
new file mode 100644
index 0000000..caf2418
--- /dev/null
+++ b/0.8.0/paludis/dep_tag.cc
@@ -0,0 +1,199 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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
+ */
+
+#include "dep_tag.hh"
+#include <paludis/util/compare.hh>
+
+/** \file
+ * Implementation for DepTag, DepTagCategory etc.
+ *
+ * \ingroup grpdeptag
+ */
+
+using namespace paludis;
+
+#include <paludis/dep_tag-sr.cc>
+
+namespace
+{
+ /**
+ * Create the DepTagCategory for GLSAs.
+ *
+ * \see register_glsa_dep_tag
+ *
+ * \ingroup grpdeptag
+ */
+ DepTagCategory::ConstPointer
+ make_glsa_dep_tag()
+ {
+ return DepTagCategory::ConstPointer(new DepTagCategory(
+ true,
+ "glsa",
+ "Security advisories",
+ "Your system is potentially affected by these security issues:",
+ "Please read the advisories carefully and take appropriate action."));
+ }
+
+ /**
+ * Register the GLSA dep tag category instance.
+ *
+ * \ingroup grpdeptag
+ */
+ static const DepTagCategoryMaker::RegisterMaker register_glsa_dep_tag("glsa",
+ &make_glsa_dep_tag);
+
+ /**
+ * Create the DepTagCategory for general sets.
+ *
+ * \see register_general_set_dep_tag
+ *
+ * \ingroup grpdeptag
+ */
+ DepTagCategory::ConstPointer
+ make_general_set_dep_tag()
+ {
+ return DepTagCategory::ConstPointer(new DepTagCategory(
+ true,
+ "general",
+ "General sets",
+ "",
+ ""));
+ }
+
+ /**
+ * Register the general set dep tag category instance.
+ *
+ * \ingroup grpdeptag
+ */
+ static const DepTagCategoryMaker::RegisterMaker register_general_set_dep_tag("general",
+ &make_general_set_dep_tag);
+
+ /**
+ * Create the DepTagCategory for dependency sets.
+ *
+ * \see register_dependency_set_dep_tag
+ *
+ * \ingroup grpdeptag
+ */
+ DepTagCategory::ConstPointer
+ make_dependency_set_dep_tag()
+ {
+ return DepTagCategory::ConstPointer(new DepTagCategory(
+ false,
+ "dependency",
+ "Dependencies",
+ "",
+ ""));
+ }
+
+ /**
+ * Register the general set dep tag category instance.
+ *
+ * \ingroup grpdeptag
+ */
+ static const DepTagCategoryMaker::RegisterMaker register_dependency_set_dep_tag("dependency",
+ &make_dependency_set_dep_tag);
+}
+
+DepTagCategory::DepTagCategory(
+ bool vis,
+ const std::string & our_id,
+ const std::string & t, const std::string & pre,
+ const std::string & post) :
+ _visible(vis),
+ _id(our_id),
+ _title(t),
+ _pre_text(pre),
+ _post_text(post)
+{
+}
+
+NoSuchDepTagCategory::NoSuchDepTagCategory(const std::string & s) throw () :
+ Exception("No such dep tag category '" + s + "'")
+{
+}
+
+DepTag::DepTag() :
+ ComparisonPolicy<DepTag, comparison_mode::FullComparisonTag,
+ comparison_method::CompareByMemberFetchFunctionTag<std::string> >(&DepTag::short_text)
+{
+}
+
+DepTag::~DepTag()
+{
+}
+
+GLSADepTag::GLSADepTag(const std::string & id, const std::string & our_glsa_title) :
+ _id(id),
+ _glsa_title(our_glsa_title)
+{
+}
+
+std::string
+GLSADepTag::short_text() const
+{
+ return "GLSA-" + _id;
+}
+
+std::string
+GLSADepTag::category() const
+{
+ return "glsa";
+}
+
+std::string
+GLSADepTag::glsa_title() const
+{
+ return _glsa_title;
+}
+
+GeneralSetDepTag::GeneralSetDepTag(const std::string & id) :
+ _id(id)
+{
+}
+
+std::string
+GeneralSetDepTag::short_text() const
+{
+ return _id;
+}
+
+std::string
+GeneralSetDepTag::category() const
+{
+ return "general";
+}
+
+DependencyDepTag::DependencyDepTag(const PackageDatabaseEntry & pde) :
+ _dbe(pde)
+{
+}
+
+std::string
+DependencyDepTag::short_text() const
+{
+ return stringify(_dbe);
+}
+
+std::string
+DependencyDepTag::category() const
+{
+ return "dependency";
+}
+