aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-13 13:34:34 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-13 13:34:34 +0000
commit0f5cf7d52720338f0903ff4e865cc9b75b1952b9 (patch)
tree120d61e234c7779ed0fbe776eb1ba6ac9c5f5f2e
parent8c38f2252522640e67497ead3d68369e47ad3c92 (diff)
downloadpaludis-0f5cf7d52720338f0903ff4e865cc9b75b1952b9.tar.gz
paludis-0f5cf7d52720338f0903ff4e865cc9b75b1952b9.tar.xz
Sneaky new visitor automagic traversal
-rw-r--r--paludis/dep_list/dep_list.cc11
-rw-r--r--paludis/dep_list/uninstall_list.cc19
-rw-r--r--paludis/environment.cc21
-rw-r--r--paludis/qa/dep_flags_check.cc19
-rw-r--r--paludis/qa/dep_packages_check.cc26
-rw-r--r--paludis/qa/deps_exist_check.cc19
-rw-r--r--paludis/qa/deps_visible_check.cc12
-rw-r--r--paludis/qa/extract_check.cc26
-rw-r--r--paludis/qa/license_check.cc26
-rw-r--r--paludis/qa/pdepend_overlap_check.cc26
-rw-r--r--paludis/qa/src_uri_check.cc19
-rw-r--r--paludis/repositories/gems/cache.cc12
-rw-r--r--paludis/tasks/report_task.cc32
-rw-r--r--paludis/util/visitor.hh68
-rw-r--r--src/clients/adjutrix/find_insecure_packages.cc26
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc13
16 files changed, 156 insertions, 219 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index cda0f03..a0536e2 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -359,7 +359,8 @@ DepList::QueryVisitor::visit(const AllDepAtom * const a)
}
struct DepList::AddVisitor :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<AddVisitor, AllDepAtom>
{
DepList * const d;
@@ -373,7 +374,7 @@ struct DepList::AddVisitor :
void visit(const UseDepAtom * const);
void visit(const AnyDepAtom * const);
void visit(const BlockDepAtom * const);
- void visit(const AllDepAtom * const);
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<AddVisitor, AllDepAtom>::visit;
};
void
@@ -698,12 +699,6 @@ DepList::AddVisitor::visit(const BlockDepAtom * const a)
}
}
-void
-DepList::AddVisitor::visit(const AllDepAtom * const a)
-{
- std::for_each(a->begin(), a->end(), accept_visitor(this));
-}
-
DepList::DepList(const Environment * const e, const DepListOptions & o) :
PrivateImplementationPattern<DepList>(new Implementation<DepList>(e, o)),
options(_imp->opts)
diff --git a/paludis/dep_list/uninstall_list.cc b/paludis/dep_list/uninstall_list.cc
index 07071c9..f3d449e 100644
--- a/paludis/dep_list/uninstall_list.cc
+++ b/paludis/dep_list/uninstall_list.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -304,8 +304,13 @@ UninstallList::collect_all_installed() const
namespace
{
struct DepCollector :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<DepCollector, AllDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<DepCollector, AnyDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<DepCollector, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<DepCollector, AnyDepAtom>::visit;
+
const Environment * const env;
const PackageDatabaseEntry pkg;
ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer matches;
@@ -317,11 +322,6 @@ namespace
{
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
void visit(const PackageDepAtom * const a)
{
PackageDatabaseEntryCollection::ConstPointer m(env->package_database()->query(
@@ -335,11 +335,6 @@ namespace
std::for_each(u->begin(), u->end(), accept_visitor(this));
}
- void visit(const AnyDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
void visit(const BlockDepAtom * const)
{
}
diff --git a/paludis/environment.cc b/paludis/environment.cc
index ad02bf7..cd6b74b 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 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
@@ -52,8 +52,11 @@ namespace
* Check whether licences for a package are accepted.
*/
struct LicenceChecker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<LicenceChecker, AllDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<LicenceChecker, AllDepAtom>::visit;
+
/// Are all necessary licences ok?
bool ok;
@@ -73,10 +76,6 @@ namespace
///\name Visit methods
///{
- void visit(const AllDepAtom * atom)
- {
- std::for_each(atom->begin(), atom->end(), accept_visitor(this));
- }
void visit(const AnyDepAtom * atom)
{
@@ -235,8 +234,11 @@ namespace
* from the world file.
*/
struct WorldTargetFinder :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<WorldTargetFinder, AllDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<WorldTargetFinder, AllDepAtom>::visit;
+
/// Matches
std::list<const PackageDepAtom *> items;
@@ -259,11 +261,6 @@ namespace
///\name Visit methods
///{
- void visit(const AllDepAtom * a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
void visit(const AnyDepAtom * a)
{
Save<bool> save_inside_any(&inside_any, true);
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index 583592f..49e1563 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -31,8 +31,13 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>::visit;
+
CheckResult & result;
const std::string role;
const Environment * const env;
@@ -51,16 +56,6 @@ namespace
{
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const AnyDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
void visit(const UseDepAtom * const u)
{
Repository::ConstPointer r(env->package_database()->fetch_repository(env->package_database()->
diff --git a/paludis/qa/dep_packages_check.cc b/paludis/qa/dep_packages_check.cc
index 12d4a50..dea7ca1 100644
--- a/paludis/qa/dep_packages_check.cc
+++ b/paludis/qa/dep_packages_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -33,8 +33,15 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>::visit;
+
CheckResult & result;
const std::string role;
const std::set<QualifiedPackageName> & suspicious;
@@ -53,21 +60,6 @@ namespace
+ stringify(p->package()) + "'");
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const AnyDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const UseDepAtom * const u)
- {
- std::for_each(u->begin(), u->end(), accept_visitor(this));
- }
-
void visit(const PlainTextDepAtom * const)
{
}
diff --git a/paludis/qa/deps_exist_check.cc b/paludis/qa/deps_exist_check.cc
index 7d1a9d9..446954a 100644
--- a/paludis/qa/deps_exist_check.cc
+++ b/paludis/qa/deps_exist_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -30,8 +30,13 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>::visit;
+
CheckResult & result;
const std::string role;
const Environment * env;
@@ -58,11 +63,6 @@ namespace
}
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
void visit(const AnyDepAtom * const a)
{
/// \todo VV make this smarter
@@ -70,11 +70,6 @@ namespace
std::for_each(a->begin(), a->end(), accept_visitor(this));
}
- void visit(const UseDepAtom * const u)
- {
- std::for_each(u->begin(), u->end(), accept_visitor(this));
- }
-
void visit(const BlockDepAtom * const b)
{
if (env->package_database()->query(*b->blocked_atom(), is_any, qo_whatever)->empty())
diff --git a/paludis/qa/deps_visible_check.cc b/paludis/qa/deps_visible_check.cc
index 4739710..0045147 100644
--- a/paludis/qa/deps_visible_check.cc
+++ b/paludis/qa/deps_visible_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -76,8 +76,11 @@ namespace
};
struct Checker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>::visit;
+
CheckResult & result;
const std::string role;
const QAEnvironment * env;
@@ -127,11 +130,6 @@ namespace
+ candidates + ")");
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
void visit(const AnyDepAtom * const a)
{
std::list<DepAtom::ConstPointer> viable_children;
diff --git a/paludis/qa/extract_check.cc b/paludis/qa/extract_check.cc
index 5228616..363caae 100644
--- a/paludis/qa/extract_check.cc
+++ b/paludis/qa/extract_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -30,8 +30,15 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>::visit;
+
bool need_zip;
bool have_zip;
@@ -48,21 +55,6 @@ namespace
need_zip = true;
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const UseDepAtom * const u)
- {
- std::for_each(u->begin(), u->end(), accept_visitor(this));
- }
-
- void visit(const AnyDepAtom * const u)
- {
- std::for_each(u->begin(), u->end(), accept_visitor(this));
- }
-
void visit(const BlockDepAtom * const)
{
}
diff --git a/paludis/qa/license_check.cc b/paludis/qa/license_check.cc
index 67f2603..e45fe4c 100644
--- a/paludis/qa/license_check.cc
+++ b/paludis/qa/license_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -30,8 +30,15 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AnyDepAtom>::visit;
+
CheckResult & result;
const Environment * const env;
@@ -48,21 +55,6 @@ namespace
result << Message(qal_major, "Item '" + a->text() + "' is not a licence");
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const AnyDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const UseDepAtom * const u)
- {
- std::for_each(u->begin(), u->end(), accept_visitor(this));
- }
-
void visit(const BlockDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
void visit(const PackageDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
};
diff --git a/paludis/qa/pdepend_overlap_check.cc b/paludis/qa/pdepend_overlap_check.cc
index 4cef581..9f7ad9f 100644
--- a/paludis/qa/pdepend_overlap_check.cc
+++ b/paludis/qa/pdepend_overlap_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -31,8 +31,15 @@ using namespace paludis::qa;
namespace
{
struct Collector :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Collector, AllDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Collector, AnyDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Collector, UseDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Collector, UseDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Collector, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Collector, AnyDepAtom>::visit;
+
std::set<QualifiedPackageName> result;
Collector()
@@ -44,21 +51,6 @@ namespace
result.insert(p->package());
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const AnyDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const UseDepAtom * const u)
- {
- std::for_each(u->begin(), u->end(), accept_visitor(this));
- }
-
void visit(const BlockDepAtom * const)
{
}
diff --git a/paludis/qa/src_uri_check.cc b/paludis/qa/src_uri_check.cc
index dd8b433..d7ebb40 100644
--- a/paludis/qa/src_uri_check.cc
+++ b/paludis/qa/src_uri_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -31,8 +31,13 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- DepAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>,
+ DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>
{
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, UseDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<Checker, AllDepAtom>::visit;
+
CheckResult & result;
bool fetch_restrict;
const Environment * const env;
@@ -94,16 +99,6 @@ namespace
}
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const UseDepAtom * const u)
- {
- std::for_each(u->begin(), u->end(), accept_visitor(this));
- }
-
void visit(const AnyDepAtom * const u)
{
result << Message(qal_major, "Unexpected || dep block");
diff --git a/paludis/repositories/gems/cache.cc b/paludis/repositories/gems/cache.cc
index 4f4fc94..7d6daef 100644
--- a/paludis/repositories/gems/cache.cc
+++ b/paludis/repositories/gems/cache.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -256,8 +256,11 @@ namespace
};
struct TopLevelVisitor :
- YamlNodeVisitorTypes::ConstVisitor
+ YamlNodeVisitorTypes::ConstVisitor,
+ YamlNodeVisitorTypes::ConstVisitor::VisitChildren<TopLevelVisitor, YamlSequenceNode>
{
+ using YamlNodeVisitorTypes::ConstVisitor::VisitChildren<TopLevelVisitor, YamlSequenceNode>::visit;
+
Implementation<GemsCache>::Pointer imp;
bool top_level;
@@ -267,11 +270,6 @@ namespace
{
}
- void visit(const YamlSequenceNode * n)
- {
- std::for_each(n->begin(), n->end(), accept_visitor(this));
- }
-
void visit(const YamlMappingNode * n)
{
for (YamlMappingNode::Iterator i(n->begin()), i_end(n->end()) ; i != i_end ; ++i)
diff --git a/paludis/tasks/report_task.cc b/paludis/tasks/report_task.cc
index 3f31acd..5d8bf95 100644
--- a/paludis/tasks/report_task.cc
+++ b/paludis/tasks/report_task.cc
@@ -28,7 +28,10 @@ using namespace paludis;
namespace
{
class VulnerableChecker :
- public DepAtomVisitorTypes::ConstVisitor
+ public DepAtomVisitorTypes::ConstVisitor,
+ public DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, AllDepAtom>,
+ public DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, AnyDepAtom>,
+ public DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, UseDepAtom>
{
private:
std::multimap<PackageDatabaseEntry, DepTag::ConstPointer,
@@ -38,6 +41,10 @@ namespace
public:
typedef std::multimap<PackageDatabaseEntry, DepTag::ConstPointer>::const_iterator ConstIterator;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, UseDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, AnyDepAtom>::visit;
+
/**
* Constructor.
*/
@@ -48,11 +55,6 @@ namespace
/// \name Visit functions
///{
- void visit(const AllDepAtom * const);
-
- void visit(const AnyDepAtom * const);
-
- void visit(const UseDepAtom * const);
void visit(const PackageDepAtom * const);
@@ -75,24 +77,6 @@ namespace
};
void
- VulnerableChecker::visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void
- VulnerableChecker::visit(const AnyDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void
- VulnerableChecker::visit(const UseDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void
VulnerableChecker::visit(const PackageDepAtom * const a)
{
PackageDatabaseEntryCollection::ConstPointer insecure(
diff --git a/paludis/util/visitor.hh b/paludis/util/visitor.hh
index 732150a..7aa374c 100644
--- a/paludis/util/visitor.hh
+++ b/paludis/util/visitor.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -26,6 +26,12 @@
* \ingroup grpvisitor
*/
+namespace std
+{
+ template <typename A_, typename B_>
+ B_ for_each(A_, A_, B_);
+}
+
namespace paludis
{
template <typename NodePtrType_>
@@ -246,15 +252,15 @@ namespace paludis
* A ConstVisitor descendent visits nodes via a const pointer.
*/
class ConstVisitor :
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N1_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N2_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N3_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N4_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N5_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N6_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N7_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N8_>::Type>,
- public visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N9_>::Type>
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N1_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N2_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N3_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N4_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N5_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N6_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N7_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N8_>::Type>,
+ public virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<N9_>::Type>
{
protected:
///\name Basic operations
@@ -263,21 +269,25 @@ namespace paludis
~ConstVisitor();
///\}
+
+ public:
+ template <typename OurType_, typename T_>
+ struct VisitChildren;
};
/**
* A Visitor descendent visits nodes via a non-const pointer.
*/
class Visitor :
- public visitor_internals::Visits<N1_>,
- public visitor_internals::Visits<N2_>,
- public visitor_internals::Visits<N3_>,
- public visitor_internals::Visits<N4_>,
- public visitor_internals::Visits<N5_>,
- public visitor_internals::Visits<N6_>,
- public visitor_internals::Visits<N7_>,
- public visitor_internals::Visits<N8_>,
- public visitor_internals::Visits<N9_>
+ public virtual visitor_internals::Visits<N1_>,
+ public virtual visitor_internals::Visits<N2_>,
+ public virtual visitor_internals::Visits<N3_>,
+ public virtual visitor_internals::Visits<N4_>,
+ public virtual visitor_internals::Visits<N5_>,
+ public virtual visitor_internals::Visits<N6_>,
+ public virtual visitor_internals::Visits<N7_>,
+ public virtual visitor_internals::Visits<N8_>,
+ public virtual visitor_internals::Visits<N9_>
{
protected:
///\name Basic operations
@@ -361,6 +371,26 @@ namespace paludis
{
return AcceptVisitor<VisitorPointer_>(p);
}
+
+ template <
+ typename N1_,
+ typename N2_,
+ typename N3_,
+ typename N4_,
+ typename N5_,
+ typename N6_,
+ typename N7_,
+ typename N8_,
+ typename N9_>
+ template <typename OurType_, typename C1_>
+ struct VisitorTypes<N1_, N2_, N3_, N4_, N5_, N6_, N7_, N8_, N9_>::ConstVisitor::VisitChildren :
+ virtual visitor_internals::Visits<typename visitor_internals::MakePointerToConst<C1_ *>::Type>
+ {
+ virtual void visit(typename visitor_internals::MakePointerToConst<C1_ *>::Type const c)
+ {
+ std::for_each(c->begin(), c->end(), accept_visitor(static_cast<OurType_ *>(this)));
+ }
+ };
}
#endif
diff --git a/src/clients/adjutrix/find_insecure_packages.cc b/src/clients/adjutrix/find_insecure_packages.cc
index f6a46ae..831ebc3 100644
--- a/src/clients/adjutrix/find_insecure_packages.cc
+++ b/src/clients/adjutrix/find_insecure_packages.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -60,7 +60,10 @@ namespace
}
class ListInsecureVisitor :
- public DepAtomVisitorTypes::ConstVisitor
+ public DepAtomVisitorTypes::ConstVisitor,
+ public DepAtomVisitorTypes::ConstVisitor::VisitChildren<ListInsecureVisitor, AllDepAtom>,
+ public DepAtomVisitorTypes::ConstVisitor::VisitChildren<ListInsecureVisitor, AnyDepAtom>,
+ public DepAtomVisitorTypes::ConstVisitor::VisitChildren<ListInsecureVisitor, UseDepAtom>
{
private:
const Environment & _env;
@@ -68,26 +71,15 @@ namespace
ArbitrarilyOrderedPackageDatabaseEntryCollectionComparator> _found;
public:
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<ListInsecureVisitor, AllDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<ListInsecureVisitor, AnyDepAtom>::visit;
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<ListInsecureVisitor, UseDepAtom>::visit;
+
ListInsecureVisitor(const Environment & e) :
_env(e)
{
}
- void visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const AnyDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const UseDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
void visit(const PackageDepAtom * const a)
{
PackageDatabaseEntryCollection::ConstPointer insecure(
diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc
index cafa472..c450977 100644
--- a/src/clients/adjutrix/find_reverse_deps.cc
+++ b/src/clients/adjutrix/find_reverse_deps.cc
@@ -40,7 +40,8 @@ using std::endl;
namespace
{
class ReverseDepChecker :
- public DepAtomVisitorTypes::ConstVisitor
+ public DepAtomVisitorTypes::ConstVisitor,
+ public DepAtomVisitorTypes::ConstVisitor::VisitChildren<ReverseDepChecker, AllDepAtom>
{
private:
PackageDatabase::ConstPointer _db;
@@ -55,6 +56,8 @@ namespace
bool _found_matches;
public:
+ using DepAtomVisitorTypes::ConstVisitor::VisitChildren<ReverseDepChecker, AllDepAtom>::visit;
+
ReverseDepChecker(PackageDatabase::ConstPointer db, PackageDatabaseEntryCollection::ConstPointer entries,
const std::string & p) :
_db(db),
@@ -78,8 +81,6 @@ namespace
return _found_matches;
}
- void visit(const AllDepAtom * const);
-
void visit(const AnyDepAtom * const);
void visit(const UseDepAtom * const);
@@ -92,12 +93,6 @@ namespace
};
void
- ReverseDepChecker::visit(const AllDepAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void
ReverseDepChecker::visit(const AnyDepAtom * const a)
{
Save<bool> in_any_save(&_in_any, true);