aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-09 13:46:00 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-09 13:46:00 +0000
commit4231af5178d647d8ad932decfcf6a437bec63365 (patch)
treebb0d7168d1aff08b6c087bd1aca0f42f8a33e1ed /paludis/repositories/e
parent6cf45c1cfa4bf675095a244693b9dbfd5e08daca (diff)
downloadpaludis-4231af5178d647d8ad932decfcf6a437bec63365.tar.gz
paludis-4231af5178d647d8ad932decfcf6a437bec63365.tar.xz
New easier tree visitors
Diffstat (limited to 'paludis/repositories/e')
-rw-r--r--paludis/repositories/e/aa_visitor.cc18
-rw-r--r--paludis/repositories/e/aa_visitor.hh11
-rw-r--r--paludis/repositories/e/aa_visitor_TEST.cc3
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc62
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.hh21
-rw-r--r--paludis/repositories/e/dep_parser.cc111
-rw-r--r--paludis/repositories/e/dep_parser.hh16
-rw-r--r--paludis/repositories/e/dep_parser_TEST.cc89
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc146
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.hh47
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer_TEST.cc25
-rw-r--r--paludis/repositories/e/dependencies_rewriter.cc63
-rw-r--r--paludis/repositories/e/dependencies_rewriter.hh26
-rw-r--r--paludis/repositories/e/e_choices_key.cc40
-rw-r--r--paludis/repositories/e/e_installed_repository.cc14
-rw-r--r--paludis/repositories/e/e_installed_repository.hh2
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc4
-rw-r--r--paludis/repositories/e/e_key.cc63
-rw-r--r--paludis/repositories/e/e_key.hh14
-rw-r--r--paludis/repositories/e/e_mask.cc1
-rw-r--r--paludis/repositories/e/e_repository.cc9
-rw-r--r--paludis/repositories/e/e_repository.hh2
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc17
-rw-r--r--paludis/repositories/e/e_repository_profile.cc11
-rw-r--r--paludis/repositories/e/e_repository_profile.hh5
-rw-r--r--paludis/repositories/e/e_repository_sets.cc18
-rw-r--r--paludis/repositories/e/e_repository_sets.hh4
-rw-r--r--paludis/repositories/e/e_repository_sets_TEST.cc13
-rw-r--r--paludis/repositories/e/ebuild.cc4
-rw-r--r--paludis/repositories/e/ebuild_entries.cc54
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc10
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc3
-rw-r--r--paludis/repositories/e/ebuild_id.cc64
-rw-r--r--paludis/repositories/e/exndbam_id.cc2
-rw-r--r--paludis/repositories/e/fetch_visitor.cc29
-rw-r--r--paludis/repositories/e/fetch_visitor.hh22
-rw-r--r--paludis/repositories/e/fetch_visitor_TEST.cc5
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc146
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.hh6
-rw-r--r--paludis/repositories/e/fix_locked_dependencies_TEST.cc15
-rw-r--r--paludis/repositories/e/info_metadata_key.cc1
-rw-r--r--paludis/repositories/e/myoptions_requirements_verifier.cc39
-rw-r--r--paludis/repositories/e/myoptions_requirements_verifier.hh23
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc11
-rw-r--r--paludis/repositories/e/pretend_fetch_visitor.cc29
-rw-r--r--paludis/repositories/e/pretend_fetch_visitor.hh21
-rw-r--r--paludis/repositories/e/qa/extractors.cc116
-rw-r--r--paludis/repositories/e/qa/fetches_key.cc65
-rw-r--r--paludis/repositories/e/qa/homepage_key.cc34
-rw-r--r--paludis/repositories/e/qa/inherited_key.cc2
-rw-r--r--paludis/repositories/e/qa/keywords_key.cc1
-rw-r--r--paludis/repositories/e/qa/license_key.cc37
-rw-r--r--paludis/repositories/e/qa/manifest.cc32
-rw-r--r--paludis/repositories/e/qa/metadata_keys.cc15
-rw-r--r--paludis/repositories/e/qa/restrict_key.cc37
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc92
-rw-r--r--paludis/repositories/e/qa/visibility.cc81
-rw-r--r--paludis/repositories/e/source_uri_finder.cc8
-rw-r--r--paludis/repositories/e/source_uri_finder.hh1
-rw-r--r--paludis/repositories/e/source_uri_finder_TEST.cc4
-rw-r--r--paludis/repositories/e/vdb_repository.cc7
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc14
62 files changed, 832 insertions, 1053 deletions
diff --git a/paludis/repositories/e/aa_visitor.cc b/paludis/repositories/e/aa_visitor.cc
index 119fbb7d9..05417e224 100644
--- a/paludis/repositories/e/aa_visitor.cc
+++ b/paludis/repositories/e/aa_visitor.cc
@@ -19,9 +19,12 @@
#include <paludis/dep_spec.hh>
#include <paludis/repositories/e/aa_visitor.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/indirect_iterator.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <list>
+#include <algorithm>
/** \file
* Implementation of aa_visitor.hh
@@ -51,14 +54,21 @@ AAVisitor::~AAVisitor()
}
void
-AAVisitor::visit_leaf(const FetchableURIDepSpec & p)
+AAVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node)
+{
+ _imp->aa.push_back(node.spec()->filename());
+}
+
+
+void
+AAVisitor::visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type &)
{
- _imp->aa.push_back(p.filename());
}
void
-AAVisitor::visit_leaf(const URILabelsDepSpec &)
+AAVisitor::visit(const FetchableURISpecTree::BasicInnerNode & node)
{
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
AAVisitor::ConstIterator
diff --git a/paludis/repositories/e/aa_visitor.hh b/paludis/repositories/e/aa_visitor.hh
index 4b2e71efa..b97d627b9 100644
--- a/paludis/repositories/e/aa_visitor.hh
+++ b/paludis/repositories/e/aa_visitor.hh
@@ -20,7 +20,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_AAVISITOR_HH
#define PALUDIS_GUARD_PALUDIS_AAVISITOR_HH 1
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
@@ -42,9 +42,6 @@ namespace paludis
* \ingroup grpaavisitor
*/
class PALUDIS_VISIBLE AAVisitor :
- public ConstVisitor<FetchableURISpecTree>,
- public ConstVisitor<FetchableURISpecTree>::VisitConstSequence<AAVisitor, AllDepSpec>,
- public ConstVisitor<FetchableURISpecTree>::VisitConstSequence<AAVisitor, ConditionalDepSpec>,
private PrivateImplementationPattern<AAVisitor>
{
public:
@@ -60,9 +57,9 @@ namespace paludis
/// \name Visit functions
///{
- void visit_leaf(const FetchableURIDepSpec &);
-
- void visit_leaf(const URILabelsDepSpec &);
+ void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::BasicInnerNode & node);
///}
diff --git a/paludis/repositories/e/aa_visitor_TEST.cc b/paludis/repositories/e/aa_visitor_TEST.cc
index c21b549cb..b9b1c8755 100644
--- a/paludis/repositories/e/aa_visitor_TEST.cc
+++ b/paludis/repositories/e/aa_visitor_TEST.cc
@@ -20,7 +20,6 @@
#include "aa_visitor.hh"
#include "dep_parser.hh"
#include <paludis/util/join.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
@@ -47,7 +46,7 @@ namespace test_cases
std::tr1::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
AAVisitor p1;
- parse_fetchable_uri("( a -> b c x? ( d e ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
+ parse_fetchable_uri("( a -> b c x? ( d e ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p1);
TEST_CHECK_EQUAL(join(p1.begin(), p1.end(), " "), "b c d e");
}
} test_aa_visitor;
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index b667dad32..2a78c952f 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -21,13 +21,13 @@
#include <paludis/repositories/e/source_uri_finder.hh>
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/e_repository_params.hh>
+#include <paludis/repositories/e/manifest2_reader.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
#include <paludis/about.hh>
#include <paludis/action.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/system.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
@@ -41,9 +41,11 @@
#include <paludis/util/md5.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/output_deviator.hh>
-
-#include <paludis/repositories/e/manifest2_reader.hh>
-
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/indirect_iterator.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <algorithm>
#include <iostream>
#include <fstream>
#include <list>
@@ -119,22 +121,18 @@ CheckFetchedFilesVisitor::~CheckFetchedFilesVisitor()
}
void
-CheckFetchedFilesVisitor::visit_sequence(const ConditionalDepSpec & u,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator end)
+CheckFetchedFilesVisitor::visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<bool> save_in_nofetch(&_imp->in_nofetch, _imp->in_nofetch);
- if ((_imp->check_unneeded) || (u.condition_met()))
- std::for_each(cur, end, accept_visitor(*this));
+ if ((_imp->check_unneeded) || (node.spec()->condition_met()))
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
void
-CheckFetchedFilesVisitor::visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator end)
+CheckFetchedFilesVisitor::visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node)
{
Save<bool> save_in_nofetch(&_imp->in_nofetch, _imp->in_nofetch);
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
namespace
@@ -177,10 +175,10 @@ namespace
}
void
-CheckFetchedFilesVisitor::visit_leaf(const URILabelsDepSpec & l)
+CheckFetchedFilesVisitor::visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node)
{
InNoFetchVisitor v;
- std::for_each(indirect_iterator(l.begin()), indirect_iterator(l.end()), accept_visitor(v));
+ std::for_each(indirect_iterator(node.spec()->begin()), indirect_iterator(node.spec()->end()), accept_visitor(v));
_imp->in_nofetch = v.result;
}
@@ -354,70 +352,70 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
}
void
-CheckFetchedFilesVisitor::visit_leaf(const FetchableURIDepSpec & u)
+CheckFetchedFilesVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
- Context context("When visiting URI dep spec '" + stringify(u.text()) + "':");
+ Context context("When visiting URI dep spec '" + stringify(node.spec()->text()) + "':");
- if (_imp->done.end() != _imp->done.find(u.filename()))
+ if (_imp->done.end() != _imp->done.find(node.spec()->filename()))
{
Log::get_instance()->message("e.check_fetched_files.already_checked", ll_debug, lc_context)
- << "Already checked '" << u.filename() << "'";
+ << "Already checked '" << node.spec()->filename() << "'";
return;
}
- _imp->done.insert(u.filename());
+ _imp->done.insert(node.spec()->filename());
- *_imp->out << "Checking '" << u.filename() << "'... " << std::flush;
+ *_imp->out << "Checking '" << node.spec()->filename() << "'... " << std::flush;
- if (! (_imp->distdir / u.filename()).is_regular_file())
+ if (! (_imp->distdir / node.spec()->filename()).is_regular_file())
{
if (_imp->in_nofetch)
{
if (! _imp->exclude_unmirrorable)
{
Log::get_instance()->message("e.check_fetched_files.requires_manual", ll_debug, lc_context)
- << "Manual fetch required for '" << u.filename() << "'";
+ << "Manual fetch required for '" << node.spec()->filename() << "'";
*_imp->out << "requires manual fetch";
_imp->need_nofetch = true;
_imp->failures->push_back(make_named_values<FetchActionFailure>(
value_for<n::failed_automatic_fetching>(false),
value_for<n::failed_integrity_checks>(""),
value_for<n::requires_manual_fetching>(true),
- value_for<n::target_file>(u.filename())
+ value_for<n::target_file>(node.spec()->filename())
));
}
}
else
{
Log::get_instance()->message("e.check_fetched_files.does_not_exist", ll_debug, lc_context)
- << "Automatic fetch failed for '" << u.filename() << "'";
+ << "Automatic fetch failed for '" << node.spec()->filename() << "'";
*_imp->out << "does not exist";
_imp->failures->push_back(make_named_values<FetchActionFailure>(
value_for<n::failed_automatic_fetching>(true),
value_for<n::failed_integrity_checks>(""),
value_for<n::requires_manual_fetching>(false),
- value_for<n::target_file>(u.filename())
+ value_for<n::target_file>(node.spec()->filename())
));
}
}
- else if (0 == (_imp->distdir / u.filename()).file_size())
+ else if (0 == (_imp->distdir / node.spec()->filename()).file_size())
{
- Log::get_instance()->message("e.check_fetched_files.empty", ll_debug, lc_context) << "Empty file for '" << u.filename() << "'";
+ Log::get_instance()->message("e.check_fetched_files.empty", ll_debug, lc_context) << "Empty file for '" << node.spec()->filename() << "'";
*_imp->out << "empty file";
_imp->failures->push_back(make_named_values<FetchActionFailure>(
value_for<n::failed_automatic_fetching>(false),
value_for<n::failed_integrity_checks>("SIZE (empty file)"),
value_for<n::requires_manual_fetching>(false),
- value_for<n::target_file>(u.filename())
+ value_for<n::target_file>(node.spec()->filename())
));
}
- else if (! check_distfile_manifest(_imp->distdir / u.filename()))
+ else if (! check_distfile_manifest(_imp->distdir / node.spec()->filename()))
{
Log::get_instance()->message("e.check_fetched_files.failure", ll_debug, lc_context)
- << "Manifest check failed for '" << u.filename() << "'";
+ << "Manifest check failed for '" << node.spec()->filename() << "'";
}
else
{
- Log::get_instance()->message("e.check_fetched_files.success", ll_debug, lc_context) << "Success for '" << u.filename() << "'";
+ Log::get_instance()->message("e.check_fetched_files.success", ll_debug, lc_context) << "Success for '" << node.spec()->filename() << "'";
*_imp->out << "ok";
}
diff --git a/paludis/repositories/e/check_fetched_files_visitor.hh b/paludis/repositories/e/check_fetched_files_visitor.hh
index a27dc8fed..c2215aaf3 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.hh
+++ b/paludis/repositories/e/check_fetched_files_visitor.hh
@@ -23,11 +23,10 @@
#include <paludis/repositories/e/e_repository_params.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/visitor-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/output_deviator-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/action-fwd.hh>
@@ -38,8 +37,7 @@ namespace paludis
namespace erepository
{
class PALUDIS_VISIBLE CheckFetchedFilesVisitor :
- private PrivateImplementationPattern<CheckFetchedFilesVisitor>,
- public ConstVisitor<FetchableURISpecTree>
+ private PrivateImplementationPattern<CheckFetchedFilesVisitor>
{
private:
bool check_distfile_manifest(const FSEntry & distfile);
@@ -58,17 +56,10 @@ namespace paludis
~CheckFetchedFilesVisitor();
- void visit_sequence(const ConditionalDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator,
- FetchableURISpecTree::ConstSequenceIterator);
-
- void visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator,
- FetchableURISpecTree::ConstSequenceIterator);
-
- void visit_leaf(const URILabelsDepSpec &);
-
- void visit_leaf(const FetchableURIDepSpec &);
+ void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node);
const std::tr1::shared_ptr<const Sequence<FetchActionFailure> > failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index f3fe0340d..46a46c6ce 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -22,7 +22,6 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/map.hh>
@@ -55,7 +54,6 @@ namespace paludis
{
namespace n
{
- struct add_handler;
struct item;
struct spec;
}
@@ -66,12 +64,9 @@ namespace
template <typename T_>
struct ParseStackTypes
{
- typedef std::tr1::function<void (const std::tr1::shared_ptr<const typename T_::ConstItem> &)> AddHandler;
-
struct Item
{
- NamedValue<n::add_handler, AddHandler> add_handler;
- NamedValue<n::item, const std::tr1::shared_ptr<const typename T_::ConstItem> > item;
+ NamedValue<n::item, std::tr1::shared_ptr<typename T_::BasicInnerNode> > item;
NamedValue<n::spec, std::tr1::shared_ptr<DepSpec> > spec;
};
@@ -89,7 +84,7 @@ namespace
{
std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
parse_elike_package_dep_spec(s, eapi.supported()->package_dep_spec_parse_options(), id)));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, PackageDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
@@ -114,7 +109,7 @@ namespace
std::tr1::shared_ptr<BlockDepSpec> spec(new BlockDepSpec(
make_shared_ptr(new PackageDepSpec(parse_elike_package_dep_spec(s.substr(specstart),
eapi.supported()->package_dep_spec_parse_options(), id))), s));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, BlockDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
else
@@ -128,7 +123,7 @@ namespace
const std::string & s)
{
std::tr1::shared_ptr<LicenseDepSpec> spec(new LicenseDepSpec(s));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, LicenseDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
@@ -139,7 +134,7 @@ namespace
const std::string & s)
{
std::tr1::shared_ptr<PlainTextDepSpec> spec(new PlainTextDepSpec(s));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, PlainTextDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
@@ -150,7 +145,7 @@ namespace
const std::string & s)
{
std::tr1::shared_ptr<SimpleURIDepSpec> spec(new SimpleURIDepSpec(s));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, SimpleURIDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
@@ -166,7 +161,7 @@ namespace
if (t.empty() || eapi.supported()->dependency_spec_tree_parse_options()[dstpo_uri_supports_arrow])
{
std::tr1::shared_ptr<FetchableURIDepSpec> spec(new FetchableURIDepSpec(t.empty() ? f : f + " -> " + t));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, FetchableURIDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
else
@@ -209,7 +204,7 @@ namespace
const EAPI & eapi)
{
std::tr1::shared_ptr<DependencyLabelsDepSpec> spec(parse_dependency_label(s, eapi));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, DependencyLabelsDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
@@ -221,7 +216,7 @@ namespace
const EAPI & eapi)
{
std::tr1::shared_ptr<URILabelsDepSpec> spec(parse_uri_label(s, eapi));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, URILabelsDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
@@ -232,20 +227,16 @@ namespace
const std::string & s)
{
std::tr1::shared_ptr<PlainTextLabelDepSpec> spec(parse_plain_text_label(s));
- (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, PlainTextLabelDepSpec>(spec)));
+ h.begin()->item()->append(spec);
annotations_go_here(spec);
}
template <typename T_, typename A_>
void any_all_handler(typename ParseStackTypes<T_>::Stack & stack)
{
- using namespace std::tr1::placeholders;
std::tr1::shared_ptr<A_> spec(new A_);
- std::tr1::shared_ptr<ConstTreeSequence<T_, A_> > item(new ConstTreeSequence<T_, A_>(spec));
- (*stack.begin()).add_handler()(item);
stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<T_, A_>::add, item.get(), _1)),
- value_for<n::item>(item),
+ value_for<n::item>(stack.begin()->item()->append(spec)),
value_for<n::spec>(spec)
));
}
@@ -257,14 +248,10 @@ namespace
const Environment * const env,
const std::tr1::shared_ptr<const PackageID> & id)
{
- using namespace std::tr1::placeholders;
std::tr1::shared_ptr<ConditionalDepSpec> spec(new ConditionalDepSpec(parse_elike_conditional_dep_spec(u, env, id,
id->supports_action(SupportsActionTest<InstalledAction>()))));
- std::tr1::shared_ptr<ConstTreeSequence<T_, ConditionalDepSpec> > item(new ConstTreeSequence<T_, ConditionalDepSpec>(spec));
- (*stack.begin()).add_handler()(item);
stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<T_, ConditionalDepSpec>::add, item.get(), _1)),
- value_for<n::item>(item),
+ value_for<n::item>(stack.begin()->item()->append(spec)),
value_for<n::spec>(spec)
));
}
@@ -326,7 +313,7 @@ namespace
}
}
-std::tr1::shared_ptr<DependencySpecTree::ConstItem>
+std::tr1::shared_ptr<DependencySpecTree>
paludis::erepository::parse_depend(const std::string & s,
const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI & eapi)
{
@@ -335,11 +322,9 @@ paludis::erepository::parse_depend(const std::string & s,
ParseStackTypes<DependencySpecTree>::Stack stack;
std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
- std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > top(
- new ConstTreeSequence<DependencySpecTree, AllDepSpec>(spec));
+ std::tr1::shared_ptr<DependencySpecTree> top(make_shared_ptr(new DependencySpecTree(spec)));
stack.push_front(make_named_values<ParseStackTypes<DependencySpecTree>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, top.get(), _1)),
- value_for<n::item>(top),
+ value_for<n::item>(top->root()),
value_for<n::spec>(spec)
));
@@ -366,10 +351,10 @@ paludis::erepository::parse_depend(const std::string & s,
parse_elike_dependencies(s, callbacks);
- return (*stack.begin()).item();
+ return top;
}
-std::tr1::shared_ptr<ProvideSpecTree::ConstItem>
+std::tr1::shared_ptr<ProvideSpecTree>
paludis::erepository::parse_provide(const std::string & s,
const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI & eapi)
{
@@ -378,11 +363,9 @@ paludis::erepository::parse_provide(const std::string & s,
ParseStackTypes<ProvideSpecTree>::Stack stack;
std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
- std::tr1::shared_ptr<ConstTreeSequence<ProvideSpecTree, AllDepSpec> > top(
- new ConstTreeSequence<ProvideSpecTree, AllDepSpec>(spec));
+ std::tr1::shared_ptr<ProvideSpecTree> top(make_shared_ptr(new ProvideSpecTree(spec)));
stack.push_front(make_named_values<ParseStackTypes<ProvideSpecTree>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<ProvideSpecTree, AllDepSpec>::add, top.get(), _1)),
- value_for<n::item>(top),
+ value_for<n::item>(top->root()),
value_for<n::spec>(spec)
));
@@ -407,10 +390,10 @@ paludis::erepository::parse_provide(const std::string & s,
parse_elike_dependencies(s, callbacks);
- return (*stack.begin()).item();
+ return top;
}
-std::tr1::shared_ptr<FetchableURISpecTree::ConstItem>
+std::tr1::shared_ptr<FetchableURISpecTree>
paludis::erepository::parse_fetchable_uri(const std::string & s,
const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI & eapi)
{
@@ -419,13 +402,11 @@ paludis::erepository::parse_fetchable_uri(const std::string & s,
ParseStackTypes<FetchableURISpecTree>::Stack stack;
std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
- std::tr1::shared_ptr<ConstTreeSequence<FetchableURISpecTree, AllDepSpec> > top(
- new ConstTreeSequence<FetchableURISpecTree, AllDepSpec>(spec));
+ std::tr1::shared_ptr<FetchableURISpecTree> top(make_shared_ptr(new FetchableURISpecTree(spec)));
stack.push_front(make_named_values<ParseStackTypes<FetchableURISpecTree>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<FetchableURISpecTree, AllDepSpec>::add, top.get(), _1)),
- value_for<n::item>(top),
+ value_for<n::item>(top->root()),
value_for<n::spec>(spec)
- ));
+ ));
ELikeDepParserCallbacks callbacks(
make_named_values<ELikeDepParserCallbacks>(
@@ -452,10 +433,10 @@ paludis::erepository::parse_fetchable_uri(const std::string & s,
parse_elike_dependencies(s, callbacks);
- return (*stack.begin()).item();
+ return top;
}
-std::tr1::shared_ptr<SimpleURISpecTree::ConstItem>
+std::tr1::shared_ptr<SimpleURISpecTree>
paludis::erepository::parse_simple_uri(const std::string & s,
const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI &)
{
@@ -464,11 +445,9 @@ paludis::erepository::parse_simple_uri(const std::string & s,
ParseStackTypes<SimpleURISpecTree>::Stack stack;
std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
- std::tr1::shared_ptr<ConstTreeSequence<SimpleURISpecTree, AllDepSpec> > top(
- new ConstTreeSequence<SimpleURISpecTree, AllDepSpec>(spec));
+ std::tr1::shared_ptr<SimpleURISpecTree> top(make_shared_ptr(new SimpleURISpecTree(spec)));
stack.push_front(make_named_values<ParseStackTypes<SimpleURISpecTree>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<SimpleURISpecTree, AllDepSpec>::add, top.get(), _1)),
- value_for<n::item>(top),
+ value_for<n::item>(top->root()),
value_for<n::spec>(spec)
));
@@ -493,10 +472,10 @@ paludis::erepository::parse_simple_uri(const std::string & s,
parse_elike_dependencies(s, callbacks);
- return (*stack.begin()).item();
+ return top;
}
-std::tr1::shared_ptr<LicenseSpecTree::ConstItem>
+std::tr1::shared_ptr<LicenseSpecTree>
paludis::erepository::parse_license(const std::string & s,
const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI & eapi)
{
@@ -505,11 +484,9 @@ paludis::erepository::parse_license(const std::string & s,
ParseStackTypes<LicenseSpecTree>::Stack stack;
std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
- std::tr1::shared_ptr<ConstTreeSequence<LicenseSpecTree, AllDepSpec> > top(
- new ConstTreeSequence<LicenseSpecTree, AllDepSpec>(spec));
+ std::tr1::shared_ptr<LicenseSpecTree> top(make_shared_ptr(new LicenseSpecTree(spec)));
stack.push_front(make_named_values<ParseStackTypes<LicenseSpecTree>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<LicenseSpecTree, AllDepSpec>::add, top.get(), _1)),
- value_for<n::item>(top),
+ value_for<n::item>(top->root()),
value_for<n::spec>(spec)
));
@@ -534,10 +511,10 @@ paludis::erepository::parse_license(const std::string & s,
parse_elike_dependencies(s, callbacks);
- return (*stack.begin()).item();
+ return top;
}
-std::tr1::shared_ptr<PlainTextSpecTree::ConstItem>
+std::tr1::shared_ptr<PlainTextSpecTree>
paludis::erepository::parse_plain_text(const std::string & s,
const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI &)
{
@@ -546,11 +523,9 @@ paludis::erepository::parse_plain_text(const std::string & s,
ParseStackTypes<PlainTextSpecTree>::Stack stack;
std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
- std::tr1::shared_ptr<ConstTreeSequence<PlainTextSpecTree, AllDepSpec> > top(
- new ConstTreeSequence<PlainTextSpecTree, AllDepSpec>(spec));
+ std::tr1::shared_ptr<PlainTextSpecTree> top(make_shared_ptr(new PlainTextSpecTree(spec)));
stack.push_front(make_named_values<ParseStackTypes<PlainTextSpecTree>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<PlainTextSpecTree, AllDepSpec>::add, top.get(), _1)),
- value_for<n::item>(top),
+ value_for<n::item>(top->root()),
value_for<n::spec>(spec)
));
@@ -575,10 +550,10 @@ paludis::erepository::parse_plain_text(const std::string & s,
parse_elike_dependencies(s, callbacks);
- return (*stack.begin()).item();
+ return top;
}
-std::tr1::shared_ptr<PlainTextSpecTree::ConstItem>
+std::tr1::shared_ptr<PlainTextSpecTree>
paludis::erepository::parse_myoptions(const std::string & s,
const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI &)
{
@@ -587,11 +562,9 @@ paludis::erepository::parse_myoptions(const std::string & s,
ParseStackTypes<PlainTextSpecTree>::Stack stack;
std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
- std::tr1::shared_ptr<ConstTreeSequence<PlainTextSpecTree, AllDepSpec> > top(
- new ConstTreeSequence<PlainTextSpecTree, AllDepSpec>(spec));
+ std::tr1::shared_ptr<PlainTextSpecTree> top(make_shared_ptr(new PlainTextSpecTree(spec)));
stack.push_front(make_named_values<ParseStackTypes<PlainTextSpecTree>::Item>(
- value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<PlainTextSpecTree, AllDepSpec>::add, top.get(), _1)),
- value_for<n::item>(top),
+ value_for<n::item>(top->root()),
value_for<n::spec>(spec)
));
@@ -618,7 +591,7 @@ paludis::erepository::parse_myoptions(const std::string & s,
parse_elike_dependencies(s, callbacks);
- return (*stack.begin()).item();
+ return top;
}
std::tr1::shared_ptr<URILabelsDepSpec>
diff --git a/paludis/repositories/e/dep_parser.hh b/paludis/repositories/e/dep_parser.hh
index d00f95536..3cc09afc1 100644
--- a/paludis/repositories/e/dep_parser.hh
+++ b/paludis/repositories/e/dep_parser.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_E_DEP_PARSER_HH 1
#include <paludis/repositories/e/dep_parser-fwd.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/repositories/e/eapi-fwd.hh>
#include <paludis/util/exception.hh>
@@ -53,7 +53,7 @@ namespace paludis
/**
* Parse a dependency heirarchy.
*/
- std::tr1::shared_ptr<DependencySpecTree::ConstItem> parse_depend(const std::string & s,
+ std::tr1::shared_ptr<DependencySpecTree> parse_depend(const std::string & s,
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
@@ -64,37 +64,37 @@ namespace paludis
/**
* Parse a provide heirarchy.
*/
- std::tr1::shared_ptr<ProvideSpecTree::ConstItem> parse_provide(const std::string & s,
+ std::tr1::shared_ptr<ProvideSpecTree> parse_provide(const std::string & s,
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
* Parse a restrict or plain text heirarchy.
*/
- std::tr1::shared_ptr<PlainTextSpecTree::ConstItem> parse_plain_text(const std::string & s,
+ std::tr1::shared_ptr<PlainTextSpecTree> parse_plain_text(const std::string & s,
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
* Parse a myoptions heirarchy.
*/
- std::tr1::shared_ptr<PlainTextSpecTree::ConstItem> parse_myoptions(const std::string & s,
+ std::tr1::shared_ptr<PlainTextSpecTree> parse_myoptions(const std::string & s,
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
* Parse a fetchable uri heirarchy.
*/
- std::tr1::shared_ptr<FetchableURISpecTree::ConstItem> parse_fetchable_uri(const std::string & s,
+ std::tr1::shared_ptr<FetchableURISpecTree> parse_fetchable_uri(const std::string & s,
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
* Parse a simple uri heirarchy.
*/
- std::tr1::shared_ptr<SimpleURISpecTree::ConstItem> parse_simple_uri(const std::string & s,
+ std::tr1::shared_ptr<SimpleURISpecTree> parse_simple_uri(const std::string & s,
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
* Parse a license heirarchy.
*/
- std::tr1::shared_ptr<LicenseSpecTree::ConstItem> parse_license(const std::string & s,
+ std::tr1::shared_ptr<LicenseSpecTree> parse_license(const std::string & s,
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
diff --git a/paludis/repositories/e/dep_parser_TEST.cc b/paludis/repositories/e/dep_parser_TEST.cc
index c5c91f929..a90e2eeea 100644
--- a/paludis/repositories/e/dep_parser_TEST.cc
+++ b/paludis/repositories/e/dep_parser_TEST.cc
@@ -24,7 +24,6 @@
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/package_database.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/stringify_formatter.hh>
#include <sstream>
#include <test/test_framework.hh>
@@ -59,7 +58,7 @@ namespace test_cases
StringifyFormatter ff;
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
}
} test_dep_spec_parser_empty;
@@ -82,7 +81,7 @@ namespace test_cases
StringifyFormatter ff;
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend(" \n \t",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
}
} test_dep_spec_parser_blank;
@@ -105,7 +104,7 @@ namespace test_cases
StringifyFormatter ff;
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("app-editors/vim",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim");
}
} test_dep_spec_parser_package;
@@ -128,17 +127,17 @@ namespace test_cases
DepSpecPrettyPrinter d1(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend(">=app-editors/vim-6.4_alpha",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d1);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d1);
TEST_CHECK_EQUAL(stringify(d1), ">=app-editors/vim-6.4_alpha");
DepSpecPrettyPrinter d2(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("=app-editors/vim-6.4_alpha-r1",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d2);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d2);
TEST_CHECK_EQUAL(stringify(d2), "=app-editors/vim-6.4_alpha-r1");
DepSpecPrettyPrinter d3(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend(">=app-editors/vim-6.4_alpha:one",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d3);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d3);
TEST_CHECK_EQUAL(stringify(d3), ">=app-editors/vim-6.4_alpha:one");
}
} test_dep_spec_parser_decorated_package;
@@ -161,7 +160,7 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("app-editors/vim app-misc/hilite \nsys-apps/findutils",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim app-misc/hilite sys-apps/findutils");
}
} test_dep_spec_parser_packages;
@@ -180,7 +179,7 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("|| ( one/one two/two )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one two/two )");
}
} test_dep_spec_parser_any;
@@ -199,15 +198,15 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("|| ( one/one foo? ( two/two ) )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one foo? ( two/two ) )");
TEST_CHECK_THROWS(parse_depend("|| ( one/one foo? ( two/two ) )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
DepSpecPrettyPrinter e(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("|| ( one/one ( foo? ( two/two ) ) )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(e);
TEST_CHECK_EQUAL(stringify(e), "|| ( one/one ( foo? ( two/two ) ) )");
}
} test_dep_spec_parser_any_use;
@@ -230,7 +229,7 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend(" ( one/one two/two ) ",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "one/one two/two");
}
} test_dep_spec_parser_all;
@@ -252,7 +251,7 @@ namespace test_cases
std::tr1::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_depend("foo? ( one/one )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ parse_depend("foo? ( one/one )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "foo? ( one/one )");
}
} test_dep_spec_parser_use;
@@ -274,7 +273,7 @@ namespace test_cases
std::tr1::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_depend("!foo? ( one/one )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ parse_depend("!foo? ( one/one )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "!foo? ( one/one )");
}
} test_dep_spec_parser_inv_use;
@@ -292,15 +291,15 @@ namespace test_cases
std::tr1::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, true, false);
- parse_fetchable_uri("a\n->\tb", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ parse_fetchable_uri("a\n->\tb", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "a -> b\n");
DepSpecPrettyPrinter e(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, true, false);
- parse_fetchable_uri("a-> b", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
+ parse_fetchable_uri("a-> b", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(e);
TEST_CHECK_EQUAL(stringify(e), "a->\nb\n");
TEST_CHECK_THROWS(parse_fetchable_uri("a -> b",
- &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->root()->accept(d), Exception);
}
} test_dep_spec_parser_uri;
@@ -322,15 +321,15 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK_THROWS(parse_depend("!foo? ( one/one",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("!foo? ( one/one ) )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("( ( ( ) )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("( ( ( ) ) ) )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend(")",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
}
} test_dep_spec_parser_bad_nesting;
@@ -352,38 +351,38 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK_THROWS(parse_depend("||",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("|| ",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("foo?",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("!? ( )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("!foo? ||",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("(((",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend(")",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("(foo/bar)",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_license("a -> b",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_fetchable_uri("( -> )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_fetchable_uri("( -> )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_fetchable_uri("foo? -> bar",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_fetchable_uri("a ->",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_fetchable_uri("a -> ( )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_fetchable_uri("a -> )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
TEST_CHECK_THROWS(parse_fetchable_uri("a -> || ( )",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), Exception);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d), Exception);
}
} test_dep_spec_parser_bad_values;
@@ -404,10 +403,10 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("build: one/one",
- &env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "build: one/one");
TEST_CHECK_THROWS(parse_depend("build: one/one",
- &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->accept(d), EDepParseError);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("0"))->root()->accept(d), EDepParseError);
}
} test_dep_spec_parser_labels;
@@ -425,10 +424,10 @@ namespace test_cases
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_fetchable_uri("http://foo/bar manual: two",
- &env, id, *EAPIData::get_instance()->eapi_from_string("kdebuild-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("kdebuild-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "http://foo/bar manual: two");
TEST_CHECK_THROWS(parse_fetchable_uri("http://foo/bar monkey: two",
- &env, id, *EAPIData::get_instance()->eapi_from_string("kdebuild-1"))->accept(d), EDepParseError);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("kdebuild-1"))->root()->accept(d), EDepParseError);
}
} test_dep_spec_parser_kdebuild_uri_labels;
@@ -446,12 +445,12 @@ namespace test_cases
StringifyFormatter ff;
DepSpecPrettyPrinter d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("cat/first [[ foo = bar bar = baz ]] cat/second cat/third [[ moo = oink ]]",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "cat/first [[ bar = [ baz ] foo = [ bar ] ]] cat/second cat/third [[ moo = [ oink ] ]]");
DepSpecPrettyPrinter e(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_depend("bar? ( foo? ( cat/first [[ for = first ]] ) [[ for = foo ]] baz? ( ) [[ for = baz ]] ) [[ for = bar ]]",
- &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(e);
TEST_CHECK_EQUAL(stringify(e), "bar? ( foo? ( cat/first [[ for = [ first ] ]] ) "
"[[ for = [ foo ] ]] baz? ( ) [[ for = [ baz ] ]] ) [[ for = [ bar ] ]]");
}
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index 04b94a3e9..c68dc7135 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -22,7 +22,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/formatter.hh>
#include <paludis/util/save.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
@@ -110,8 +109,7 @@ paludis::erepository::operator<< (std::ostream & s, const DepSpecPrettyPrinter &
namespace
{
- struct IsLabelVisitor :
- ConstVisitor<GenericSpecTree>
+ struct IsLabelVisitor
{
bool result;
@@ -120,63 +118,63 @@ namespace
{
}
- void visit_leaf(const PlainTextDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &)
{
}
- void visit_leaf(const SimpleURIDepSpec &)
+ void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &)
{
}
- void visit_leaf(const FetchableURIDepSpec &)
+ void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type &)
{
}
- void visit_leaf(const LicenseDepSpec &)
+ void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &)
{
}
- void visit_leaf(const PackageDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type &)
{
}
- void visit_leaf(const BlockDepSpec &)
+ void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type &)
{
}
- void visit_leaf(const PlainTextLabelDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &)
{
result = true;
}
- void visit_leaf(const URILabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &)
{
result = true;
}
- void visit_leaf(const DependencyLabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<DependencyLabelsDepSpec>::Type &)
{
result = true;
}
- void visit_leaf(const NamedSetDepSpec &)
+ void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &)
{
}
- void visit_sequence(const AllDepSpec &, GenericSpecTree::ConstSequenceIterator, GenericSpecTree::ConstSequenceIterator)
+ void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type &)
{
}
- void visit_sequence(const AnyDepSpec &, GenericSpecTree::ConstSequenceIterator, GenericSpecTree::ConstSequenceIterator)
+ void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type &)
{
}
- void visit_sequence(const ConditionalDepSpec &, GenericSpecTree::ConstSequenceIterator, GenericSpecTree::ConstSequenceIterator)
+ void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type &)
{
}
};
- bool is_label(const ConstAcceptInterface<GenericSpecTree> & i)
+ bool is_label(const GenericSpecTree::BasicNode & i)
{
IsLabelVisitor v;
i.accept(v);
@@ -185,12 +183,12 @@ namespace
}
void
-DepSpecPrettyPrinter::visit_sequence(const AllDepSpec & a,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node)
{
- bool need_parens(_imp->all_needs_parens || a.annotations_key() ||
- (! _imp->outer_block && end != std::find_if(cur, end, is_label)));
+ bool need_parens(_imp->all_needs_parens || node.spec()->annotations_key() ||
+ (! _imp->outer_block && indirect_iterator(node.end()) != std::find_if(indirect_iterator(node.begin()),
+ indirect_iterator(node.end()),
+ is_label)));
Save<bool> old_outer(&_imp->outer_block, false);
Save<bool> old_needs_parens(&_imp->all_needs_parens, false);
@@ -210,7 +208,7 @@ DepSpecPrettyPrinter::visit_sequence(const AllDepSpec & a,
{
Save<unsigned> old_indent(&_imp->indent, need_parens ? _imp->indent +1 : _imp->indent);
Save<bool> extra_label_indent(&_imp->extra_label_indent, need_parens ? false : _imp->extra_label_indent);
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
if (need_parens)
@@ -221,7 +219,7 @@ DepSpecPrettyPrinter::visit_sequence(const AllDepSpec & a,
_imp->s << " ";
_imp->s << ")";
- do_annotations(a);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -231,9 +229,7 @@ DepSpecPrettyPrinter::visit_sequence(const AllDepSpec & a,
}
void
-DepSpecPrettyPrinter::visit_sequence(const AnyDepSpec & a,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node)
{
Save<bool> old_outer(&_imp->outer_block, false);
Save<bool> old_needs_parens(&_imp->all_needs_parens, true);
@@ -251,7 +247,7 @@ DepSpecPrettyPrinter::visit_sequence(const AnyDepSpec & a,
{
Save<unsigned> old_indent(&_imp->indent, _imp->indent + 1);
Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
if (_imp->use_newlines)
@@ -260,7 +256,7 @@ DepSpecPrettyPrinter::visit_sequence(const AnyDepSpec & a,
_imp->s << " ";
_imp->s << ")";
- do_annotations(a);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -269,9 +265,7 @@ DepSpecPrettyPrinter::visit_sequence(const AnyDepSpec & a,
}
void
-DepSpecPrettyPrinter::visit_sequence(const ConditionalDepSpec & a,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<bool> old_outer(&_imp->outer_block, false);
Save<bool> old_needs_parens(&_imp->all_needs_parens, false);
@@ -282,11 +276,11 @@ DepSpecPrettyPrinter::visit_sequence(const ConditionalDepSpec & a,
_imp->s << " ";
if (! _imp->check_conditions)
- _imp->s << _imp->formatter.format(a, format::Plain()) << " (";
- else if (a.condition_met())
- _imp->s << _imp->formatter.format(a, format::Enabled()) << " (";
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain()) << " (";
+ else if (node.spec()->condition_met())
+ _imp->s << _imp->formatter.format(*node.spec(), format::Enabled()) << " (";
else
- _imp->s << _imp->formatter.format(a, format::Disabled()) << " (";
+ _imp->s << _imp->formatter.format(*node.spec(), format::Disabled()) << " (";
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -296,7 +290,7 @@ DepSpecPrettyPrinter::visit_sequence(const ConditionalDepSpec & a,
{
Save<unsigned> old_indent(&_imp->indent, _imp->indent + 1);
Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
if (_imp->use_newlines)
@@ -305,7 +299,7 @@ DepSpecPrettyPrinter::visit_sequence(const ConditionalDepSpec & a,
_imp->s << " ";
_imp->s << ")";
- do_annotations(a);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -314,7 +308,7 @@ DepSpecPrettyPrinter::visit_sequence(const ConditionalDepSpec & a,
}
void
-DepSpecPrettyPrinter::visit_leaf(const PackageDepSpec & p)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
@@ -323,19 +317,19 @@ DepSpecPrettyPrinter::visit_leaf(const PackageDepSpec & p)
if (_imp->env && _imp->check_conditions)
{
- if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(p, MatchPackageOptions()) |
+ if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), MatchPackageOptions()) |
filter::InstalledAtRoot(_imp->env->root()))]->empty())
- _imp->s << _imp->formatter.format(p, format::Installed());
- else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(p, MatchPackageOptions()) |
+ _imp->s << _imp->formatter.format(*node.spec(), format::Installed());
+ else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), MatchPackageOptions()) |
filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
- _imp->s << _imp->formatter.format(p, format::Installable());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Installable());
else
- _imp->s << _imp->formatter.format(p, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
}
else
- _imp->s << _imp->formatter.format(p, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(p);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -344,16 +338,16 @@ DepSpecPrettyPrinter::visit_leaf(const PackageDepSpec & p)
}
void
-DepSpecPrettyPrinter::visit_leaf(const PlainTextDepSpec & p)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & node)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(p, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(p);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -362,16 +356,16 @@ DepSpecPrettyPrinter::visit_leaf(const PlainTextDepSpec & p)
}
void
-DepSpecPrettyPrinter::visit_leaf(const NamedSetDepSpec & p)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & node)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(p, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(p);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -380,7 +374,7 @@ DepSpecPrettyPrinter::visit_leaf(const NamedSetDepSpec & p)
}
void
-DepSpecPrettyPrinter::visit_leaf(const LicenseDepSpec & p)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & node)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
@@ -389,15 +383,15 @@ DepSpecPrettyPrinter::visit_leaf(const LicenseDepSpec & p)
if (_imp->env && _imp->id && _imp->check_conditions)
{
- if (_imp->env->accept_license(p.text(), *_imp->id))
- _imp->s << _imp->formatter.format(p, format::Accepted());
+ if (_imp->env->accept_license(node.spec()->text(), *_imp->id))
+ _imp->s << _imp->formatter.format(*node.spec(), format::Accepted());
else
- _imp->s << _imp->formatter.format(p, format::Unaccepted());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Unaccepted());
}
else
- _imp->s << _imp->formatter.format(p, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(p);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -406,16 +400,16 @@ DepSpecPrettyPrinter::visit_leaf(const LicenseDepSpec & p)
}
void
-DepSpecPrettyPrinter::visit_leaf(const FetchableURIDepSpec & p)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(p, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(p);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -424,16 +418,16 @@ DepSpecPrettyPrinter::visit_leaf(const FetchableURIDepSpec & p)
}
void
-DepSpecPrettyPrinter::visit_leaf(const SimpleURIDepSpec & p)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & node)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(p, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(p);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -442,16 +436,16 @@ DepSpecPrettyPrinter::visit_leaf(const SimpleURIDepSpec & p)
}
void
-DepSpecPrettyPrinter::visit_leaf(const BlockDepSpec & b)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node)
{
if (_imp->use_newlines)
_imp->s << _imp->formatter.indent(_imp->indent);
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(b, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(b);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -460,7 +454,7 @@ DepSpecPrettyPrinter::visit_leaf(const BlockDepSpec & b)
}
void
-DepSpecPrettyPrinter::visit_leaf(const URILabelsDepSpec & l)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & node)
{
if (_imp->extra_label_indent)
{
@@ -473,9 +467,9 @@ DepSpecPrettyPrinter::visit_leaf(const URILabelsDepSpec & l)
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(l, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(l);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -490,7 +484,7 @@ DepSpecPrettyPrinter::visit_leaf(const URILabelsDepSpec & l)
}
void
-DepSpecPrettyPrinter::visit_leaf(const PlainTextLabelDepSpec & l)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node)
{
if (_imp->extra_label_indent)
{
@@ -503,9 +497,9 @@ DepSpecPrettyPrinter::visit_leaf(const PlainTextLabelDepSpec & l)
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(l, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(l);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
@@ -520,7 +514,7 @@ DepSpecPrettyPrinter::visit_leaf(const PlainTextLabelDepSpec & l)
}
void
-DepSpecPrettyPrinter::visit_leaf(const DependencyLabelsDepSpec & l)
+DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<DependencyLabelsDepSpec>::Type & node)
{
if (_imp->extra_label_indent)
{
@@ -533,9 +527,9 @@ DepSpecPrettyPrinter::visit_leaf(const DependencyLabelsDepSpec & l)
else if (_imp->need_space)
_imp->s << " ";
- _imp->s << _imp->formatter.format(l, format::Plain());
+ _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- do_annotations(l);
+ do_annotations(*node.spec());
if (_imp->use_newlines)
_imp->s << _imp->formatter.newline();
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.hh b/paludis/repositories/e/dep_spec_pretty_printer.hh
index 949dd9abe..6a60c5670 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.hh
+++ b/paludis/repositories/e/dep_spec_pretty_printer.hh
@@ -22,7 +22,7 @@
#include <iosfwd>
#include <paludis/dep_spec.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -43,7 +43,6 @@ namespace paludis
* \ingroup grperepository
*/
class PALUDIS_VISIBLE DepSpecPrettyPrinter :
- public ConstVisitor<GenericSpecTree>,
private PrivateImplementationPattern<DepSpecPrettyPrinter>
{
friend std::ostream & operator<< (std::ostream &, const DepSpecPrettyPrinter &);
@@ -92,37 +91,19 @@ namespace paludis
/// \name Visit functions
///{
- void visit_sequence(const AllDepSpec &,
- GenericSpecTree::ConstSequenceIterator,
- GenericSpecTree::ConstSequenceIterator);
-
- void visit_sequence(const AnyDepSpec &,
- GenericSpecTree::ConstSequenceIterator,
- GenericSpecTree::ConstSequenceIterator);
-
- void visit_sequence(const ConditionalDepSpec &,
- GenericSpecTree::ConstSequenceIterator,
- GenericSpecTree::ConstSequenceIterator);
-
- void visit_leaf(const PackageDepSpec &);
-
- void visit_leaf(const PlainTextDepSpec &);
-
- void visit_leaf(const BlockDepSpec &);
-
- void visit_leaf(const FetchableURIDepSpec &);
-
- void visit_leaf(const SimpleURIDepSpec &);
-
- void visit_leaf(const LicenseDepSpec &);
-
- void visit_leaf(const URILabelsDepSpec &);
-
- void visit_leaf(const DependencyLabelsDepSpec &);
-
- void visit_leaf(const NamedSetDepSpec &);
-
- void visit_leaf(const PlainTextLabelDepSpec &);
+ void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<DependencyLabelsDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & node);
///}
};
diff --git a/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc b/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
index 479d7e03b..37091ef92 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/stringify_formatter.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
@@ -48,28 +47,28 @@ namespace test_cases
std::tr1::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
DepSpecPrettyPrinter p1(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_depend("foo/bar bar/baz", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
+ parse_depend("foo/bar bar/baz", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p1);
TEST_CHECK_STRINGIFY_EQUAL(p1, "foo/bar bar/baz");
DepSpecPrettyPrinter p2(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_depend("foo/bar moo? ( bar/baz )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
+ parse_depend("foo/bar moo? ( bar/baz )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p2);
TEST_CHECK_STRINGIFY_EQUAL(p2, "foo/bar moo? ( bar/baz )");
DepSpecPrettyPrinter p3(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_depend("|| ( a/b ( c/d e/f ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
+ parse_depend("|| ( a/b ( c/d e/f ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p3);
TEST_CHECK_STRINGIFY_EQUAL(p3, "|| ( a/b ( c/d e/f ) )");
DepSpecPrettyPrinter p4(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_license("( ( ( ) a ) b )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
+ parse_license("( ( ( ) a ) b )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p4);
TEST_CHECK_STRINGIFY_EQUAL(p4, "a b");
DepSpecPrettyPrinter p5(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- parse_fetchable_uri("( a -> b c x? ( d e ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p5);
+ parse_fetchable_uri("( a -> b c x? ( d e ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p5);
TEST_CHECK_STRINGIFY_EQUAL(p5, "a -> b c x? ( d e )");
DepSpecPrettyPrinter p6(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
parse_fetchable_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
- &env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(p6);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->root()->accept(p6);
TEST_CHECK_STRINGIFY_EQUAL(p6, "a manual: b x? ( c mirrors-first: d manual: e ) f");
}
} test_pretty_printer_no_indent;
@@ -87,25 +86,25 @@ namespace test_cases
std::tr1::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
DepSpecPrettyPrinter p1(0, std::tr1::shared_ptr<const PackageID>(), ff, 1, true, false);
- parse_depend("foo/bar bar/baz", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
+ parse_depend("foo/bar bar/baz", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p1);
TEST_CHECK_STRINGIFY_EQUAL(p1, " foo/bar\n bar/baz\n");
DepSpecPrettyPrinter p2(0, std::tr1::shared_ptr<const PackageID>(), ff, 1, true, false);
- parse_depend("foo/bar moo? ( bar/baz )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
+ parse_depend("foo/bar moo? ( bar/baz )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p2);
TEST_CHECK_STRINGIFY_EQUAL(p2, " foo/bar\n moo? (\n bar/baz\n )\n");
DepSpecPrettyPrinter p3(0, std::tr1::shared_ptr<const PackageID>(), ff, 1, true, false);
- parse_depend("|| ( a/b ( c/d e/f ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
+ parse_depend("|| ( a/b ( c/d e/f ) )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p3);
TEST_CHECK_STRINGIFY_EQUAL(p3, " || (\n a/b\n (\n c/d\n"
" e/f\n )\n )\n");
DepSpecPrettyPrinter p4(0, std::tr1::shared_ptr<const PackageID>(), ff, 1, true, false);
- parse_license("( ( ( ) a ) b )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
+ parse_license("( ( ( ) a ) b )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->root()->accept(p4);
TEST_CHECK_STRINGIFY_EQUAL(p4, " a\n b\n");
DepSpecPrettyPrinter p5(0, std::tr1::shared_ptr<const PackageID>(), ff, 1, true, false);
parse_fetchable_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
- &env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(p5);
+ &env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->root()->accept(p5);
TEST_CHECK_STRINGIFY_EQUAL(p5, " a\n manual:\n b\n x? (\n c\n"
" mirrors-first:\n d\n manual:\n e\n )\n f\n");
}
diff --git a/paludis/repositories/e/dependencies_rewriter.cc b/paludis/repositories/e/dependencies_rewriter.cc
index 8565878ad..65c6e823c 100644
--- a/paludis/repositories/e/dependencies_rewriter.cc
+++ b/paludis/repositories/e/dependencies_rewriter.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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
@@ -19,13 +19,14 @@
#include <paludis/repositories/e/dependencies_rewriter.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/save.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/sequence.hh>
#include <paludis/metadata_key.hh>
#include <list>
@@ -107,37 +108,35 @@ DependenciesRewriter::pdepend() const
}
void
-DependenciesRewriter::visit_leaf(const PackageDepSpec & spec)
+DependenciesRewriter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
{
- _add_where_necessary(stringify(spec), spec);
+ _add_where_necessary(stringify(*node.spec()), *node.spec());
}
void
-DependenciesRewriter::visit_leaf(const NamedSetDepSpec & spec)
+DependenciesRewriter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
{
- _add_where_necessary(stringify(spec), spec);
+ _add_where_necessary(stringify(*node.spec()), *node.spec());
}
void
-DependenciesRewriter::visit_leaf(const BlockDepSpec & spec)
+DependenciesRewriter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node)
{
- _add_where_necessary(stringify(spec), spec);
+ _add_where_necessary(stringify(*node.spec()), *node.spec());
}
void
-DependenciesRewriter::visit_leaf(const DependencyLabelsDepSpec & spec)
+DependenciesRewriter::visit(const DependencySpecTree::NodeType<DependencyLabelsDepSpec>::Type & node)
{
- _imp->depend.append(" " + stringify(spec) + get_annotations(spec));
- _imp->rdepend.append(" " + stringify(spec) + get_annotations(spec));
- _imp->pdepend.append(" " + stringify(spec) + get_annotations(spec));
+ _imp->depend.append(" " + stringify(*node.spec()) + get_annotations(*node.spec()));
+ _imp->rdepend.append(" " + stringify(*node.spec()) + get_annotations(*node.spec()));
+ _imp->pdepend.append(" " + stringify(*node.spec()) + get_annotations(*node.spec()));
- _imp->labels.begin()->reset(new ActiveDependencyLabels(**_imp->labels.begin(), spec));
+ _imp->labels.begin()->reset(new ActiveDependencyLabels(**_imp->labels.begin(), *node.spec()));
}
void
-DependenciesRewriter::visit_sequence(const AllDepSpec & spec,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+DependenciesRewriter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
{
_imp->labels.push_front(make_shared_ptr(new ActiveDependencyLabels(**_imp->labels.begin())));
RunOnDestruction restore_labels(std::tr1::bind(std::tr1::mem_fn(&LabelsStack::pop_front), &_imp->labels));
@@ -147,17 +146,15 @@ DependenciesRewriter::visit_sequence(const AllDepSpec & spec,
_imp->rdepend.clear();
_imp->pdepend.clear();
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
- _imp->depend = d + " ( " + _imp->depend + " )" + get_annotations(spec);
- _imp->rdepend = r + " ( " + _imp->rdepend + " )" + get_annotations(spec);
- _imp->pdepend = p + " ( " + _imp->pdepend + " )" + get_annotations(spec);
+ _imp->depend = d + " ( " + _imp->depend + " )" + get_annotations(*node.spec());
+ _imp->rdepend = r + " ( " + _imp->rdepend + " )" + get_annotations(*node.spec());
+ _imp->pdepend = p + " ( " + _imp->pdepend + " )" + get_annotations(*node.spec());
}
void
-DependenciesRewriter::visit_sequence(const AnyDepSpec & spec,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+DependenciesRewriter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
_imp->labels.push_front(make_shared_ptr(new ActiveDependencyLabels(**_imp->labels.begin())));
RunOnDestruction restore_labels(std::tr1::bind(std::tr1::mem_fn(&LabelsStack::pop_front), &_imp->labels));
@@ -167,17 +164,15 @@ DependenciesRewriter::visit_sequence(const AnyDepSpec & spec,
_imp->rdepend.clear();
_imp->pdepend.clear();
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
- _imp->depend = d + " || ( " + _imp->depend + " )" + get_annotations(spec);
- _imp->rdepend = r + " || ( " + _imp->rdepend + " )" + get_annotations(spec);
- _imp->pdepend = p + " || ( " + _imp->pdepend + " )" + get_annotations(spec);
+ _imp->depend = d + " || ( " + _imp->depend + " )" + get_annotations(*node.spec());
+ _imp->rdepend = r + " || ( " + _imp->rdepend + " )" + get_annotations(*node.spec());
+ _imp->pdepend = p + " || ( " + _imp->pdepend + " )" + get_annotations(*node.spec());
}
void
-DependenciesRewriter::visit_sequence(const ConditionalDepSpec & spec,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+DependenciesRewriter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
_imp->labels.push_front(make_shared_ptr(new ActiveDependencyLabels(**_imp->labels.begin())));
RunOnDestruction restore_labels(std::tr1::bind(std::tr1::mem_fn(&LabelsStack::pop_front), &_imp->labels));
@@ -187,11 +182,11 @@ DependenciesRewriter::visit_sequence(const ConditionalDepSpec & spec,
_imp->rdepend.clear();
_imp->pdepend.clear();
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
- _imp->depend = d + " " + stringify(spec) + " ( " + _imp->depend + " )" + get_annotations(spec);
- _imp->rdepend = r + " " + stringify(spec) + " ( " + _imp->rdepend + " )" + get_annotations(spec);
- _imp->pdepend = p + " " + stringify(spec) + " ( " + _imp->pdepend + " )" + get_annotations(spec);
+ _imp->depend = d + " " + stringify(*node.spec()) + " ( " + _imp->depend + " )" + get_annotations(*node.spec());
+ _imp->rdepend = r + " " + stringify(*node.spec()) + " ( " + _imp->rdepend + " )" + get_annotations(*node.spec());
+ _imp->pdepend = p + " " + stringify(*node.spec()) + " ( " + _imp->pdepend + " )" + get_annotations(*node.spec());
}
namespace
diff --git a/paludis/repositories/e/dependencies_rewriter.hh b/paludis/repositories/e/dependencies_rewriter.hh
index 4b91a86ba..9fb20bd3d 100644
--- a/paludis/repositories/e/dependencies_rewriter.hh
+++ b/paludis/repositories/e/dependencies_rewriter.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_DEPENDENCIES_REWRITER_HH 1
#include <paludis/dep_spec.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <paludis/util/private_implementation_pattern.hh>
namespace paludis
@@ -29,7 +29,6 @@ namespace paludis
namespace erepository
{
class DependenciesRewriter :
- public ConstVisitor<DependencySpecTree>,
private PrivateImplementationPattern<DependenciesRewriter>
{
public:
@@ -38,22 +37,13 @@ namespace paludis
void _add_where_necessary(const std::string &, const DepSpec &);
- void visit_leaf(const PackageDepSpec &);
- void visit_leaf(const NamedSetDepSpec &);
- void visit_leaf(const BlockDepSpec &);
- void visit_leaf(const DependencyLabelsDepSpec &);
-
- void visit_sequence(const AnyDepSpec &,
- DependencySpecTree::ConstSequenceIterator,
- DependencySpecTree::ConstSequenceIterator);
-
- void visit_sequence(const AllDepSpec &,
- DependencySpecTree::ConstSequenceIterator,
- DependencySpecTree::ConstSequenceIterator);
-
- void visit_sequence(const ConditionalDepSpec &,
- DependencySpecTree::ConstSequenceIterator,
- DependencySpecTree::ConstSequenceIterator);
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<DependencyLabelsDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
const std::string depend() const;
const std::string rdepend() const;
diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc
index 4500529b2..9fba4dd64 100644
--- a/paludis/repositories/e/e_choices_key.cc
+++ b/paludis/repositories/e/e_choices_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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,18 +31,19 @@
#include <paludis/util/log.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/join.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/member_iterator-impl.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/sequence.hh>
#include <paludis/environment.hh>
#include <paludis/stringify_formatter-impl.hh>
#include <paludis/choice.hh>
#include <paludis/elike_choices.hh>
+#include <list>
#include <algorithm>
#include <set>
#include <map>
@@ -113,8 +114,7 @@ namespace
}
};
- struct MyOptionsFinder :
- ConstVisitor<PlainTextSpecTree>
+ struct MyOptionsFinder
{
typedef std::map<std::string, std::string> Annotations;
typedef std::map<UnprefixedChoiceName, Annotations> Values;
@@ -128,26 +128,26 @@ namespace
current_prefix_stack.push_front(ChoicePrefixName(""));
}
- void visit_leaf(const PlainTextDepSpec & s)
+ void visit(const PlainTextSpecTree::NodeType<PlainTextDepSpec>::Type & node)
{
- if (s.text().empty())
+ if (node.spec()->text().empty())
return;
- Context context("When handling item '" + stringify(s) + "':");
+ Context context("When handling item '" + stringify(*node.spec()) + "':");
Prefixes::iterator p(prefixes.find(*current_prefix_stack.begin()));
if (p == prefixes.end())
p = prefixes.insert(std::make_pair(*current_prefix_stack.begin(), Values())).first;
- UnprefixedChoiceName n(parse_myoption(s.text()).first);
+ UnprefixedChoiceName n(parse_myoption(node.spec()->text()).first);
Values::iterator v(p->second.find(n));
if (v == p->second.end())
v = p->second.insert(std::make_pair(n, Annotations())).first;
- if (s.annotations_key())
+ if (node.spec()->annotations_key())
{
- for (MetadataSectionKey::MetadataConstIterator m(s.annotations_key()->begin_metadata()),
- m_end(s.annotations_key()->end_metadata()) ;
+ for (MetadataSectionKey::MetadataConstIterator m(node.spec()->annotations_key()->begin_metadata()),
+ m_end(node.spec()->annotations_key()->end_metadata()) ;
m != m_end ; ++m)
{
const MetadataValueKey<std::string> * mm(simple_visitor_cast<const MetadataValueKey<std::string> >(**m));
@@ -164,26 +164,22 @@ namespace
}
}
- void visit_leaf(const PlainTextLabelDepSpec & s)
+ void visit(const PlainTextSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node)
{
- *current_prefix_stack.begin() = ChoicePrefixName(s.label());
+ *current_prefix_stack.begin() = ChoicePrefixName(node.spec()->label());
}
- void visit_sequence(const ConditionalDepSpec &,
- PlainTextSpecTree::ConstSequenceIterator cur,
- PlainTextSpecTree::ConstSequenceIterator end)
+ void visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
current_prefix_stack.push_front(*current_prefix_stack.begin());
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
current_prefix_stack.pop_front();
}
- void visit_sequence(const AllDepSpec &,
- PlainTextSpecTree::ConstSequenceIterator cur,
- PlainTextSpecTree::ConstSequenceIterator end)
+ void visit(const PlainTextSpecTree::NodeType<AllDepSpec>::Type & node)
{
current_prefix_stack.push_front(*current_prefix_stack.begin());
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
current_prefix_stack.pop_front();
}
};
@@ -275,7 +271,7 @@ EChoicesKey::value() const
/* yay. myoptions is easy. */
MyOptionsFinder myoptions;
- _imp->id->raw_myoptions_key()->value()->accept(myoptions);
+ _imp->id->raw_myoptions_key()->value()->root()->accept(myoptions);
if (_imp->id->raw_use_expand_key())
for (Set<std::string>::ConstIterator u(_imp->id->raw_use_expand_key()->value()->begin()),
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 6be3b44d9..2deb15564 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -24,7 +24,6 @@
#include <paludis/repositories/e/eapi_phase.hh>
#include <paludis/repositories/e/ebuild.hh>
#include <paludis/repositories/e/e_repository.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/mutex.hh>
@@ -36,6 +35,8 @@
#include <paludis/util/system.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
@@ -157,7 +158,7 @@ EInstalledRepository::perform_hook(const Hook & hook) const
return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
-std::tr1::shared_ptr<SetSpecTree::ConstItem>
+const std::tr1::shared_ptr<const SetSpecTree>
EInstalledRepository::package_set(const SetName & s) const
{
using namespace std::tr1::placeholders;
@@ -167,8 +168,7 @@ EInstalledRepository::package_set(const SetName & s) const
if ("everything" == s.data())
{
- std::tr1::shared_ptr<ConstTreeSequence<SetSpecTree, AllDepSpec> > result(new ConstTreeSequence<SetSpecTree, AllDepSpec>(
- std::tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
+ std::tr1::shared_ptr<SetSpecTree> result(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(SetName("everything"), stringify(name())));
std::tr1::shared_ptr<const CategoryNamePartSet> cats(category_names());
@@ -181,14 +181,14 @@ EInstalledRepository::package_set(const SetName & s) const
{
std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(make_package_dep_spec().package(*e)));
spec->set_tag(tag);
- result->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ result->root()->append(spec);
}
}
return result;
}
else
- return std::tr1::shared_ptr<SetSpecTree::ConstItem>();
+ return make_null_shared_ptr();
}
std::tr1::shared_ptr<const SetNameSet>
diff --git a/paludis/repositories/e/e_installed_repository.hh b/paludis/repositories/e/e_installed_repository.hh
index 13bf67b1a..ab9c2390e 100644
--- a/paludis/repositories/e/e_installed_repository.hh
+++ b/paludis/repositories/e/e_installed_repository.hh
@@ -59,7 +59,7 @@ namespace paludis
public:
/* RepositorySetsInterface */
- virtual std::tr1::shared_ptr<SetSpecTree::ConstItem> package_set(const SetName & id) const
+ virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & id) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 748787507..0940e4e9b 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -34,13 +34,13 @@
#include <paludis/environment.hh>
#include <paludis/action.hh>
#include <paludis/util/fs_entry.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/literal_metadata_key.hh>
#include <iterator>
#include <fstream>
@@ -273,7 +273,7 @@ EInstalledRepositoryID::need_keys_added() const
if ((_imp->dir / vars->dependencies().name()).exists())
{
DependenciesRewriter rewriter;
- parse_depend(file_contents(_imp->dir / vars->dependencies().name()), _imp->environment, shared_from_this(), *eapi())->accept(rewriter);
+ parse_depend(file_contents(_imp->dir / vars->dependencies().name()), _imp->environment, shared_from_this(), *eapi())->root()->accept(rewriter);
_imp->build_dependencies.reset(new EDependenciesKey(_imp->environment, shared_from_this(), vars->dependencies().name() + ".DEPEND",
vars->dependencies().description() + " (build)", rewriter.depend(), _imp->build_dependencies_labels, mkt_dependencies));
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 18055a3e1..6fd9877d0 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -35,12 +35,11 @@
#include <paludis/util/log.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/join.hh>
-#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/member_iterator-impl.hh>
+#include <paludis/util/sequence.hh>
#include <paludis/contents.hh>
#include <paludis/repository.hh>
@@ -88,7 +87,7 @@ namespace paludis
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const DependencySpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const DependencySpecTree> value;
mutable std::tr1::function<void () throw ()> value_used;
const std::tr1::shared_ptr<const DependencyLabelSequence> labels;
@@ -120,7 +119,7 @@ EDependenciesKey::~EDependenciesKey()
{
}
-const std::tr1::shared_ptr<const DependencySpecTree::ConstItem>
+const std::tr1::shared_ptr<const DependencySpecTree>
EDependenciesKey::value() const
{
Lock l(_imp->value_mutex);
@@ -150,7 +149,7 @@ EDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) cons
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -159,7 +158,7 @@ EDependenciesKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f)
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -172,7 +171,7 @@ namespace paludis
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const LicenseSpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const LicenseSpecTree> value;
mutable std::tr1::function<void () throw ()> value_used;
Implementation(const Environment * const e,
@@ -199,7 +198,7 @@ ELicenseKey::~ELicenseKey()
{
}
-const std::tr1::shared_ptr<const LicenseSpecTree::ConstItem>
+const std::tr1::shared_ptr<const LicenseSpecTree>
ELicenseKey::value() const
{
Lock l(_imp->value_mutex);
@@ -223,7 +222,7 @@ ELicenseKey::pretty_print(const LicenseSpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -232,7 +231,7 @@ ELicenseKey::pretty_print_flat(const LicenseSpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -245,7 +244,7 @@ namespace paludis
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const FetchableURISpecTree> value;
mutable std::tr1::shared_ptr<const URILabel> initial_label;
Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
@@ -270,7 +269,7 @@ EFetchableURIKey::~EFetchableURIKey()
{
}
-const std::tr1::shared_ptr<const FetchableURISpecTree::ConstItem>
+const std::tr1::shared_ptr<const FetchableURISpecTree>
EFetchableURIKey::value() const
{
Lock l(_imp->value_mutex);
@@ -288,7 +287,7 @@ EFetchableURIKey::pretty_print(const FetchableURISpecTree::ItemFormatter & f) co
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -297,7 +296,7 @@ EFetchableURIKey::pretty_print_flat(const FetchableURISpecTree::ItemFormatter &
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -310,7 +309,7 @@ EFetchableURIKey::initial_label() const
{
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> f(_imp->env);
if (_imp->id->restrict_key())
- _imp->id->restrict_key()->value()->accept(f);
+ _imp->id->restrict_key()->value()->root()->accept(f);
for (DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec>::ConstIterator i(f.begin()), i_end(f.end()) ;
i != i_end ; ++i)
{
@@ -346,7 +345,7 @@ namespace paludis
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const SimpleURISpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const SimpleURISpecTree> value;
Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
env(e),
@@ -370,7 +369,7 @@ ESimpleURIKey::~ESimpleURIKey()
{
}
-const std::tr1::shared_ptr<const SimpleURISpecTree::ConstItem>
+const std::tr1::shared_ptr<const SimpleURISpecTree>
ESimpleURIKey::value() const
{
Lock l(_imp->value_mutex);
@@ -388,7 +387,7 @@ ESimpleURIKey::pretty_print(const SimpleURISpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -397,7 +396,7 @@ ESimpleURIKey::pretty_print_flat(const SimpleURISpecTree::ItemFormatter & f) con
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -410,7 +409,7 @@ namespace paludis
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const PlainTextSpecTree> value;
Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
env(e),
@@ -434,7 +433,7 @@ EPlainTextSpecKey::~EPlainTextSpecKey()
{
}
-const std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem>
+const std::tr1::shared_ptr<const PlainTextSpecTree>
EPlainTextSpecKey::value() const
{
Lock l(_imp->value_mutex);
@@ -452,7 +451,7 @@ EPlainTextSpecKey::pretty_print(const PlainTextSpecTree::ItemFormatter & f) cons
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -461,7 +460,7 @@ EPlainTextSpecKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f)
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -474,7 +473,7 @@ namespace paludis
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const PlainTextSpecTree> value;
Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
env(e),
@@ -498,7 +497,7 @@ EMyOptionsKey::~EMyOptionsKey()
{
}
-const std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem>
+const std::tr1::shared_ptr<const PlainTextSpecTree>
EMyOptionsKey::value() const
{
Lock l(_imp->value_mutex);
@@ -516,7 +515,7 @@ EMyOptionsKey::pretty_print(const PlainTextSpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -525,7 +524,7 @@ EMyOptionsKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f) con
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -538,7 +537,7 @@ namespace paludis
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const ProvideSpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const ProvideSpecTree> value;
Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
env(e),
@@ -561,7 +560,7 @@ EProvideKey::~EProvideKey()
{
}
-const std::tr1::shared_ptr<const ProvideSpecTree::ConstItem>
+const std::tr1::shared_ptr<const ProvideSpecTree>
EProvideKey::value() const
{
Lock l(_imp->value_mutex);
@@ -579,7 +578,7 @@ EProvideKey::pretty_print(const ProvideSpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
@@ -588,7 +587,7 @@ EProvideKey::pretty_print_flat(const ProvideSpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->accept(p);
+ value()->root()->accept(p);
return stringify(p);
}
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 9d30cd416..cd7c6299f 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -66,7 +66,7 @@ namespace paludis
const MetadataKeyType);
~EDependenciesKey();
- virtual const std::tr1::shared_ptr<const DependencySpecTree::ConstItem> value() const
+ virtual const std::tr1::shared_ptr<const DependencySpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
@@ -92,7 +92,7 @@ namespace paludis
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
~EFetchableURIKey();
- virtual const std::tr1::shared_ptr<const FetchableURISpecTree::ConstItem> value() const
+ virtual const std::tr1::shared_ptr<const FetchableURISpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::string pretty_print(const FetchableURISpecTree::ItemFormatter &) const
@@ -118,7 +118,7 @@ namespace paludis
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
~ESimpleURIKey();
- virtual const std::tr1::shared_ptr<const SimpleURISpecTree::ConstItem> value() const
+ virtual const std::tr1::shared_ptr<const SimpleURISpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::string pretty_print(const SimpleURISpecTree::ItemFormatter &) const
@@ -141,7 +141,7 @@ namespace paludis
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
~EPlainTextSpecKey();
- virtual const std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem> value() const
+ virtual const std::tr1::shared_ptr<const PlainTextSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::string pretty_print(const PlainTextSpecTree::ItemFormatter &) const
@@ -164,7 +164,7 @@ namespace paludis
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
~EMyOptionsKey();
- virtual const std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem> value() const
+ virtual const std::tr1::shared_ptr<const PlainTextSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::string pretty_print(const PlainTextSpecTree::ItemFormatter &) const
@@ -187,7 +187,7 @@ namespace paludis
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
~EProvideKey();
- virtual const std::tr1::shared_ptr<const ProvideSpecTree::ConstItem> value() const
+ virtual const std::tr1::shared_ptr<const ProvideSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::string pretty_print(const ProvideSpecTree::ItemFormatter &) const
@@ -211,7 +211,7 @@ namespace paludis
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
~ELicenseKey();
- virtual const std::tr1::shared_ptr<const LicenseSpecTree::ConstItem> value() const
+ virtual const std::tr1::shared_ptr<const LicenseSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::string pretty_print(const LicenseSpecTree::ItemFormatter &) const
diff --git a/paludis/repositories/e/e_mask.cc b/paludis/repositories/e/e_mask.cc
index cebad426f..5adedd993 100644
--- a/paludis/repositories/e/e_mask.cc
+++ b/paludis/repositories/e/e_mask.cc
@@ -18,7 +18,6 @@
*/
#include <paludis/repositories/e/e_mask.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
using namespace paludis;
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 93db316da..7941b6488 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2006 Danny van Dyk
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -72,7 +72,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
#include <paludis/util/system.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/rmd160.hh>
@@ -81,6 +80,8 @@
#include <paludis/util/hashes.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/destringify.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/wrapped_output_iterator.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
@@ -690,7 +691,7 @@ ERepository::need_mirrors() const
}
}
-std::tr1::shared_ptr<SetSpecTree::ConstItem>
+const std::tr1::shared_ptr<const SetSpecTree>
ERepository::package_set(const SetName & s) const
{
if (s.data() == "system")
@@ -1188,7 +1189,7 @@ ERepository::make_manifest(const QualifiedPackageName & qpn)
if (! id->fetches_key())
continue;
AAVisitor aa;
- id->fetches_key()->value()->accept(aa);
+ id->fetches_key()->value()->root()->accept(aa);
for (AAVisitor::ConstIterator d(aa.begin()) ;
d != aa.end() ; ++d)
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index a301f1b51..2308664c6 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -127,7 +127,7 @@ namespace paludis
/* RepositorySetsInterface */
- virtual std::tr1::shared_ptr<SetSpecTree::ConstItem> package_set(const SetName & id) const;
+ virtual const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & id) const;
virtual std::tr1::shared_ptr<const SetNameSet> sets_list() const;
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 150b50c6f..8766699ed 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -27,7 +27,6 @@
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/system.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -490,11 +489,11 @@ namespace test_cases
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pd(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id1->build_dependencies_key());
- id1->build_dependencies_key()->value()->accept(pd);
+ id1->build_dependencies_key()->value()->root()->accept(pd);
TEST_CHECK_STRINGIFY_EQUAL(pd, "foo/bar");
erepository::DepSpecPrettyPrinter pr(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id1->run_dependencies_key());
- id1->run_dependencies_key()->value()->accept(pr);
+ id1->run_dependencies_key()->value()->root()->accept(pr);
TEST_CHECK_STRINGIFY_EQUAL(pr, "foo/bar");
const std::tr1::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches(
@@ -506,11 +505,11 @@ namespace test_cases
TEST_CHECK_EQUAL(id2->short_description_key()->value(), "dquote \" squote ' backslash \\ dollar $");
erepository::DepSpecPrettyPrinter pd2(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id2->build_dependencies_key());
- id2->build_dependencies_key()->value()->accept(pd2);
+ id2->build_dependencies_key()->value()->root()->accept(pd2);
TEST_CHECK_STRINGIFY_EQUAL(pd2, "foo/bar bar/baz");
erepository::DepSpecPrettyPrinter pr2(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id2->run_dependencies_key());
- id2->run_dependencies_key()->value()->accept(pr2);
+ id2->run_dependencies_key()->value()->root()->accept(pr2);
TEST_CHECK_STRINGIFY_EQUAL(pr2, "foo/bar");
const std::tr1::shared_ptr<const PackageID> id3(*env[selection::RequireExactlyOne(generator::Matches(
@@ -2295,17 +2294,17 @@ namespace test_cases
erepository::DepSpecPrettyPrinter pd(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id->build_dependencies_key());
- id->build_dependencies_key()->value()->accept(pd);
+ id->build_dependencies_key()->value()->root()->accept(pd);
TEST_CHECK_STRINGIFY_EQUAL(pd, "( cat/pkg1 build: cat/pkg2 build,run: cat/pkg3 suggested: cat/pkg4 post: )");
erepository::DepSpecPrettyPrinter pr(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id->run_dependencies_key());
- id->run_dependencies_key()->value()->accept(pr);
+ id->run_dependencies_key()->value()->root()->accept(pr);
TEST_CHECK_STRINGIFY_EQUAL(pr, "( cat/pkg1 build: build,run: cat/pkg3 suggested: cat/pkg4 post: )");
erepository::DepSpecPrettyPrinter pp(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id->post_dependencies_key());
- id->post_dependencies_key()->value()->accept(pp);
+ id->post_dependencies_key()->value()->root()->accept(pp);
TEST_CHECK_STRINGIFY_EQUAL(pp, "( build: build,run: suggested: post: cat/pkg5 )");
}
} test_e_repository_dependencies_rewriter;
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 3644bea8d..5806a3c9b 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -147,7 +147,7 @@ namespace paludis
///\name System package set
///\{
- std::tr1::shared_ptr<ConstTreeSequence<SetSpecTree, AllDepSpec> > system_packages;
+ std::tr1::shared_ptr<SetSpecTree> system_packages;
std::tr1::shared_ptr<GeneralSetDepTag> system_tag;
///\}
@@ -188,8 +188,7 @@ namespace paludis
package_mask_file(p),
env(e),
repository(p),
- system_packages(new ConstTreeSequence<SetSpecTree, AllDepSpec>(
- std::tr1::shared_ptr<AllDepSpec>(new AllDepSpec))),
+ system_packages(new SetSpecTree(make_shared_ptr(new AllDepSpec))),
system_tag(new GeneralSetDepTag(SetName("system"), stringify(name))),
use_expand(new Set<std::string>),
use_expand_hidden(new Set<std::string>)
@@ -484,7 +483,7 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
std::tr1::shared_ptr<const PackageID>())));
spec->set_tag(system_tag);
- system_packages->add(std::tr1::shared_ptr<SetSpecTree::ConstItem>(new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ system_packages->root()->append(spec);
}
}
catch (const InternalError &)
@@ -866,7 +865,7 @@ ERepositoryProfile::environment_variable(const std::string & s) const
return i->second;
}
-std::tr1::shared_ptr<SetSpecTree::ConstItem>
+const std::tr1::shared_ptr<const SetSpecTree>
ERepositoryProfile::system_packages() const
{
return _imp->system_packages;
diff --git a/paludis/repositories/e/e_repository_profile.hh b/paludis/repositories/e/e_repository_profile.hh
index 3dcded6bd..c30117fe0 100644
--- a/paludis/repositories/e/e_repository_profile.hh
+++ b/paludis/repositories/e/e_repository_profile.hh
@@ -21,17 +21,18 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_REPOSITORY_PROFILE_HH 1
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/dep_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/version_spec-fwd.hh>
#include <paludis/mask-fwd.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/choice-fwd.hh>
+#include <paludis/spec_tree-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/tribool.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
#include <string>
/** \file
@@ -129,7 +130,7 @@ namespace paludis
///\name System package set
///\{
- std::tr1::shared_ptr<SetSpecTree::ConstItem> system_packages() const;
+ const std::tr1::shared_ptr<const SetSpecTree> system_packages() const;
///\}
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index 3542f59f9..d94cca68f 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2006 Danny van Dyk
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -94,7 +94,7 @@ ERepositorySets::~ERepositorySets()
{
}
-std::tr1::shared_ptr<SetSpecTree::ConstItem>
+const std::tr1::shared_ptr<const SetSpecTree>
ERepositorySets::package_set(const SetName & ss) const
{
using namespace std::tr1::placeholders;
@@ -127,7 +127,7 @@ ERepositorySets::package_set(const SetName & ss) const
return f.contents();
}
else
- return std::tr1::shared_ptr<SetSpecTree::ConstItem>();
+ return make_null_shared_ptr();
}
std::tr1::shared_ptr<const SetNameSet>
@@ -249,12 +249,12 @@ namespace
}
}
-std::tr1::shared_ptr<SetSpecTree::ConstItem>
+const std::tr1::shared_ptr<const SetSpecTree>
ERepositorySets::security_set(bool insecurity) const
{
Context context("When building security or insecurity package set:");
- std::tr1::shared_ptr<ConstTreeSequence<SetSpecTree, AllDepSpec> > security_packages(
- new ConstTreeSequence<SetSpecTree, AllDepSpec>(std::tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
+
+ std::tr1::shared_ptr<SetSpecTree> security_packages(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
if (!_imp->params.securitydir().is_directory_or_symlink_to_directory())
return security_packages;
@@ -305,8 +305,7 @@ ERepositorySets::security_set(bool insecurity) const
value_for<n::version_spec>((*c)->version())))
.in_repository((*c)->repository()->name())));
spec->set_tag(glsa_tags.find(glsa->id())->second);
- security_packages->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
- new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ security_packages->root()->append(spec);
}
else
{
@@ -341,8 +340,7 @@ ERepositorySets::security_set(bool insecurity) const
value_for<n::version_spec>((*r)->version())))
.in_repository((*r)->repository()->name())));
spec->set_tag(glsa_tags.find(glsa->id())->second);
- security_packages->add(std::tr1::shared_ptr<SetSpecTree::ConstItem>(
- new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ security_packages->root()->append(spec);
ok = true;
break;
}
diff --git a/paludis/repositories/e/e_repository_sets.hh b/paludis/repositories/e/e_repository_sets.hh
index 2cafa6836..ba1bb11dc 100644
--- a/paludis/repositories/e/e_repository_sets.hh
+++ b/paludis/repositories/e/e_repository_sets.hh
@@ -58,12 +58,12 @@ namespace paludis
/**
* Fetch a package set other than system.
*/
- std::tr1::shared_ptr<SetSpecTree::ConstItem> package_set(const SetName & s) const;
+ const std::tr1::shared_ptr<const SetSpecTree> package_set(const SetName & s) const;
/**
* Fetch the security or insecurity set.
*/
- std::tr1::shared_ptr<SetSpecTree::ConstItem> security_set(bool insecure) const;
+ const std::tr1::shared_ptr<const SetSpecTree> security_set(bool insecure) const;
/**
* Give a list of all the sets in this repo.
diff --git a/paludis/repositories/e/e_repository_sets_TEST.cc b/paludis/repositories/e/e_repository_sets_TEST.cc
index 0924b921b..a5cc45bc5 100644
--- a/paludis/repositories/e/e_repository_sets_TEST.cc
+++ b/paludis/repositories/e/e_repository_sets_TEST.cc
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/system.hh>
#include <paludis/util/map.hh>
@@ -92,10 +91,10 @@ namespace test_cases
installed->add_version("cat-two", "bar", "1.5");
env.package_database()->add_repository(0, installed);
- std::tr1::shared_ptr<SetSpecTree::ConstItem> set1(repo->sets_interface()->package_set(SetName("set1")));
+ std::tr1::shared_ptr<const SetSpecTree> set1(repo->sets_interface()->package_set(SetName("set1")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- set1->accept(pretty);
+ set1->root()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "cat-one/foo >=cat-two/bar-2");
}
} test_e_repository_sets_maintainer_defined_sets_list;
@@ -122,10 +121,10 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(1, repo);
- std::tr1::shared_ptr<SetSpecTree::ConstItem> insecurity(repo->sets_interface()->package_set(SetName("insecurity")));
+ std::tr1::shared_ptr<const SetSpecTree> insecurity(repo->sets_interface()->package_set(SetName("insecurity")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- insecurity->accept(pretty);
+ insecurity->root()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "=cat-four/xyzzy-2.0.1::test-repo-1 =cat-four/xyzzy-2.0.2::test-repo-1 =cat-one/foo-1::test-repo-1 =cat-two/bar-1.5::test-repo-1 "
"=cat-two/bar-1.5.1::test-repo-1 =cat-three/baz-1.0::test-repo-1 "
"=cat-three/baz-1.1-r2::test-repo-1 =cat-three/baz-1.2::test-repo-1");
@@ -162,10 +161,10 @@ namespace test_cases
installed->add_version("cat-four", "xyzzy", "2.0.1")->set_slot(SlotName("2"));
env.package_database()->add_repository(0, installed);
- std::tr1::shared_ptr<const SetSpecTree::ConstItem> security(repo->sets_interface()->package_set(SetName("security")));
+ std::tr1::shared_ptr<const SetSpecTree> security(repo->sets_interface()->package_set(SetName("security")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- security->accept(pretty);
+ security->root()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "=cat-four/xyzzy-2.0.3::test-repo-1 =cat-two/bar-2.0::test-repo-1 =cat-three/baz-1.3::test-repo-1");
}
} test_e_repository_sets_security_set;
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index ba5294681..7b5a38677 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -38,8 +38,6 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/visitor_cast.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/util/cookie.hh>
#include <paludis/util/output_deviator.hh>
@@ -447,7 +445,7 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.dependencies().name().empty())
{
DependenciesRewriter rewriter;
- parse_depend(get(keys, m.dependencies().name()), params.environment(), id, *id->eapi())->accept(rewriter);
+ parse_depend(get(keys, m.dependencies().name()), params.environment(), id, *id->eapi())->root()->accept(rewriter);
id->load_build_depend(m.dependencies().name() + ".DEPEND", m.dependencies().description() + " (build)", rewriter.depend());
id->load_run_depend(m.dependencies().name() + ".RDEPEND", m.dependencies().description() + " (run)", rewriter.rdepend());
id->load_post_depend(m.dependencies().name() + ".PDEPEND", m.dependencies().description() + " (post)", rewriter.pdepend());
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 0740e8bde..819884b2e 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -51,7 +51,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/is_file_with_extension.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/instantiation_policy-impl.hh>
@@ -163,8 +162,7 @@ EbuildEntries::make_id(const QualifiedPackageName & q, const FSEntry & f) const
namespace
{
class AFinder :
- private InstantiationPolicy<AFinder, instantiation_method::NonCopyableTag>,
- public ConstVisitor<FetchableURISpecTree>
+ private InstantiationPolicy<AFinder, instantiation_method::NonCopyableTag>
{
private:
std::list<std::pair<const FetchableURIDepSpec *, const URILabelsDepSpec *> > _specs;
@@ -181,33 +179,29 @@ namespace
_labels.push_back(0);
}
- void visit_leaf(const FetchableURIDepSpec & a)
+ void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
- _specs.push_back(std::make_pair(&a, *_labels.begin()));
+ _specs.push_back(std::make_pair(node.spec().get(), *_labels.begin()));
}
- void visit_leaf(const URILabelsDepSpec & l)
+ void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node)
{
- *_labels.begin() = &l;
+ *_labels.begin() = node.spec().get();
}
- void visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator e)
+ void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node)
{
_labels.push_front(*_labels.begin());
- std::for_each(cur, e, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
_labels.pop_front();
}
- void visit_sequence(const ConditionalDepSpec & u,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator e)
+ void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (u.condition_met())
+ if (node.spec()->condition_met())
{
_labels.push_front(*_labels.begin());
- std::for_each(cur, e, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
_labels.pop_front();
}
}
@@ -365,7 +359,7 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
{
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment());
if (id->restrict_key())
- id->restrict_key()->value()->accept(restricts);
+ id->restrict_key()->value()->root()->accept(restricts);
for (DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec>::ConstIterator i(restricts.begin()), i_end(restricts.end()) ;
i != i_end ; ++i)
@@ -389,7 +383,7 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
/* make A */
AFinder f(_imp->params.environment(), id);
if (id->fetches_key())
- id->fetches_key()->value()->accept(f);
+ id->fetches_key()->value()->root()->accept(f);
for (AFinder::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
{
@@ -408,7 +402,7 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
{
AAVisitor g;
if (id->fetches_key())
- id->fetches_key()->value()->accept(g);
+ id->fetches_key()->value()->root()->accept(g);
std::set<std::string> already_in_all_archives;
for (AAVisitor::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
@@ -443,13 +437,13 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
FetchVisitor f(_imp->params.environment(), id, *id->eapi(),
_imp->e_repository->params().distdir(), o.fetch_unneeded(), fetch_userpriv_ok, mirrors_name,
id->fetches_key()->initial_label(), o.safe_resume(), o.maybe_output_deviant());
- id->fetches_key()->value()->accept(f);
+ id->fetches_key()->value()->root()->accept(f);
CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir(),
o.fetch_unneeded(), fetch_restrict,
((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"),
_imp->e_repository->params().use_manifest(),
o.maybe_output_deviant(), o.exclude_unmirrorable());
- id->fetches_key()->value()->accept(c);
+ id->fetches_key()->value()->root()->accept(c);
if (c.need_nofetch())
{
@@ -520,7 +514,7 @@ EbuildEntries::pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> & i
PretendFetchVisitor f(_imp->params.environment(), id, *id->eapi(),
_imp->e_repository->params().distdir(), a.options.fetch_unneeded(),
id->fetches_key()->initial_label(), a);
- id->fetches_key()->value()->accept(f);
+ id->fetches_key()->value()->root()->accept(f);
}
}
@@ -536,7 +530,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
{
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment());
if (id->restrict_key())
- id->restrict_key()->value()->accept(restricts);
+ id->restrict_key()->value()->root()->accept(restricts);
userpriv_restrict =
indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
@@ -562,7 +556,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
/* make A */
AFinder f(_imp->params.environment(), id);
if (id->fetches_key())
- id->fetches_key()->value()->accept(f);
+ id->fetches_key()->value()->root()->accept(f);
for (AFinder::ConstIterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
{
@@ -581,7 +575,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
{
AAVisitor g;
if (id->fetches_key())
- id->fetches_key()->value()->accept(g);
+ id->fetches_key()->value()->root()->accept(g);
std::set<std::string> already_in_all_archives;
for (AAVisitor::ConstIterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
@@ -757,7 +751,7 @@ EbuildEntries::info(const std::tr1::shared_ptr<const ERepositoryID> & id,
{
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment());
if (id->restrict_key())
- id->restrict_key()->value()->accept(restricts);
+ id->restrict_key()->value()->root()->accept(restricts);
userpriv_restrict =
indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
@@ -839,7 +833,7 @@ EbuildEntries::get_environment_variable(const std::tr1::shared_ptr<const EReposi
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment());
if (id->restrict_key())
- id->restrict_key()->value()->accept(restricts);
+ id->restrict_key()->value()->root()->accept(restricts);
userpriv_restrict =
indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
@@ -964,7 +958,7 @@ EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
{
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment());
if (id->restrict_key())
- id->restrict_key()->value()->accept(restricts);
+ id->restrict_key()->value()->root()->accept(restricts);
userpriv_restrict =
indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
@@ -984,7 +978,7 @@ EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (id->raw_myoptions_key())
{
MyOptionsRequirementsVerifier verifier(id);
- id->raw_myoptions_key()->value()->accept(verifier);
+ id->raw_myoptions_key()->value()->root()->accept(verifier);
if (verifier.unmet_requirements() && ! verifier.unmet_requirements()->empty())
{
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 883b0d308..4e581bae0 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2008 David Leverton
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -22,9 +22,9 @@
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/join.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/util/destringify.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/dependencies_rewriter.hh>
@@ -163,7 +163,7 @@ namespace
if (-1 != m.dependencies().flat_list_index() && ! m.dependencies().name().empty())
{
DependenciesRewriter rewriter;
- parse_depend(lines.at(m.dependencies().flat_list_index()), _imp->env, id, *id->eapi())->accept(rewriter);
+ parse_depend(lines.at(m.dependencies().flat_list_index()), _imp->env, id, *id->eapi())->root()->accept(rewriter);
id->load_build_depend(m.dependencies().name() + ".DEPEND", m.dependencies().description() + " (build)", rewriter.depend());
id->load_run_depend(m.dependencies().name() + ".RDEPEND", m.dependencies().description() + " (run)", rewriter.rdepend());
id->load_post_depend(m.dependencies().name() + ".PDEPEND", m.dependencies().description() + " (post)", rewriter.pdepend());
@@ -477,7 +477,7 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.dependencies().name().empty())
{
DependenciesRewriter rewriter;
- parse_depend(keys[m.dependencies().name()], _imp->env, id, *id->eapi())->accept(rewriter);
+ parse_depend(keys[m.dependencies().name()], _imp->env, id, *id->eapi())->root()->accept(rewriter);
id->load_build_depend(m.dependencies().name() + ".DEPEND", m.dependencies().description() + " (build)", rewriter.depend());
id->load_run_depend(m.dependencies().name() + ".RDEPEND", m.dependencies().description() + " (run)", rewriter.rdepend());
id->load_post_depend(m.dependencies().name() + ".PDEPEND", m.dependencies().description() + " (post)", rewriter.pdepend());
@@ -638,7 +638,7 @@ namespace
{
StringifyFormatter ff;
DepSpecPrettyPrinter p(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- d->accept(p);
+ d->root()->accept(p);
return stringify(p);
}
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
index f11954f49..aa60697c3 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2008 David Leverton
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -30,7 +30,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index b61d954fc..bc189c33e 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -45,11 +45,11 @@
#include <paludis/util/log.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/save.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/tribool.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <set>
#include <iterator>
@@ -326,15 +326,11 @@ EbuildID::need_keys_added() const
namespace
{
- struct LicenceChecker :
- ConstVisitor<LicenseSpecTree>,
- ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>
+ struct LicenceChecker
{
- using ConstVisitor<LicenseSpecTree>::VisitConstSequence<LicenceChecker, AllDepSpec>::visit_sequence;
-
bool ok;
const Environment * const env;
- bool (Environment::* const func) (const std::string &, const PackageID &) const;
+ bool (Environment::* const func) (const std::string &, const PackageID &) const;
const PackageID * const id;
LicenceChecker(const Environment * const e,
@@ -347,20 +343,24 @@ namespace
{
}
- void visit_sequence(const AnyDepSpec &,
- LicenseSpecTree::ConstSequenceIterator begin,
- LicenseSpecTree::ConstSequenceIterator end)
+ void visit(const LicenseSpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const LicenseSpecTree::NodeType<AnyDepSpec>::Type & node)
{
bool local_ok(false);
- if (begin == end)
+ if (node.begin() == node.end())
local_ok = true;
else
{
- for ( ; begin != end ; ++begin)
+ for (LicenseSpecTree::NodeType<AnyDepSpec>::Type::ConstIterator c(node.begin()), c_end(node.end()) ;
+ c != c_end ; ++c)
{
Save<bool> save_ok(&ok, true);
- begin->accept(*this);
+ (*c)->accept(*this);
local_ok |= ok;
}
}
@@ -368,17 +368,15 @@ namespace
ok &= local_ok;
}
- void visit_sequence(const ConditionalDepSpec & spec,
- LicenseSpecTree::ConstSequenceIterator begin,
- LicenseSpecTree::ConstSequenceIterator end)
+ void visit(const LicenseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (spec.condition_met())
- std::for_each(begin, end, accept_visitor(*this));
+ if (node.spec()->condition_met())
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
- void visit_leaf(const LicenseDepSpec & spec)
+ void visit(const LicenseSpecTree::NodeType<LicenseDepSpec>::Type & node)
{
- if (! (env->*func)(spec.text(), *id))
+ if (! (env->*func)(node.spec()->text(), *id))
ok = false;
}
};
@@ -411,7 +409,7 @@ EbuildID::need_masks_added() const
if (license_key())
{
LicenceChecker c(_imp->environment, &Environment::accept_license, this);
- license_key()->value()->accept(c);
+ license_key()->value()->root()->accept(c);
if (! c.ok)
add_mask(make_shared_ptr(new EUnacceptedMask('L',
DistributionData::get_instance()->distribution_from_string(
@@ -1194,32 +1192,26 @@ EbuildID::make_choice_value(
namespace
{
- struct UnconditionalRestrictFinder :
- ConstVisitor<PlainTextSpecTree>
+ struct UnconditionalRestrictFinder
{
std::set<std::string> s;
- void visit_leaf(const PlainTextDepSpec & p)
+ void visit(const PlainTextSpecTree::NodeType<PlainTextDepSpec>::Type & node)
{
- s.insert(p.text());
+ s.insert(node.spec()->text());
}
- void visit_leaf(const PlainTextLabelDepSpec & p)
+ void visit(const PlainTextSpecTree::NodeType<PlainTextLabelDepSpec>::Type &)
{
- s.insert(p.text());
}
- void visit_sequence(const ConditionalDepSpec &,
- PlainTextSpecTree::ConstSequenceIterator,
- PlainTextSpecTree::ConstSequenceIterator)
+ void visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type &)
{
}
- void visit_sequence(const AllDepSpec &,
- PlainTextSpecTree::ConstSequenceIterator cur,
- PlainTextSpecTree::ConstSequenceIterator end)
+ void visit(const PlainTextSpecTree::NodeType<AllDepSpec>::Type & node)
{
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
};
}
@@ -1241,7 +1233,7 @@ EbuildID::add_build_options(const std::tr1::shared_ptr<Choices> & choices) const
if (restrict_key())
{
UnconditionalRestrictFinder f;
- restrict_key()->value()->accept(f);
+ restrict_key()->value()->root()->accept(f);
may_be_unrestricted_test = f.s.end() == f.s.find("test");
may_be_unrestricted_strip = f.s.end() == f.s.find("strip");
}
diff --git a/paludis/repositories/e/exndbam_id.cc b/paludis/repositories/e/exndbam_id.cc
index 41c88ebde..270a4a049 100644
--- a/paludis/repositories/e/exndbam_id.cc
+++ b/paludis/repositories/e/exndbam_id.cc
@@ -21,8 +21,8 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/sequence.hh>
#include <paludis/contents.hh>
#include <paludis/ndbam.hh>
#include <tr1/functional>
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index 9426a7b3d..5c818aff8 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -28,7 +28,6 @@
#include <paludis/action.hh>
#include <paludis/repository.hh>
#include <paludis/about.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/system.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
@@ -108,32 +107,28 @@ FetchVisitor::~FetchVisitor()
}
void
-FetchVisitor::visit_sequence(const ConditionalDepSpec & u,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator end)
+FetchVisitor::visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if ((_imp->fetch_unneeded) || (u.condition_met()))
+ if ((_imp->fetch_unneeded) || (node.spec()->condition_met()))
{
_imp->labels.push_front(* _imp->labels.begin());
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
_imp->labels.pop_front();
}
}
void
-FetchVisitor::visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator end)
+FetchVisitor::visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node)
{
_imp->labels.push_front(* _imp->labels.begin());
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
_imp->labels.pop_front();
}
void
-FetchVisitor::visit_leaf(const URILabelsDepSpec & l)
+FetchVisitor::visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node)
{
- for (URILabelsDepSpec::ConstIterator i(l.begin()), i_end(l.end()) ;
+ for (URILabelsDepSpec::ConstIterator i(node.spec()->begin()), i_end(node.spec()->end()) ;
i != i_end ; ++i)
*_imp->labels.begin() = i->get();
}
@@ -149,22 +144,22 @@ namespace
}
void
-FetchVisitor::visit_leaf(const FetchableURIDepSpec & u)
+FetchVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
- Context context("When visiting URI dep spec '" + stringify(u.text()) + "':");
+ Context context("When visiting URI dep spec '" + stringify(node.spec()->text()) + "':");
if (! *_imp->labels.begin())
throw FetchActionError("No fetch action label available");
SourceURIFinder source_uri_finder(_imp->env, _imp->id->repository().get(),
- u.original_url(), u.filename(), _imp->mirrors_name);
+ node.spec()->original_url(), node.spec()->filename(), _imp->mirrors_name);
(*_imp->labels.begin())->accept(source_uri_finder);
for (SourceURIFinder::ConstIterator i(source_uri_finder.begin()), i_end(source_uri_finder.end()) ;
i != i_end ; ++i)
{
Context local_context("When fetching URI '" + stringify(i->first) + "' to '" + stringify(i->second) + ":");
- FSEntry destination(_imp->distdir / u.filename());
+ FSEntry destination(_imp->distdir / node.spec()->filename());
if (destination.exists())
{
diff --git a/paludis/repositories/e/fetch_visitor.hh b/paludis/repositories/e/fetch_visitor.hh
index f3917be3d..84013b2e3 100644
--- a/paludis/repositories/e/fetch_visitor.hh
+++ b/paludis/repositories/e/fetch_visitor.hh
@@ -23,13 +23,13 @@
#include <paludis/repositories/e/eapi-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/visitor-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/output_deviator-fwd.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
+#include <paludis/spec_tree.hh>
#include <tr1/memory>
namespace paludis
@@ -37,8 +37,7 @@ namespace paludis
namespace erepository
{
class PALUDIS_VISIBLE FetchVisitor :
- private PrivateImplementationPattern<FetchVisitor>,
- public ConstVisitor<FetchableURISpecTree>
+ private PrivateImplementationPattern<FetchVisitor>
{
public:
FetchVisitor(
@@ -55,17 +54,10 @@ namespace paludis
~FetchVisitor();
- void visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator,
- FetchableURISpecTree::ConstSequenceIterator);
-
- void visit_sequence(const ConditionalDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator,
- FetchableURISpecTree::ConstSequenceIterator);
-
- void visit_leaf(const URILabelsDepSpec &);
-
- void visit_leaf(const FetchableURIDepSpec &);
+ void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node);
};
}
}
diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc
index c1156accf..b8868cf2d 100644
--- a/paludis/repositories/e/fetch_visitor_TEST.cc
+++ b/paludis/repositories/e/fetch_visitor_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -25,7 +25,6 @@
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/package_database.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
@@ -64,7 +63,7 @@ namespace test_cases
*eapi, FSEntry("fetch_visitor_TEST_dir/out"),
false, false, "test", make_shared_ptr(new URIListedThenMirrorsLabel("listed-then-mirrors")), false,
make_null_shared_ptr());
- parse_fetchable_uri("file:///" + stringify(FSEntry("fetch_visitor_TEST_dir/in/input1").realpath()), &env, id, *eapi)->accept(v);
+ parse_fetchable_uri("file:///" + stringify(FSEntry("fetch_visitor_TEST_dir/in/input1").realpath()), &env, id, *eapi)->root()->accept(v);
TEST_CHECK(FSEntry("fetch_visitor_TEST_dir/out/input1").is_regular_file());
std::ifstream f(stringify(FSEntry("fetch_visitor_TEST_dir/out/input1")).c_str());
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
index ea7557c83..dcff49624 100644
--- a/paludis/repositories/e/fix_locked_dependencies.cc
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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
@@ -19,7 +19,6 @@
#include <paludis/repositories/e/fix_locked_dependencies.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
@@ -44,178 +43,109 @@ using namespace paludis::erepository;
namespace
{
- void cannot_add(const std::tr1::shared_ptr<const DependencySpecTree::ConstItem> &) PALUDIS_ATTRIBUTE((noreturn));
+ void cannot_add(const std::tr1::shared_ptr<const DependencySpecTree> &) PALUDIS_ATTRIBUTE((noreturn));
- void cannot_add(const std::tr1::shared_ptr<const DependencySpecTree::ConstItem> &)
+ void cannot_add(const std::tr1::shared_ptr<const DependencySpecTree> &)
{
throw InternalError(PALUDIS_HERE, "Got weird tree");
}
- struct Fixer :
- ConstVisitor<DependencySpecTree>
+ struct Fixer
{
- std::list<std::pair<
- std::tr1::shared_ptr<DependencySpecTree::ConstItem>,
- std::tr1::function<void (const std::tr1::shared_ptr<DependencySpecTree::ConstItem> &)> > > stack;
-
- std::tr1::shared_ptr<const DependencySpecTree::ConstItem> result;
+ std::list<std::tr1::shared_ptr<DependencySpecTree::BasicInnerNode> > stack;
+ std::tr1::shared_ptr<DependencySpecTree> result;
const Environment * const env;
const EAPI & eapi;
const std::tr1::shared_ptr<const PackageID> id;
Fixer(const Environment * const e, const EAPI & a, const std::tr1::shared_ptr<const PackageID> & i) :
+ result(new DependencySpecTree(make_shared_ptr(new AllDepSpec))),
env(e),
eapi(a),
id(i)
{
+ stack.push_front(result->root());
}
- void visit_sequence(const AllDepSpec & s,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
{
- std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > c(
- new ConstTreeSequence<DependencySpecTree, AllDepSpec>(
- std::tr1::static_pointer_cast<AllDepSpec>(s.clone())));
-
- if (! stack.empty())
- stack.begin()->second(c);
- else
- result = c;
-
- using namespace std::tr1::placeholders;
- stack.push_front(std::make_pair(c, std::tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, c.get(), _1)));
- std::for_each(cur, end, accept_visitor(*this));
+ std::tr1::shared_ptr<AllDepSpec> spec(std::tr1::static_pointer_cast<AllDepSpec>(node.spec()->clone()));
+ stack.push_front((*stack.begin())->append(spec));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
stack.pop_front();
}
- void visit_sequence(const AnyDepSpec & s,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
- std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AnyDepSpec> > c(
- new ConstTreeSequence<DependencySpecTree, AnyDepSpec>(
- std::tr1::static_pointer_cast<AnyDepSpec>(s.clone())));
-
- if (! stack.empty())
- stack.begin()->second(c);
- else
- result = c;
-
- using namespace std::tr1::placeholders;
- stack.push_front(std::make_pair(c, std::tr1::bind(&ConstTreeSequence<DependencySpecTree, AnyDepSpec>::add, c.get(), _1)));
- std::for_each(cur, end, accept_visitor(*this));
+ std::tr1::shared_ptr<AnyDepSpec> spec(std::tr1::static_pointer_cast<AnyDepSpec>(node.spec()->clone()));
+ stack.push_front((*stack.begin())->append(spec));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
stack.pop_front();
}
- void visit_sequence(const ConditionalDepSpec & s,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, ConditionalDepSpec> > c(
- new ConstTreeSequence<DependencySpecTree, ConditionalDepSpec>(
- std::tr1::static_pointer_cast<ConditionalDepSpec>(s.clone())));
-
- if (! stack.empty())
- stack.begin()->second(c);
- else
- result = c;
-
- using namespace std::tr1::placeholders;
- stack.push_front(std::make_pair(c, std::tr1::bind(&ConstTreeSequence<DependencySpecTree, ConditionalDepSpec>::add, c.get(), _1)));
- std::for_each(cur, end, accept_visitor(*this));
+ std::tr1::shared_ptr<ConditionalDepSpec> spec(std::tr1::static_pointer_cast<ConditionalDepSpec>(node.spec()->clone()));
+ stack.push_front((*stack.begin())->append(spec));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
stack.pop_front();
}
- void visit_leaf(const PackageDepSpec & s)
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
{
- std::tr1::shared_ptr<TreeLeaf<DependencySpecTree, PackageDepSpec> > c;
+ std::tr1::shared_ptr<const PackageDepSpec> c;
do
{
- if (! s.slot_requirement_ptr())
+ if (! node.spec()->slot_requirement_ptr())
break;
- const SlotAnyLockedRequirement * const r(simple_visitor_cast<const SlotAnyLockedRequirement>(*s.slot_requirement_ptr()));
+ const SlotAnyLockedRequirement * const r(simple_visitor_cast<const SlotAnyLockedRequirement>(*node.spec()->slot_requirement_ptr()));
if (! r)
break;
std::tr1::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted(
- generator::Matches(s, MatchPackageOptions()) | filter::InstalledAtRoot(FSEntry("/")))]);
+ generator::Matches(*node.spec(), MatchPackageOptions()) | filter::InstalledAtRoot(FSEntry("/")))]);
if (matches->empty())
break;
- PackageDepSpec new_s(PartiallyMadePackageDepSpec(s).slot_requirement(
+ PackageDepSpec new_s(PartiallyMadePackageDepSpec(*node.spec()).slot_requirement(
make_shared_ptr(new ELikeSlotExactRequirement((*matches->last())->slot(), true))));
- c.reset(new TreeLeaf<DependencySpecTree, PackageDepSpec>(std::tr1::static_pointer_cast<PackageDepSpec>(
- new_s.clone())));
+ c.reset(new PackageDepSpec(new_s));
} while (false);
if (! c)
- c.reset(new TreeLeaf<DependencySpecTree, PackageDepSpec>(std::tr1::static_pointer_cast<PackageDepSpec>(s.clone())));
+ c = node.spec();
- if (stack.empty())
- {
- stack.push_front(std::make_pair(c, &cannot_add));
- result = c;
- }
- else
- stack.begin()->second(c);
+ (*stack.begin())->append(c);
}
- void visit_leaf(const NamedSetDepSpec & s)
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
{
- std::tr1::shared_ptr<TreeLeaf<DependencySpecTree, NamedSetDepSpec> > c(
- new TreeLeaf<DependencySpecTree, NamedSetDepSpec>(std::tr1::static_pointer_cast<NamedSetDepSpec>(s.clone())));
-
- if (stack.empty())
- {
- stack.push_front(std::make_pair(c, &cannot_add));
- result = c;
- }
- else
- stack.begin()->second(c);
+ (*stack.begin())->append(node.spec());
}
- void visit_leaf(const BlockDepSpec & s)
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node)
{
- std::tr1::shared_ptr<TreeLeaf<DependencySpecTree, BlockDepSpec> > c(
- new TreeLeaf<DependencySpecTree, BlockDepSpec>(std::tr1::static_pointer_cast<BlockDepSpec>(s.clone())));
-
- if (stack.empty())
- {
- stack.push_front(std::make_pair(c, &cannot_add));
- result = c;
- }
- else
- stack.begin()->second(c);
+ (*stack.begin())->append(node.spec());
}
- void visit_leaf(const DependencyLabelsDepSpec & s)
+ void visit(const DependencySpecTree::NodeType<DependencyLabelsDepSpec>::Type & node)
{
- std::tr1::shared_ptr<TreeLeaf<DependencySpecTree, DependencyLabelsDepSpec> > c(
- new TreeLeaf<DependencySpecTree, DependencyLabelsDepSpec>(std::tr1::static_pointer_cast<DependencyLabelsDepSpec>(s.clone())));
-
- if (stack.empty())
- {
- stack.push_front(std::make_pair(c, &cannot_add));
- result = c;
- }
- else
- stack.begin()->second(c);
+ (*stack.begin())->append(node.spec());
}
};
}
-const std::tr1::shared_ptr<const DependencySpecTree::ConstItem>
+const std::tr1::shared_ptr<const DependencySpecTree>
paludis::erepository::fix_locked_dependencies(
const Environment * const env,
const EAPI & e, const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const DependencySpecTree::ConstItem> & b)
+ const std::tr1::shared_ptr<const DependencySpecTree> & b)
{
Fixer f(env, e, id);
- b->accept(f);
+ b->root()->accept(f);
return f.result;
}
diff --git a/paludis/repositories/e/fix_locked_dependencies.hh b/paludis/repositories/e/fix_locked_dependencies.hh
index 6ccbd4e92..379b0d3a1 100644
--- a/paludis/repositories/e/fix_locked_dependencies.hh
+++ b/paludis/repositories/e/fix_locked_dependencies.hh
@@ -24,17 +24,17 @@
#include <paludis/util/attributes.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <tr1/memory>
namespace paludis
{
namespace erepository
{
- const std::tr1::shared_ptr<const DependencySpecTree::ConstItem> fix_locked_dependencies(
+ const std::tr1::shared_ptr<const DependencySpecTree> fix_locked_dependencies(
const Environment * const env,
const EAPI &, const std::tr1::shared_ptr<const PackageID> &,
- const std::tr1::shared_ptr<const DependencySpecTree::ConstItem> &) PALUDIS_VISIBLE;
+ const std::tr1::shared_ptr<const DependencySpecTree> &) PALUDIS_VISIBLE;
}
}
diff --git a/paludis/repositories/e/fix_locked_dependencies_TEST.cc b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
index 6083d55df..6f44fb0ce 100644
--- a/paludis/repositories/e/fix_locked_dependencies_TEST.cc
+++ b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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
@@ -24,7 +24,6 @@
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/stringify_formatter.hh>
#include <paludis/package_database.hh>
@@ -54,7 +53,7 @@ namespace test_cases
std::tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"));
- std::tr1::shared_ptr<DependencySpecTree::ConstItem> bb(parse_depend(
+ std::tr1::shared_ptr<const DependencySpecTree> bb(parse_depend(
"|| ( foo/bar ( bar/baz oink/squeak ) ) blah/blah", &env, id, *eapi)),
aa(fix_locked_dependencies(&env, *eapi, id, bb));
@@ -62,20 +61,20 @@ namespace test_cases
DepSpecPrettyPrinter
a(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false),
b(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- aa->accept(a);
- bb->accept(b);
+ aa->root()->accept(a);
+ bb->root()->accept(b);
TEST_CHECK_STRINGIFY_EQUAL(a, b);
- std::tr1::shared_ptr<DependencySpecTree::ConstItem> cc(parse_depend(
+ std::tr1::shared_ptr<const DependencySpecTree> cc(parse_depend(
"foo/bar:= cat/installed:= >=cat/installed-1.2:= <=cat/installed-1.2:=", &env, id, *eapi)),
dd(fix_locked_dependencies(&env, *eapi, id, cc));
DepSpecPrettyPrinter
c(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false),
d(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- cc->accept(c);
- dd->accept(d);
+ cc->root()->accept(c);
+ dd->root()->accept(d);
TEST_CHECK_STRINGIFY_EQUAL(c, "foo/bar:= cat/installed:= >=cat/installed-1.2:= <=cat/installed-1.2:=");
TEST_CHECK_STRINGIFY_EQUAL(d, "foo/bar:= cat/installed:=monkey >=cat/installed-1.2:= <=cat/installed-1.2:=monkey");
diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc
index a6f5f3506..8bd84eb96 100644
--- a/paludis/repositories/e/info_metadata_key.cc
+++ b/paludis/repositories/e/info_metadata_key.cc
@@ -31,7 +31,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/join.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
diff --git a/paludis/repositories/e/myoptions_requirements_verifier.cc b/paludis/repositories/e/myoptions_requirements_verifier.cc
index fd6ccfac7..fc85a08fd 100644
--- a/paludis/repositories/e/myoptions_requirements_verifier.cc
+++ b/paludis/repositories/e/myoptions_requirements_verifier.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/myoption.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/tokeniser.hh>
@@ -78,9 +77,9 @@ MyOptionsRequirementsVerifier::unmet_requirements() const
}
void
-MyOptionsRequirementsVerifier::visit_leaf(const PlainTextLabelDepSpec & s)
+MyOptionsRequirementsVerifier::visit(const PlainTextSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node)
{
- *_imp->current_prefix_stack.begin() = ChoicePrefixName(s.label());
+ *_imp->current_prefix_stack.begin() = ChoicePrefixName(node.spec()->label());
}
namespace
@@ -223,18 +222,18 @@ MyOptionsRequirementsVerifier::verify_one(const ChoicePrefixName & spec_prefix,
}
void
-MyOptionsRequirementsVerifier::visit_leaf(const PlainTextDepSpec & s)
+MyOptionsRequirementsVerifier::visit(const PlainTextSpecTree::NodeType<PlainTextDepSpec>::Type & node)
{
- Context context("When verifying requirements for item '" + stringify(s) + "':");
+ Context context("When verifying requirements for item '" + stringify(*node.spec()) + "':");
for (std::list<ChildrenList>::iterator l(_imp->current_children_stack.begin()), l_end(_imp->current_children_stack.end()) ;
l != l_end ; ++l)
- l->push_back(std::make_pair(*_imp->current_prefix_stack.begin(), s.text()));
+ l->push_back(std::make_pair(*_imp->current_prefix_stack.begin(), node.spec()->text()));
{
Context local_context("When finding associated choice:");
- std::pair<UnprefixedChoiceName, bool> active_myoption(parse_myoption(s.text()));
+ std::pair<UnprefixedChoiceName, bool> active_myoption(parse_myoption(node.spec()->text()));
ChoiceNameWithPrefix active_flag((
! stringify(*_imp->current_prefix_stack.begin()).empty() ? stringify(*_imp->current_prefix_stack.begin()) +
stringify(_imp->id->eapi()->supported()->choices_options()->use_expand_separator()) : "") +
@@ -247,24 +246,22 @@ MyOptionsRequirementsVerifier::visit_leaf(const PlainTextDepSpec & s)
++*l;
}
- if ((! s.annotations_key()) || (s.annotations_key()->begin_metadata() == s.annotations_key()->end_metadata()))
+ if ((! node.spec()->annotations_key()) || (node.spec()->annotations_key()->begin_metadata() == node.spec()->annotations_key()->end_metadata()))
return;
- verify_one(*_imp->current_prefix_stack.begin(), s.text(), s.annotations_key());
+ verify_one(*_imp->current_prefix_stack.begin(), node.spec()->text(), node.spec()->annotations_key());
}
void
-MyOptionsRequirementsVerifier::visit_sequence(const ConditionalDepSpec & spec,
- PlainTextSpecTree::ConstSequenceIterator cur,
- PlainTextSpecTree::ConstSequenceIterator end)
+MyOptionsRequirementsVerifier::visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if (spec.condition_met())
+ if (node.spec()->condition_met())
{
_imp->current_prefix_stack.push_front(*_imp->current_prefix_stack.begin());
_imp->current_children_stack.push_front(ChildrenList());
_imp->number_enabled_stack.push_front(0);
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
_imp->number_enabled_stack.pop_front();
_imp->current_children_stack.pop_front();
@@ -273,23 +270,21 @@ MyOptionsRequirementsVerifier::visit_sequence(const ConditionalDepSpec & spec,
}
void
-MyOptionsRequirementsVerifier::visit_sequence(const AllDepSpec & s,
- PlainTextSpecTree::ConstSequenceIterator cur,
- PlainTextSpecTree::ConstSequenceIterator end)
+MyOptionsRequirementsVerifier::visit(const PlainTextSpecTree::NodeType<AllDepSpec>::Type & node)
{
_imp->current_prefix_stack.push_front(*_imp->current_prefix_stack.begin());
_imp->current_children_stack.push_front(ChildrenList());
_imp->number_enabled_stack.push_front(0);
- std::for_each(cur, end, accept_visitor(*this));
- if (s.annotations_key() && (s.annotations_key()->begin_metadata() != s.annotations_key()->end_metadata()))
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ if (node.spec()->annotations_key() && (node.spec()->annotations_key()->begin_metadata() != node.spec()->annotations_key()->end_metadata()))
{
for (ChildrenList::const_iterator i(_imp->current_children_stack.begin()->begin()),
i_end(_imp->current_children_stack.begin()->end()) ;
i != i_end ; ++i)
- verify_one(i->first, i->second, s.annotations_key());
+ verify_one(i->first, i->second, node.spec()->annotations_key());
- for (MetadataSectionKey::MetadataConstIterator m(s.annotations_key()->begin_metadata()), m_end(s.annotations_key()->end_metadata()) ;
+ for (MetadataSectionKey::MetadataConstIterator m(node.spec()->annotations_key()->begin_metadata()), m_end(node.spec()->annotations_key()->end_metadata()) ;
m != m_end ; ++m)
{
const MetadataValueKey<std::string> * mm(simple_visitor_cast<const MetadataValueKey<std::string> >(**m));
diff --git a/paludis/repositories/e/myoptions_requirements_verifier.hh b/paludis/repositories/e/myoptions_requirements_verifier.hh
index 28172e55d..b92fb2c26 100644
--- a/paludis/repositories/e/myoptions_requirements_verifier.hh
+++ b/paludis/repositories/e/myoptions_requirements_verifier.hh
@@ -21,12 +21,11 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_MYOPTIONS_REQUIREMENTS_VERIFIER_HH 1
#include <paludis/repositories/e/e_repository_id.hh>
-#include <paludis/util/visitor.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/attributes.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <tr1/memory>
namespace paludis
@@ -34,8 +33,7 @@ namespace paludis
namespace erepository
{
class PALUDIS_VISIBLE MyOptionsRequirementsVerifier :
- private PrivateImplementationPattern<MyOptionsRequirementsVerifier>,
- public ConstVisitor<PlainTextSpecTree>
+ private PrivateImplementationPattern<MyOptionsRequirementsVerifier>
{
private:
void verify_one(const ChoicePrefixName &, const std::string &,
@@ -47,19 +45,10 @@ namespace paludis
const std::tr1::shared_ptr<const Sequence<std::string> > unmet_requirements() const PALUDIS_ATTRIBUTE((warn_unused_result));
- void visit_leaf(const PlainTextLabelDepSpec &);
-
- void visit_leaf(const PlainTextDepSpec &);
-
- void visit_sequence(const ConditionalDepSpec &,
- PlainTextSpecTree::ConstSequenceIterator,
- PlainTextSpecTree::ConstSequenceIterator
- );
-
- void visit_sequence(const AllDepSpec &,
- PlainTextSpecTree::ConstSequenceIterator,
- PlainTextSpecTree::ConstSequenceIterator
- );
+ void visit(const PlainTextSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node);
+ void visit(const PlainTextSpecTree::NodeType<PlainTextDepSpec>::Type & node);
+ void visit(const PlainTextSpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type & node);
};
}
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index 54072e2e5..e939478ea 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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,9 +30,9 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/indirect_iterator.hh>
#include <paludis/package_id.hh>
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
@@ -274,13 +274,13 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
(var == eapi->supported()->ebuild_metadata_variables()->pdepend().name()) ||
(var == eapi->supported()->ebuild_metadata_variables()->dependencies().name()))
{
- std::tr1::shared_ptr<const DependencySpecTree::ConstItem> before(parse_depend(join(tokens.begin() + 4, tokens.end(), " "),
+ std::tr1::shared_ptr<const DependencySpecTree> before(parse_depend(join(tokens.begin() + 4, tokens.end(), " "),
environment, package_id, *eapi));
- std::tr1::shared_ptr<const DependencySpecTree::ConstItem> after(fix_locked_dependencies(
+ std::tr1::shared_ptr<const DependencySpecTree> after(fix_locked_dependencies(
environment, *eapi, package_id, before));
StringifyFormatter ff;
DepSpecPrettyPrinter p(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- after->accept(p);
+ after->root()->accept(p);
return "O0;" + stringify(p);
}
@@ -331,4 +331,3 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
}
}
-
diff --git a/paludis/repositories/e/pretend_fetch_visitor.cc b/paludis/repositories/e/pretend_fetch_visitor.cc
index d32a3beee..cedd99905 100644
--- a/paludis/repositories/e/pretend_fetch_visitor.cc
+++ b/paludis/repositories/e/pretend_fetch_visitor.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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
@@ -25,7 +25,6 @@
#include <paludis/package_id.hh>
#include <paludis/action.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/log.hh>
@@ -93,47 +92,43 @@ PretendFetchVisitor::~PretendFetchVisitor()
}
void
-PretendFetchVisitor::visit_sequence(const ConditionalDepSpec & u,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator end)
+PretendFetchVisitor::visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- if ((_imp->fetch_unneeded) || (u.condition_met()))
+ if ((_imp->fetch_unneeded) || (node.spec()->condition_met()))
{
_imp->labels.push_front(* _imp->labels.begin());
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
_imp->labels.pop_front();
}
}
void
-PretendFetchVisitor::visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator cur,
- FetchableURISpecTree::ConstSequenceIterator end)
+PretendFetchVisitor::visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node)
{
_imp->labels.push_front(* _imp->labels.begin());
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
_imp->labels.pop_front();
}
void
-PretendFetchVisitor::visit_leaf(const URILabelsDepSpec & l)
+PretendFetchVisitor::visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node)
{
- for (URILabelsDepSpec::ConstIterator i(l.begin()), i_end(l.end()) ;
+ for (URILabelsDepSpec::ConstIterator i(node.spec()->begin()), i_end(node.spec()->end()) ;
i != i_end ; ++i)
*_imp->labels.begin() = i->get();
}
void
-PretendFetchVisitor::visit_leaf(const FetchableURIDepSpec & u)
+PretendFetchVisitor::visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
- if (! _imp->already_done.insert(u.filename()).second)
+ if (! _imp->already_done.insert(node.spec()->filename()).second)
return;
- FSEntry destination(_imp->distdir / u.filename());
+ FSEntry destination(_imp->distdir / node.spec()->filename());
if (destination.exists())
return;
- Manifest2Reader::ConstIterator m(_imp->manifest.find("DIST", u.filename()));
+ Manifest2Reader::ConstIterator m(_imp->manifest.find("DIST", node.spec()->filename()));
if (_imp->manifest.end() == m)
return;
diff --git a/paludis/repositories/e/pretend_fetch_visitor.hh b/paludis/repositories/e/pretend_fetch_visitor.hh
index 3b770e0a2..e21f7e5e8 100644
--- a/paludis/repositories/e/pretend_fetch_visitor.hh
+++ b/paludis/repositories/e/pretend_fetch_visitor.hh
@@ -22,7 +22,8 @@
#include <paludis/action-fwd.hh>
#include <paludis/dep_label-fwd.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/spec_tree.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/repositories/e/eapi-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
@@ -33,8 +34,7 @@ namespace paludis
namespace erepository
{
class PALUDIS_VISIBLE PretendFetchVisitor :
- private PrivateImplementationPattern<PretendFetchVisitor>,
- public ConstVisitor<FetchableURISpecTree>
+ private PrivateImplementationPattern<PretendFetchVisitor>
{
public:
PretendFetchVisitor(
@@ -48,17 +48,10 @@ namespace paludis
~PretendFetchVisitor();
- void visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator,
- FetchableURISpecTree::ConstSequenceIterator);
-
- void visit_sequence(const ConditionalDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator,
- FetchableURISpecTree::ConstSequenceIterator);
-
- void visit_leaf(const URILabelsDepSpec &);
-
- void visit_leaf(const FetchableURIDepSpec &);
+ void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node);
+ void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node);
};
}
diff --git a/paludis/repositories/e/qa/extractors.cc b/paludis/repositories/e/qa/extractors.cc
index ad1e0d979..e7c9ee2ec 100644
--- a/paludis/repositories/e/qa/extractors.cc
+++ b/paludis/repositories/e/qa/extractors.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -25,7 +25,6 @@
#include <paludis/util/config_file.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/system.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/options.hh>
@@ -70,21 +69,28 @@ namespace
}
};
- struct FlagExtractor :
- ConstVisitor<GenericSpecTree>,
- ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AllDepSpec>,
- ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AnyDepSpec>
+ struct FlagExtractor
{
std::map<QualifiedPackageName, std::set<ChoiceNameWithPrefix> > relevant;
std::set<ChoiceNameWithPrefix> current;
std::set<QualifiedPackageName> needed_packages;
- void visit_leaf(const FetchableURIDepSpec & u)
+ void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node)
{
- std::string::size_type p(u.filename().rfind('.'));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node)
+ {
+ std::string::size_type p(node.spec()->filename().rfind('.'));
if (std::string::npos == p)
return;
- std::string extension(u.filename().substr(p + 1));
+ std::string extension(node.spec()->filename().substr(p + 1));
std::string needed(ExtractorsRequirements::get_instance()->file->get(extension));
if (! needed.empty())
{
@@ -93,60 +99,53 @@ namespace
}
}
- void visit_leaf(const PackageDepSpec & p)
+ void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node)
{
- if (p.package_ptr() && needed_packages.count(*p.package_ptr()))
- relevant[*p.package_ptr()].insert(current.begin(), current.end());
+ if (node.spec()->package_ptr() && needed_packages.count(*node.spec()->package_ptr()))
+ relevant[*node.spec()->package_ptr()].insert(current.begin(), current.end());
}
- void visit_leaf(const BlockDepSpec &)
+ void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type &)
{
}
- void visit_leaf(const URILabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &)
{
}
- void visit_leaf(const DependencyLabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<DependencyLabelsDepSpec>::Type &)
{
}
- void visit_leaf(const PlainTextDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &)
{
}
- void visit_sequence(const ConditionalDepSpec & u,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+ void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<std::set<ChoiceNameWithPrefix> > save_current(&current);
- current.insert(elike_conditional_dep_spec_flag(u));
- std::for_each(cur, end, accept_visitor(*this));
+ current.insert(elike_conditional_dep_spec_flag(*node.spec()));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
- void visit_leaf(const LicenseDepSpec &)
+ void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &)
{
}
- void visit_leaf(const SimpleURIDepSpec &)
+ void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &)
{
}
- void visit_leaf(const PlainTextLabelDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &)
{
}
- void visit_leaf(const NamedSetDepSpec &)
+ void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &)
{
}
-
- using ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AllDepSpec>::visit_sequence;
- using ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AnyDepSpec>::visit_sequence;
};
- struct Requirements :
- ConstVisitor<GenericSpecTree>,
- ConstVisitor<GenericSpecTree>::VisitConstSequence<Requirements, AllDepSpec>
+ struct Requirements
{
const QualifiedPackageName & name;
const std::set<ChoiceNameWithPrefix> & relevant;
@@ -185,12 +184,17 @@ namespace
requirements.insert(new_requirements.begin(), new_requirements.end());
}
- void visit_leaf(const FetchableURIDepSpec & u)
+ void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node)
{
- std::string::size_type p(u.filename().rfind('.'));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node)
+ {
+ std::string::size_type p(node.spec()->filename().rfind('.'));
if (std::string::npos == p)
return;
- std::string extension(u.filename().substr(p + 1));
+ std::string extension(node.spec()->filename().substr(p + 1));
std::string needed(ExtractorsRequirements::get_instance()->file->get(extension));
if (needed.empty() || QualifiedPackageName(needed) != name)
return;
@@ -198,62 +202,56 @@ namespace
add_requirements();
}
- void visit_leaf(const SimpleURIDepSpec &)
+ void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &)
{
}
- void visit_leaf(const PackageDepSpec & p)
+ void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node)
{
- if ((! p.package_ptr()) || (name != *p.package_ptr()))
+ if ((! node.spec()->package_ptr()) || (name != *node.spec()->package_ptr()))
return;
add_requirements();
}
- void visit_leaf(const PlainTextLabelDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &)
{
}
- void visit_leaf(const URILabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &)
{
}
- void visit_leaf(const DependencyLabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<DependencyLabelsDepSpec>::Type &)
{
}
- void visit_leaf(const BlockDepSpec &)
+ void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type &)
{
}
- void visit_leaf(const PlainTextDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &)
{
}
- void visit_leaf(const LicenseDepSpec &)
+ void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &)
{
}
- void visit_leaf(const NamedSetDepSpec &)
+ void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &)
{
}
- using ConstVisitor<GenericSpecTree>::VisitConstSequence<Requirements, AllDepSpec>::visit_sequence;
-
- void visit_sequence(const ConditionalDepSpec & u,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+ void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<std::map<ChoiceNameWithPrefix, bool> > save_current(&current);
std::pair<std::map<ChoiceNameWithPrefix, bool>::const_iterator, bool> p(current.insert(std::make_pair(
- elike_conditional_dep_spec_flag(u), ! elike_conditional_dep_spec_is_inverse(u))));
- if (p.second || (p.first->second == ! elike_conditional_dep_spec_is_inverse(u)))
- std::for_each(cur, end, accept_visitor(*this));
+ elike_conditional_dep_spec_flag(*node.spec()), ! elike_conditional_dep_spec_is_inverse(*node.spec()))));
+ if (p.second || (p.first->second == ! elike_conditional_dep_spec_is_inverse(*node.spec())))
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
- void visit_sequence(const AnyDepSpec &,
- GenericSpecTree::ConstSequenceIterator,
- GenericSpecTree::ConstSequenceIterator)
+ void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type &)
{
}
};
@@ -278,9 +276,9 @@ paludis::erepository::extractors_check(
* since it needs to work with USE_EXPAND and it's potentially
* O(2^n). */
FlagExtractor f;
- id->fetches_key()->value()->accept(f);
+ id->fetches_key()->value()->root()->accept(f);
if (id->build_dependencies_key())
- id->build_dependencies_key()->value()->accept(f);
+ id->build_dependencies_key()->value()->root()->accept(f);
for (std::map<QualifiedPackageName, std::set<ChoiceNameWithPrefix> >::const_iterator
r(f.relevant.begin()), r_end(f.relevant.end()) ;
@@ -297,12 +295,12 @@ paludis::erepository::extractors_check(
/* Find the set of requirements. */
Requirements q(r->first, r->second);
- id->fetches_key()->value()->accept(q);
+ id->fetches_key()->value()->root()->accept(q);
/* Find the set of met requirements. */
Requirements m(r->first, r->second);
if (id->build_dependencies_key())
- id->build_dependencies_key()->value()->accept(m);
+ id->build_dependencies_key()->value()->root()->accept(m);
/* Find the set of unmet requirements */
std::set<std::map<ChoiceNameWithPrefix, bool> > unmet;
diff --git a/paludis/repositories/e/qa/fetches_key.cc b/paludis/repositories/e/qa/fetches_key.cc
index 2d1dd9133..926b49fab 100644
--- a/paludis/repositories/e/qa/fetches_key.cc
+++ b/paludis/repositories/e/qa/fetches_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -21,7 +21,6 @@
#include <paludis/qa.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/log.hh>
#include <paludis/util/save.hh>
#include <paludis/name.hh>
@@ -75,7 +74,7 @@ namespace
}
};
- struct Checker : ConstVisitor<FetchableURISpecTree>
+ struct Checker
{
QAReporter & reporter;
bool fetch_restrict;
@@ -97,48 +96,48 @@ namespace
{
}
- void visit_leaf(const FetchableURIDepSpec & a)
+ void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
std::string::size_type p(std::string::npos);
- if (std::string::npos == ((p = a.original_url().find("://"))) && ! fetch_restrict)
+ if (std::string::npos == ((p = node.spec()->original_url().find("://"))) && ! fetch_restrict)
reporter.message(QAMessage(entry, qaml_normal, name,
- "No protocol found for '" + a.original_url() +
+ "No protocol found for '" + node.spec()->original_url() +
"' and not fetch restricted in '" + key->raw_name() + "'")
.with_associated_id(id)
.with_associated_key(id, key));
else if ((std::string::npos != p) &&
- (("http" != a.original_url().substr(0, p)) &&
- ("https" != a.original_url().substr(0, p)) &&
- ("mirror" != a.original_url().substr(0, p)) &&
- ("ftp" != a.original_url().substr(0, p))))
+ (("http" != node.spec()->original_url().substr(0, p)) &&
+ ("https" != node.spec()->original_url().substr(0, p)) &&
+ ("mirror" != node.spec()->original_url().substr(0, p)) &&
+ ("ftp" != node.spec()->original_url().substr(0, p))))
reporter.message(QAMessage(entry, qaml_normal, name,
- "Unrecognised protocol for '" + a.original_url() +
+ "Unrecognised protocol for '" + node.spec()->original_url() +
"' in '" + key->raw_name() + "'")
.with_associated_id(id)
.with_associated_key(id, key));
- else if ((std::string::npos != a.original_url().find("dev.gentoo.org")) ||
- (std::string::npos != a.original_url().find("cvs.gentoo.org")) ||
- (std::string::npos != a.original_url().find("toucan.gentoo.org")) ||
- (std::string::npos != a.original_url().find("emu.gentoo.org")) ||
- (std::string::npos != a.original_url().find("alpha.gnu.org")) ||
- (std::string::npos != a.original_url().find("geocities.com")))
+ else if ((std::string::npos != node.spec()->original_url().find("dev.gentoo.org")) ||
+ (std::string::npos != node.spec()->original_url().find("cvs.gentoo.org")) ||
+ (std::string::npos != node.spec()->original_url().find("toucan.gentoo.org")) ||
+ (std::string::npos != node.spec()->original_url().find("emu.gentoo.org")) ||
+ (std::string::npos != node.spec()->original_url().find("alpha.gnu.org")) ||
+ (std::string::npos != node.spec()->original_url().find("geocities.com")))
reporter.message(QAMessage(entry, qaml_normal, name,
- "Unreliable host for '" + a.original_url() + "' in '" +
+ "Unreliable host for '" + node.spec()->original_url() + "' in '" +
key->raw_name() + "'")
.with_associated_id(id)
.with_associated_key(id, key));
else
{
- if (0 == a.original_url().compare(0, 9, "mirror://"))
+ if (0 == node.spec()->original_url().compare(0, 9, "mirror://"))
{
- std::string mirror_host(a.original_url().substr(9));
+ std::string mirror_host(node.spec()->original_url().substr(9));
std::string::size_type pos(mirror_host.find('/'));
if (std::string::npos == pos)
reporter.message(QAMessage(entry, qaml_normal, name,
- "Malformed component '" + a.original_url() + "' in '" +
+ "Malformed component '" + node.spec()->original_url() + "' in '" +
key->raw_name() + "'")
.with_associated_id(id)
.with_associated_key(id, key));
@@ -149,7 +148,7 @@ namespace
if (! m->is_mirror(mirror_host))
reporter.message(QAMessage(entry, qaml_normal, name,
"Unknown mirror '" + mirror_host + "' for '" +
- a.original_url() + "' in '" + key->raw_name() + "'")
+ node.spec()->original_url() + "' in '" + key->raw_name() + "'")
.with_associated_id(id)
.with_associated_key(id, key));
}
@@ -157,28 +156,24 @@ namespace
}
}
- void visit_leaf(const URILabelsDepSpec & a)
+ void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node)
{
- if (1 != std::distance(a.begin(), a.end()))
+ if (1 != std::distance(node.spec()->begin(), node.spec()->end()))
throw InternalError(PALUDIS_HERE, "URILabelsDepSpec contains " +
- stringify(std::distance(a.begin(), a.end())) + " labels, but expected 1");
- fetch_restrict = LabelToFetchRestrict(**a.begin()).value;
+ stringify(std::distance(node.spec()->begin(), node.spec()->end())) + " labels, but expected 1");
+ fetch_restrict = LabelToFetchRestrict(**node.spec()->begin()).value;
}
- void visit_sequence(const AllDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator begin,
- FetchableURISpecTree::ConstSequenceIterator end)
+ void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node)
{
Save<bool> s(&fetch_restrict);
- std::for_each(begin, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
- void visit_sequence(const ConditionalDepSpec &,
- FetchableURISpecTree::ConstSequenceIterator begin,
- FetchableURISpecTree::ConstSequenceIterator end)
+ void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<bool> s(&fetch_restrict);
- std::for_each(begin, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
};
}
@@ -200,7 +195,7 @@ paludis::erepository::fetches_key_check(
{
Checker c(reporter, LabelToFetchRestrict(*id->fetches_key()->initial_label()).value,
id, id->fetches_key(), entry, name);
- id->fetches_key()->value()->accept(c);
+ id->fetches_key()->value()->root()->accept(c);
}
catch (const InternalError &)
{
diff --git a/paludis/repositories/e/qa/homepage_key.cc b/paludis/repositories/e/qa/homepage_key.cc
index 018a932f3..471002808 100644
--- a/paludis/repositories/e/qa/homepage_key.cc
+++ b/paludis/repositories/e/qa/homepage_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -21,7 +21,6 @@
#include <paludis/qa.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/log.hh>
#include <paludis/name.hh>
#include <paludis/dep_spec.hh>
@@ -33,14 +32,8 @@ using namespace paludis::erepository;
namespace
{
- struct HomepageChecker :
- ConstVisitor<SimpleURISpecTree>,
- ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, AllDepSpec>,
- ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, ConditionalDepSpec>
+ struct HomepageChecker
{
- using ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, ConditionalDepSpec>::visit_sequence;
- using ConstVisitor<SimpleURISpecTree>::VisitConstSequence<HomepageChecker, AllDepSpec>::visit_sequence;
-
const std::tr1::shared_ptr<const MetadataKey> & key;
const FSEntry entry;
QAReporter & reporter;
@@ -71,18 +64,28 @@ namespace
.with_associated_key(id, key));
}
- void visit_leaf(const SimpleURIDepSpec & u)
+ void visit(const SimpleURISpecTree::NodeType<SimpleURIDepSpec>::Type & node)
{
found_one = true;
- if (0 != u.text().compare(0, 7, "http://") &&
- 0 != u.text().compare(0, 8, "https://") &&
- 0 != u.text().compare(0, 6, "ftp://"))
+ if (0 != node.spec()->text().compare(0, 7, "http://") &&
+ 0 != node.spec()->text().compare(0, 8, "https://") &&
+ 0 != node.spec()->text().compare(0, 6, "ftp://"))
reporter.message(QAMessage(entry, qaml_normal, name,
- "Homepage uses no or unknown protocol in part '" + u.text() + "'")
+ "Homepage uses no or unknown protocol in part '" + node.spec()->text() + "'")
.with_associated_id(id)
.with_associated_key(id, key));
}
+
+ void visit(const SimpleURISpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const SimpleURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
};
}
@@ -103,10 +106,9 @@ paludis::erepository::homepage_key_check(
else
{
HomepageChecker h(id->homepage_key(), entry, reporter, id, name);
- id->homepage_key()->value()->accept(h);
+ id->homepage_key()->value()->root()->accept(h);
}
return true;
}
-
diff --git a/paludis/repositories/e/qa/inherited_key.cc b/paludis/repositories/e/qa/inherited_key.cc
index 83a529a84..8bbd167f0 100644
--- a/paludis/repositories/e/qa/inherited_key.cc
+++ b/paludis/repositories/e/qa/inherited_key.cc
@@ -27,8 +27,6 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
#include <paludis/util/log.hh>
#include <paludis/util/system.hh>
#include <paludis/package_id.hh>
diff --git a/paludis/repositories/e/qa/keywords_key.cc b/paludis/repositories/e/qa/keywords_key.cc
index d7c565e06..ddb2b0420 100644
--- a/paludis/repositories/e/qa/keywords_key.cc
+++ b/paludis/repositories/e/qa/keywords_key.cc
@@ -24,7 +24,6 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/log.hh>
-#include <paludis/util/visitor_cast.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/package_id.hh>
#include <paludis/name.hh>
diff --git a/paludis/repositories/e/qa/license_key.cc b/paludis/repositories/e/qa/license_key.cc
index 30f9b02c5..b3277c0e6 100644
--- a/paludis/repositories/e/qa/license_key.cc
+++ b/paludis/repositories/e/qa/license_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -23,11 +23,9 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/package_id.hh>
#include <paludis/name.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/dep_tree.hh>
#include <paludis/util/fs_entry.hh>
using namespace paludis;
@@ -35,11 +33,7 @@ using namespace paludis::erepository;
namespace
{
- struct Checker :
- ConstVisitor<LicenseSpecTree>,
- ConstVisitor<LicenseSpecTree>::VisitConstSequence<Checker, AllDepSpec>,
- ConstVisitor<LicenseSpecTree>::VisitConstSequence<Checker, AnyDepSpec>,
- ConstVisitor<LicenseSpecTree>::VisitConstSequence<Checker, ConditionalDepSpec>
+ struct Checker
{
const FSEntry & entry;
QAReporter & reporter;
@@ -57,22 +51,33 @@ namespace
{
}
- using ConstVisitor<LicenseSpecTree>::VisitConstSequence<Checker, AllDepSpec>::visit_sequence;
- using ConstVisitor<LicenseSpecTree>::VisitConstSequence<Checker, AnyDepSpec>::visit_sequence;
- using ConstVisitor<LicenseSpecTree>::VisitConstSequence<Checker, ConditionalDepSpec>::visit_sequence;
-
- void visit_leaf(const LicenseDepSpec & l)
+ void visit(const LicenseSpecTree::NodeType<LicenseDepSpec>::Type & node)
{
for (FSEntrySequence::ConstIterator it(dirs->begin()),
it_end(dirs->end()); it_end != it; ++it)
- if (((*it) / l.text()).is_regular_file_or_symlink_to_regular_file())
+ if (((*it) / node.spec()->text()).is_regular_file_or_symlink_to_regular_file())
return;
reporter.message(QAMessage(entry, qaml_normal, name,
- "Item '" + l.text() + "' in '" + id->license_key()->raw_name() + "' is not a licence")
+ "Item '" + node.spec()->text() + "' in '" + id->license_key()->raw_name() + "' is not a licence")
.with_associated_id(id)
.with_associated_key(id, id->license_key()));
}
+
+ void visit(const LicenseSpecTree::NodeType<AnyDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const LicenseSpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const LicenseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
};
}
@@ -93,7 +98,7 @@ paludis::erepository::license_key_check(
try
{
Checker c(entry, reporter, id, repo->layout()->licenses_dirs(), name);
- id->license_key()->value()->accept(c);
+ id->license_key()->value()->root()->accept(c);
}
catch (const InternalError &)
{
diff --git a/paludis/repositories/e/qa/manifest.cc b/paludis/repositories/e/qa/manifest.cc
index 1631478d0..ad2f96752 100644
--- a/paludis/repositories/e/qa/manifest.cc
+++ b/paludis/repositories/e/qa/manifest.cc
@@ -21,14 +21,13 @@
#include <iostream>
#include "manifest.hh"
#include <paludis/qa.hh>
-#include <paludis/dep_tree.hh>
+#include <paludis/spec_tree.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/log.hh>
#include <paludis/util/system.hh>
#include <paludis/util/map.hh>
#include <paludis/util/member_iterator-impl.hh>
#include <paludis/util/set.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/sha1.hh>
#include <paludis/util/sha256.hh>
@@ -50,17 +49,11 @@ using namespace paludis::erepository;
namespace
{
- struct DistfilesCollector :
- ConstVisitor<FetchableURISpecTree>,
- ConstVisitor<FetchableURISpecTree>::VisitConstSequence<DistfilesCollector, AllDepSpec>,
- ConstVisitor<FetchableURISpecTree>::VisitConstSequence<DistfilesCollector, ConditionalDepSpec>
+ struct DistfilesCollector
{
std::tr1::shared_ptr<const PackageID> id;
std::map<std::string, std::tr1::shared_ptr<PackageIDSet> > & distfiles;
- using ConstVisitor<FetchableURISpecTree>::VisitConstSequence<DistfilesCollector, AllDepSpec>::visit_sequence;
- using ConstVisitor<FetchableURISpecTree>::VisitConstSequence<DistfilesCollector, ConditionalDepSpec>::visit_sequence;
-
DistfilesCollector(const std::tr1::shared_ptr<const PackageID> & i,
std::map<std::string, std::tr1::shared_ptr<PackageIDSet> > & d) :
id(i),
@@ -68,18 +61,27 @@ namespace
{
}
- void visit_leaf(const URILabelsDepSpec &)
+ void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type &)
{
}
- void visit_leaf(const FetchableURIDepSpec & u)
+ void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
- std::map<std::string, std::tr1::shared_ptr<PackageIDSet> >::iterator it(
- distfiles.find(u.filename()));
+ std::map<std::string, std::tr1::shared_ptr<PackageIDSet> >::iterator it(distfiles.find(node.spec()->filename()));
if (distfiles.end() == it)
{
std::tr1::shared_ptr<PackageIDSet> set(new PackageIDSet);
- it = distfiles.insert(std::make_pair(u.filename(), set)).first;
+ it = distfiles.insert(std::make_pair(node.spec()->filename(), set)).first;
}
it->second->insert(id);
}
@@ -247,7 +249,7 @@ paludis::erepository::manifest_check(
if ((*it)->fetches_key())
{
DistfilesCollector c(*it, checker.distfiles);
- (*it)->fetches_key()->value()->accept(c);
+ (*it)->fetches_key()->value()->root()->accept(c);
}
}
diff --git a/paludis/repositories/e/qa/metadata_keys.cc b/paludis/repositories/e/qa/metadata_keys.cc
index ae49b7db3..70806219a 100644
--- a/paludis/repositories/e/qa/metadata_keys.cc
+++ b/paludis/repositories/e/qa/metadata_keys.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
* Copyright (c) 2008 David Leverton
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -23,7 +23,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/qa.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/log.hh>
#include <paludis/util/set.hh>
@@ -77,32 +76,32 @@ namespace
void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k)
{
- const std::tr1::shared_ptr<PlainTextSpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ const std::tr1::shared_ptr<const PlainTextSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
{
- const std::tr1::shared_ptr<ProvideSpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ const std::tr1::shared_ptr<const ProvideSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
- const std::tr1::shared_ptr<FetchableURISpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ const std::tr1::shared_ptr<const FetchableURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
- const std::tr1::shared_ptr<SimpleURISpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ const std::tr1::shared_ptr<const SimpleURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
{
- const std::tr1::shared_ptr<LicenseSpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ const std::tr1::shared_ptr<const LicenseSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
{
- const std::tr1::shared_ptr<DependencySpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ const std::tr1::shared_ptr<const DependencySpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
void visit(const MetadataCollectionKey<PackageIDSequence> & k)
diff --git a/paludis/repositories/e/qa/restrict_key.cc b/paludis/repositories/e/qa/restrict_key.cc
index b2ee1152f..eb006aefd 100644
--- a/paludis/repositories/e/qa/restrict_key.cc
+++ b/paludis/repositories/e/qa/restrict_key.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -20,7 +20,6 @@
#include "restrict_key.hh"
#include <paludis/qa.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/log.hh>
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/name.hh>
@@ -53,14 +52,8 @@ namespace
}
};
- struct RestrictChecker :
- ConstVisitor<PlainTextSpecTree>,
- ConstVisitor<PlainTextSpecTree>::VisitConstSequence<RestrictChecker, AllDepSpec>,
- ConstVisitor<PlainTextSpecTree>::VisitConstSequence<RestrictChecker, ConditionalDepSpec>
+ struct RestrictChecker
{
- using ConstVisitor<PlainTextSpecTree>::VisitConstSequence<RestrictChecker, ConditionalDepSpec>::visit_sequence;
- using ConstVisitor<PlainTextSpecTree>::VisitConstSequence<RestrictChecker, AllDepSpec>::visit_sequence;
-
const std::set<std::string> & allowed_restricts;
const std::tr1::shared_ptr<const MetadataKey> & key;
@@ -84,28 +77,38 @@ namespace
{
}
- void visit_leaf(const PlainTextLabelDepSpec & t)
+ void visit(const PlainTextSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node)
{
reporter.message(QAMessage(entry, qaml_normal, name,
- "Unexpected label '" + stringify(t) + "' in '" + key->raw_name() + "@")
+ "Unexpected label '" + stringify(node.spec()->text()) + "' in '" + key->raw_name() + "@")
.with_associated_id(id)
.with_associated_key(id, key));
}
- void visit_leaf(const PlainTextDepSpec & t)
+ void visit(const PlainTextSpecTree::NodeType<PlainTextDepSpec>::Type & node)
{
- if (allowed_restricts.end() == allowed_restricts.find(t.text()))
+ if (allowed_restricts.end() == allowed_restricts.find(node.spec()->text()))
reporter.message(QAMessage(entry, qaml_normal, name,
- "Unrecognised value '" + t.text() + "' in '" + key->raw_name() + "'")
+ "Unrecognised value '" + node.spec()->text() + "' in '" + key->raw_name() + "'")
.with_associated_id(id)
.with_associated_key(id, key));
- else if (0 == t.text().compare(0, 2, "no"))
+ else if (0 == node.spec()->text().compare(0, 2, "no"))
reporter.message(QAMessage(entry, qaml_minor, name,
- "Deprecated value '" + t.text() + "' in '" + key->raw_name() + "' (use '" + t.text().substr(2) + "' instead)")
+ "Deprecated value '" + node.spec()->text() + "' in '" + key->raw_name() + "' (use '" + node.spec()->text().substr(2) + "' instead)")
.with_associated_id(id)
.with_associated_key(id, key));
}
+
+ void visit(const PlainTextSpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
};
}
@@ -123,7 +126,7 @@ paludis::erepository::restrict_key_check(
if (id->restrict_key())
{
RestrictChecker r(id->restrict_key(), entry, reporter, id, name);
- id->restrict_key()->value()->accept(r);
+ id->restrict_key()->value()->root()->accept(r);
}
return true;
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 05fc9fe76..717331d62 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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,7 +31,6 @@
#include <paludis/util/save.hh>
#include <paludis/util/set.hh>
#include <paludis/util/system.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/mutex.hh>
@@ -39,6 +38,8 @@
#include <paludis/util/log.hh>
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/create_iterator-impl.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/elike_conditional_dep_spec.hh>
#include <algorithm>
#include <map>
@@ -85,8 +86,7 @@ namespace
}
};
- struct Checker :
- ConstVisitor<GenericSpecTree>
+ struct Checker
{
const FSEntry entry;
QAReporter & reporter;
@@ -121,62 +121,60 @@ namespace
{
}
- void visit_leaf(const PackageDepSpec & p)
+ void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node)
{
- if (pds_blacklist && p.package_ptr())
+ if (pds_blacklist && node.spec()->package_ptr())
{
- if (pds_blacklist->end() != pds_blacklist->find(*p.package_ptr()))
- reporter.message(QAMessage(entry, qaml_maybe, name, "Package '" + stringify(p)
+ if (pds_blacklist->end() != pds_blacklist->find(*node.spec()->package_ptr()))
+ reporter.message(QAMessage(entry, qaml_maybe, name, "Package '" + stringify(*node.spec())
+ "' blacklisted in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
}
}
- void visit_leaf(const BlockDepSpec & b)
+ void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node)
{
if (child_of_any)
reporter.message(QAMessage(entry, qaml_normal, name, "'|| ( )' with block child '"
- + stringify(b) + "' in '" + stringify(key->raw_name()) + "'")
+ + stringify(*node.spec()) + "' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
}
- void visit_leaf(const SimpleURIDepSpec &)
+ void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &)
{
}
- void visit_leaf(const FetchableURIDepSpec &)
+ void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type &)
{
}
- void visit_leaf(const PlainTextDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &)
{
}
- void visit_leaf(const PlainTextLabelDepSpec &)
+ void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &)
{
}
- void visit_leaf(const URILabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &)
{
}
- void visit_leaf(const DependencyLabelsDepSpec &)
+ void visit(const GenericSpecTree::NodeType<DependencyLabelsDepSpec>::Type &)
{
}
- void visit_leaf(const LicenseDepSpec &)
+ void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &)
{
}
- void visit_leaf(const NamedSetDepSpec &)
+ void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &)
{
}
- void visit_sequence(const ConditionalDepSpec & u,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+ void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
if (child_of_any)
reporter.message(QAMessage(entry, qaml_normal, name,
@@ -185,9 +183,9 @@ namespace
.with_associated_id(id)
.with_associated_key(id, key));
- if (uses.count(elike_conditional_dep_spec_flag(u)))
+ if (uses.count(elike_conditional_dep_spec_flag(*node.spec())))
reporter.message(QAMessage(entry, qaml_normal, name,
- "Recursive use of flag '" + stringify(elike_conditional_dep_spec_flag(u)) + "' in '"
+ "Recursive use of flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) + "' in '"
+ stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
@@ -195,7 +193,7 @@ namespace
std::tr1::shared_ptr<const ChoiceValue> value;
std::tr1::shared_ptr<const Choice> choice;
{
- ChoiceNameWithPrefix f(elike_conditional_dep_spec_flag(u));
+ ChoiceNameWithPrefix f(elike_conditional_dep_spec_flag(*node.spec()));
for (Choices::ConstIterator c(id->choices_key()->value()->begin()), c_end(id->choices_key()->value()->end()) ;
c != c_end && ! value ; ++c)
for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ;
@@ -212,7 +210,7 @@ namespace
if (! choice)
{
reporter.message(QAMessage(entry, qaml_normal, name,
- "Conditional flag '" + stringify(elike_conditional_dep_spec_flag(u)) +
+ "Conditional flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) +
"' in '" + stringify(key->raw_name()) + "' does not exist")
.with_associated_id(id)
.with_associated_key(id, key)
@@ -222,12 +220,12 @@ namespace
{
if (forbid_arch_flags)
reporter.message(QAMessage(entry, qaml_normal, name,
- "Arch flag '" + stringify(elike_conditional_dep_spec_flag(u)) + "' in '" + stringify(key->raw_name()) + "'")
+ "Arch flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) + "' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
- else if (elike_conditional_dep_spec_is_inverse(u) && forbid_inverse_arch_flags)
+ else if (elike_conditional_dep_spec_is_inverse(*node.spec()) && forbid_inverse_arch_flags)
reporter.message(QAMessage(entry, qaml_maybe, name,
- "Inverse arch flag '" + stringify(elike_conditional_dep_spec_flag(u)) + "' in '" + stringify(key->raw_name()) + "'")
+ "Inverse arch flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) + "' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
}
@@ -235,23 +233,21 @@ namespace
Save<unsigned> save_level(&level, level + 1);
Save<bool> save_child_of_any(&child_of_any, false);
Save<std::set<ChoiceNameWithPrefix> > save_uses(&uses, uses);
- uses.insert(elike_conditional_dep_spec_flag(u));
- if (cur == end)
+ uses.insert(elike_conditional_dep_spec_flag(*node.spec()));
+ if (node.begin() == node.end())
reporter.message(QAMessage(entry, qaml_normal, name,
"Empty 'use? ( )' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
else
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
- void visit_sequence(const AllDepSpec &,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+ void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node)
{
Save<unsigned> save_level(&level, level + 1);
Save<bool> save_child_of_any(&child_of_any, false);
- if (cur == end)
+ if (node.begin() == node.end())
{
if (level > 1)
reporter.message(QAMessage(entry, qaml_normal, name,
@@ -260,30 +256,28 @@ namespace
.with_associated_key(id, key));
}
else
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
- void visit_sequence(const AnyDepSpec &,
- GenericSpecTree::ConstSequenceIterator cur,
- GenericSpecTree::ConstSequenceIterator end)
+ void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node)
{
Save<unsigned> save_level(&level, level + 1);
Save<bool> save_child_of_any(&child_of_any, true);
- if (cur == end)
+ if (node.begin() == node.end())
reporter.message(QAMessage(entry, qaml_normal, name,
"Empty '|| ( )' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
- else if (next(cur) == end)
+ else if (next(node.begin()) == node.end())
{
- cur->accept(*this);
+ (*node.begin())->accept(*this);
reporter.message(QAMessage(entry, qaml_normal, name,
"'|| ( )' with only one child in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
.with_associated_key(id, key));
}
else
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
};
@@ -381,7 +375,7 @@ namespace
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), false, false);
- k.value()->accept(c);
+ k.value()->root()->accept(c);
}
catch (const InternalError &)
{
@@ -402,7 +396,7 @@ namespace
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
- k.value()->accept(c);
+ k.value()->root()->accept(c);
}
catch (const InternalError &)
{
@@ -423,7 +417,7 @@ namespace
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
- k.value()->accept(c);
+ k.value()->root()->accept(c);
}
catch (const InternalError &)
{
@@ -444,7 +438,7 @@ namespace
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
Checker c(entry, reporter, id, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), false, true);
- k.value()->accept(c);
+ k.value()->root()->accept(c);
}
catch (const InternalError &)
{
@@ -465,7 +459,7 @@ namespace
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
Checker c(entry, reporter, id, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), true, true);
- k.value()->accept(c);
+ k.value()->root()->accept(c);
}
catch (const InternalError &)
{
@@ -486,7 +480,7 @@ namespace
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
- k.value()->accept(c);
+ k.value()->root()->accept(c);
}
catch (const InternalError &)
{
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index 37e6e84bc..6a8c0919e 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -24,7 +24,6 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/log.hh>
#include <paludis/util/set.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/qa.hh>
@@ -49,8 +48,7 @@ using namespace paludis::erepository;
namespace
{
- struct Checker :
- ConstVisitor<DependencySpecTree>
+ struct Checker
{
const FSEntry entry;
QAReporter * const reporter;
@@ -92,27 +90,27 @@ namespace
{
}
- void visit_leaf(const BlockDepSpec &)
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
{
viable = true;
}
- void visit_leaf(const DependencyLabelsDepSpec &)
+ void visit(const DependencySpecTree::NodeType<DependencyLabelsDepSpec>::Type &)
{
}
- void visit_leaf(const NamedSetDepSpec &)
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type &)
{
}
- void visit_leaf(const PackageDepSpec & orig_p)
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
{
using namespace std::tr1::placeholders;
success = false;
viable = true;
- const PackageDepSpec * p(&orig_p);
+ const PackageDepSpec * p(node.spec().get());
std::tr1::shared_ptr<PackageDepSpec> local_p;
/* rewrite virtuals to avoid problems later on */
@@ -126,18 +124,18 @@ namespace
if (v->second->version_requirements_ptr())
std::for_each(v->second->version_requirements_ptr()->begin(), v->second->version_requirements_ptr()->end(),
std::tr1::bind(&PartiallyMadePackageDepSpec::version_requirement, &pp, _1));
- if (orig_p.version_requirements_ptr())
- std::for_each(orig_p.version_requirements_ptr()->begin(), orig_p.version_requirements_ptr()->end(),
+ if (node.spec()->version_requirements_ptr())
+ std::for_each(node.spec()->version_requirements_ptr()->begin(), node.spec()->version_requirements_ptr()->end(),
std::tr1::bind(&PartiallyMadePackageDepSpec::version_requirement, &pp, _1));
pp.package(*v->second->package_ptr());
- if (orig_p.slot_requirement_ptr())
- pp.slot_requirement(orig_p.slot_requirement_ptr());
- if (orig_p.in_repository_ptr())
- pp.in_repository(*orig_p.in_repository_ptr());
+ if (node.spec()->slot_requirement_ptr())
+ pp.slot_requirement(node.spec()->slot_requirement_ptr());
+ if (node.spec()->in_repository_ptr())
+ pp.in_repository(*node.spec()->in_repository_ptr());
local_p.reset(new PackageDepSpec(pp));
- local_p->set_tag(orig_p.tag());
+ local_p->set_tag(node.spec()->tag());
p = local_p.get();
}
}
@@ -149,7 +147,7 @@ namespace
{
if (reporter)
reporter->message(QAMessage(entry, qaml_normal, name, "No packages matching '"
- + stringify(orig_p) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '"
+ + stringify(*node.spec()) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '"
+ stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "."
+ stringify((*profile).status())
+ (unstable ? ".unstable" : ".stable") + ")")
@@ -192,7 +190,7 @@ namespace
{
Log::get_instance()->message("e.qa.visibility_check.no_masks", ll_warning, lc_context)
<< "Probably a bug: don't know how to get masks for '"
- << **i << "' from '" << orig_p << "' -> '" << *p << "'";
+ << **i << "' from '" << *node.spec() << "' -> '" << *p << "'";
continue;
}
}
@@ -213,7 +211,7 @@ namespace
if (! success)
if (reporter)
reporter->message(QAMessage(entry, qaml_normal, name, "No visible packages matching '"
- + stringify(orig_p) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '"
+ + stringify(*node.spec()) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '"
+ stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status())
+ (unstable ? ".unstable" : ".stable") + ")")
.with_associated_id(id)
@@ -221,11 +219,9 @@ namespace
}
}
- void visit_sequence(const ConditionalDepSpec & u,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- ChoiceNameWithPrefix prefixed(elike_conditional_dep_spec_flag(u));
+ ChoiceNameWithPrefix prefixed(elike_conditional_dep_spec_flag(*node.spec()));
UnprefixedChoiceName value("x");
std::tr1::shared_ptr<const Choice> choice;
if (id->choices_key())
@@ -263,25 +259,24 @@ namespace
}
else
viable =
- ((! elike_conditional_dep_spec_is_inverse(u)) && (! (*profile).profile()->use_masked(
+ ((! elike_conditional_dep_spec_is_inverse(*node.spec())) && (! (*profile).profile()->use_masked(
id, choice, value, prefixed))) ||
- ((elike_conditional_dep_spec_is_inverse(u)) && (! (*profile).profile()->use_forced(
+ ((elike_conditional_dep_spec_is_inverse(*node.spec())) && (! (*profile).profile()->use_forced(
id, choice, value, prefixed)));
if (viable)
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
- void visit_sequence(const AnyDepSpec &,
- DependencySpecTree::ConstSequenceIterator begin,
- DependencySpecTree::ConstSequenceIterator end)
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
{
success = true;
viable = true;
- for (DependencySpecTree::ConstSequenceIterator cur(begin) ; cur != end ; ++cur)
+ for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator cur(node.begin()), cur_end(node.end()) ;
+ cur != cur_end ; ++cur)
{
Checker c(entry, 0, env, id, repo, accepted_keywords, profile, name, unstable, key);
- accept_visitor(c)(*cur);
+ accept_visitor(c)(**cur);
if (c.success)
{
success = true;
@@ -297,7 +292,7 @@ namespace
{
StringifyFormatter ff;
DepSpecPrettyPrinter printer(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
- std::for_each(begin, end, accept_visitor(printer));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(printer));
reporter->message(QAMessage(entry, qaml_normal, name, "No item in block '|| ( "
+ stringify(printer) + " )' visible for profile '"
+ stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status())
@@ -308,12 +303,10 @@ namespace
}
}
- void visit_sequence(const AllDepSpec &,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
{
viable = true;
- std::for_each(cur, end, accept_visitor(*this));
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
};
}
@@ -354,25 +347,25 @@ paludis::erepository::visibility_check(
if (id->build_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->build_dependencies_key());
- id->build_dependencies_key()->value()->accept(c);
+ id->build_dependencies_key()->value()->root()->accept(c);
}
if (id->run_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->run_dependencies_key());
- id->run_dependencies_key()->value()->accept(c);
+ id->run_dependencies_key()->value()->root()->accept(c);
}
if (id->post_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->post_dependencies_key());
- id->post_dependencies_key()->value()->accept(c);
+ id->post_dependencies_key()->value()->root()->accept(c);
}
if (id->suggested_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->suggested_dependencies_key());
- id->post_dependencies_key()->value()->accept(c);
+ id->post_dependencies_key()->value()->root()->accept(c);
}
}
else
@@ -391,25 +384,25 @@ paludis::erepository::visibility_check(
if (id->build_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->build_dependencies_key());
- id->build_dependencies_key()->value()->accept(c);
+ id->build_dependencies_key()->value()->root()->accept(c);
}
if (id->run_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->run_dependencies_key());
- id->run_dependencies_key()->value()->accept(c);
+ id->run_dependencies_key()->value()->root()->accept(c);
}
if (id->post_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->post_dependencies_key());
- id->post_dependencies_key()->value()->accept(c);
+ id->post_dependencies_key()->value()->root()->accept(c);
}
if (id->suggested_dependencies_key())
{
Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->suggested_dependencies_key());
- id->post_dependencies_key()->value()->accept(c);
+ id->post_dependencies_key()->value()->root()->accept(c);
}
}
}
diff --git a/paludis/repositories/e/source_uri_finder.cc b/paludis/repositories/e/source_uri_finder.cc
index 47b8f5066..283171f2e 100644
--- a/paludis/repositories/e/source_uri_finder.cc
+++ b/paludis/repositories/e/source_uri_finder.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -18,10 +18,12 @@
*/
#include <paludis/repositories/e/source_uri_finder.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/log.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/repository.hh>
#include <paludis/environment.hh>
#include <paludis/action.hh>
@@ -218,3 +220,5 @@ SourceURIFinder::add_listed()
}
}
+template class WrappedForwardIterator<SourceURIFinder::ConstIteratorTag, const std::pair<std::string, std::string> >;
+
diff --git a/paludis/repositories/e/source_uri_finder.hh b/paludis/repositories/e/source_uri_finder.hh
index 1e48bbf27..8b8fbd5c1 100644
--- a/paludis/repositories/e/source_uri_finder.hh
+++ b/paludis/repositories/e/source_uri_finder.hh
@@ -22,7 +22,6 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/visitor.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
#include <paludis/dep_label.hh>
#include <paludis/environment-fwd.hh>
diff --git a/paludis/repositories/e/source_uri_finder_TEST.cc b/paludis/repositories/e/source_uri_finder_TEST.cc
index b99e135cd..592a2c357 100644
--- a/paludis/repositories/e/source_uri_finder_TEST.cc
+++ b/paludis/repositories/e/source_uri_finder_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -20,8 +20,8 @@
#include <paludis/repositories/e/source_uri_finder.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/package_database.hh>
-#include <paludis/util/visitor-impl.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index ef384ddea..da1fbf3a2 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -61,7 +61,6 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/map.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/system.hh>
@@ -639,9 +638,9 @@ VDBRepository::provides_from_package_id(const PackageID & id) const
if (! id.provide_key())
return;
- std::tr1::shared_ptr<const ProvideSpecTree::ConstItem> provide(id.provide_key()->value());
+ std::tr1::shared_ptr<const ProvideSpecTree> provide(id.provide_key()->value());
DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->params.environment());
- provide->accept(f);
+ provide->root()->accept(f);
std::tr1::shared_ptr<Sequence<QualifiedPackageName> > qpns(new Sequence<QualifiedPackageName>);
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 5d0e1ceaa..6a3f71db2 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -24,7 +24,6 @@
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/options.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/make_named_values.hh>
@@ -279,17 +278,17 @@ namespace test_cases
erepository::DepSpecPrettyPrinter pd(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id->build_dependencies_key());
- id->build_dependencies_key()->value()->accept(pd);
+ id->build_dependencies_key()->value()->root()->accept(pd);
TEST_CHECK_STRINGIFY_EQUAL(pd, "( cat/pkg1 build: cat/pkg2 build,run: cat/pkg3 suggested: cat/pkg4 post: )");
erepository::DepSpecPrettyPrinter pr(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id->run_dependencies_key());
- id->run_dependencies_key()->value()->accept(pr);
+ id->run_dependencies_key()->value()->root()->accept(pr);
TEST_CHECK_STRINGIFY_EQUAL(pr, "( cat/pkg1 build: build,run: cat/pkg3 suggested: cat/pkg4 post: )");
erepository::DepSpecPrettyPrinter pp(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false);
TEST_CHECK(id->post_dependencies_key());
- id->post_dependencies_key()->value()->accept(pp);
+ id->post_dependencies_key()->value()->root()->accept(pp);
TEST_CHECK_STRINGIFY_EQUAL(pp, "( build: build,run: suggested: post: cat/pkg5 )");
}
} test_vdb_repository_dependencies_rewriter;
@@ -851,6 +850,11 @@ namespace test_cases
{
std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence> seq(vdb_repo->provides_interface()->provided_packages());
+
+ for (RepositoryProvidesInterface::ProvidesSequence::ConstIterator s(seq->begin()), s_end(seq->end()) ;
+ s != s_end ; ++s)
+ TestMessageSuffix x(stringify(s->virtual_name()) + " by " + stringify(*s->provided_by()), true);
+
TEST_CHECK_EQUAL(std::distance(seq->begin(), seq->end()), 5U);
RepositoryProvidesInterface::ProvidesSequence::ConstIterator it(seq->begin());