aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-12 19:29:09 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-13 00:50:37 +0000
commit3ff3aa41ac733cb8a0c0d7e532b3cdd56673ddd0 (patch)
tree1159c5580577715e4279de0c8a39fe38738ae325
parentc4b5049c5c9064c0f694440f91136695b6e7e193 (diff)
downloadpaludis-3ff3aa41ac733cb8a0c0d7e532b3cdd56673ddd0.tar.gz
paludis-3ff3aa41ac733cb8a0c0d7e532b3cdd56673ddd0.tar.xz
New, simpler visitor framework.
Convert everything except the tree things, to begin with.
-rw-r--r--doc/api/cplusplus/examples/example_contents.cc3
-rw-r--r--doc/api/cplusplus/examples/example_dep_label.cc3
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec_flattener.cc8
-rw-r--r--doc/api/cplusplus/examples/example_dep_tag.cc3
-rw-r--r--doc/api/cplusplus/examples/example_mask.cc3
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc3
-rw-r--r--paludis/action-fwd.hh3
-rw-r--r--paludis/action.cc92
-rw-r--r--paludis/action.hh115
-rw-r--r--paludis/args/args_dumper.hh4
-rw-r--r--paludis/args/args_handler.hh2
-rw-r--r--paludis/args/args_option.hh18
-rw-r--r--paludis/args/args_visitor.cc24
-rw-r--r--paludis/args/args_visitor.hh24
-rw-r--r--paludis/args/man.cc8
-rw-r--r--paludis/contents-fwd.hh4
-rw-r--r--paludis/contents.cc33
-rw-r--r--paludis/contents.hh58
-rw-r--r--paludis/dep_label-fwd.hh2
-rw-r--r--paludis/dep_label.cc71
-rw-r--r--paludis/dep_label.hh254
-rw-r--r--paludis/dep_list.cc3
-rw-r--r--paludis/dep_spec-fwd.hh4
-rw-r--r--paludis/dep_spec.cc13
-rw-r--r--paludis/dep_spec.hh8
-rw-r--r--paludis/dep_tag-fwd.hh2
-rw-r--r--paludis/dep_tag.cc24
-rw-r--r--paludis/dep_tag.hh48
-rw-r--r--paludis/dep_tree.hh2
-rw-r--r--paludis/elike_conditional_dep_spec.cc7
-rw-r--r--paludis/handled_information-fwd.hh2
-rw-r--r--paludis/handled_information.hh44
-rw-r--r--paludis/install_task.cc12
-rw-r--r--paludis/mask-fwd.hh2
-rw-r--r--paludis/mask.cc8
-rw-r--r--paludis/mask.hh36
-rw-r--r--paludis/match_package.cc3
-rw-r--r--paludis/metadata_key-fwd.hh2
-rw-r--r--paludis/metadata_key.hh77
-rw-r--r--paludis/override_functions.cc16
-rw-r--r--paludis/report_task.cc4
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc39
-rw-r--r--paludis/repositories/cran/cran_package_id.cc35
-rw-r--r--paludis/repositories/cran/cran_repository.cc40
-rw-r--r--paludis/repositories/cran/keys.cc1
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc3
-rw-r--r--paludis/repositories/e/dep_parser.cc2
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc4
-rw-r--r--paludis/repositories/e/dependencies_rewriter.cc7
-rw-r--r--paludis/repositories/e/e_choices_key.cc4
-rw-r--r--paludis/repositories/e/e_installed_repository.cc46
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc44
-rw-r--r--paludis/repositories/e/e_repository.cc42
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc60
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc26
-rw-r--r--paludis/repositories/e/ebuild_id.cc46
-rw-r--r--paludis/repositories/e/exndbam_id.cc1
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc4
-rw-r--r--paludis/repositories/e/myoptions_requirements_verifier.cc6
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc6
-rw-r--r--paludis/repositories/e/qa/fetches_key.cc2
-rw-r--r--paludis/repositories/e/qa/metadata_keys.cc3
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc3
-rw-r--r--paludis/repositories/e/source_uri_finder.hh3
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc3
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc38
-rw-r--r--paludis/repositories/fake/fake_package_id.cc3
-rw-r--r--paludis/repositories/fake/fake_repository.cc38
-rw-r--r--paludis/repositories/gems/gem_specification.cc12
-rw-r--r--paludis/repositories/gems/gem_specification_TEST.cc6
-rw-r--r--paludis/repositories/gems/gem_specifications.cc9
-rw-r--r--paludis/repositories/gems/gems_repository.cc38
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc39
-rw-r--r--paludis/repositories/gems/yaml-fwd.hh3
-rw-r--r--paludis/repositories/gems/yaml.cc3
-rw-r--r--paludis/repositories/gems/yaml.hh31
-rw-r--r--paludis/repositories/gems/yaml_TEST.cc5
-rw-r--r--paludis/repositories/unavailable/unavailable_id.cc4
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc38
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc43
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc46
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc3
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc6
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc1
-rw-r--r--paludis/repositories/unwritten/unwritten_id.cc4
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.cc38
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc38
-rw-r--r--paludis/repositories/virtuals/package_id.cc3
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc38
-rw-r--r--paludis/show_suggest_visitor.cc3
-rw-r--r--paludis/slot_requirement-fwd.hh1
-rw-r--r--paludis/slot_requirement.cc5
-rw-r--r--paludis/slot_requirement.hh23
-rw-r--r--paludis/unchoices_key.cc1
-rw-r--r--paludis/uninstall_list.cc4
-rw-r--r--paludis/util/files.m43
-rw-r--r--paludis/util/simple_visitor-fwd.hh55
-rw-r--r--paludis/util/simple_visitor-impl.hh30
-rw-r--r--paludis/util/simple_visitor.cc21
-rw-r--r--paludis/util/simple_visitor.hh177
-rw-r--r--paludis/util/simple_visitor_cast-fwd.hh31
-rw-r--r--paludis/util/simple_visitor_cast.cc23
-rw-r--r--paludis/util/simple_visitor_cast.hh51
-rw-r--r--paludis/util/type_list-fwd.hh70
-rw-r--r--paludis/util/type_list.cc21
-rw-r--r--paludis/util/type_list.hh150
-rw-r--r--python/mask.cc3
-rw-r--r--python/metadata_key.cc3
-rw-r--r--ruby/contents.cc3
-rw-r--r--ruby/dep_spec.cc6
-rw-r--r--ruby/dep_tag.cc4
-rw-r--r--ruby/mask.cc3
-rw-r--r--ruby/metadata_key.cc3
-rw-r--r--src/clients/cave/cmd_print_environment_metadata.cc4
-rw-r--r--src/clients/cave/cmd_print_id_metadata.cc4
-rw-r--r--src/clients/cave/cmd_print_ids.cc12
-rw-r--r--src/clients/cave/cmd_show.cc15
-rw-r--r--src/clients/cave/format_plain_contents_entry.cc3
-rw-r--r--src/clients/cave/format_plain_metadata_key.cc3
-rw-r--r--src/clients/inquisitio/key_extractor.cc3
-rw-r--r--src/clients/instruo/instruo.cc9
-rw-r--r--src/clients/paludis/applets.cc3
-rw-r--r--src/clients/paludis/do_contents.cc3
-rw-r--r--src/clients/paludis/do_executables.cc3
-rw-r--r--src/clients/paludis/info.cc9
-rw-r--r--src/clients/paludis/owner.cc3
-rw-r--r--src/clients/qualudis/qualudis.cc3
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc4
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc10
-rw-r--r--src/clients/reconcilio/littlelf/elf.cc24
-rw-r--r--src/clients/reconcilio/littlelf/elf_dynamic_section.cc26
-rw-r--r--src/clients/reconcilio/littlelf/elf_dynamic_section.hh41
-rw-r--r--src/clients/reconcilio/littlelf/elf_relocation_section.hh2
-rw-r--r--src/clients/reconcilio/littlelf/elf_sections.hh58
-rw-r--r--src/clients/reconcilio/littlelf/elf_symbol_section.cc14
-rw-r--r--src/clients/reconcilio/littlelf/elf_symbol_section.hh2
-rw-r--r--src/output/console_install_task.cc4
-rw-r--r--src/output/console_install_task.hh6
-rw-r--r--src/output/console_query_task.cc3
-rw-r--r--src/output/mask_displayer.cc3
-rw-r--r--src/output/mask_displayer.hh1
141 files changed, 1410 insertions, 1528 deletions
diff --git a/doc/api/cplusplus/examples/example_contents.cc b/doc/api/cplusplus/examples/example_contents.cc
index 31069d6..2aa398f 100644
--- a/doc/api/cplusplus/examples/example_contents.cc
+++ b/doc/api/cplusplus/examples/example_contents.cc
@@ -29,8 +29,7 @@ using std::setw;
namespace
{
/* This visitor displays information about ContentsEntry subclasses. */
- class ContentsPrinter :
- public ConstVisitor<ContentsVisitorTypes>
+ class ContentsPrinter
{
public:
void visit(const ContentsDevEntry & d)
diff --git a/doc/api/cplusplus/examples/example_dep_label.cc b/doc/api/cplusplus/examples/example_dep_label.cc
index 5823f99..3b01329 100644
--- a/doc/api/cplusplus/examples/example_dep_label.cc
+++ b/doc/api/cplusplus/examples/example_dep_label.cc
@@ -42,8 +42,7 @@ namespace
{
/* This visitor class is used to determine whether a label represents a
* fetch restriction. */
- class IsLabelRestrictedVisitor :
- public ConstVisitor<URILabelVisitorTypes>
+ class IsLabelRestrictedVisitor
{
public:
bool result;
diff --git a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
index d46accc..430232e 100644
--- a/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec_flattener.cc
@@ -83,15 +83,15 @@ int main(int argc, char * argv[])
/* And again for restricts. There's no global restrict key, since
* it has no meaning outside of the repositories that support it.
* Instead, we use PackageID::find_metadata to see if the key we
- * want exists, and then visitor_cast<> to see whether it's of a
- * suitable type (the key could be something other than a
+ * want exists, and then simple_visitor_cast<> to see whether it's
+ * of a suitable type (the key could be something other than a
* MetadataSpecTreeKey<PlainTextSpecTree>). */
if ((*i)->end_metadata() != (*i)->find_metadata("RESTRICT") &&
- visitor_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >(**(*i)->find_metadata("RESTRICT")))
+ simple_visitor_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >(**(*i)->find_metadata("RESTRICT")))
{
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(env.get());
- visitor_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >(
+ simple_visitor_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >(
**(*i)->find_metadata("RESTRICT"))->value()->accept(restricts);
cout << " " << left << setw(24) << "Restricts:" << " "
diff --git a/doc/api/cplusplus/examples/example_dep_tag.cc b/doc/api/cplusplus/examples/example_dep_tag.cc
index b44c324..46c8999 100644
--- a/doc/api/cplusplus/examples/example_dep_tag.cc
+++ b/doc/api/cplusplus/examples/example_dep_tag.cc
@@ -35,8 +35,7 @@ typedef std::set<std::string> SeenCategories;
namespace
{
/* This visitor is used to display information about a tag. */
- class TagDisplayer :
- public ConstVisitor<DepTagVisitorTypes>
+ class TagDisplayer
{
public:
void visit(const DependencyDepTag & tag)
diff --git a/doc/api/cplusplus/examples/example_mask.cc b/doc/api/cplusplus/examples/example_mask.cc
index aefbee8..9a312bf 100644
--- a/doc/api/cplusplus/examples/example_mask.cc
+++ b/doc/api/cplusplus/examples/example_mask.cc
@@ -32,8 +32,7 @@ namespace
{
/* We use this visitor to display extra information about a Mask,
* depending upon its type. */
- class MaskInformationVisitor :
- public ConstVisitor<MaskVisitorTypes>
+ class MaskInformationVisitor
{
public:
void visit(const UserMask &)
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 381a426..fcda0fa 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -34,8 +34,7 @@ namespace
/* We use this visitor to display extra information about a MetadataKey,
* depending upon its type. */
- class MetadataKeyInformationVisitor :
- public ConstVisitor<MetadataKeyVisitorTypes>
+ class MetadataKeyInformationVisitor
{
private:
/* Various methods need a formatter. See \ref example_stringify_formatter.cc
diff --git a/paludis/action-fwd.hh b/paludis/action-fwd.hh
index 3ae5504..a18d890 100644
--- a/paludis/action-fwd.hh
+++ b/paludis/action-fwd.hh
@@ -44,9 +44,6 @@ namespace paludis
class SupportsActionTestBase;
template <typename A_> class SupportsActionTest;
- class ActionVisitorTypes;
- class SupportsActionTestVisitorTypes;
-
class ActionError;
class UnsupportedActionError;
class InstallActionError;
diff --git a/paludis/action.cc b/paludis/action.cc
index d1620bd..d8fcf24 100644
--- a/paludis/action.cc
+++ b/paludis/action.cc
@@ -19,7 +19,6 @@
#include <paludis/action.hh>
#include <paludis/repository.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/sequence-impl.hh>
@@ -172,58 +171,51 @@ UnsupportedActionError::UnsupportedActionError(const PackageID & id, const Actio
namespace
{
- struct ActionStringifier :
- ConstVisitor<ActionVisitorTypes>
+ struct ActionStringifier
{
- std::ostream & s;
-
- ActionStringifier(std::ostream & ss) :
- s(ss)
+ std::string visit(const InstallAction & a)
{
- }
-
- void visit(const InstallAction & a)
- {
- s << "install to ";
+ std::string s("install to ");
if (a.options.destination())
- s << a.options.destination()->name();
+ s.append(stringify(a.options.destination()->name()));
else
- s << "nowhere";
+ s.append("nowhere");
+ return s;
}
- void visit(const UninstallAction &)
+ std::string visit(const UninstallAction &)
{
- s << "uninstall";
+ return "uninstall";
}
- void visit(const PretendAction &)
+ std::string visit(const PretendAction &)
{
- s << "pretend";
+ return "pretend";
}
- void visit(const InstalledAction &)
+ std::string visit(const InstalledAction &)
{
- s << "installed";
+ return "installed";
}
- void visit(const ConfigAction &)
+ std::string visit(const ConfigAction &)
{
- s << "config";
+ return "config";
}
- void visit(const InfoAction &)
+ std::string visit(const InfoAction &)
{
- s << "info";
+ return "info";
}
- void visit(const FetchAction &)
+ std::string visit(const FetchAction &)
{
- s << "fetch";
+ return "fetch";
}
- void visit(const PretendFetchAction &)
+ std::string visit(const PretendFetchAction &)
{
- s << "pretend fetch";
+ return "pretend fetch";
}
};
}
@@ -231,9 +223,8 @@ namespace
std::ostream &
paludis::operator<< (std::ostream & s, const Action & a)
{
- ActionStringifier t(s);
- a.accept(t);
- return s;
+ ActionStringifier t;
+ return s << a.accept_returning<std::string>(t);
}
ActionError::ActionError(const std::string & msg) throw () :
@@ -283,45 +274,6 @@ InfoActionError::InfoActionError(const std::string & msg) throw () :
{
}
-template class AcceptInterface<ActionVisitorTypes>;
-template class AcceptInterface<SupportsActionTestVisitorTypes>;
-
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, ConfigAction>;
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, FetchAction>;
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, InfoAction>;
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, InstallAction>;
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, InstalledAction>;
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, PretendAction>;
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, PretendFetchAction>;
-template class AcceptInterfaceVisitsThis<ActionVisitorTypes, UninstallAction>;
-
-template class Visits<ConfigAction>;
-template class Visits<FetchAction>;
-template class Visits<InfoAction>;
-template class Visits<InstallAction>;
-template class Visits<InstalledAction>;
-template class Visits<PretendAction>;
-template class Visits<PretendFetchAction>;
-template class Visits<UninstallAction>;
-
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<ConfigAction> >;
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<FetchAction> >;
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InfoAction> >;
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstallAction> >;
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstalledAction> >;
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<PretendAction> >;
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<PretendFetchAction> >;
-template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<UninstallAction> >;
-
-template class Visits<SupportsActionTest<ConfigAction> >;
-template class Visits<SupportsActionTest<FetchAction> >;
-template class Visits<SupportsActionTest<InfoAction> >;
-template class Visits<SupportsActionTest<InstallAction> >;
-template class Visits<SupportsActionTest<InstalledAction> >;
-template class Visits<SupportsActionTest<PretendAction> >;
-template class Visits<SupportsActionTest<PretendFetchAction> >;
-template class Visits<SupportsActionTest<UninstallAction> >;
-
template class PrivateImplementationPattern<FetchAction>;
template class PrivateImplementationPattern<InstallAction>;
template class PrivateImplementationPattern<PretendAction>;
diff --git a/paludis/action.hh b/paludis/action.hh
index 59f9662..5577872 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -24,13 +24,14 @@
#include <paludis/repository-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/util/attributes.hh>
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/output_deviator-fwd.hh>
+#include <paludis/util/type_list.hh>
#include <tr1/functional>
/** \file
@@ -126,52 +127,6 @@ namespace paludis
};
/**
- * Types for visiting an action.
- *
- * \since 0.26
- * \ingroup g_actions
- * \nosubgrouping
- */
- struct ActionVisitorTypes :
- VisitorTypes<
- ActionVisitorTypes,
- Action,
- InstallAction,
- FetchAction,
- InstalledAction,
- UninstallAction,
- PretendAction,
- ConfigAction,
- InfoAction,
- PretendFetchAction
- >
- {
- };
-
- /**
- * Types for visiting a supports action query.
- *
- * \since 0.26
- * \ingroup g_actions
- * \nosubgrouping
- */
- struct SupportsActionTestVisitorTypes :
- VisitorTypes<
- SupportsActionTestVisitorTypes,
- SupportsActionTestBase,
- SupportsActionTest<InstallAction>,
- SupportsActionTest<FetchAction>,
- SupportsActionTest<InstalledAction>,
- SupportsActionTest<UninstallAction>,
- SupportsActionTest<PretendAction>,
- SupportsActionTest<ConfigAction>,
- SupportsActionTest<InfoAction>,
- SupportsActionTest<PretendFetchAction>
- >
- {
- };
-
- /**
* An Action represents an action that can be executed by a PackageID via
* PackageID::perform_action.
*
@@ -180,7 +135,9 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE Action :
- public virtual AcceptInterface<ActionVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<Action, MakeTypeList<
+ InstallAction, InstalledAction, UninstallAction, PretendAction, ConfigAction, FetchAction,
+ InfoAction, PretendFetchAction>::Type>
{
public:
///\name Basic operations
@@ -202,7 +159,7 @@ namespace paludis
class PALUDIS_VISIBLE InstallAction :
public Action,
private PrivateImplementationPattern<InstallAction>,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, InstallAction>
+ public ImplementAcceptMethods<Action, InstallAction>
{
public:
///\name Basic operations
@@ -228,7 +185,7 @@ namespace paludis
class PALUDIS_VISIBLE FetchAction :
public Action,
private PrivateImplementationPattern<FetchAction>,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, FetchAction>
+ public ImplementAcceptMethods<Action, FetchAction>
{
public:
///\name Basic operations
@@ -253,7 +210,7 @@ namespace paludis
class PALUDIS_VISIBLE UninstallAction :
public Action,
private PrivateImplementationPattern<UninstallAction>,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, UninstallAction>
+ public ImplementAcceptMethods<Action, UninstallAction>
{
public:
///\name Basic operations
@@ -280,7 +237,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE InstalledAction :
public Action,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, InstalledAction>
+ public ImplementAcceptMethods<Action, InstalledAction>
{
};
@@ -295,7 +252,7 @@ namespace paludis
class PALUDIS_VISIBLE PretendAction :
public Action,
private PrivateImplementationPattern<PretendAction>,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, PretendAction>
+ public ImplementAcceptMethods<Action, PretendAction>
{
public:
///\name Basic operations
@@ -324,7 +281,7 @@ namespace paludis
class PALUDIS_VISIBLE PretendFetchAction :
public Action,
private PrivateImplementationPattern<PretendFetchAction>,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, PretendFetchAction>
+ public ImplementAcceptMethods<Action, PretendFetchAction>
{
public:
///\name Basic operations
@@ -353,7 +310,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE ConfigAction :
public Action,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, ConfigAction>
+ public ImplementAcceptMethods<Action, ConfigAction>
{
};
@@ -372,7 +329,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE InfoAction:
public Action,
- public AcceptInterfaceVisitsThis<ActionVisitorTypes, InfoAction>
+ public ImplementAcceptMethods<Action, InfoAction>
{
};
@@ -385,7 +342,10 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE SupportsActionTestBase :
- public virtual AcceptInterface<SupportsActionTestVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<SupportsActionTestBase, MakeTypeList<
+ SupportsActionTest<InstallAction>, SupportsActionTest<InstalledAction>, SupportsActionTest<UninstallAction>,
+ SupportsActionTest<PretendAction>, SupportsActionTest<ConfigAction>, SupportsActionTest<FetchAction>,
+ SupportsActionTest<InfoAction>, SupportsActionTest<PretendFetchAction> >::Type>
{
public:
virtual ~SupportsActionTestBase() = 0;
@@ -409,7 +369,7 @@ namespace paludis
template <typename A_>
class PALUDIS_VISIBLE SupportsActionTest :
public SupportsActionTestBase,
- public AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<A_> >
+ public ImplementAcceptMethods<SupportsActionTestBase, SupportsActionTest<A_> >
{
};
@@ -568,45 +528,6 @@ namespace paludis
};
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
- extern template class AcceptInterface<ActionVisitorTypes>;
- extern template class AcceptInterface<SupportsActionTestVisitorTypes>;
-
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, ConfigAction>;
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, FetchAction>;
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, InfoAction>;
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, InstallAction>;
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, InstalledAction>;
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, PretendAction>;
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, PretendFetchAction>;
- extern template class AcceptInterfaceVisitsThis<ActionVisitorTypes, UninstallAction>;
-
- extern template class Visits<ConfigAction>;
- extern template class Visits<FetchAction>;
- extern template class Visits<InfoAction>;
- extern template class Visits<InstallAction>;
- extern template class Visits<InstalledAction>;
- extern template class Visits<PretendAction>;
- extern template class Visits<PretendFetchAction>;
- extern template class Visits<UninstallAction>;
-
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<ConfigAction> >;
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<FetchAction> >;
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InfoAction> >;
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstallAction> >;
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstalledAction> >;
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<PretendAction> >;
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<PretendFetchAction> >;
- extern template class AcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<UninstallAction> >;
-
- extern template class Visits<SupportsActionTest<ConfigAction> >;
- extern template class Visits<SupportsActionTest<FetchAction> >;
- extern template class Visits<SupportsActionTest<InfoAction> >;
- extern template class Visits<SupportsActionTest<InstallAction> >;
- extern template class Visits<SupportsActionTest<InstalledAction> >;
- extern template class Visits<SupportsActionTest<PretendAction> >;
- extern template class Visits<SupportsActionTest<PretendFetchAction> >;
- extern template class Visits<SupportsActionTest<UninstallAction> >;
-
extern template class PrivateImplementationPattern<FetchAction>;
extern template class PrivateImplementationPattern<InstallAction>;
extern template class PrivateImplementationPattern<PretendAction>;
diff --git a/paludis/args/args_dumper.hh b/paludis/args/args_dumper.hh
index 23cd164..5ad1fad 100644
--- a/paludis/args/args_dumper.hh
+++ b/paludis/args/args_dumper.hh
@@ -22,7 +22,6 @@
#include <iosfwd>
#include <paludis/args/args_visitor.hh>
-#include <paludis/util/visitor.hh>
/** \file
* Declarations for the ArgsDumper class.
@@ -50,8 +49,7 @@ namespace paludis
*
* \ingroup g_args
*/
- class PALUDIS_VISIBLE ArgsDumper :
- public ConstVisitor<ArgsVisitorTypes>
+ class PALUDIS_VISIBLE ArgsDumper
{
private:
std::ostream & _os;
diff --git a/paludis/args/args_handler.hh b/paludis/args/args_handler.hh
index be0206a..2f0320d 100644
--- a/paludis/args/args_handler.hh
+++ b/paludis/args/args_handler.hh
@@ -25,7 +25,7 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/options.hh>
#include <paludis/util/sequence.hh>
-
+#include <tr1/memory>
#include <iosfwd>
#include <string>
diff --git a/paludis/args/args_option.hh b/paludis/args/args_option.hh
index f3b4194..675e8c0 100644
--- a/paludis/args/args_option.hh
+++ b/paludis/args/args_option.hh
@@ -24,6 +24,7 @@
#include <paludis/args/args_visitor.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/type_list.hh>
/** \file
* Declarations for ArgsOption.
@@ -47,7 +48,8 @@ namespace paludis
* \ingroup g_args
*/
class PALUDIS_VISIBLE ArgsOption :
- public virtual AcceptInterface<ArgsVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<ArgsOption, MakeTypeList<
+ StringArg, AliasArg, SwitchArg, IntegerArg, EnumArg, StringSetArg, StringSequenceArg>::Type>
{
friend class ArgsHandler;
@@ -146,7 +148,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE SwitchArg :
public ArgsOption,
- public AcceptInterfaceVisitsThis<ArgsVisitorTypes, SwitchArg>
+ public ImplementAcceptMethods<ArgsOption, SwitchArg>
{
private:
bool _can_be_negated;
@@ -172,7 +174,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE StringArg :
public ArgsOption,
- public AcceptInterfaceVisitsThis<ArgsVisitorTypes, StringArg>
+ public ImplementAcceptMethods<ArgsOption, StringArg>
{
private:
std::string _argument;
@@ -213,7 +215,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE StringSetArg :
public ArgsOption,
- public AcceptInterfaceVisitsThis<ArgsVisitorTypes, StringSetArg>,
+ public ImplementAcceptMethods<ArgsOption, StringSetArg>,
private PrivateImplementationPattern<StringSetArg>
{
private:
@@ -316,7 +318,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE StringSequenceArg :
public ArgsOption,
- public AcceptInterfaceVisitsThis<ArgsVisitorTypes, StringSequenceArg>,
+ public ImplementAcceptMethods<ArgsOption, StringSequenceArg>,
private PrivateImplementationPattern<StringSequenceArg>
{
public:
@@ -358,7 +360,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE AliasArg :
public ArgsOption,
- public AcceptInterfaceVisitsThis<ArgsVisitorTypes, AliasArg>
+ public ImplementAcceptMethods<ArgsOption, AliasArg>
{
private:
ArgsOption * const _other;
@@ -408,7 +410,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE IntegerArg :
public ArgsOption,
- public AcceptInterfaceVisitsThis<ArgsVisitorTypes, IntegerArg>
+ public ImplementAcceptMethods<ArgsOption, IntegerArg>
{
private:
int _argument;
@@ -440,7 +442,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE EnumArg :
public ArgsOption,
- public AcceptInterfaceVisitsThis<ArgsVisitorTypes, EnumArg>,
+ public ImplementAcceptMethods<ArgsOption, EnumArg>,
private PrivateImplementationPattern<EnumArg>
{
private:
diff --git a/paludis/args/args_visitor.cc b/paludis/args/args_visitor.cc
index 24e6097..ec28a05 100644
--- a/paludis/args/args_visitor.cc
+++ b/paludis/args/args_visitor.cc
@@ -34,30 +34,6 @@
using namespace paludis;
using namespace paludis::args;
-template class Visitor<ArgsVisitorTypes>;
-template class AcceptInterface<ArgsVisitorTypes>;
-
-template class AcceptInterfaceVisitsThis<ArgsVisitorTypes, IntegerArg>;
-template class AcceptInterfaceVisitsThis<ArgsVisitorTypes, EnumArg>;
-template class AcceptInterfaceVisitsThis<ArgsVisitorTypes, StringArg>;
-template class AcceptInterfaceVisitsThis<ArgsVisitorTypes, StringSetArg>;
-template class AcceptInterfaceVisitsThis<ArgsVisitorTypes, AliasArg>;
-template class AcceptInterfaceVisitsThis<ArgsVisitorTypes, SwitchArg>;
-
-template class Visits<IntegerArg>;
-template class Visits<EnumArg>;
-template class Visits<StringArg>;
-template class Visits<StringSetArg>;
-template class Visits<AliasArg>;
-template class Visits<SwitchArg>;
-
-template class Visits<const IntegerArg>;
-template class Visits<const EnumArg>;
-template class Visits<const StringArg>;
-template class Visits<const StringSetArg>;
-template class Visits<const AliasArg>;
-template class Visits<const SwitchArg>;
-
template class WrappedForwardIterator<ArgsVisitor::ArgsIteratorTag, std::string>;
ArgsVisitor::ArgsVisitor(ArgsIterator * ai, ArgsIterator ae,
diff --git a/paludis/args/args_visitor.hh b/paludis/args/args_visitor.hh
index 5d554d1..75ae661 100644
--- a/paludis/args/args_visitor.hh
+++ b/paludis/args/args_visitor.hh
@@ -21,7 +21,7 @@
#ifndef PALUDIS_GUARD_ARGS_ARGS_VISITOR_HH
#define PALUDIS_GUARD_ARGS_ARGS_VISITOR_HH 1
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/attributes.hh>
#include <string>
@@ -50,31 +50,11 @@ namespace paludis
class StringSequenceArg;
/**
- * Visitor types for visitors that can visit Args.
- *
- * \ingroup g_args
- */
- struct ArgsVisitorTypes :
- VisitorTypes<
- ArgsVisitorTypes,
- ArgsOption,
- StringArg,
- AliasArg,
- SwitchArg,
- IntegerArg,
- EnumArg,
- StringSetArg,
- StringSequenceArg>
- {
- };
-
- /**
* Visitor class. Processes command-line options as they are found.
*
* \ingroup g_args
*/
- class PALUDIS_VISIBLE ArgsVisitor :
- public Visitor<ArgsVisitorTypes>
+ class PALUDIS_VISIBLE ArgsVisitor
{
public:
struct ArgsIteratorTag;
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index 4e2b3c2..7fb1d4b 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -19,7 +19,7 @@
#include "man.hh"
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <tr1/functional>
#include <ostream>
#include <sstream>
@@ -31,8 +31,7 @@ using std::endl;
namespace
{
- struct ExtraText :
- ConstVisitor<ArgsVisitorTypes>
+ struct ExtraText
{
DocWriter & _dw;
@@ -119,7 +118,8 @@ paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h)
for (paludis::args::ArgsGroup::ConstIterator b((*a)->begin()), b_end((*a)->end()) ;
b != b_end ; ++b)
{
- if (visitor_cast<const paludis::args::AliasArg>(**b) && visitor_cast<const paludis::args::AliasArg>(**b)->hidden())
+ if (simple_visitor_cast<const paludis::args::AliasArg>(**b) &&
+ simple_visitor_cast<const paludis::args::AliasArg>(**b)->hidden())
continue;
dw.arg_group_item((*b)->short_name(), (*b)->long_name(),
diff --git a/paludis/contents-fwd.hh b/paludis/contents-fwd.hh
index 5983a33..37659b9 100644
--- a/paludis/contents-fwd.hh
+++ b/paludis/contents-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008 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
@@ -41,8 +41,6 @@ namespace paludis
struct Contents;
- struct ContentsVisitorTypes;
-
/**
* Write a ContentsEntry to a stream.
*
diff --git a/paludis/contents.cc b/paludis/contents.cc
index 4b250e7..37f0b1e 100644
--- a/paludis/contents.cc
+++ b/paludis/contents.cc
@@ -17,37 +17,13 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "contents.hh"
-#include <paludis/util/visitor-impl.hh>
+#include <paludis/contents.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <list>
using namespace paludis;
-template class InstantiationPolicy<ContentsEntry, instantiation_method::NonCopyableTag>;
-template class InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>;
-
-template class ConstAcceptInterface<ContentsVisitorTypes>;
-
-template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsFileEntry>;
-template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsDirEntry>;
-template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsMiscEntry>;
-template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsFifoEntry>;
-template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsDevEntry>;
-template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsSymEntry>;
-
-template class PrivateImplementationPattern<Contents>;
-
-template class WrappedForwardIterator<Contents::ConstIteratorTag, const std::tr1::shared_ptr<const ContentsEntry> >;
-
-template class Visits<const ContentsFileEntry>;
-template class Visits<const ContentsDirEntry>;
-template class Visits<const ContentsSymEntry>;
-template class Visits<const ContentsFifoEntry>;
-template class Visits<const ContentsDevEntry>;
-template class Visits<const ContentsMiscEntry>;
-
ContentsEntry::ContentsEntry(const std::string & n) :
_name(n)
{
@@ -155,3 +131,10 @@ ContentsSymEntry::as_string() const
return name() + " -> " + target();
}
+template class InstantiationPolicy<ContentsEntry, instantiation_method::NonCopyableTag>;
+template class InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>;
+
+template class PrivateImplementationPattern<Contents>;
+
+template class WrappedForwardIterator<Contents::ConstIteratorTag, const std::tr1::shared_ptr<const ContentsEntry> >;
+
diff --git a/paludis/contents.hh b/paludis/contents.hh
index f3c9562..7054d1c 100644
--- a/paludis/contents.hh
+++ b/paludis/contents.hh
@@ -21,12 +21,12 @@
#define PALUDIS_GUARD_PALUDIS_CONTENTS_HH 1
#include <paludis/contents-fwd.hh>
-
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/type_list.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
#include <tr1/memory>
-
#include <string>
/** \file
@@ -42,26 +42,6 @@
namespace paludis
{
/**
- * Visit a contents heirarchy.
- *
- * \ingroup g_contents
- * \nosubgrouping
- */
- struct ContentsVisitorTypes :
- VisitorTypes<
- ContentsVisitorTypes,
- ContentsEntry,
- ContentsFileEntry,
- ContentsDirEntry,
- ContentsSymEntry,
- ContentsFifoEntry,
- ContentsDevEntry,
- ContentsMiscEntry
- >
- {
- };
-
- /**
* Base class for a contents entry.
*
* \ingroup g_contents
@@ -69,7 +49,8 @@ namespace paludis
*/
class PALUDIS_VISIBLE ContentsEntry :
private InstantiationPolicy<ContentsEntry, instantiation_method::NonCopyableTag>,
- public virtual ConstAcceptInterface<ContentsVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<ContentsEntry, MakeTypeList<
+ ContentsFileEntry, ContentsDirEntry, ContentsSymEntry, ContentsFifoEntry, ContentsDevEntry, ContentsMiscEntry>::Type>
{
friend std::ostream & operator<< (std::ostream &, const ContentsEntry &);
@@ -109,7 +90,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE ContentsFileEntry :
public ContentsEntry,
- public ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsFileEntry>
+ public ImplementAcceptMethods<ContentsEntry, ContentsFileEntry>
{
public:
///\name Basic operations
@@ -128,7 +109,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE ContentsDirEntry :
public ContentsEntry,
- public ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsDirEntry>
+ public ImplementAcceptMethods<ContentsEntry, ContentsDirEntry>
{
public:
///\name Basic operations
@@ -147,7 +128,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE ContentsMiscEntry :
public ContentsEntry,
- public ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsMiscEntry>
+ public ImplementAcceptMethods<ContentsEntry, ContentsMiscEntry>
{
public:
///\name Basic operations
@@ -166,7 +147,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE ContentsFifoEntry :
public ContentsEntry,
- public ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsFifoEntry>
+ public ImplementAcceptMethods<ContentsEntry, ContentsFifoEntry>
{
public:
///\name Basic operations
@@ -185,7 +166,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE ContentsDevEntry :
public ContentsEntry,
- public ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsDevEntry>
+ public ImplementAcceptMethods<ContentsEntry, ContentsDevEntry>
{
public:
///\name Basic operations
@@ -204,7 +185,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE ContentsSymEntry :
public ContentsEntry,
- public ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsSymEntry>
+ public ImplementAcceptMethods<ContentsEntry, ContentsSymEntry>
{
private:
std::string _target;
@@ -264,24 +245,7 @@ namespace paludis
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class InstantiationPolicy<ContentsEntry, instantiation_method::NonCopyableTag>;
extern template class InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>;
-
- extern template class ConstAcceptInterface<ContentsVisitorTypes>;
-
- extern template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsFileEntry>;
- extern template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsDirEntry>;
- extern template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsMiscEntry>;
- extern template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsFifoEntry>;
- extern template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsDevEntry>;
- extern template class ConstAcceptInterfaceVisitsThis<ContentsVisitorTypes, ContentsSymEntry>;
-
extern template class PrivateImplementationPattern<Contents>;
-
- extern template class Visits<const ContentsFileEntry>;
- extern template class Visits<const ContentsDirEntry>;
- extern template class Visits<const ContentsSymEntry>;
- extern template class Visits<const ContentsFifoEntry>;
- extern template class Visits<const ContentsDevEntry>;
- extern template class Visits<const ContentsMiscEntry>;
#endif
}
diff --git a/paludis/dep_label-fwd.hh b/paludis/dep_label-fwd.hh
index 0d33665..7e9e7a6 100644
--- a/paludis/dep_label-fwd.hh
+++ b/paludis/dep_label-fwd.hh
@@ -33,7 +33,6 @@
namespace paludis
{
- struct URILabelVisitorTypes;
struct URILabel;
template <typename T_> struct ConcreteURILabel;
@@ -64,7 +63,6 @@ namespace paludis
*/
std::ostream & operator<< (std::ostream &, const URILabel &) PALUDIS_VISIBLE;
- struct DependencyLabelVisitorTypes;
struct DependencyLabel;
struct DependencySystemLabel;
struct DependencyTypeLabel;
diff --git a/paludis/dep_label.cc b/paludis/dep_label.cc
index 3fca001..14f3963 100644
--- a/paludis/dep_label.cc
+++ b/paludis/dep_label.cc
@@ -146,8 +146,7 @@ namespace paludis
namespace
{
- struct LabelsPopulator :
- ConstVisitor<DependencyLabelVisitorTypes>
+ struct LabelsPopulator
{
Implementation<ActiveDependencyLabels> & _imp;
const std::tr1::shared_ptr<const DependencyLabel> _l;
@@ -325,74 +324,6 @@ ActiveDependencyLabels::suggest_labels() const
return _imp->suggest_labels;
}
-template class ConstAcceptInterface<DependencyABIsLabelVisitorTypes>;
-template class ConstAcceptInterface<DependencyLabelVisitorTypes>;
-template class ConstAcceptInterface<DependencySuggestLabelVisitorTypes>;
-template class ConstAcceptInterface<DependencySystemLabelVisitorTypes>;
-template class ConstAcceptInterface<DependencyTypeLabelVisitorTypes>;
-template class ConstAcceptInterface<URILabelVisitorTypes>;
-
-template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyABIsLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySuggestLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySystemLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyTypeLabel>;
-
-template class Visits<DependencyABIsLabel>;
-template class Visits<DependencySuggestLabel>;
-template class Visits<DependencySystemLabel>;
-template class Visits<DependencyTypeLabel>;
-
-template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIMirrorsThenListedLabel>;
-template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIMirrorsOnlyLabel>;
-template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIListedOnlyLabel>;
-template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIListedThenMirrorsLabel>;
-template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URILocalMirrorsOnlyLabel>;
-template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIManualOnlyLabel>;
-
-template class Visits<URIMirrorsThenListedLabel>;
-template class Visits<URIMirrorsOnlyLabel>;
-template class Visits<URIListedOnlyLabel>;
-template class Visits<URIListedThenMirrorsLabel>;
-template class Visits<URILocalMirrorsOnlyLabel>;
-template class Visits<URIManualOnlyLabel>;
-
-// template class ConstAcceptInterfaceVisitsThis<DependencySystemLabelVisitorTypes, DependencySystemLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencySystemLabelVisitorTypes, DependencyHostLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencySystemLabelVisitorTypes, DependencyTargetLabel>;
-
-template class Visits<DependencyHostLabel>;
-template class Visits<DependencyTargetLabel>;
-
-template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyBuildLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyRunLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyPostLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyInstallLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyCompileLabel>;
-
-template class Visits<DependencyBuildLabel>;
-template class Visits<DependencyRunLabel>;
-template class Visits<DependencyPostLabel>;
-template class Visits<DependencyInstallLabel>;
-template class Visits<DependencyCompileLabel>;
-
-template class ConstAcceptInterfaceVisitsThis<DependencySuggestLabelVisitorTypes, DependencySuggestedLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencySuggestLabelVisitorTypes, DependencyRecommendedLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencySuggestLabelVisitorTypes, DependencyRequiredLabel>;
-
-template class Visits<DependencySuggestedLabel>;
-template class Visits<DependencyRecommendedLabel>;
-template class Visits<DependencyRequiredLabel>;
-
-template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyAnyLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyMineLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyPrimaryLabel>;
-template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyABILabel>;
-
-template class Visits<DependencyAnyLabel>;
-template class Visits<DependencyMineLabel>;
-template class Visits<DependencyPrimaryLabel>;
-template class Visits<DependencyABILabel>;
-
template class InstantiationPolicy<DependencyLabel, instantiation_method::NonCopyableTag>;
template class InstantiationPolicy<URILabel, instantiation_method::NonCopyableTag>;
diff --git a/paludis/dep_label.hh b/paludis/dep_label.hh
index 6b83d5f..faa0f82 100644
--- a/paludis/dep_label.hh
+++ b/paludis/dep_label.hh
@@ -23,9 +23,11 @@
#include <paludis/dep_label-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/attributes.hh>
+#include <paludis/util/type_list.hh>
/** \file
* Declarations for dependency label-related classes.
@@ -43,120 +45,6 @@
namespace paludis
{
/**
- * Types for visiting a URI label.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- * \nosubgrouping
- */
- struct URILabelVisitorTypes :
- VisitorTypes<
- URILabelVisitorTypes,
- URILabel,
- URIMirrorsThenListedLabel,
- URIMirrorsOnlyLabel,
- URIListedOnlyLabel,
- URIListedThenMirrorsLabel,
- URILocalMirrorsOnlyLabel,
- URIManualOnlyLabel
- >
- {
- };
-
- /**
- * Types for visiting a dependency label.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- * \nosubgrouping
- */
- struct DependencyLabelVisitorTypes :
- VisitorTypes<
- DependencyLabelVisitorTypes,
- DependencyLabel,
- DependencySystemLabel,
- DependencyTypeLabel,
- DependencySuggestLabel,
- DependencyABIsLabel
- >
- {
- };
-
- /**
- * Types for visiting a dependency system label.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- * \nosubgrouping
- */
- struct DependencySystemLabelVisitorTypes :
- VisitorTypes<
- DependencySystemLabelVisitorTypes,
- DependencySystemLabel,
- DependencyHostLabel,
- DependencyTargetLabel
- >
- {
- };
-
- /**
- * Types for visiting a dependency type label.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- * \nosubgrouping
- */
- struct DependencyTypeLabelVisitorTypes :
- VisitorTypes<
- DependencyTypeLabelVisitorTypes,
- DependencyTypeLabel,
- DependencyBuildLabel,
- DependencyRunLabel,
- DependencyPostLabel,
- DependencyInstallLabel,
- DependencyCompileLabel
- >
- {
- };
-
- /**
- * Types for visiting a dependency suggests label.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- * \nosubgrouping
- */
- struct DependencySuggestLabelVisitorTypes :
- VisitorTypes<
- DependencySuggestLabelVisitorTypes,
- DependencySuggestLabel,
- DependencySuggestedLabel,
- DependencyRecommendedLabel,
- DependencyRequiredLabel
- >
- {
- };
-
- /**
- * Types for visiting a dependency abi label.
- *
- * \since 0.26
- * \ingroup g_dep_spec
- * \nosubgrouping
- */
- struct DependencyABIsLabelVisitorTypes :
- VisitorTypes<
- DependencyABIsLabelVisitorTypes,
- DependencyABIsLabel,
- DependencyAnyLabel,
- DependencyMineLabel,
- DependencyPrimaryLabel,
- DependencyABILabel
- >
- {
- };
-
- /**
* URI label base class.
*
* \since 0.26
@@ -165,7 +53,9 @@ namespace paludis
*/
class PALUDIS_VISIBLE URILabel :
private InstantiationPolicy<URILabel, instantiation_method::NonCopyableTag>,
- public virtual ConstAcceptInterface<URILabelVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<URILabel, MakeTypeList<
+ URIMirrorsThenListedLabel, URIMirrorsOnlyLabel, URIListedOnlyLabel, URIListedThenMirrorsLabel,
+ URILocalMirrorsOnlyLabel, URIManualOnlyLabel>::Type>
{
public:
///\name Basic operations
@@ -189,7 +79,7 @@ namespace paludis
template <typename T_>
class PALUDIS_VISIBLE ConcreteURILabel :
public URILabel,
- public ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, ConcreteURILabel<T_> >,
+ public ImplementAcceptMethods<URILabel, ConcreteURILabel<T_> >,
private PrivateImplementationPattern<ConcreteURILabel<T_> >
{
private:
@@ -219,7 +109,8 @@ namespace paludis
*/
class PALUDIS_VISIBLE DependencyLabel :
private InstantiationPolicy<DependencyLabel, instantiation_method::NonCopyableTag>,
- public virtual ConstAcceptInterface<DependencyLabelVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<DependencyLabel, MakeTypeList<
+ DependencySystemLabel, DependencyTypeLabel, DependencySuggestLabel, DependencyABIsLabel>::Type>
{
public:
///\name Basic operations
@@ -242,14 +133,15 @@ namespace paludis
*/
struct PALUDIS_VISIBLE DependencySystemLabel :
public DependencyLabel,
- public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySystemLabel>,
- public virtual ConstAcceptInterface<DependencySystemLabelVisitorTypes>
+ public ImplementAcceptMethods<DependencyLabel, DependencySystemLabel>,
+ public virtual DeclareAbstractAcceptMethods<DependencySystemLabel, MakeTypeList<
+ DependencyHostLabel, DependencyTargetLabel>::Type>
{
- /// Convenience alias for our visitor types.
- typedef DependencySystemLabelVisitorTypes VisitorTypes;
+ typedef DeclareAbstractAcceptMethods<DependencySystemLabel, MakeTypeList<
+ DependencyHostLabel, DependencyTargetLabel>::Type>::VisitableTypeList VisitableTypeList;
- typedef ConstAcceptInterface<DependencySystemLabelVisitorTypes>::Heirarchy Heirarchy;
- using ConstAcceptInterface<DependencySystemLabelVisitorTypes>::accept;
+ using DeclareAbstractAcceptMethods<DependencySystemLabel, MakeTypeList<
+ DependencyHostLabel, DependencyTargetLabel>::Type>::accept;
};
/**
@@ -261,14 +153,18 @@ namespace paludis
*/
struct PALUDIS_VISIBLE DependencyTypeLabel :
public DependencyLabel,
- public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyTypeLabel>,
- public virtual ConstAcceptInterface<DependencyTypeLabelVisitorTypes>
+ public ImplementAcceptMethods<DependencyLabel, DependencyTypeLabel>,
+ public virtual DeclareAbstractAcceptMethods<DependencyTypeLabel, MakeTypeList<
+ DependencyBuildLabel, DependencyRunLabel, DependencyPostLabel, DependencyInstallLabel,
+ DependencyCompileLabel>::Type>
{
- /// Convenience alias for our visitor types.
- typedef DependencyTypeLabelVisitorTypes VisitorTypes;
+ typedef DeclareAbstractAcceptMethods<DependencyTypeLabel, MakeTypeList<
+ DependencyBuildLabel, DependencyRunLabel, DependencyPostLabel, DependencyInstallLabel,
+ DependencyCompileLabel>::Type>::VisitableTypeList VisitableTypeList;
- typedef ConstAcceptInterface<DependencyTypeLabelVisitorTypes>::Heirarchy Heirarchy;
- using ConstAcceptInterface<DependencyTypeLabelVisitorTypes>::accept;
+ using DeclareAbstractAcceptMethods<DependencyTypeLabel, MakeTypeList<
+ DependencyBuildLabel, DependencyRunLabel, DependencyPostLabel, DependencyInstallLabel,
+ DependencyCompileLabel>::Type>::accept;
};
/**
@@ -280,14 +176,17 @@ namespace paludis
*/
struct PALUDIS_VISIBLE DependencySuggestLabel :
public DependencyLabel,
- public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySuggestLabel>,
- public virtual ConstAcceptInterface<DependencySuggestLabelVisitorTypes>
+ public ImplementAcceptMethods<DependencyLabel, DependencySuggestLabel>,
+ public virtual DeclareAbstractAcceptMethods<DependencySuggestLabel, MakeTypeList<
+ DependencySuggestedLabel, DependencyRecommendedLabel, DependencyRequiredLabel>::Type>
{
- /// Convenience alias for our visitor types.
- typedef DependencySuggestLabelVisitorTypes VisitorTypes;
+ typedef DeclareAbstractAcceptMethods<DependencySuggestLabel, MakeTypeList<
+ DependencySuggestedLabel, DependencyRecommendedLabel,
+ DependencyRequiredLabel>::Type>::VisitableTypeList VisitableTypeList;
- typedef ConstAcceptInterface<DependencySuggestLabelVisitorTypes>::Heirarchy Heirarchy;
- using ConstAcceptInterface<DependencySuggestLabelVisitorTypes>::accept;
+ using DeclareAbstractAcceptMethods<DependencySuggestLabel, MakeTypeList<
+ DependencySuggestedLabel, DependencyRecommendedLabel,
+ DependencyRequiredLabel>::Type>::accept;
};
/**
@@ -299,14 +198,17 @@ namespace paludis
*/
struct PALUDIS_VISIBLE DependencyABIsLabel :
public DependencyLabel,
- public ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyABIsLabel>,
- public virtual ConstAcceptInterface<DependencyABIsLabelVisitorTypes>
+ public ImplementAcceptMethods<DependencyLabel, DependencyABIsLabel>,
+ public virtual DeclareAbstractAcceptMethods<DependencyABIsLabel, MakeTypeList<
+ DependencyAnyLabel, DependencyMineLabel, DependencyPrimaryLabel, DependencyABILabel>::Type>
{
- /// Convenience alias for our visitor types.
- typedef DependencyABIsLabelVisitorTypes VisitorTypes;
+ typedef DeclareAbstractAcceptMethods<DependencyABIsLabel, MakeTypeList<
+ DependencyAnyLabel, DependencyMineLabel, DependencyPrimaryLabel,
+ DependencyABILabel>::Type>::VisitableTypeList VisitableTypeList;
- typedef ConstAcceptInterface<DependencyABIsLabelVisitorTypes>::Heirarchy Heirarchy;
- using ConstAcceptInterface<DependencyABIsLabelVisitorTypes>::accept;
+ using DeclareAbstractAcceptMethods<DependencyABIsLabel, MakeTypeList<
+ DependencyAnyLabel, DependencyMineLabel, DependencyPrimaryLabel,
+ DependencyABILabel>::Type>::accept;
};
/**
@@ -319,7 +221,7 @@ namespace paludis
template <typename T_, typename C_>
class PALUDIS_VISIBLE ConcreteDependencyLabel :
public C_,
- public ConstAcceptInterfaceVisitsThis<typename C_::VisitorTypes, ConcreteDependencyLabel<T_, C_> >,
+ public ImplementAcceptMethods<C_, ConcreteDependencyLabel<T_, C_> >,
private PrivateImplementationPattern<ConcreteDependencyLabel<T_, C_> >
{
private:
@@ -375,74 +277,6 @@ namespace paludis
};
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
- extern template class ConstAcceptInterface<DependencyABIsLabelVisitorTypes>;
- extern template class ConstAcceptInterface<DependencyLabelVisitorTypes>;
- extern template class ConstAcceptInterface<DependencySuggestLabelVisitorTypes>;
- extern template class ConstAcceptInterface<DependencySystemLabelVisitorTypes>;
- extern template class ConstAcceptInterface<DependencyTypeLabelVisitorTypes>;
- extern template class ConstAcceptInterface<URILabelVisitorTypes>;
-
- extern template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyABIsLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySuggestLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencySystemLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyLabelVisitorTypes, DependencyTypeLabel>;
-
- extern template class Visits<DependencyABIsLabel>;
- extern template class Visits<DependencySuggestLabel>;
- extern template class Visits<DependencySystemLabel>;
- extern template class Visits<DependencyTypeLabel>;
-
- extern template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIMirrorsThenListedLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIMirrorsOnlyLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIListedOnlyLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIListedThenMirrorsLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URILocalMirrorsOnlyLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, URIManualOnlyLabel>;
-
- extern template class Visits<URIMirrorsThenListedLabel>;
- extern template class Visits<URIMirrorsOnlyLabel>;
- extern template class Visits<URIListedOnlyLabel>;
- extern template class Visits<URIListedThenMirrorsLabel>;
- extern template class Visits<URILocalMirrorsOnlyLabel>;
- extern template class Visits<URIManualOnlyLabel>;
-
- extern template class ConstAcceptInterfaceVisitsThis<DependencySystemLabelVisitorTypes, DependencyHostLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencySystemLabelVisitorTypes, DependencyTargetLabel>;
-
- extern template class Visits<DependencySystemLabel>;
- extern template class Visits<DependencyHostLabel>;
- extern template class Visits<DependencyTargetLabel>;
-
- extern template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyBuildLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyRunLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyPostLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyInstallLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyTypeLabelVisitorTypes, DependencyCompileLabel>;
-
- extern template class Visits<DependencyBuildLabel>;
- extern template class Visits<DependencyRunLabel>;
- extern template class Visits<DependencyPostLabel>;
- extern template class Visits<DependencyInstallLabel>;
- extern template class Visits<DependencyCompileLabel>;
-
- extern template class ConstAcceptInterfaceVisitsThis<DependencySuggestLabelVisitorTypes, DependencySuggestedLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencySuggestLabelVisitorTypes, DependencyRecommendedLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencySuggestLabelVisitorTypes, DependencyRequiredLabel>;
-
- extern template class Visits<DependencySuggestedLabel>;
- extern template class Visits<DependencyRecommendedLabel>;
- extern template class Visits<DependencyRequiredLabel>;
-
- extern template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyAnyLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyMineLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyPrimaryLabel>;
- extern template class ConstAcceptInterfaceVisitsThis<DependencyABIsLabelVisitorTypes, DependencyABILabel>;
-
- extern template class Visits<DependencyAnyLabel>;
- extern template class Visits<DependencyMineLabel>;
- extern template class Visits<DependencyPrimaryLabel>;
- extern template class Visits<DependencyABILabel>;
-
extern template class InstantiationPolicy<DependencyLabel, instantiation_method::NonCopyableTag>;
extern template class InstantiationPolicy<URILabel, instantiation_method::NonCopyableTag>;
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index c0a27e1..6ee4a20 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -338,8 +338,7 @@ struct DepList::AddVisitor :
namespace
{
- struct SuggestActiveVisitor :
- ConstVisitor<DependencySuggestLabelVisitorTypes>
+ struct SuggestActiveVisitor
{
bool result;
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh
index ad827b7..668dab1 100644
--- a/paludis/dep_spec-fwd.hh
+++ b/paludis/dep_spec-fwd.hh
@@ -58,7 +58,7 @@ namespace paludis
* \ingroup g_dep_spec
* \since 0.26
*/
- typedef LabelsDepSpec<URILabelVisitorTypes> URILabelsDepSpec;
+ typedef LabelsDepSpec<URILabel> URILabelsDepSpec;
/**
* A DependencyLabelsDepSpec represents labels in a DependencySpecTree.
@@ -66,7 +66,7 @@ namespace paludis
* \ingroup g_dep_spec
* \since 0.26
*/
- typedef LabelsDepSpec<DependencyLabelVisitorTypes> DependencyLabelsDepSpec;
+ typedef LabelsDepSpec<DependencyLabel> DependencyLabelsDepSpec;
class PackageDepSpecData;
class PartiallyMadePackageDepSpec;
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index f656226..76c3da1 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -546,7 +546,7 @@ namespace paludis
template <typename T_>
struct Implementation<LabelsDepSpec<T_ > >
{
- std::list<std::tr1::shared_ptr<const typename T_::BasicNode> > items;
+ std::list<std::tr1::shared_ptr<const T_> > items;
};
}
@@ -589,7 +589,7 @@ LabelsDepSpec<T_>::end() const
template <typename T_>
void
-LabelsDepSpec<T_>::add_label(const std::tr1::shared_ptr<const typename T_::BasicNode> & item)
+LabelsDepSpec<T_>::add_label(const std::tr1::shared_ptr<const T_> & item)
{
_imp->items.push_back(item);
}
@@ -1254,13 +1254,8 @@ PartiallyMadePackageDepSpec::to_package_dep_spec() const
return operator const PackageDepSpec();
}
-template class LabelsDepSpec<URILabelVisitorTypes>;
-template class WrappedForwardIterator<LabelsDepSpec<URILabelVisitorTypes>::ConstIteratorTag,
- const std::tr1::shared_ptr<const URILabelVisitorTypes::BasicNode> >;
-
-template class LabelsDepSpec<DependencyLabelVisitorTypes>;
-template class WrappedForwardIterator<LabelsDepSpec<DependencyLabelVisitorTypes>::ConstIteratorTag,
- const std::tr1::shared_ptr<const DependencyLabelVisitorTypes::BasicNode> >;
+template class LabelsDepSpec<URILabel>;
+template class LabelsDepSpec<DependencyLabel>;
template class Sequence<std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index f5e9704..60a76c4 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -900,10 +900,10 @@ namespace paludis
* \ingroup g_dep_spec
* \nosubgrouping
*/
- template <typename SpecTree_>
+ template <typename Labels_>
class PALUDIS_VISIBLE LabelsDepSpec :
public DepSpec,
- private PrivateImplementationPattern<LabelsDepSpec<SpecTree_> >
+ private PrivateImplementationPattern<LabelsDepSpec<Labels_> >
{
private:
typename PrivateImplementationPattern<LabelsDepSpec>::ImpPtr & _imp;
@@ -923,11 +923,11 @@ namespace paludis
///\name Contained labels
///\{
- void add_label(const std::tr1::shared_ptr<const typename SpecTree_::BasicNode> &);
+ void add_label(const std::tr1::shared_ptr<const Labels_> &);
struct ConstIteratorTag;
typedef WrappedForwardIterator<ConstIteratorTag,
- const std::tr1::shared_ptr<const typename SpecTree_::BasicNode> > ConstIterator;
+ const std::tr1::shared_ptr<const Labels_> > ConstIterator;
ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/dep_tag-fwd.hh b/paludis/dep_tag-fwd.hh
index c689255..b3da555 100644
--- a/paludis/dep_tag-fwd.hh
+++ b/paludis/dep_tag-fwd.hh
@@ -41,8 +41,6 @@ namespace paludis
class DependencyDepTag;
class TargetDepTag;
- class DepTagVisitorTypes;
-
class DepTagEntry;
class DepTagEntryComparator;
diff --git a/paludis/dep_tag.cc b/paludis/dep_tag.cc
index d0d930c..8e9f15d 100644
--- a/paludis/dep_tag.cc
+++ b/paludis/dep_tag.cc
@@ -17,31 +17,20 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "dep_tag.hh"
+#include <paludis/dep_tag.hh>
#include <paludis/dep_spec.hh>
#include <paludis/dep_label.hh>
-#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/set-impl.hh>
#include <paludis/util/mutex.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <algorithm>
#include <sstream>
using namespace paludis;
-template class ConstVisitor<DepTagVisitorTypes>;
-template class ConstAcceptInterface<DepTagVisitorTypes>;
-
-template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, GeneralSetDepTag>;
-template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, GLSADepTag>;
-template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, DependencyDepTag>;
-template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, TargetDepTag>;
-
-template class Visits<const GeneralSetDepTag>;
-template class Visits<const GLSADepTag>;
-template class Visits<const DependencyDepTag>;
-template class Visits<const TargetDepTag>;
-
template class InstantiationPolicy<DepTagCategoryFactory, instantiation_method::SingletonTag>;
template class Set<DepTagEntry, DepTagEntryComparator>;
@@ -202,7 +191,7 @@ namespace
visit_leaf(const DependencyLabelsDepSpec & l)
{
std::copy(indirect_iterator(l.begin()), indirect_iterator(l.end()),
- std::ostream_iterator<DependencyLabelVisitorTypes::BasicNode>(s, ","));
+ std::ostream_iterator<DependencyLabel>(s, ","));
s << ":";
}
@@ -213,8 +202,7 @@ namespace
}
};
- struct DepTagComparator :
- ConstVisitor<DepTagVisitorTypes>
+ struct DepTagComparator
{
std::string value;
diff --git a/paludis/dep_tag.hh b/paludis/dep_tag.hh
index 15f9bc3..e5afc3b 100644
--- a/paludis/dep_tag.hh
+++ b/paludis/dep_tag.hh
@@ -39,11 +39,12 @@
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/named_value.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/operators.hh>
+#include <paludis/util/type_list.hh>
#include <string>
#include <tr1/memory>
@@ -57,26 +58,6 @@ namespace paludis
}
/**
- * Visitor class for visiting the different DepTag subclasses.
- *
- * \ingroup g_dep_spec
- * \nosubgrouping
- * \since 0.26
- * \see DepTag
- */
- struct DepTagVisitorTypes :
- VisitorTypes<
- DepTagVisitorTypes,
- DepTag,
- GLSADepTag,
- GeneralSetDepTag,
- DependencyDepTag,
- TargetDepTag
- >
- {
- };
-
- /**
* A DepTagCategory is identified by its name and has associated display
* information for a DepTag's category.
*
@@ -168,9 +149,10 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE DepTag :
- InstantiationPolicy<DepTag, instantiation_method::NonCopyableTag>,
+ private InstantiationPolicy<DepTag, instantiation_method::NonCopyableTag>,
public relational_operators::HasRelationalOperators,
- public virtual ConstAcceptInterface<DepTagVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<DepTag, MakeTypeList<
+ GLSADepTag, GeneralSetDepTag, DependencyDepTag, TargetDepTag>::Type>
{
protected:
///\name Basic operations
@@ -211,7 +193,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE GLSADepTag :
public DepTag,
- public ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, GLSADepTag>
+ public ImplementAcceptMethods<DepTag, GLSADepTag>
{
private:
const std::string _id;
@@ -256,7 +238,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE GeneralSetDepTag :
public DepTag,
- public ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, GeneralSetDepTag>,
+ public ImplementAcceptMethods<DepTag, GLSADepTag>,
private PrivateImplementationPattern<GeneralSetDepTag>
{
public:
@@ -286,7 +268,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE DependencyDepTag :
public DepTag,
- public ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, DependencyDepTag>,
+ public ImplementAcceptMethods<DepTag, DependencyDepTag>,
private PrivateImplementationPattern<DependencyDepTag>
{
private:
@@ -332,7 +314,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE TargetDepTag :
public DepTag,
- public ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, TargetDepTag>
+ public ImplementAcceptMethods<DepTag, TargetDepTag>
{
public:
///\name Basic operations
@@ -376,18 +358,6 @@ namespace paludis
};
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
- extern template class ConstAcceptInterface<DepTagVisitorTypes>;
-
- extern template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, DependencyDepTag>;
- extern template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, GLSADepTag>;
- extern template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, GeneralSetDepTag>;
- extern template class ConstAcceptInterfaceVisitsThis<DepTagVisitorTypes, TargetDepTag>;
-
- extern template class Visits<const GeneralSetDepTag>;
- extern template class Visits<const GLSADepTag>;
- extern template class Visits<const DependencyDepTag>;
- extern template class Visits<const TargetDepTag>;
-
extern template class InstantiationPolicy<DepTagCategoryFactory, instantiation_method::SingletonTag>;
extern template class PrivateImplementationPattern<DependencyDepTag>;
extern template class PrivateImplementationPattern<GeneralSetDepTag>;
diff --git a/paludis/dep_tree.hh b/paludis/dep_tree.hh
index dc0cf07..2d1874b 100644
--- a/paludis/dep_tree.hh
+++ b/paludis/dep_tree.hh
@@ -135,7 +135,7 @@ namespace paludis
FetchableURISpecTree,
DepSpec,
TreeLeaf<FetchableURISpecTree, FetchableURIDepSpec>,
- TreeLeaf<FetchableURISpecTree, LabelsDepSpec<URILabelVisitorTypes> >,
+ TreeLeaf<FetchableURISpecTree, URILabelsDepSpec>,
ConstTreeSequence<FetchableURISpecTree, AllDepSpec>,
ConstTreeSequence<FetchableURISpecTree, ConditionalDepSpec>
>
diff --git a/paludis/elike_conditional_dep_spec.cc b/paludis/elike_conditional_dep_spec.cc
index 1498781..5566372 100644
--- a/paludis/elike_conditional_dep_spec.cc
+++ b/paludis/elike_conditional_dep_spec.cc
@@ -22,8 +22,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/log.hh>
#include <paludis/dep_spec.hh>
@@ -160,7 +159,7 @@ paludis::elike_conditional_dep_spec_flag(const ConditionalDepSpec & spec)
ConditionalDepSpec::MetadataConstIterator i(spec.find_metadata("Flag"));
if (i == spec.end_metadata())
throw InternalError(PALUDIS_HERE, "Spec '" + stringify(spec) + "' has no Flag metadata");
- const MetadataValueKey<std::string> * key(visitor_cast<const MetadataValueKey<std::string> >(**i));
+ const MetadataValueKey<std::string> * key(simple_visitor_cast<const MetadataValueKey<std::string> >(**i));
if (! key)
throw InternalError(PALUDIS_HERE, "Spec '" + stringify(spec) + "' has Flag metadata which is not a string");
return ChoiceNameWithPrefix(key->value());
@@ -172,7 +171,7 @@ paludis::elike_conditional_dep_spec_is_inverse(const ConditionalDepSpec & spec)
ConditionalDepSpec::MetadataConstIterator i(spec.find_metadata("Inverse"));
if (i == spec.end_metadata())
throw InternalError(PALUDIS_HERE, "Spec '" + stringify(spec) + "' has no Inverse metadata");
- const MetadataValueKey<std::string> * key(visitor_cast<const MetadataValueKey<std::string> >(**i));
+ const MetadataValueKey<std::string> * key(simple_visitor_cast<const MetadataValueKey<std::string> >(**i));
if (! key)
throw InternalError(PALUDIS_HERE, "Spec '" + stringify(spec) + "' has Inverse metadata which is not a string");
return destringify<bool>(key->value());
diff --git a/paludis/handled_information-fwd.hh b/paludis/handled_information-fwd.hh
index ab835f7..42251d0 100644
--- a/paludis/handled_information-fwd.hh
+++ b/paludis/handled_information-fwd.hh
@@ -35,8 +35,6 @@ namespace paludis
class DepListEntryHandledFailed;
class DepListEntryUnhandled;
class DepListEntryNoHandlingRequired;
-
- class DepListEntryHandledVisitorTypes;
}
#endif
diff --git a/paludis/handled_information.hh b/paludis/handled_information.hh
index 986c16b..e2fca7b 100644
--- a/paludis/handled_information.hh
+++ b/paludis/handled_information.hh
@@ -21,9 +21,10 @@
#define PALUDIS_GUARD_PALUDIS_HANDLED_INFORMATION_HH 1
#include <paludis/handled_information-fwd.hh>
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/type_list.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -41,27 +42,6 @@
namespace paludis
{
/**
- * Types for a visitor that can visit a DepListEntry subclass.
- *
- * \ingroup g_dep_list
- * \since 0.26
- * \nosubgrouping
- */
- struct DepListEntryHandledVisitorTypes :
- VisitorTypes<
- DepListEntryHandledVisitorTypes,
- DepListEntryHandled,
- DepListEntryHandledSuccess,
- DepListEntryHandledSkippedUnsatisfied,
- DepListEntryHandledSkippedDependent,
- DepListEntryHandledFailed,
- DepListEntryUnhandled,
- DepListEntryNoHandlingRequired
- >
- {
- };
-
- /**
* Represents a DepListEntry that has been handled.
*
* \ingroup g_dep_list
@@ -69,7 +49,13 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE DepListEntryHandled :
- public virtual ConstAcceptInterface<DepListEntryHandledVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<DepListEntryHandled, MakeTypeList<
+ DepListEntryHandledSuccess,
+ DepListEntryHandledSkippedUnsatisfied,
+ DepListEntryHandledSkippedDependent,
+ DepListEntryHandledFailed,
+ DepListEntryUnhandled,
+ DepListEntryNoHandlingRequired>::Type>
{
public:
virtual ~DepListEntryHandled() = 0;
@@ -84,7 +70,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE DepListEntryUnhandled :
public DepListEntryHandled,
- public ConstAcceptInterfaceVisitsThis<DepListEntryHandledVisitorTypes, DepListEntryUnhandled>
+ public ImplementAcceptMethods<DepListEntryHandled, DepListEntryUnhandled>
{
};
@@ -97,7 +83,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE DepListEntryNoHandlingRequired :
public DepListEntryHandled,
- public ConstAcceptInterfaceVisitsThis<DepListEntryHandledVisitorTypes, DepListEntryNoHandlingRequired>
+ public ImplementAcceptMethods<DepListEntryHandled, DepListEntryNoHandlingRequired>
{
};
@@ -110,7 +96,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE DepListEntryHandledSuccess :
public DepListEntryHandled,
- public ConstAcceptInterfaceVisitsThis<DepListEntryHandledVisitorTypes, DepListEntryHandledSuccess>
+ public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledSuccess>
{
};
@@ -124,7 +110,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE DepListEntryHandledSkippedUnsatisfied :
public DepListEntryHandled,
- public ConstAcceptInterfaceVisitsThis<DepListEntryHandledVisitorTypes, DepListEntryHandledSkippedUnsatisfied>,
+ public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledSkippedUnsatisfied>,
private PrivateImplementationPattern<DepListEntryHandledSkippedUnsatisfied>
{
public:
@@ -153,7 +139,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE DepListEntryHandledSkippedDependent :
public DepListEntryHandled,
- public ConstAcceptInterfaceVisitsThis<DepListEntryHandledVisitorTypes, DepListEntryHandledSkippedDependent>,
+ public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledSkippedDependent>,
private PrivateImplementationPattern<DepListEntryHandledSkippedDependent>
{
public:
@@ -181,7 +167,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE DepListEntryHandledFailed :
public DepListEntryHandled,
- public ConstAcceptInterfaceVisitsThis<DepListEntryHandledVisitorTypes, DepListEntryHandledFailed>
+ public ImplementAcceptMethods<DepListEntryHandled, DepListEntryHandledFailed>
{
};
}
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 6cfc9b2..eaedd72 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -279,8 +279,7 @@ InstallTask::serialised_format() const
namespace
{
- struct HandledDisplayer :
- ConstVisitor<DepListEntryHandledVisitorTypes>
+ struct HandledDisplayer
{
std::string result;
const bool undo_failures;
@@ -535,8 +534,7 @@ InstallTask::_display_task_list()
namespace
{
- struct SummaryVisitor :
- ConstVisitor<DepListEntryHandledVisitorTypes>
+ struct SummaryVisitor
{
int total, successes, skipped, failures, unreached;
InstallTask & task;
@@ -1391,8 +1389,7 @@ InstallTask::_unsatisfied(const DepListEntry & e) const
namespace
{
- struct CheckHandledVisitor :
- ConstVisitor<DepListEntryHandledVisitorTypes>
+ struct CheckHandledVisitor
{
bool failure;
bool skipped;
@@ -1619,8 +1616,7 @@ InstallTask::_dependent(const DepListEntry & e) const
namespace
{
- struct AlreadyDoneVisitor :
- ConstVisitor<DepListEntryHandledVisitorTypes>
+ struct AlreadyDoneVisitor
{
bool result;
diff --git a/paludis/mask-fwd.hh b/paludis/mask-fwd.hh
index 6bb8386..8f1d5f1 100644
--- a/paludis/mask-fwd.hh
+++ b/paludis/mask-fwd.hh
@@ -35,8 +35,6 @@ namespace paludis
class UnsupportedMask;
class AssociationMask;
- class MaskVisitorTypes;
-
struct RepositoryMaskInfo;
}
diff --git a/paludis/mask.cc b/paludis/mask.cc
index 137a792..0f81f17 100644
--- a/paludis/mask.cc
+++ b/paludis/mask.cc
@@ -18,17 +18,9 @@
*/
#include <paludis/mask.hh>
-#include <paludis/util/visitor-impl.hh>
using namespace paludis;
-template class ConstAcceptInterface<MaskVisitorTypes>;
-template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UserMask>;
-template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UnacceptedMask>;
-template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, RepositoryMask>;
-template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UnsupportedMask>;
-template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, AssociationMask>;
-
Mask::~Mask()
{
}
diff --git a/paludis/mask.hh b/paludis/mask.hh
index 3807463..ed23fdf 100644
--- a/paludis/mask.hh
+++ b/paludis/mask.hh
@@ -23,11 +23,12 @@
#include <paludis/mask-fwd.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/package_id-fwd.hh>
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/named_value.hh>
+#include <paludis/util/type_list.hh>
#include <string>
/** \file
@@ -66,26 +67,6 @@ namespace paludis
};
/**
- * Types for a visitor that can visit a Mask subclass.
- *
- * \ingroup g_mask
- * \since 0.26
- * \nosubgrouping
- */
- struct MaskVisitorTypes :
- VisitorTypes<
- MaskVisitorTypes,
- Mask,
- UserMask,
- UnacceptedMask,
- RepositoryMask,
- UnsupportedMask,
- AssociationMask
- >
- {
- };
-
- /**
* A Mask represents one reason why a PackageID is masked (not available to
* be installed).
*
@@ -103,7 +84,8 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE Mask :
- public virtual ConstAcceptInterface<MaskVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<Mask, MakeTypeList<
+ UserMask, UnacceptedMask, RepositoryMask, UnsupportedMask, AssociationMask>::Type>
{
public:
///\name Basic operations
@@ -134,7 +116,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE UserMask :
public Mask,
- public ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UserMask>
+ public ImplementAcceptMethods<Mask, UserMask>
{
};
@@ -149,7 +131,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE UnacceptedMask :
public Mask,
- public ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UnacceptedMask>
+ public ImplementAcceptMethods<Mask, UnacceptedMask>
{
public:
/**
@@ -168,7 +150,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE RepositoryMask :
public Mask,
- public ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, RepositoryMask>
+ public ImplementAcceptMethods<Mask, RepositoryMask>
{
public:
/**
@@ -189,7 +171,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE UnsupportedMask :
public Mask,
- public ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UnsupportedMask>
+ public ImplementAcceptMethods<Mask, UnsupportedMask>
{
public:
/**
@@ -211,7 +193,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE AssociationMask :
public Mask,
- public ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, AssociationMask>
+ public ImplementAcceptMethods<Mask, AssociationMask>
{
public:
/**
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index e3f3609..217af76 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -44,8 +44,7 @@ using namespace paludis;
namespace
{
- struct SlotRequirementChecker :
- ConstVisitor<SlotRequirementVisitorTypes>
+ struct SlotRequirementChecker
{
const SlotName actual;
bool result;
diff --git a/paludis/metadata_key-fwd.hh b/paludis/metadata_key-fwd.hh
index d7f481d..d221c68 100644
--- a/paludis/metadata_key-fwd.hh
+++ b/paludis/metadata_key-fwd.hh
@@ -32,8 +32,6 @@
namespace paludis
{
- class MetadataKeyVisitorTypes;
-
class MetadataKey;
class MetadataSectionKey;
class MetadataTimeKey;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index a404fc8..9732997 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -35,8 +35,9 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/visitor.hh>
#include <paludis/util/remove_shared_ptr.hh>
+#include <paludis/util/simple_visitor.hh>
+#include <paludis/util/type_list.hh>
#include <tr1/type_traits>
#include <string>
@@ -53,42 +54,6 @@
namespace paludis
{
/**
- * Types for a visitor that can visit a MetadataKey subclass.
- *
- * \ingroup g_metadata_key
- * \since 0.26
- * \nosubgrouping
- */
- struct MetadataKeyVisitorTypes :
- VisitorTypes<
- MetadataKeyVisitorTypes,
- MetadataKey,
- MetadataCollectionKey<KeywordNameSet>,
- MetadataCollectionKey<Set<std::string> >,
- MetadataCollectionKey<Sequence<std::string> >,
- MetadataCollectionKey<PackageIDSequence>,
- MetadataCollectionKey<FSEntrySequence>,
- MetadataSpecTreeKey<DependencySpecTree>,
- MetadataSpecTreeKey<LicenseSpecTree>,
- MetadataSpecTreeKey<FetchableURISpecTree>,
- MetadataSpecTreeKey<SimpleURISpecTree>,
- MetadataSpecTreeKey<ProvideSpecTree>,
- MetadataSpecTreeKey<PlainTextSpecTree>,
- MetadataValueKey<std::string>,
- MetadataValueKey<long>,
- MetadataValueKey<bool>,
- MetadataValueKey<FSEntry>,
- MetadataValueKey<std::tr1::shared_ptr<const PackageID> >,
- MetadataValueKey<std::tr1::shared_ptr<const Contents> >,
- MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> >,
- MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
- MetadataTimeKey,
- MetadataSectionKey
- >
- {
- };
-
- /**
* A MetadataKey is a generic key that contains a particular piece of
* information about a PackageID or Repository instance.
*
@@ -121,7 +86,29 @@ namespace paludis
class PALUDIS_VISIBLE MetadataKey :
private InstantiationPolicy<MetadataKey, instantiation_method::NonCopyableTag>,
private PrivateImplementationPattern<MetadataKey>,
- public virtual ConstAcceptInterface<MetadataKeyVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<MetadataKey, MakeTypeList<
+ MetadataCollectionKey<KeywordNameSet>,
+ MetadataCollectionKey<Set<std::string> >,
+ MetadataCollectionKey<Sequence<std::string> >,
+ MetadataCollectionKey<PackageIDSequence>,
+ MetadataCollectionKey<FSEntrySequence>,
+ MetadataSpecTreeKey<DependencySpecTree>,
+ MetadataSpecTreeKey<LicenseSpecTree>,
+ MetadataSpecTreeKey<FetchableURISpecTree>,
+ MetadataSpecTreeKey<SimpleURISpecTree>,
+ MetadataSpecTreeKey<ProvideSpecTree>,
+ MetadataSpecTreeKey<PlainTextSpecTree>,
+ MetadataValueKey<std::string>,
+ MetadataValueKey<long>,
+ MetadataValueKey<bool>,
+ MetadataValueKey<FSEntry>,
+ MetadataValueKey<std::tr1::shared_ptr<const PackageID> >,
+ MetadataValueKey<std::tr1::shared_ptr<const Contents> >,
+ MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> >,
+ MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
+ MetadataTimeKey,
+ MetadataSectionKey
+ >::Type>
{
protected:
///\name Basic operations
@@ -160,7 +147,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE MetadataSectionKey :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSectionKey>,
+ public ImplementAcceptMethods<MetadataKey, MetadataSectionKey>,
public MetadataKeyHolder
{
protected:
@@ -260,7 +247,7 @@ namespace paludis
template <typename C_>
class PALUDIS_VISIBLE MetadataValueKey :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataValueKey<C_> >,
+ public ImplementAcceptMethods<MetadataKey, MetadataValueKey<C_> >,
public virtual ExtraMetadataValueKeyMethods<C_>
{
protected:
@@ -288,7 +275,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE MetadataTimeKey :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataTimeKey>
+ public ImplementAcceptMethods<MetadataKey, MetadataTimeKey>
{
protected:
///\name Basic operations
@@ -317,7 +304,7 @@ namespace paludis
template <typename C_>
class PALUDIS_VISIBLE MetadataCollectionKey :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataCollectionKey<C_> >
+ public ImplementAcceptMethods<MetadataKey, MetadataCollectionKey<C_> >
{
protected:
///\name Basic operations
@@ -354,7 +341,7 @@ namespace paludis
template <typename C_>
class PALUDIS_VISIBLE MetadataSpecTreeKey :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSpecTreeKey<C_> >
+ public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<C_> >
{
protected:
///\name Basic operations
@@ -400,7 +387,7 @@ namespace paludis
template <>
class PALUDIS_VISIBLE MetadataSpecTreeKey<FetchableURISpecTree> :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSpecTreeKey<FetchableURISpecTree> >
+ public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<FetchableURISpecTree> >
{
protected:
///\name Basic operations
@@ -453,7 +440,7 @@ namespace paludis
template <>
class PALUDIS_VISIBLE MetadataSpecTreeKey<DependencySpecTree> :
public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataSpecTreeKey<DependencySpecTree> >
+ public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<DependencySpecTree> >
{
protected:
///\name Basic operations
diff --git a/paludis/override_functions.cc b/paludis/override_functions.cc
index bd8378b..dd5b0d9 100644
--- a/paludis/override_functions.cc
+++ b/paludis/override_functions.cc
@@ -19,7 +19,7 @@
#include <paludis/override_functions.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/util/stringify.hh>
#include <paludis/environment.hh>
@@ -35,11 +35,11 @@ paludis::override_tilde_keywords(const Environment * const e, const PackageID &
{
Context c("When working out whether mask is a tilde keyword mask for override:");
- const UnacceptedMask * const mm(visitor_cast<const UnacceptedMask>(m));
+ const UnacceptedMask * const mm(simple_visitor_cast<const UnacceptedMask>(m));
if (! mm)
return false;
- const MetadataCollectionKey<KeywordNameSet> * const k(visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(*mm->unaccepted_key()));
+ const MetadataCollectionKey<KeywordNameSet> * const k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(*mm->unaccepted_key()));
if (! k)
return false;
@@ -60,11 +60,11 @@ paludis::override_unkeyworded(const Environment * const e, const PackageID & id,
{
Context c("When working out whether mask is an unkeyworded mask for override:");
- const UnacceptedMask * const mm(visitor_cast<const UnacceptedMask>(m));
+ const UnacceptedMask * const mm(simple_visitor_cast<const UnacceptedMask>(m));
if (! mm)
return false;
- const MetadataCollectionKey<KeywordNameSet> * const k(visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(*mm->unaccepted_key()));
+ const MetadataCollectionKey<KeywordNameSet> * const k(simple_visitor_cast<const MetadataCollectionKey<KeywordNameSet> >(*mm->unaccepted_key()));
if (! k)
return false;
@@ -81,15 +81,15 @@ bool
paludis::override_repository_masks(const Mask & m)
{
Context c("When working out whether mask is a repository mask for override:");
- return visitor_cast<const RepositoryMask>(m);
+ return simple_visitor_cast<const RepositoryMask>(m);
}
bool
paludis::override_license(const Mask & m)
{
Context c("When working out whether mask is a license mask for override:");
- const UnacceptedMask * const mm(visitor_cast<const UnacceptedMask>(m));
- return mm && visitor_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(*mm->unaccepted_key());
+ const UnacceptedMask * const mm(simple_visitor_cast<const UnacceptedMask>(m));
+ return mm && simple_visitor_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(*mm->unaccepted_key());
}
diff --git a/paludis/report_task.cc b/paludis/report_task.cc
index 6b8daf1..52851be 100644
--- a/paludis/report_task.cc
+++ b/paludis/report_task.cc
@@ -30,7 +30,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/package_database.hh>
@@ -100,7 +100,7 @@ namespace
generator::Matches(a, MatchPackageOptions()))]);
for (PackageIDSequence::ConstIterator i(insecure->begin()),
i_end(insecure->end()) ; i != i_end ; ++i)
- if (a.tag() && visitor_cast<const GLSADepTag>(*a.tag()))
+ if (a.tag() && simple_visitor_cast<const GLSADepTag>(*a.tag()))
_found.insert(std::make_pair(*i, a.tag()));
else
throw InternalError(PALUDIS_HERE, "didn't get a tag");
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 6f11919..43ce5dc 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -526,48 +526,46 @@ CRANInstalledRepository::merge(const MergeParams & m)
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
};
}
@@ -576,8 +574,7 @@ bool
CRANInstalledRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
void
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index be6059e..e2ea74c 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -452,53 +452,55 @@ CRANPackageID::canonical_form(const PackageIDCanonicalForm f) const
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
const std::tr1::shared_ptr<const CRANRepository> cran_repository;
const std::tr1::shared_ptr<const CRANInstalledRepository> cran_installed_repository;
SupportsActionQuery(const std::tr1::shared_ptr<const CRANRepository> & c, const std::tr1::shared_ptr<const CRANInstalledRepository> & r) :
- result(false),
cran_repository(c),
cran_installed_repository(r)
{
}
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
- result = cran_repository;
+ return cran_repository;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- result = cran_repository;
+ return cran_repository;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = cran_repository;
+ return cran_repository;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
};
}
@@ -507,8 +509,7 @@ bool
CRANPackageID::supports_action(const SupportsActionTestBase & b) const
{
SupportsActionQuery q(_imp->cran_repository, _imp->cran_installed_repository);
- b.accept(q);
- return q.result;
+ return b.accept_returning<bool>(q);
}
void
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index b2bf144..44cd46d 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -515,49 +515,46 @@ CRANRepository::invalidate_masks()
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
};
}
@@ -566,8 +563,7 @@ bool
CRANRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
void
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index af39e48..f6a8cfc 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -28,6 +28,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/set.hh>
#include <paludis/dep_spec.hh>
#include <paludis/stringify_formatter-impl.hh>
#include <paludis/formatter.hh>
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index ab0e5f3..b667dad 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -139,8 +139,7 @@ CheckFetchedFilesVisitor::visit_sequence(const AllDepSpec &,
namespace
{
- struct InNoFetchVisitor :
- ConstVisitor<URILabelVisitorTypes>
+ struct InNoFetchVisitor
{
bool result;
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index 8668f99..f3fe034 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -633,7 +633,7 @@ paludis::erepository::parse_uri_label(const std::string & s, const EAPI & e)
if (c.empty())
throw EDepParseError(s, "Unknown label");
- std::tr1::shared_ptr<URILabelsDepSpec> l(new LabelsDepSpec<URILabelVisitorTypes>);
+ std::tr1::shared_ptr<URILabelsDepSpec> l(new URILabelsDepSpec);
if (c == "URIMirrorsThenListedLabel")
l->add_label(make_shared_ptr(new URIMirrorsThenListedLabel(s.substr(0, s.length() - 1))));
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index d51e161..04b94a3 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -23,7 +23,7 @@
#include <paludis/formatter.hh>
#include <paludis/util/save.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/fs_entry.hh>
@@ -558,7 +558,7 @@ DepSpecPrettyPrinter::do_annotations(const DepSpec & p)
for (MetadataSectionKey::MetadataConstIterator k(p.annotations_key()->begin_metadata()), k_end(p.annotations_key()->end_metadata()) ;
k != k_end ; ++k)
{
- const MetadataValueKey<std::string> * r(visitor_cast<const MetadataValueKey<std::string> >(**k));
+ const MetadataValueKey<std::string> * r(simple_visitor_cast<const MetadataValueKey<std::string> >(**k));
if (! r)
throw InternalError(PALUDIS_HERE, "annotations must be string keys");
_imp->s << (*k)->raw_name() << " = [" << (r->value().empty() ? " " : " " + r->value() + " ") << "] ";
diff --git a/paludis/repositories/e/dependencies_rewriter.cc b/paludis/repositories/e/dependencies_rewriter.cc
index ec30ca9..8565878 100644
--- a/paludis/repositories/e/dependencies_rewriter.cc
+++ b/paludis/repositories/e/dependencies_rewriter.cc
@@ -24,7 +24,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/save.hh>
#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/metadata_key.hh>
#include <list>
@@ -46,7 +46,7 @@ namespace
k_end(a.annotations_key()->end_metadata()) ;
k != k_end ; ++k)
{
- const MetadataValueKey<std::string> * r(visitor_cast<const MetadataValueKey<std::string> >(**k));
+ const MetadataValueKey<std::string> * r(simple_visitor_cast<const MetadataValueKey<std::string> >(**k));
if (! r)
throw InternalError(PALUDIS_HERE, "annotations must be string keys");
s << (*k)->raw_name() << " = [" << (r->value().empty() ? " " : " " + r->value() + " ") << "] ";
@@ -196,8 +196,7 @@ DependenciesRewriter::visit_sequence(const ConditionalDepSpec & spec,
namespace
{
- struct AddWhereNecessary :
- ConstVisitor<DependencyTypeLabelVisitorTypes>
+ struct AddWhereNecessary
{
std::string & d, & r, & p;
const std::string & s;
diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc
index bb8ac00..7ea30bc 100644
--- a/paludis/repositories/e/e_choices_key.cc
+++ b/paludis/repositories/e/e_choices_key.cc
@@ -32,7 +32,7 @@
#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/simple_visitor_cast.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/member_iterator-impl.hh>
@@ -150,7 +150,7 @@ namespace
m_end(s.annotations_key()->end_metadata()) ;
m != m_end ; ++m)
{
- const MetadataValueKey<std::string> * mm(visitor_cast<const MetadataValueKey<std::string> >(**m));
+ const MetadataValueKey<std::string> * mm(simple_visitor_cast<const MetadataValueKey<std::string> >(**m));
if (! mm)
{
Log::get_instance()->message("e_key.myoptions.strange_annotation", ll_warning, lc_context)
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 2f09f00..6be3b44 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -25,7 +25,7 @@
#include <paludis/repositories/e/ebuild.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/stringify.hh>
@@ -78,49 +78,46 @@ EInstalledRepository::~EInstalledRepository()
namespace
{
- struct SomeIDsMightSupportVisitor :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SomeIDsMightSupportVisitor
{
- bool result;
-
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = false;
+ return false;
}
};
}
@@ -129,8 +126,7 @@ bool
EInstalledRepository::some_ids_might_support_action(const SupportsActionTestBase & test) const
{
SomeIDsMightSupportVisitor v;
- test.accept(v);
- return v.result;
+ return test.accept_returning<bool>(v);
}
bool
@@ -337,7 +333,7 @@ EInstalledRepository::perform_info(const std::tr1::shared_ptr<const ERepositoryI
if (r->end_metadata() != m)
{
const MetadataCollectionKey<Set<std::string> > * const mm(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**m));
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**m));
if (mm)
{
i = mm->value();
@@ -360,7 +356,7 @@ EInstalledRepository::perform_info(const std::tr1::shared_ptr<const ERepositoryI
if ((*r)->end_metadata() != m)
{
const MetadataCollectionKey<Set<std::string> > * const mm(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**m));
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**m));
if (mm)
{
i = mm->value();
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 09056a8..7487875 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -833,50 +833,46 @@ EInstalledRepositoryID::extra_hash_value() const
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
- result = true;
+ return true;
}
};
}
@@ -885,14 +881,12 @@ bool
EInstalledRepositoryID::supports_action(const SupportsActionTestBase & b) const
{
SupportsActionQuery q;
- b.accept(q);
- return q.result;
+ return b.accept_returning<bool>(q);
}
namespace
{
- struct PerformAction :
- ConstVisitor<ActionVisitorTypes>
+ struct PerformAction
{
const std::tr1::shared_ptr<const erepository::ERepositoryID> id;
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 0760351..bd97850 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1080,51 +1080,46 @@ ERepository::check_qa(
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
- result = true;
+ return true;
}
};
}
@@ -1133,8 +1128,7 @@ bool
ERepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
void
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 6615679..150b50c 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -28,7 +28,7 @@
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/system.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/make_named_values.hh>
@@ -483,8 +483,8 @@ namespace test_cases
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->begin());
TEST_CHECK(id1->end_metadata() != id1->find_metadata("EAPI"));
- TEST_CHECK(visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI")));
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI"))->value(), "0");
+ TEST_CHECK(simple_visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI")));
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI"))->value(), "0");
TEST_CHECK(id1->short_description_key());
TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Description");
StringifyFormatter ff;
@@ -1230,7 +1230,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-0",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
TEST_CHECK_THROWS(id->perform_action(action), InstallActionError);
}
@@ -1240,7 +1240,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/doman-0",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
id->perform_action(action);
}
@@ -1250,7 +1250,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-0",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
id->perform_action(action);
}
@@ -1260,7 +1260,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-0",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
id->perform_action(action);
}
@@ -1358,7 +1358,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
id->perform_action(action);
}
@@ -1368,7 +1368,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/dosym-success-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
id->perform_action(action);
}
@@ -1378,7 +1378,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/doman-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
id->perform_action(action);
}
@@ -1388,7 +1388,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
id->perform_action(action);
}
@@ -1398,7 +1398,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
id->perform_action(action);
}
}
@@ -1451,7 +1451,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
id->perform_action(action);
}
@@ -1461,7 +1461,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/doman-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
id->perform_action(action);
}
@@ -1471,7 +1471,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
TEST_CHECK_THROWS(id->perform_action(action), InstallActionError);
}
@@ -1481,7 +1481,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
TEST_CHECK_THROWS(id->perform_action(action), InstallActionError);
}
@@ -1491,7 +1491,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_configure-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
id->perform_action(action);
}
@@ -1501,7 +1501,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_compile-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
id->perform_action(action);
}
@@ -1511,7 +1511,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_compile-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
id->perform_action(action);
}
@@ -1521,7 +1521,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_compile-via-default-func-2",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
id->perform_action(action);
}
}
@@ -1574,7 +1574,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
id->perform_action(action);
}
@@ -1584,7 +1584,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/banned-functions-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
TEST_CHECK_THROWS(id->perform_action(action), InstallActionError);
}
@@ -1594,7 +1594,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/banned-vars-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "UNKNOWN");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "UNKNOWN");
}
{
@@ -1603,7 +1603,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/dosym-success-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
id->perform_action(action);
}
@@ -1613,7 +1613,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/dosym-fail-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
TEST_CHECK_THROWS(id->perform_action(action), InstallActionError);
}
@@ -1623,7 +1623,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/doman-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
id->perform_action(action);
}
@@ -1633,7 +1633,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
id->perform_action(action);
}
@@ -1643,7 +1643,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
id->perform_action(action);
}
}
@@ -1693,7 +1693,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/info-success-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
id->perform_action(action);
}
@@ -1703,7 +1703,7 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat/info-fail-kdebuild-1",
&env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
TEST_CHECK(id);
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "kdebuild-1");
TEST_CHECK_THROWS(id->perform_action(action), InfoActionError);
}
}
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
index 89b8cca..f11954f 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST.cc
@@ -29,7 +29,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
-#include <paludis/util/visitor_cast.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>
@@ -136,8 +136,8 @@ namespace test_cases
TEST_CHECK(id->short_description_key());
TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_list-eclass");
TEST_CHECK_EQUAL(join(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
}
} test_metadata_flat_list_eclass_cached;
@@ -504,8 +504,8 @@ namespace test_cases
TEST_CHECK(id->short_description_key());
TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-eclass");
TEST_CHECK_EQUAL(join(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
}
} test_metadata_flat_hash_eclass;
@@ -618,8 +618,8 @@ namespace test_cases
TEST_CHECK(id->short_description_key());
TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-full-eclass");
TEST_CHECK_EQUAL(join(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
}
} test_metadata_flat_hash_full_eclass;
@@ -649,8 +649,8 @@ namespace test_cases
TEST_CHECK(id->short_description_key());
TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-full-eclass-nonstandard");
TEST_CHECK_EQUAL(join(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "bar foo");
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "bar foo");
}
} test_metadata_flat_hash_full_eclass_nonstandard;
@@ -856,8 +856,8 @@ namespace test_cases
TEST_CHECK(id->short_description_key());
TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-exlib");
TEST_CHECK_EQUAL(join(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "foo");
}
} test_metadata_flat_hash_exlib;
@@ -888,8 +888,8 @@ namespace test_cases
TEST_CHECK(id->short_description_key());
TEST_CHECK_EQUAL(id->short_description_key()->value(), "the-description-flat_hash-exlib-percat");
TEST_CHECK_EQUAL(join(
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
- visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "bar foo");
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->begin(),
+ simple_visitor_cast<const MetadataCollectionKey<Set<std::string> > >(**id->find_metadata("INHERITED"))->value()->end(), " "), "bar foo");
}
} test_metadata_flat_hash_exlib_per_category;
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 694479f..b61d954 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -935,51 +935,46 @@ EbuildID::load_remote_ids(const std::string & r, const std::string & h, const st
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return true;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
- result = true;
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return true;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InfoAction> &)
- {
- result = true;
- }
-
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
};
}
@@ -988,15 +983,12 @@ bool
EbuildID::supports_action(const SupportsActionTestBase & b) const
{
SupportsActionQuery q;
- b.accept(q);
-
- return q.result && eapi()->supported();
+ return b.accept_returning<bool>(q) && eapi()->supported();
}
namespace
{
- struct PerformAction :
- Visitor<ActionVisitorTypes>
+ struct PerformAction
{
const std::tr1::shared_ptr<const PackageID> id;
diff --git a/paludis/repositories/e/exndbam_id.cc b/paludis/repositories/e/exndbam_id.cc
index fd6636e..41c88eb 100644
--- a/paludis/repositories/e/exndbam_id.cc
+++ b/paludis/repositories/e/exndbam_id.cc
@@ -22,6 +22,7 @@
#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/contents.hh>
#include <paludis/ndbam.hh>
#include <tr1/functional>
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
index cdc595c..ea7557c 100644
--- a/paludis/repositories/e/fix_locked_dependencies.cc
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -20,7 +20,7 @@
#include <paludis/repositories/e/fix_locked_dependencies.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -137,7 +137,7 @@ namespace
if (! s.slot_requirement_ptr())
break;
- const SlotAnyLockedRequirement * const r(visitor_cast<const SlotAnyLockedRequirement>(*s.slot_requirement_ptr()));
+ const SlotAnyLockedRequirement * const r(simple_visitor_cast<const SlotAnyLockedRequirement>(*s.slot_requirement_ptr()));
if (! r)
break;
diff --git a/paludis/repositories/e/myoptions_requirements_verifier.cc b/paludis/repositories/e/myoptions_requirements_verifier.cc
index d2bbe03..fd6ccfa 100644
--- a/paludis/repositories/e/myoptions_requirements_verifier.cc
+++ b/paludis/repositories/e/myoptions_requirements_verifier.cc
@@ -24,7 +24,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/log.hh>
#include <paludis/util/set.hh>
@@ -137,7 +137,7 @@ MyOptionsRequirementsVerifier::verify_one(const ChoicePrefixName & spec_prefix,
for (MetadataSectionKey::MetadataConstIterator m(annotations_key->begin_metadata()), m_end(annotations_key->end_metadata()) ;
m != m_end ; ++m)
{
- const MetadataValueKey<std::string> * mm(visitor_cast<const MetadataValueKey<std::string> >(**m));
+ const MetadataValueKey<std::string> * mm(simple_visitor_cast<const MetadataValueKey<std::string> >(**m));
if (! mm)
{
Log::get_instance()->message("e_key.myoptions.strange_annotation", ll_warning, lc_context)
@@ -292,7 +292,7 @@ MyOptionsRequirementsVerifier::visit_sequence(const AllDepSpec & s,
for (MetadataSectionKey::MetadataConstIterator m(s.annotations_key()->begin_metadata()), m_end(s.annotations_key()->end_metadata()) ;
m != m_end ; ++m)
{
- const MetadataValueKey<std::string> * mm(visitor_cast<const MetadataValueKey<std::string> >(**m));
+ const MetadataValueKey<std::string> * mm(simple_visitor_cast<const MetadataValueKey<std::string> >(**m));
if (! mm)
{
Log::get_instance()->message("e_key.myoptions.strange_annotation", ll_warning, lc_context)
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index 25a32ce..54072e2 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -31,7 +31,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/package_id.hh>
#include <paludis/environment.hh>
@@ -218,9 +218,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
Repository::MetadataConstIterator key(repo->find_metadata("location"));
if (repo->end_metadata() == key)
return "Einstalled repository has no location key";
- if (! visitor_cast<const MetadataValueKey<FSEntry> >(**key))
+ if (! simple_visitor_cast<const MetadataValueKey<FSEntry> >(**key))
return "Einstalled repository location key is not a MetadataValueKey<FSEntry> ";
- return "O0;" + stringify(visitor_cast<const MetadataValueKey<FSEntry> >(**key)->value());
+ return "O0;" + stringify(simple_visitor_cast<const MetadataValueKey<FSEntry> >(**key)->value());
}
}
else if (tokens[0] == "OPTIONQ")
diff --git a/paludis/repositories/e/qa/fetches_key.cc b/paludis/repositories/e/qa/fetches_key.cc
index 91f96ae..2d1dd91 100644
--- a/paludis/repositories/e/qa/fetches_key.cc
+++ b/paludis/repositories/e/qa/fetches_key.cc
@@ -35,7 +35,7 @@ using namespace paludis;
namespace
{
- struct LabelToFetchRestrict : ConstVisitor<URILabelVisitorTypes>
+ struct LabelToFetchRestrict
{
bool value;
diff --git a/paludis/repositories/e/qa/metadata_keys.cc b/paludis/repositories/e/qa/metadata_keys.cc
index a07c7ca..ae49b7d 100644
--- a/paludis/repositories/e/qa/metadata_keys.cc
+++ b/paludis/repositories/e/qa/metadata_keys.cc
@@ -33,8 +33,7 @@ using namespace paludis::erepository;
namespace
{
- struct KeyValidator :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct KeyValidator
{
void visit(const MetadataValueKey<std::string> & k)
{
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 8d60026..05fc9fe 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -287,8 +287,7 @@ namespace
}
};
- struct CheckForwarder :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct CheckForwarder
{
const FSEntry entry;
QAReporter & reporter;
diff --git a/paludis/repositories/e/source_uri_finder.hh b/paludis/repositories/e/source_uri_finder.hh
index 36e672b..1e48bbf 100644
--- a/paludis/repositories/e/source_uri_finder.hh
+++ b/paludis/repositories/e/source_uri_finder.hh
@@ -33,8 +33,7 @@ namespace paludis
namespace erepository
{
class PALUDIS_VISIBLE SourceURIFinder :
- private PrivateImplementationPattern<SourceURIFinder>,
- public ConstVisitor<URILabelVisitorTypes>
+ private PrivateImplementationPattern<SourceURIFinder>
{
private:
void add_local_mirrors();
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 215ab60..5d0e1ce 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -152,8 +152,7 @@ namespace test_cases
{
VDBRepositoryContentsTest() : TestCase("CONTENTS") { }
- struct ContentsGatherer :
- ConstVisitor<ContentsVisitorTypes>
+ struct ContentsGatherer
{
std::string _str;
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 133f1d3..9677d4f 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -139,47 +139,46 @@ FakeInstalledRepository::merge(const MergeParams &)
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
};
}
@@ -188,8 +187,7 @@ bool
FakeInstalledRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index b05dec9..2d374df 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -951,8 +951,7 @@ FakePackageID::make_unsupported()
namespace
{
- struct PerformAction :
- ConstVisitor<ActionVisitorTypes>
+ struct PerformAction
{
const PackageID * const id;
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 3433664..a9361b8 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -126,47 +126,46 @@ namespace paludis
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
};
}
@@ -175,8 +174,7 @@ bool
FakeRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
FakeRepository::MirrorsConstIterator
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index b32ac80..696a36c 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -74,8 +74,7 @@ namespace
{
std::string extract_text_only(const yaml::Node & n, const std::string & extra);
- struct VersionVisitor :
- ConstVisitor<yaml::NodeVisitorTypes>
+ struct VersionVisitor
{
std::string text;
@@ -101,8 +100,7 @@ namespace
throw BadSpecificationError("Version child node is sequence, not map");
}
- struct ExtractTextVisitor :
- ConstVisitor<yaml::NodeVisitorTypes>
+ struct ExtractTextVisitor
{
const std::string extra;
const bool accept_sequence;
@@ -191,8 +189,7 @@ namespace
return v.text;
}
- struct TopVisitor :
- ConstVisitor<yaml::NodeVisitorTypes>
+ struct TopVisitor
{
Implementation<GemSpecification> * const _imp;
@@ -499,8 +496,7 @@ GemSpecification::supports_action(const SupportsActionTestBase & b) const
namespace
{
- struct PerformAction :
- ConstVisitor<ActionVisitorTypes>
+ struct PerformAction
{
const PackageID * const id;
diff --git a/paludis/repositories/gems/gem_specification_TEST.cc b/paludis/repositories/gems/gem_specification_TEST.cc
index 28a855d..18aa092 100644
--- a/paludis/repositories/gems/gem_specification_TEST.cc
+++ b/paludis/repositories/gems/gem_specification_TEST.cc
@@ -23,7 +23,7 @@
#include <paludis/repositories/gems/yaml.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/name.hh>
#include <paludis/metadata_key.hh>
@@ -70,8 +70,8 @@ namespace test_cases
TEST_CHECK_EQUAL(spec.long_description_key()->value(), "A longer description");
TEST_CHECK(spec.find_metadata("authors") != spec.end_metadata());
- TEST_CHECK(visitor_cast<const MetadataValueKey<std::string> >(**spec.find_metadata("authors")));
- TEST_CHECK_EQUAL(visitor_cast<const MetadataValueKey<std::string> >(**spec.find_metadata("authors"))->value(), "Fred, Barney");
+ TEST_CHECK(simple_visitor_cast<const MetadataValueKey<std::string> >(**spec.find_metadata("authors")));
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**spec.find_metadata("authors"))->value(), "Fred, Barney");
#if 0
TEST_CHECK_EQUAL(spec.homepage(), "");
diff --git a/paludis/repositories/gems/gem_specifications.cc b/paludis/repositories/gems/gem_specifications.cc
index 994273f..bc72fad 100644
--- a/paludis/repositories/gems/gem_specifications.cc
+++ b/paludis/repositories/gems/gem_specifications.cc
@@ -53,8 +53,7 @@ namespace
{
std::string extract_text_only(const yaml::Node & n, const std::string & extra);
- struct ExtractTextVisitor :
- ConstVisitor<yaml::NodeVisitorTypes>
+ struct ExtractTextVisitor
{
const std::string extra;
const bool accept_sequence;
@@ -101,8 +100,7 @@ namespace
return v.result;
}
- struct GemsVisitor :
- ConstVisitor<yaml::NodeVisitorTypes>
+ struct GemsVisitor
{
Implementation<GemSpecifications> * const _imp;
const Environment * const environment;
@@ -155,8 +153,7 @@ namespace
throw BadSpecificationError("Top level 'gems' right hand node is text '" + n.text() + "', not map");
}
- struct TopVisitor :
- ConstVisitor<yaml::NodeVisitorTypes>
+ struct TopVisitor
{
Implementation<GemSpecifications> * const _imp;
const Environment * const environment;
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index d061c22..c068495 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -287,47 +287,46 @@ GemsRepository::do_install(const std::tr1::shared_ptr<const PackageID> & id, con
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
};
}
@@ -336,8 +335,7 @@ bool
GemsRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
void
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index a62e990..ca6c978 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -303,48 +303,46 @@ InstalledGemsRepository::do_uninstall(const std::tr1::shared_ptr<const PackageID
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
- result = true;
+ return true;
}
};
}
@@ -353,8 +351,7 @@ bool
InstalledGemsRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
void
diff --git a/paludis/repositories/gems/yaml-fwd.hh b/paludis/repositories/gems/yaml-fwd.hh
index f4f1569..b55c566 100644
--- a/paludis/repositories/gems/yaml-fwd.hh
+++ b/paludis/repositories/gems/yaml-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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 @@ namespace paludis
class StringNode;
class SequenceNode;
class MapNode;
- class NodeVisitorTypes;
class Document;
class NodeManager;
class ParseError;
diff --git a/paludis/repositories/gems/yaml.cc b/paludis/repositories/gems/yaml.cc
index 8974e70..cd01642 100644
--- a/paludis/repositories/gems/yaml.cc
+++ b/paludis/repositories/gems/yaml.cc
@@ -142,8 +142,7 @@ MapNode::end() const
namespace
{
- struct MatchStringVisitor :
- ConstVisitor<NodeVisitorTypes>
+ struct MatchStringVisitor
{
bool found;
const std::string target;
diff --git a/paludis/repositories/gems/yaml.hh b/paludis/repositories/gems/yaml.hh
index 1c48133..c2caf44 100644
--- a/paludis/repositories/gems/yaml.hh
+++ b/paludis/repositories/gems/yaml.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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,11 +21,13 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_YAML_HH 1
#include <paludis/repositories/gems/yaml-fwd.hh>
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/exception.hh>
+#include <paludis/util/type_list.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
namespace paludis
{
@@ -37,29 +39,14 @@ namespace paludis
class MapNode;
/**
- * Visitor types for a yaml node heirarchy.
- *
- * \ingroup grpgemsrepository
- * \nosubgrouping
- */
- struct NodeVisitorTypes :
- VisitorTypes<
- NodeVisitorTypes,
- Node,
- StringNode,
- SequenceNode,
- MapNode>
- {
- };
-
- /**
* A node in a yaml document.
*
* \ingroup grpgemsrepository
* \nosubgrouping
*/
class PALUDIS_VISIBLE Node :
- public virtual ConstAcceptInterface<NodeVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<Node, MakeTypeList<
+ StringNode, SequenceNode, MapNode>::Type>
{
public:
///\name Basic operations
@@ -78,7 +65,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE StringNode :
public Node,
- public ConstAcceptInterfaceVisitsThis<NodeVisitorTypes, StringNode>,
+ public ImplementAcceptMethods<Node, StringNode>,
private PrivateImplementationPattern<StringNode>
{
public:
@@ -104,7 +91,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE SequenceNode :
public Node,
- public ConstAcceptInterfaceVisitsThis<NodeVisitorTypes, SequenceNode>,
+ public ImplementAcceptMethods<Node, SequenceNode>,
private PrivateImplementationPattern<SequenceNode>
{
public:
@@ -140,7 +127,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE MapNode :
public Node,
- public ConstAcceptInterfaceVisitsThis<NodeVisitorTypes, MapNode>,
+ public ImplementAcceptMethods<Node, MapNode>,
private PrivateImplementationPattern<MapNode>
{
public:
diff --git a/paludis/repositories/gems/yaml_TEST.cc b/paludis/repositories/gems/yaml_TEST.cc
index 11983fb..08a8b31 100644
--- a/paludis/repositories/gems/yaml_TEST.cc
+++ b/paludis/repositories/gems/yaml_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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
@@ -68,8 +68,7 @@ namespace
}
};
- struct Dumper :
- ConstVisitor<NodeVisitorTypes>
+ struct Dumper
{
std::stringstream s;
diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc
index 60531e3..08f728e 100644
--- a/paludis/repositories/unavailable/unavailable_id.cc
+++ b/paludis/repositories/unavailable/unavailable_id.cc
@@ -22,7 +22,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/hashes.hh>
@@ -148,7 +148,7 @@ UnavailableID::repository() const
bool
UnavailableID::supports_action(const SupportsActionTestBase & a) const
{
- return visitor_cast<const SupportsActionTest<InstallAction> >(a);
+ return simple_visitor_cast<const SupportsActionTest<InstallAction> >(a);
}
void
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index 20ffc6b..7d45460 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -203,47 +203,46 @@ UnavailableRepository::package_ids(const QualifiedPackageName & p) const
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
};
}
@@ -252,8 +251,7 @@ bool
UnavailableRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
bool
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 93f6747..b462085 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -581,54 +581,50 @@ InstalledUnpackagedID::transient_key() const
namespace
{
- struct SupportVisitor :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportVisitor
{
- bool result;
-
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- result = false;
+ return false;
}
};
- struct PerformAction :
- Visitor<ActionVisitorTypes>
+ struct PerformAction
{
const InstalledUnpackagedID * const id;
@@ -682,8 +678,7 @@ bool
InstalledUnpackagedID::supports_action(const SupportsActionTestBase & test) const
{
SupportVisitor v;
- test.accept(v);
- return v.result;
+ return test.accept_returning<bool>(v);
}
void
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 8177658..691cb23 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -31,7 +31,7 @@
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/system.hh>
#include <paludis/util/cookie.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/stringify_formatter.hh>
#include <paludis/action.hh>
@@ -167,49 +167,46 @@ InstalledUnpackagedRepository::has_category_named(const CategoryNamePart & c) co
namespace
{
- struct SomeIDsMightSupportVisitor :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SomeIDsMightSupportVisitor
{
- bool result;
-
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
- result = false;
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = false;
+ return false;
}
};
}
@@ -218,8 +215,7 @@ bool
InstalledUnpackagedRepository::some_ids_might_support_action(const SupportsActionTestBase & test) const
{
SomeIDsMightSupportVisitor v;
- test.accept(v);
- return v.result;
+ return test.accept_returning<bool>(v);
}
namespace
@@ -262,7 +258,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
Repository::MetadataConstIterator k(m.package_id()->repository()->find_metadata("install_under"));
if (k == m.package_id()->repository()->end_metadata())
throw InstallActionError("Could not fetch install_under key from owning repository");
- const MetadataValueKey<FSEntry> * kk(visitor_cast<const MetadataValueKey<FSEntry> >(**k));
+ const MetadataValueKey<FSEntry> * kk(simple_visitor_cast<const MetadataValueKey<FSEntry> >(**k));
if (! kk)
throw InstallActionError("Fetched install_under key but did not get an FSEntry key from owning repository");
install_under = kk->value();
@@ -273,7 +269,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
Repository::MetadataConstIterator k(m.package_id()->repository()->find_metadata("rewrite_ids_over_to_root"));
if (k == m.package_id()->repository()->end_metadata())
throw InstallActionError("Could not fetch rewrite_ids_over_to_root key from owning repository");
- const MetadataValueKey<long> * kk(visitor_cast<const MetadataValueKey<long> >(**k));
+ const MetadataValueKey<long> * kk(simple_visitor_cast<const MetadataValueKey<long> >(**k));
if (! kk)
throw InstallActionError("Fetched rewrite_ids_over_to_root key but did not get a long key from owning repository");
rewrite_ids_over_to_root = kk->value();
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 1c1e892..c5c011d 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -44,8 +44,7 @@ using namespace paludis;
namespace
{
- struct ContentsDumper :
- ConstVisitor<ContentsVisitorTypes>
+ struct ContentsDumper
{
std::stringstream s;
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 361aa60..2a345b3 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -26,7 +26,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/log.hh>
#include <paludis/util/hashes.hh>
@@ -280,13 +280,13 @@ UnpackagedID::transient_key() const
bool
UnpackagedID::supports_action(const SupportsActionTestBase & test) const
{
- return visitor_cast<const SupportsActionTest<InstallAction> >(test);
+ return simple_visitor_cast<const SupportsActionTest<InstallAction> >(test);
}
void
UnpackagedID::perform_action(Action & action) const
{
- const InstallAction * const install_action(visitor_cast<const InstallAction>(action));
+ const InstallAction * const install_action(simple_visitor_cast<const InstallAction>(action));
if (! install_action)
throw UnsupportedActionError(*this, action);
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 6b0f761..ade4af2 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -27,6 +27,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/validated.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/set.hh>
#include <paludis/choice.hh>
#include <paludis/elike_choices.hh>
#include <tr1/memory>
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc
index 253fa48..fc391bf 100644
--- a/paludis/repositories/unwritten/unwritten_id.cc
+++ b/paludis/repositories/unwritten/unwritten_id.cc
@@ -22,7 +22,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/hashes.hh>
@@ -156,7 +156,7 @@ UnwrittenID::repository() const
bool
UnwrittenID::supports_action(const SupportsActionTestBase & a) const
{
- return visitor_cast<const SupportsActionTest<InstallAction> >(a);
+ return simple_visitor_cast<const SupportsActionTest<InstallAction> >(a);
}
void
diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc
index e8b0864..3336623 100644
--- a/paludis/repositories/unwritten/unwritten_repository.cc
+++ b/paludis/repositories/unwritten/unwritten_repository.cc
@@ -203,47 +203,46 @@ UnwrittenRepository::package_ids(const QualifiedPackageName & p) const
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
};
}
@@ -252,8 +251,7 @@ bool
UnwrittenRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
bool
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index f20ff5c..5f32f54 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -253,47 +253,46 @@ InstalledVirtualsRepository::can_be_favourite_repository() const
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
};
}
@@ -302,8 +301,7 @@ bool
InstalledVirtualsRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
std::tr1::shared_ptr<const CategoryNamePartSet>
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 3529bb6..0e7be04 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -342,8 +342,7 @@ VirtualsPackageID::need_keys_added() const
namespace
{
- struct PerformAction :
- ConstVisitor<ActionVisitorTypes>
+ struct PerformAction
{
const PackageID * const id;
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 797dc71..cd96295 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -351,47 +351,46 @@ VirtualsRepository::can_be_favourite_repository() const
namespace
{
- struct SupportsActionQuery :
- ConstVisitor<SupportsActionTestVisitorTypes>
+ struct SupportsActionQuery
{
- bool result;
-
- SupportsActionQuery() :
- result(false)
- {
- }
-
- void visit(const SupportsActionTest<InstalledAction> &)
+ bool visit(const SupportsActionTest<InstalledAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InstallAction> &)
+ bool visit(const SupportsActionTest<InstallAction> &) const
{
- result = true;
+ return true;
}
- void visit(const SupportsActionTest<ConfigAction> &)
+ bool visit(const SupportsActionTest<ConfigAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendAction> &)
+ bool visit(const SupportsActionTest<PretendAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<FetchAction> &)
+ bool visit(const SupportsActionTest<FetchAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<InfoAction> &)
+ bool visit(const SupportsActionTest<InfoAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<UninstallAction> &)
+ bool visit(const SupportsActionTest<UninstallAction> &) const
{
+ return false;
}
- void visit(const SupportsActionTest<PretendFetchAction> &)
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
{
+ return false;
}
};
}
@@ -400,8 +399,7 @@ bool
VirtualsRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
{
SupportsActionQuery q;
- a.accept(q);
- return q.result;
+ return a.accept_returning<bool>(q);
}
std::tr1::shared_ptr<const CategoryNamePartSet>
diff --git a/paludis/show_suggest_visitor.cc b/paludis/show_suggest_visitor.cc
index 2c4163b..b1c8734 100644
--- a/paludis/show_suggest_visitor.cc
+++ b/paludis/show_suggest_visitor.cc
@@ -136,8 +136,7 @@ ShowSuggestVisitor::visit_leaf(const BlockDepSpec &)
namespace
{
- struct SuggestActiveVisitor :
- ConstVisitor<DependencySuggestLabelVisitorTypes>
+ struct SuggestActiveVisitor
{
bool result;
diff --git a/paludis/slot_requirement-fwd.hh b/paludis/slot_requirement-fwd.hh
index 9f743d9..09852be 100644
--- a/paludis/slot_requirement-fwd.hh
+++ b/paludis/slot_requirement-fwd.hh
@@ -29,7 +29,6 @@ namespace paludis
struct SlotExactRequirement;
struct SlotAnyLockedRequirement;
struct SlotAnyUnlockedRequirement;
- struct SlotRequirementVisitorTypes;
std::ostream & operator<< (std::ostream &, const SlotRequirement &) PALUDIS_VISIBLE;
}
diff --git a/paludis/slot_requirement.cc b/paludis/slot_requirement.cc
index 00c7574..f0b7f45 100644
--- a/paludis/slot_requirement.cc
+++ b/paludis/slot_requirement.cc
@@ -23,11 +23,6 @@
using namespace paludis;
-template class ConstAcceptInterface<SlotRequirementVisitorTypes>;
-template class ConstAcceptInterfaceVisitsThis<SlotRequirementVisitorTypes, SlotExactRequirement>;
-template class ConstAcceptInterfaceVisitsThis<SlotRequirementVisitorTypes, SlotAnyLockedRequirement>;
-template class ConstAcceptInterfaceVisitsThis<SlotRequirementVisitorTypes, SlotAnyUnlockedRequirement>;
-
std::ostream &
paludis::operator<< (std::ostream & s, const SlotRequirement & r)
{
diff --git a/paludis/slot_requirement.hh b/paludis/slot_requirement.hh
index 9674ba9..e4f678d 100644
--- a/paludis/slot_requirement.hh
+++ b/paludis/slot_requirement.hh
@@ -22,23 +22,14 @@
#include <paludis/slot_requirement-fwd.hh>
#include <paludis/name-fwd.hh>
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
+#include <paludis/util/type_list.hh>
namespace paludis
{
- struct SlotRequirementVisitorTypes :
- VisitorTypes<
- SlotRequirementVisitorTypes,
- SlotRequirement,
- SlotExactRequirement,
- SlotAnyLockedRequirement,
- SlotAnyUnlockedRequirement
- >
- {
- };
-
class PALUDIS_VISIBLE SlotRequirement :
- public virtual ConstAcceptInterface<SlotRequirementVisitorTypes>
+ public virtual DeclareAbstractAcceptMethods<SlotRequirement, MakeTypeList<
+ SlotExactRequirement, SlotAnyLockedRequirement, SlotAnyUnlockedRequirement>::Type>
{
public:
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
@@ -46,7 +37,7 @@ namespace paludis
class PALUDIS_VISIBLE SlotExactRequirement :
public SlotRequirement,
- public ConstAcceptInterfaceVisitsThis<SlotRequirementVisitorTypes, SlotExactRequirement>
+ public ImplementAcceptMethods<SlotRequirement, SlotExactRequirement>
{
public:
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
@@ -54,13 +45,13 @@ namespace paludis
class PALUDIS_VISIBLE SlotAnyLockedRequirement :
public SlotRequirement,
- public ConstAcceptInterfaceVisitsThis<SlotRequirementVisitorTypes, SlotAnyLockedRequirement>
+ public ImplementAcceptMethods<SlotRequirement, SlotAnyLockedRequirement>
{
};
class PALUDIS_VISIBLE SlotAnyUnlockedRequirement :
public SlotRequirement,
- public ConstAcceptInterfaceVisitsThis<SlotRequirementVisitorTypes, SlotAnyUnlockedRequirement>
+ public ImplementAcceptMethods<SlotRequirement, SlotAnyUnlockedRequirement>
{
};
}
diff --git a/paludis/unchoices_key.cc b/paludis/unchoices_key.cc
index 7039e76..8beee35 100644
--- a/paludis/unchoices_key.cc
+++ b/paludis/unchoices_key.cc
@@ -23,6 +23,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/validated.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/set.hh>
using namespace paludis;
diff --git a/paludis/uninstall_list.cc b/paludis/uninstall_list.cc
index 33b038f..4b35e19 100644
--- a/paludis/uninstall_list.cc
+++ b/paludis/uninstall_list.cc
@@ -24,7 +24,7 @@
#include <paludis/util/log.hh>
#include <paludis/util/save.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/util/set-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -281,7 +281,7 @@ namespace
bool best_only(false);
if (a.slot_requirement_ptr())
- best_only = visitor_cast<const SlotAnyUnlockedRequirement>(*a.slot_requirement_ptr());
+ best_only = simple_visitor_cast<const SlotAnyUnlockedRequirement>(*a.slot_requirement_ptr());
std::tr1::shared_ptr<const PackageIDSequence> m(
best_only ?
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index bcaf51f..9c6924d 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -59,6 +59,8 @@ add(`set', `hh', `fwd', `impl')
add(`sha1', `hh', `cc', `test')
add(`sha256', `hh', `cc', `test')
add(`simple_parser', `hh', `cc')
+add(`simple_visitor', `hh', `cc', `fwd', `impl')
+add(`simple_visitor_cast', `hh', `cc', `fwd')
add(`stringify', `hh', `test')
add(`strip', `hh', `cc', `test')
add(`system', `hh', `cc', `test', `testscript')
@@ -68,6 +70,7 @@ add(`thread', `hh', `cc', `test')
add(`thread_pool', `hh', `cc', `test')
add(`tokeniser', `hh', `cc', `test')
add(`tribool', `hh', `cc', `fwd', `test')
+add(`type_list', `hh', `cc', `fwd')
add(`util', `hh')
add(`validated', `hh', `fwd', `test')
add(`visitor', `hh', `impl', `fwd', `test')
diff --git a/paludis/util/simple_visitor-fwd.hh b/paludis/util/simple_visitor-fwd.hh
new file mode 100644
index 0000000..ce75ea8
--- /dev/null
+++ b/paludis/util/simple_visitor-fwd.hh
@@ -0,0 +1,55 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_FWD_HH 1
+
+#include <paludis/util/type_list-fwd.hh>
+
+namespace paludis
+{
+ template <typename TypeList_>
+ struct DeclareAbstractVisitMethods;
+
+ template <>
+ struct DeclareAbstractVisitMethods<TypeListTail>;
+
+ template <typename TypeList_>
+ struct WrappedVisitorBase;
+
+ template <typename RealClass_, typename TypeList_>
+ struct ImplementVisitMethods;
+
+ template <typename RealClass_>
+ struct ImplementVisitMethods<RealClass_, TypeListTail>;
+
+ template <typename TypeList_, typename UnwrappedVisitor_>
+ struct WrappedVoidResultVisitor;
+
+ template <typename TypeList_, typename Result_, typename UnwrappedVisitor_>
+ struct WrappedNonVoidResultVisitor;
+
+ template <typename BaseClass_, typename VisitableTypeList_>
+ struct DeclareAbstractAcceptMethods;
+
+ template <typename BaseClass_, typename RealClass_>
+ struct ImplementAcceptMethods;
+}
+
+#endif
diff --git a/paludis/util/simple_visitor-impl.hh b/paludis/util/simple_visitor-impl.hh
new file mode 100644
index 0000000..4418e33
--- /dev/null
+++ b/paludis/util/simple_visitor-impl.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_IMPL_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_IMPL_HH 1
+
+#include <paludis/util/simple_visitor.hh>
+
+namespace paludis
+{
+
+}
+
+#endif
diff --git a/paludis/util/simple_visitor.cc b/paludis/util/simple_visitor.cc
new file mode 100644
index 0000000..0c84576
--- /dev/null
+++ b/paludis/util/simple_visitor.cc
@@ -0,0 +1,21 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/util/simple_visitor-impl.hh>
+
diff --git a/paludis/util/simple_visitor.hh b/paludis/util/simple_visitor.hh
new file mode 100644
index 0000000..38cff95
--- /dev/null
+++ b/paludis/util/simple_visitor.hh
@@ -0,0 +1,177 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_HH 1
+
+#include <paludis/util/simple_visitor-fwd.hh>
+#include <paludis/util/no_type.hh>
+
+namespace paludis
+{
+ template <>
+ struct DeclareAbstractVisitMethods<TypeListTail>
+ {
+ void forward_visit(const NoType<0u> &);
+ };
+
+ template <typename TypeList_>
+ class DeclareAbstractVisitMethods :
+ public virtual DeclareAbstractVisitMethods<typename TypeList_::Tail>
+ {
+ public:
+ using DeclareAbstractVisitMethods<typename TypeList_::Tail>::forward_visit;
+
+ virtual void forward_visit(typename TypeList_::Item &) = 0;
+ };
+
+ template <typename TypeList_>
+ class WrappedVisitorBase :
+ public virtual DeclareAbstractVisitMethods<TypeList_>
+ {
+ };
+
+ template <typename RealClass_>
+ class ImplementVisitMethods<RealClass_, TypeListTail>
+ {
+ public:
+ void forward_visit(const NoType<1u> &);
+ };
+
+ template <typename RealClass_, typename TypeList_>
+ class ImplementVisitMethods :
+ public virtual DeclareAbstractVisitMethods<TypeList_>,
+ public ImplementVisitMethods<RealClass_, typename TypeList_::Tail>
+ {
+ public:
+ using ImplementVisitMethods<RealClass_, typename TypeList_::Tail>::forward_visit;
+
+ virtual void forward_visit(typename TypeList_::Item & n)
+ {
+ /* avoid gcc being too clever about noreturn */
+ if (this)
+ static_cast<RealClass_ *>(this)->perform_visit(n);
+ }
+ };
+
+ template <typename TypeList_, typename UnwrappedVisitor_>
+ class WrappedVoidResultVisitor :
+ public WrappedVisitorBase<TypeList_>,
+ public ImplementVisitMethods<WrappedVoidResultVisitor<TypeList_, UnwrappedVisitor_>, TypeList_>
+ {
+ private:
+ UnwrappedVisitor_ & _unwrapped_visitor;
+
+ public:
+ WrappedVoidResultVisitor(UnwrappedVisitor_ & v) :
+ _unwrapped_visitor(v)
+ {
+ }
+
+ template <typename C_>
+ void perform_visit(C_ & t)
+ {
+ _unwrapped_visitor.visit(t);
+ }
+ };
+
+ template <typename TypeList_, typename Result_, typename UnwrappedVisitor_>
+ class WrappedNonVoidResultVisitor :
+ public WrappedVisitorBase<TypeList_>,
+ public ImplementVisitMethods<WrappedNonVoidResultVisitor<TypeList_, Result_, UnwrappedVisitor_>,
+ TypeList_>
+ {
+ private:
+ UnwrappedVisitor_ & _unwrapped_visitor;
+
+ public:
+ Result_ result;
+
+ WrappedNonVoidResultVisitor(UnwrappedVisitor_ & v, const Result_ & r) :
+ _unwrapped_visitor(v),
+ result(r)
+ {
+ }
+
+ template <typename C_>
+ void perform_visit(C_ & t)
+ {
+ result = _unwrapped_visitor.visit(t);
+ }
+ };
+
+ template <typename BaseClass_, typename VisitableTypeList_>
+ class DeclareAbstractAcceptMethods
+ {
+ private:
+ virtual void _real_accept(WrappedVisitorBase<VisitableTypeList_> &) = 0;
+ virtual void _real_accept_const(WrappedVisitorBase<typename MakeTypeListConst<VisitableTypeList_>::Type> &) const = 0;
+
+ public:
+ typedef VisitableTypeList_ VisitableTypeList;
+
+ template <typename UnwrappedVisitor_>
+ void accept(UnwrappedVisitor_ & v)
+ {
+ WrappedVoidResultVisitor<VisitableTypeList_, UnwrappedVisitor_> vv(v);
+ _real_accept(vv);
+ }
+
+ template <typename UnwrappedVisitor_>
+ void accept(UnwrappedVisitor_ & v) const
+ {
+ WrappedVoidResultVisitor<typename MakeTypeListConst<VisitableTypeList_>::Type, UnwrappedVisitor_> vv(v);
+ _real_accept_const(vv);
+ }
+
+ template <typename Result_, typename UnwrappedVisitor_>
+ Result_ accept_returning(UnwrappedVisitor_ & v, const Result_ & r = Result_())
+ {
+ WrappedNonVoidResultVisitor<VisitableTypeList_, Result_, UnwrappedVisitor_> vv(v, r);
+ _real_accept(vv);
+ return vv.result;
+ }
+
+ template <typename Result_, typename UnwrappedVisitor_>
+ Result_ accept_returning(UnwrappedVisitor_ & v, const Result_ & r = Result_()) const
+ {
+ WrappedNonVoidResultVisitor<typename MakeTypeListConst<VisitableTypeList_>::Type, Result_, UnwrappedVisitor_> vv(v, r);
+ _real_accept_const(vv);
+ return vv.result;
+ }
+ };
+
+ template <typename BaseClass_, typename RealClass_>
+ class ImplementAcceptMethods :
+ public virtual DeclareAbstractAcceptMethods<BaseClass_, typename BaseClass_::VisitableTypeList>
+ {
+ private:
+ void _real_accept(WrappedVisitorBase<typename BaseClass_::VisitableTypeList> & v)
+ {
+ v.forward_visit(*static_cast<RealClass_ *>(this));
+ };
+
+ void _real_accept_const(WrappedVisitorBase<typename MakeTypeListConst<typename BaseClass_::VisitableTypeList>::Type> & v) const
+ {
+ v.forward_visit(*static_cast<const RealClass_ *>(this));
+ };
+ };
+}
+
+#endif
diff --git a/paludis/util/simple_visitor_cast-fwd.hh b/paludis/util/simple_visitor_cast-fwd.hh
new file mode 100644
index 0000000..3fcb4d7
--- /dev/null
+++ b/paludis/util/simple_visitor_cast-fwd.hh
@@ -0,0 +1,31 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_CAST_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_CAST_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+
+namespace paludis
+{
+ template <typename To_, typename From_>
+ To_ * simple_visitor_cast(const From_ &) PALUDIS_ATTRIBUTE((warn_unused_result));
+}
+
+#endif
diff --git a/paludis/util/simple_visitor_cast.cc b/paludis/util/simple_visitor_cast.cc
new file mode 100644
index 0000000..641abf8
--- /dev/null
+++ b/paludis/util/simple_visitor_cast.cc
@@ -0,0 +1,23 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/util/simple_visitor_cast.hh>
+
+using namespace paludis;
+
diff --git a/paludis/util/simple_visitor_cast.hh b/paludis/util/simple_visitor_cast.hh
new file mode 100644
index 0000000..db74622
--- /dev/null
+++ b/paludis/util/simple_visitor_cast.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_CAST_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_SIMPLE_VISITOR_CAST_HH 1
+
+#include <paludis/util/simple_visitor_cast-fwd.hh>
+#include <paludis/util/simple_visitor.hh>
+#include <tr1/type_traits>
+
+namespace paludis
+{
+ template <typename To_, typename From_>
+ struct SimpleVisitorCaster
+ {
+ To_ * visit(const To_ & t)
+ {
+ return &t;
+ }
+
+ To_ * visit(const From_ &)
+ {
+ return 0;
+ }
+ };
+
+ template <typename To_, typename From_>
+ To_ * simple_visitor_cast(const From_ & from)
+ {
+ SimpleVisitorCaster<To_, From_> q;
+ return from.template accept_returning<To_ *>(q);
+ }
+}
+
+#endif
diff --git a/paludis/util/type_list-fwd.hh b/paludis/util/type_list-fwd.hh
new file mode 100644
index 0000000..43965d3
--- /dev/null
+++ b/paludis/util/type_list-fwd.hh
@@ -0,0 +1,70 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_TYPE_LIST_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_TYPE_LIST_FWD_HH 1
+
+namespace paludis
+{
+ struct TypeListTail;
+
+ template <typename Item_, typename Tail_>
+ struct TypeListEntry;
+
+ template <typename Item_, typename Tail_>
+ struct MakeTypeListEntry;
+
+ template <
+ typename T01_ = TypeListTail,
+ typename T02_ = TypeListTail,
+ typename T03_ = TypeListTail,
+ typename T04_ = TypeListTail,
+ typename T05_ = TypeListTail,
+ typename T06_ = TypeListTail,
+ typename T07_ = TypeListTail,
+ typename T08_ = TypeListTail,
+ typename T09_ = TypeListTail,
+ typename T10_ = TypeListTail,
+ typename T11_ = TypeListTail,
+ typename T12_ = TypeListTail,
+ typename T13_ = TypeListTail,
+ typename T14_ = TypeListTail,
+ typename T15_ = TypeListTail,
+ typename T16_ = TypeListTail,
+ typename T17_ = TypeListTail,
+ typename T18_ = TypeListTail,
+ typename T19_ = TypeListTail,
+ typename T20_ = TypeListTail,
+ typename T21_ = TypeListTail,
+ typename T22_ = TypeListTail,
+ typename T23_ = TypeListTail,
+ typename T24_ = TypeListTail,
+ typename T25_ = TypeListTail
+ >
+ struct MakeTypeList;
+
+ template <typename TypeList_>
+ struct MakeTypeListConst;
+
+ template <typename Item_>
+ struct MakeTypeListConstEntry;
+
+}
+
+#endif
diff --git a/paludis/util/type_list.cc b/paludis/util/type_list.cc
new file mode 100644
index 0000000..d2b4e49
--- /dev/null
+++ b/paludis/util/type_list.cc
@@ -0,0 +1,21 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/util/type_list.hh>
+
diff --git a/paludis/util/type_list.hh b/paludis/util/type_list.hh
new file mode 100644
index 0000000..761b440
--- /dev/null
+++ b/paludis/util/type_list.hh
@@ -0,0 +1,150 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_TYPE_LIST_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_TYPE_LIST_HH 1
+
+#include <paludis/util/type_list-fwd.hh>
+
+namespace paludis
+{
+ struct TypeListTail
+ {
+ };
+
+ template <typename Item_, typename Tail_>
+ struct TypeListEntry
+ {
+ typedef Item_ Item;
+ typedef Tail_ Tail;
+ };
+
+ template <typename Item_, typename Tail_>
+ struct MakeTypeListEntry
+ {
+ typedef TypeListEntry<Item_, Tail_> Type;
+ };
+
+ template <typename Tail_>
+ struct MakeTypeListEntry<TypeListTail, Tail_>
+ {
+ typedef TypeListTail Type;
+ };
+
+ template <
+ typename T01_,
+ typename T02_,
+ typename T03_,
+ typename T04_,
+ typename T05_,
+ typename T06_,
+ typename T07_,
+ typename T08_,
+ typename T09_,
+ typename T10_,
+ typename T11_,
+ typename T12_,
+ typename T13_,
+ typename T14_,
+ typename T15_,
+ typename T16_,
+ typename T17_,
+ typename T18_,
+ typename T19_,
+ typename T20_,
+ typename T21_,
+ typename T22_,
+ typename T23_,
+ typename T24_,
+ typename T25_
+ >
+ struct MakeTypeList
+ {
+ typedef
+ typename MakeTypeListEntry<T01_,
+ typename MakeTypeListEntry<T02_,
+ typename MakeTypeListEntry<T03_,
+ typename MakeTypeListEntry<T04_,
+ typename MakeTypeListEntry<T05_,
+ typename MakeTypeListEntry<T06_,
+ typename MakeTypeListEntry<T07_,
+ typename MakeTypeListEntry<T08_,
+ typename MakeTypeListEntry<T09_,
+ typename MakeTypeListEntry<T10_,
+ typename MakeTypeListEntry<T11_,
+ typename MakeTypeListEntry<T12_,
+ typename MakeTypeListEntry<T13_,
+ typename MakeTypeListEntry<T14_,
+ typename MakeTypeListEntry<T15_,
+ typename MakeTypeListEntry<T16_,
+ typename MakeTypeListEntry<T17_,
+ typename MakeTypeListEntry<T18_,
+ typename MakeTypeListEntry<T19_,
+ typename MakeTypeListEntry<T20_,
+ typename MakeTypeListEntry<T21_,
+ typename MakeTypeListEntry<T22_,
+ typename MakeTypeListEntry<T23_,
+ typename MakeTypeListEntry<T24_,
+ typename MakeTypeListEntry<T25_, TypeListTail>::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type
+ >::Type Type;
+ };
+
+ template <>
+ struct MakeTypeListConstEntry<TypeListTail>
+ {
+ typedef TypeListTail Type;
+ };
+
+ template <typename Item_, typename Tail_>
+ struct MakeTypeListConstEntry<TypeListEntry<Item_, Tail_> >
+ {
+ typedef TypeListEntry<const Item_, typename MakeTypeListConstEntry<Tail_>::Type> Type;
+ };
+
+ template <typename TypeList_>
+ struct MakeTypeListConst
+ {
+ typedef typename MakeTypeListConstEntry<TypeList_>::Type Type;
+ };
+}
+
+#endif
diff --git a/python/mask.cc b/python/mask.cc
index ebed55b..f9d5ae2 100644
--- a/python/mask.cc
+++ b/python/mask.cc
@@ -41,8 +41,7 @@ namespace
}
}
-class MaskSptrToPythonVisitor :
- public ConstVisitor<MaskVisitorTypes>
+class MaskSptrToPythonVisitor
{
private:
const std::tr1::shared_ptr<const Mask> & _m_ptr;
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 6e440ed..93fa31d 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -35,8 +35,7 @@ using namespace paludis;
using namespace paludis::python;
namespace bp = boost::python;
-class MetadataKeySptrToPythonVisitor :
- public ConstVisitor<MetadataKeyVisitorTypes>
+class MetadataKeySptrToPythonVisitor
{
private:
const std::tr1::shared_ptr<const MetadataKey> & _m_ptr;
diff --git a/ruby/contents.cc b/ruby/contents.cc
index 8f34437..8265644 100644
--- a/ruby/contents.cc
+++ b/ruby/contents.cc
@@ -37,8 +37,7 @@ namespace
static VALUE c_contents_dev_entry;
static VALUE c_contents_fifo_entry;
- struct V :
- ConstVisitor<ContentsVisitorTypes>
+ struct V
{
VALUE value;
std::tr1::shared_ptr<const ContentsEntry> mm;
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 8e4e18a..cbd3729 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -65,8 +65,7 @@ namespace
static VALUE c_slot_any_locked_requirement;
static VALUE c_slot_any_unlocked_requirement;
- struct V :
- ConstVisitor<SlotRequirementVisitorTypes>
+ struct V
{
VALUE value;
std::tr1::shared_ptr<const SlotRequirement> mm;
@@ -1020,8 +1019,7 @@ namespace
}
- struct URILabelToValue :
- ConstVisitor<URILabelVisitorTypes>
+ struct URILabelToValue
{
VALUE value;
std::tr1::shared_ptr<const URILabel> mm;
diff --git a/ruby/dep_tag.cc b/ruby/dep_tag.cc
index a918a4a..6bc3106 100644
--- a/ruby/dep_tag.cc
+++ b/ruby/dep_tag.cc
@@ -34,8 +34,8 @@ namespace
static VALUE c_glsa_dep_tag;
static VALUE c_general_set_dep_tag;
static VALUE c_target_dep_tag;
- struct V :
- ConstVisitor<DepTagVisitorTypes>
+
+ struct V
{
VALUE value;
std::tr1::shared_ptr<const DepTag> mm;
diff --git a/ruby/mask.cc b/ruby/mask.cc
index 49c7a1b..c010ab7 100644
--- a/ruby/mask.cc
+++ b/ruby/mask.cc
@@ -35,8 +35,7 @@ namespace
static VALUE c_unsupported_mask;
static VALUE c_association_mask;
- struct V :
- ConstVisitor<MaskVisitorTypes>
+ struct V
{
VALUE value;
std::tr1::shared_ptr<const Mask> mm;
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index 4c7f859..9e3e060 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -91,8 +91,7 @@ namespace
}
};
- struct V :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct V
{
VALUE value;
std::tr1::shared_ptr<const MetadataKey> mm;
diff --git a/src/clients/cave/cmd_print_environment_metadata.cc b/src/clients/cave/cmd_print_environment_metadata.cc
index 0b4ec9b..eec34df 100644
--- a/src/clients/cave/cmd_print_environment_metadata.cc
+++ b/src/clients/cave/cmd_print_environment_metadata.cc
@@ -24,7 +24,7 @@
#include <paludis/args/do_help.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
@@ -103,7 +103,7 @@ namespace
cout << format_plain_metadata_key(k, name_prefix, cmdline.a_format.argument());
} while (false);
- const MetadataSectionKey * section(visitor_cast<const MetadataSectionKey>(*k));
+ const MetadataSectionKey * section(simple_visitor_cast<const MetadataSectionKey>(*k));
if (section)
{
for (MetadataSectionKey::MetadataConstIterator s(section->begin_metadata()), s_end(section->end_metadata()) ;
diff --git a/src/clients/cave/cmd_print_id_metadata.cc b/src/clients/cave/cmd_print_id_metadata.cc
index e9aed60..5517712 100644
--- a/src/clients/cave/cmd_print_id_metadata.cc
+++ b/src/clients/cave/cmd_print_id_metadata.cc
@@ -24,7 +24,7 @@
#include <paludis/args/do_help.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/options.hh>
@@ -116,7 +116,7 @@ namespace
cout << format_plain_metadata_key(k, name_prefix, cmdline.a_format.argument());
} while (false);
- const MetadataSectionKey * section(visitor_cast<const MetadataSectionKey>(*k));
+ const MetadataSectionKey * section(simple_visitor_cast<const MetadataSectionKey>(*k));
if (section)
{
for (MetadataSectionKey::MetadataConstIterator s(section->begin_metadata()), s_end(section->end_metadata()) ;
diff --git a/src/clients/cave/cmd_print_ids.cc b/src/clients/cave/cmd_print_ids.cc
index 6c3d23a..4aa95f4 100644
--- a/src/clients/cave/cmd_print_ids.cc
+++ b/src/clients/cave/cmd_print_ids.cc
@@ -29,7 +29,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
@@ -171,7 +171,7 @@ namespace
{
for (PackageID::MasksConstIterator m((*i)->begin_masks()), m_end((*i)->end_masks()) ;
m != m_end ; ++m)
- if (visitor_cast<const UserMask>(**m))
+ if (simple_visitor_cast<const UserMask>(**m))
{
result->insert(*i);
break;
@@ -181,7 +181,7 @@ namespace
{
for (PackageID::MasksConstIterator m((*i)->begin_masks()), m_end((*i)->end_masks()) ;
m != m_end ; ++m)
- if (visitor_cast<const UnacceptedMask>(**m))
+ if (simple_visitor_cast<const UnacceptedMask>(**m))
{
result->insert(*i);
break;
@@ -191,7 +191,7 @@ namespace
{
for (PackageID::MasksConstIterator m((*i)->begin_masks()), m_end((*i)->end_masks()) ;
m != m_end ; ++m)
- if (visitor_cast<const RepositoryMask>(**m))
+ if (simple_visitor_cast<const RepositoryMask>(**m))
{
result->insert(*i);
break;
@@ -201,7 +201,7 @@ namespace
{
for (PackageID::MasksConstIterator m((*i)->begin_masks()), m_end((*i)->end_masks()) ;
m != m_end ; ++m)
- if (visitor_cast<const UnsupportedMask>(**m))
+ if (simple_visitor_cast<const UnsupportedMask>(**m))
{
result->insert(*i);
break;
@@ -211,7 +211,7 @@ namespace
{
for (PackageID::MasksConstIterator m((*i)->begin_masks()), m_end((*i)->end_masks()) ;
m != m_end ; ++m)
- if (visitor_cast<const AssociationMask>(**m))
+ if (simple_visitor_cast<const AssociationMask>(**m))
{
result->insert(*i);
break;
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 9509126..0aea0e2 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -40,7 +40,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/action.hh>
#include <paludis/mask.hh>
@@ -187,8 +187,8 @@ namespace
{
bool operator() (const std::tr1::shared_ptr<const MetadataKey> & a, const std::tr1::shared_ptr<const MetadataKey> & b) const
{
- bool a_is_section(visitor_cast<const MetadataSectionKey>(*a));
- bool b_is_section(visitor_cast<const MetadataSectionKey>(*b));
+ bool a_is_section(simple_visitor_cast<const MetadataSectionKey>(*a));
+ bool b_is_section(simple_visitor_cast<const MetadataSectionKey>(*b));
if (a_is_section != b_is_section)
return b_is_section;
if (a->type() != b->type())
@@ -197,8 +197,7 @@ namespace
}
};
- struct ContentsDisplayer :
- ConstVisitor<ContentsVisitorTypes>
+ struct ContentsDisplayer
{
const unsigned indent;
std::stringstream s;
@@ -245,8 +244,7 @@ namespace
}
};
- struct InfoDisplayer :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct InfoDisplayer
{
const ShowCommandLine & cmdline;
const int indent;
@@ -467,8 +465,7 @@ namespace
}
};
- struct MaskDisplayer :
- ConstVisitor<MaskVisitorTypes>
+ struct MaskDisplayer
{
const ShowCommandLine & cmdline;
const int indent;
diff --git a/src/clients/cave/format_plain_contents_entry.cc b/src/clients/cave/format_plain_contents_entry.cc
index 8174689..d4a622c 100644
--- a/src/clients/cave/format_plain_contents_entry.cc
+++ b/src/clients/cave/format_plain_contents_entry.cc
@@ -32,8 +32,7 @@ using namespace cave;
namespace
{
- struct ValueGetter :
- ConstVisitor<ContentsVisitorTypes>
+ struct ValueGetter
{
std::string target;
std::string slash;
diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc
index 1f2ba3e..0bdacd9 100644
--- a/src/clients/cave/format_plain_metadata_key.cc
+++ b/src/clients/cave/format_plain_metadata_key.cc
@@ -35,8 +35,7 @@ using namespace cave;
namespace
{
- struct ValueGetter :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct ValueGetter
{
std::stringstream s;
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 5ceb986..6f8c2ac 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -178,8 +178,7 @@ namespace
}
};
- class KeyVisitor :
- public ConstVisitor<MetadataKeyVisitorTypes>
+ class KeyVisitor
{
private:
const std::string _key;
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 0cd7b6a..b6b3242 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -34,7 +34,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/map.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/set.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
@@ -52,8 +52,7 @@ using std::endl;
namespace
{
- struct KeyValidator :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct KeyValidator
{
void visit(const MetadataValueKey<std::string> & k)
{
@@ -269,13 +268,13 @@ main(int argc, char *argv[])
continue;
}
- if (! visitor_cast<const MetadataValueKey<std::string> >(**eapi_i))
+ if (! simple_visitor_cast<const MetadataValueKey<std::string> >(**eapi_i))
{
results.insert(std::make_pair(*i, "EAPI metadata key is not a string key"));
continue;
}
- if (visitor_cast<const MetadataValueKey<std::string> >(**eapi_i)->value() == "UNKNOWN")
+ if (simple_visitor_cast<const MetadataValueKey<std::string> >(**eapi_i)->value() == "UNKNOWN")
{
results.insert(std::make_pair(*i, "EAPI is 'UNKNOWN'"));
continue;
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index f83e3ea..8d2db8f 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -41,8 +41,7 @@ using namespace paludis;
namespace
{
- struct ValuePrinter :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct ValuePrinter
{
int return_code;
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index 74bc0b8..214ab9d 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -33,8 +33,7 @@ using std::endl;
namespace
{
- struct ContentsDisplayer :
- ConstVisitor<ContentsVisitorTypes>
+ struct ContentsDisplayer
{
void visit(const ContentsFileEntry & e)
{
diff --git a/src/clients/paludis/do_executables.cc b/src/clients/paludis/do_executables.cc
index 4b65854..f9b7904 100644
--- a/src/clients/paludis/do_executables.cc
+++ b/src/clients/paludis/do_executables.cc
@@ -35,8 +35,7 @@ using std::endl;
namespace
{
- struct ExecutablesDisplayer :
- ConstVisitor<ContentsVisitorTypes>
+ struct ExecutablesDisplayer
{
private:
const std::list<std::string> _paths;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 9d72bce..2c73587 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -25,7 +25,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
@@ -52,8 +52,8 @@ namespace
{
bool operator() (const std::tr1::shared_ptr<const MetadataKey> & a, const std::tr1::shared_ptr<const MetadataKey> & b) const
{
- bool a_is_section(visitor_cast<const MetadataSectionKey>(*a));
- bool b_is_section(visitor_cast<const MetadataSectionKey>(*b));
+ bool a_is_section(simple_visitor_cast<const MetadataSectionKey>(*a));
+ bool b_is_section(simple_visitor_cast<const MetadataSectionKey>(*b));
if (a_is_section != b_is_section)
return b_is_section;
if (a->type() != b->type())
@@ -62,8 +62,7 @@ namespace
}
};
- struct InfoDisplayer :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct InfoDisplayer
{
std::string indent;
diff --git a/src/clients/paludis/owner.cc b/src/clients/paludis/owner.cc
index e9917a8..f9014d2 100644
--- a/src/clients/paludis/owner.cc
+++ b/src/clients/paludis/owner.cc
@@ -34,8 +34,7 @@ using std::endl;
namespace
{
- struct ContentsFinder :
- ConstVisitor<ContentsVisitorTypes>
+ struct ContentsFinder
{
std::set<std::string> matches;
const std::string query;
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index c1441c5..0db817e 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -71,8 +71,7 @@ namespace
throw ConfigurationError("Cannot find tree location (try specifying --repository-dir)");
}
- struct MetadataKeyPrettyPrinter :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct MetadataKeyPrettyPrinter
{
std::ostringstream stream;
StringifyFormatter formatter;
diff --git a/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc b/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc
index d003a8f..b6439f7 100644
--- a/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/broken_linkage_finder.cc
@@ -31,7 +31,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/set-impl.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/member_iterator-impl.hh>
@@ -346,7 +346,7 @@ Implementation<BrokenLinkageFinder>::gather_package(const std::tr1::shared_ptr<c
for (Contents::ConstIterator it(contents->begin()),
it_end(contents->end()); it_end != it; ++it)
{
- const ContentsFileEntry * file(visitor_cast<const ContentsFileEntry>(**it));
+ const ContentsFileEntry * file(simple_visitor_cast<const ContentsFileEntry>(**it));
if (0 != file)
{
Lock l(mutex);
diff --git a/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc b/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc
index d75a7ea..1734713 100644
--- a/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/elf_linkage_checker.cc
@@ -24,6 +24,8 @@
#include <src/clients/reconcilio/littlelf/elf.hh>
#include <src/clients/reconcilio/littlelf/elf_dynamic_section.hh>
#include <src/clients/reconcilio/littlelf/elf_types.hh>
+#include <src/clients/reconcilio/littlelf/elf_relocation_section.hh>
+#include <src/clients/reconcilio/littlelf/elf_symbol_section.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/join.hh>
@@ -32,8 +34,8 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/util/member_iterator-impl.hh>
-#include <paludis/util/visitor_cast.hh>
-#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <algorithm>
#include <cerrno>
@@ -190,13 +192,13 @@ Implementation<ElfLinkageChecker>::check_elf(const FSEntry & file, std::ifstream
for (typename ElfObject<ElfType_>::SectionIterator sec_it(elf.section_begin()),
sec_it_end(elf.section_end()); sec_it_end != sec_it; ++sec_it)
{
- const DynamicSection<ElfType_> * dyn_sec(visitor_cast<const DynamicSection<ElfType_> >(*sec_it));
+ const DynamicSection<ElfType_> * dyn_sec(simple_visitor_cast<const DynamicSection<ElfType_> >(*sec_it));
if (0 != dyn_sec)
for (typename DynamicSection<ElfType_>::EntryIterator ent_it(dyn_sec->entry_begin()),
ent_it_end(dyn_sec->entry_end()); ent_it_end != ent_it; ++ent_it)
{
- const DynamicEntryString<ElfType_> * ent_str(visitor_cast<const DynamicEntryString<ElfType_> >(*ent_it));
+ const DynamicEntryString<ElfType_> * ent_str(simple_visitor_cast<const DynamicEntryString<ElfType_> >(*ent_it));
if (0 != ent_str && "NEEDED" == ent_str->tag_name())
{
diff --git a/src/clients/reconcilio/littlelf/elf.cc b/src/clients/reconcilio/littlelf/elf.cc
index 344b232..a56da9f 100644
--- a/src/clients/reconcilio/littlelf/elf.cc
+++ b/src/clients/reconcilio/littlelf/elf.cc
@@ -132,11 +132,8 @@ namespace
};
template <typename ElfType_>
- class StringResolvingVisitor :
- public SectionVisitor<ElfType_>
+ class StringResolvingVisitor
{
- using SectionVisitor<ElfType_>::visit;
-
private:
ElfObject<ElfType_> *_elf_object;
@@ -146,7 +143,11 @@ namespace
{
}
- virtual void visit(SymbolSection<ElfType_> & section)
+ void visit(Section<ElfType_> &)
+ {
+ }
+
+ void visit(SymbolSection<ElfType_> & section)
{
typename ElfObject<ElfType_>::SectionIterator sec(_elf_object->get_section_by_index(section.get_link_index()));
if (_elf_object->section_end() == sec)
@@ -156,7 +157,7 @@ namespace
section.resolve_symbols(*sec);
}
- virtual void visit(DynamicSection<ElfType_> & section)
+ void visit(DynamicSection<ElfType_> & section)
{
typename ElfObject<ElfType_>::SectionIterator sec(_elf_object->get_section_by_index(section.get_link_index()));
if (_elf_object->section_end() == sec)
@@ -171,11 +172,8 @@ namespace
namespace littlelf_internals
{
template <typename ElfType_>
- class SectionNameResolvingVisitor :
- public ConstSectionVisitor<ElfType_>
+ class SectionNameResolvingVisitor
{
- using ConstSectionVisitor<ElfType_>::visit;
-
private:
typename ElfObject<ElfType_>::SectionIterator _begin, _end;
@@ -186,7 +184,11 @@ namespace littlelf_internals
{
}
- virtual void visit(const StringSection<ElfType_> & section)
+ void visit(const Section<ElfType_> &)
+ {
+ }
+
+ void visit(const StringSection<ElfType_> & section)
{
for (typename ElfObject<ElfType_>::SectionIterator i = _begin; i != _end; ++i)
try
diff --git a/src/clients/reconcilio/littlelf/elf_dynamic_section.cc b/src/clients/reconcilio/littlelf/elf_dynamic_section.cc
index 4f07ddf..26e53ef 100644
--- a/src/clients/reconcilio/littlelf/elf_dynamic_section.cc
+++ b/src/clients/reconcilio/littlelf/elf_dynamic_section.cc
@@ -19,7 +19,11 @@
*/
#include "elf_dynamic_section.hh"
+#include "elf_sections.hh"
#include "elf_types.hh"
+#include "elf_relocation_section.hh"
+#include "elf_sections.hh"
+#include "elf_symbol_section.hh"
#include "elf.hh"
#include <paludis/util/byte_swap.hh>
@@ -55,11 +59,8 @@ namespace paludis
namespace littlelf_internals
{
template <typename ElfType_>
- class DynEntriesStringResolvingVisitor :
- public DynamicEntriesVisitor<ElfType_>
+ class DynEntriesStringResolvingVisitor
{
- using DynamicEntriesVisitor<ElfType_>::visit;
-
private:
const DynamicSection<ElfType_> & _dyn_section;
const StringSection<ElfType_> & _string_section;
@@ -73,7 +74,11 @@ namespace littlelf_internals
{
}
- virtual void visit(DynamicEntryString<ElfType_> & entry)
+ void visit(DynamicEntry<ElfType_> &)
+ {
+ }
+
+ void visit(DynamicEntryString<ElfType_> & entry)
{
try
{
@@ -103,11 +108,8 @@ namespace
};
template <typename ElfType_>
- class DynamicSectionStringResolvingVisitor :
- public SectionVisitor<ElfType_>
+ class DynamicSectionStringResolvingVisitor
{
- using SectionVisitor<ElfType_>::visit;
-
private:
const DynamicSection<ElfType_> & _dyn_section;
typename std::vector<std::tr1::shared_ptr<DynamicEntry<ElfType_> > >::iterator _begin, _end;
@@ -123,7 +125,11 @@ namespace
{
}
- virtual void visit(StringSection<ElfType_> & section)
+ void visit(Section<ElfType_> &)
+ {
+ }
+
+ void visit(StringSection<ElfType_> & section)
{
littlelf_internals::DynEntriesStringResolvingVisitor<ElfType_> v(_dyn_section, section);
for(typename std::vector<std::tr1::shared_ptr<DynamicEntry<ElfType_> > >::iterator i = _begin; i != _end; ++i)
diff --git a/src/clients/reconcilio/littlelf/elf_dynamic_section.hh b/src/clients/reconcilio/littlelf/elf_dynamic_section.hh
index b6f489c..d846789 100644
--- a/src/clients/reconcilio/littlelf/elf_dynamic_section.hh
+++ b/src/clients/reconcilio/littlelf/elf_dynamic_section.hh
@@ -26,8 +26,9 @@
#include <paludis/util/clone.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/visitor.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/simple_visitor.hh>
+#include <paludis/util/type_list.hh>
#include <tr1/memory>
#include <string>
#include <iosfwd>
@@ -40,34 +41,14 @@ template <typename ElfType_> class DynamicEntryString;
template <typename ElfType_> class DynamicEntryFlag;
template <typename ElfType_>
-struct DynamicEntryVisitorTypes :
- paludis::VisitorTypes<
- DynamicEntryVisitorTypes<ElfType_>,
- DynamicEntry<ElfType_>,
+class DynamicEntry :
+ public virtual paludis::DeclareAbstractAcceptMethods<DynamicEntry<ElfType_>, typename paludis::MakeTypeList<
DynamicEntryUnknown<ElfType_>,
DynamicEntryValue<ElfType_>,
DynamicEntryPointer<ElfType_>,
DynamicEntryString<ElfType_>,
DynamicEntryFlag<ElfType_>
- >
-{
-};
-
-template <typename ElfType_>
-class DynamicEntriesVisitor :
- public paludis::Visitor<DynamicEntryVisitorTypes<ElfType_> >
-{
- public:
- virtual void visit(DynamicEntryUnknown<ElfType_> &) {}
- virtual void visit(DynamicEntryString<ElfType_> &) {}
- virtual void visit(DynamicEntryPointer<ElfType_> &) {}
- virtual void visit(DynamicEntryValue<ElfType_> &) {}
- virtual void visit(DynamicEntryFlag<ElfType_> &) {}
-};
-
-template <typename ElfType_>
-class DynamicEntry :
- public virtual paludis::AcceptInterface<DynamicEntryVisitorTypes<ElfType_> >,
+ >::Type>,
public virtual paludis::Cloneable<DynamicEntry<ElfType_> >
{
private:
@@ -90,7 +71,7 @@ class DynamicEntry :
template <typename ElfType_>
class DynamicEntryUnknown :
public virtual DynamicEntry<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<DynamicEntryVisitorTypes<ElfType_> , DynamicEntryUnknown<ElfType_> >,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryUnknown<ElfType_> >,
public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryUnknown<ElfType_> >
{
public:
@@ -101,7 +82,7 @@ class DynamicEntryUnknown :
template <typename ElfType_>
class DynamicEntryFlag :
public virtual DynamicEntry<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<DynamicEntryVisitorTypes<ElfType_> , DynamicEntryFlag<ElfType_> >,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryFlag<ElfType_> >,
public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryFlag<ElfType_> >
{
public:
@@ -112,7 +93,7 @@ class DynamicEntryFlag :
template <typename ElfType_>
class DynamicEntryValue :
public virtual DynamicEntry<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<DynamicEntryVisitorTypes<ElfType_> , DynamicEntryValue<ElfType_> >,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryValue<ElfType_> >,
public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryValue<ElfType_> >
{
private:
@@ -132,7 +113,7 @@ class DynamicEntryValue :
template <typename ElfType_>
class DynamicEntryPointer :
public virtual DynamicEntry<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<DynamicEntryVisitorTypes<ElfType_> , DynamicEntryPointer<ElfType_> >,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryPointer<ElfType_> >,
public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryPointer<ElfType_> >
{
private:
@@ -157,7 +138,7 @@ namespace littlelf_internals
template <typename ElfType_>
class DynamicEntryString :
public virtual DynamicEntry<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<DynamicEntryVisitorTypes<ElfType_> , DynamicEntryString<ElfType_> >,
+ public paludis::ImplementAcceptMethods<DynamicEntry<ElfType_>, DynamicEntryString<ElfType_> >,
public paludis::CloneUsingThis<DynamicEntry<ElfType_>, DynamicEntryString<ElfType_> >
{
friend class littlelf_internals::DynEntriesStringResolvingVisitor<ElfType_>;
@@ -210,7 +191,7 @@ class DynamicEntries :
template <typename ElfType_>
class DynamicSection :
public Section<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<SectionVisitorTypes<ElfType_> , DynamicSection<ElfType_> >,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, DynamicSection<ElfType_> >,
private paludis::PrivateImplementationPattern<DynamicSection<ElfType_> >
{
using paludis::PrivateImplementationPattern<DynamicSection>::_imp;
diff --git a/src/clients/reconcilio/littlelf/elf_relocation_section.hh b/src/clients/reconcilio/littlelf/elf_relocation_section.hh
index 751f4be..9ca3a52 100644
--- a/src/clients/reconcilio/littlelf/elf_relocation_section.hh
+++ b/src/clients/reconcilio/littlelf/elf_relocation_section.hh
@@ -94,7 +94,7 @@ struct RelocationA
template <typename ElfType_, typename Relocation_>
class RelocationSection :
public Section<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<SectionVisitorTypes<ElfType_> , RelocationSection<ElfType_, Relocation_> >,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, RelocationSection<ElfType_, Relocation_> >,
private paludis::PrivateImplementationPattern<RelocationSection<ElfType_, Relocation_> >
{
using paludis::PrivateImplementationPattern<RelocationSection>::_imp;
diff --git a/src/clients/reconcilio/littlelf/elf_sections.hh b/src/clients/reconcilio/littlelf/elf_sections.hh
index a16abb3..2dfee56 100644
--- a/src/clients/reconcilio/littlelf/elf_sections.hh
+++ b/src/clients/reconcilio/littlelf/elf_sections.hh
@@ -23,8 +23,8 @@
#include <string>
#include <iosfwd>
-
-#include <paludis/util/visitor.hh>
+#include <paludis/util/simple_visitor.hh>
+#include <paludis/util/type_list.hh>
template <typename ElfType_> class ElfObject;
template <typename ElfType_> class Section;
@@ -37,47 +37,6 @@ template <typename ElfType_, class RelocationType_> class RelocationSection;
template <typename ElfType_> class Relocation;
template <typename ElfType_> class RelocationA;
-template <typename ElfType_>
-struct SectionVisitorTypes :
- paludis::VisitorTypes<
- SectionVisitorTypes<ElfType_>,
- Section<ElfType_>,
- StringSection<ElfType_>,
- DynamicSection<ElfType_>,
- SymbolSection<ElfType_>,
- GenericSection<ElfType_>,
- RelocationSection<ElfType_, Relocation<ElfType_> >,
- RelocationSection<ElfType_, RelocationA<ElfType_> >
- >
-{
-};
-
-template <typename ElfType_>
-class ConstSectionVisitor :
- public paludis::ConstVisitor<SectionVisitorTypes<ElfType_> >
-{
- public:
- virtual void visit(const StringSection<ElfType_> &) {}
- virtual void visit(const SymbolSection<ElfType_> &) {}
- virtual void visit(const DynamicSection<ElfType_> &) {}
- virtual void visit(const GenericSection<ElfType_> &) {}
- virtual void visit(const RelocationSection<ElfType_, Relocation<ElfType_> > &) {}
- virtual void visit(const RelocationSection<ElfType_, RelocationA<ElfType_> > &) {}
-};
-
-template <typename ElfType_>
-class SectionVisitor :
- public paludis::Visitor<SectionVisitorTypes<ElfType_> >
-{
- public:
- virtual void visit(StringSection<ElfType_> &) {}
- virtual void visit(SymbolSection<ElfType_> &) {}
- virtual void visit(DynamicSection<ElfType_> &) {}
- virtual void visit(GenericSection<ElfType_> &) {}
- virtual void visit(RelocationSection<ElfType_, Relocation<ElfType_> > &) {}
- virtual void visit(RelocationSection<ElfType_, RelocationA<ElfType_> > &) {}
-};
-
namespace littlelf_internals
{
template <typename ElfType_> class SectionNameResolvingVisitor;
@@ -85,7 +44,14 @@ namespace littlelf_internals
template <typename ElfType_>
class Section :
- public virtual paludis::AcceptInterface<SectionVisitorTypes<ElfType_> >
+ public virtual paludis::DeclareAbstractAcceptMethods<Section<ElfType_>, typename paludis::MakeTypeList<
+ StringSection<ElfType_>,
+ DynamicSection<ElfType_>,
+ SymbolSection<ElfType_>,
+ GenericSection<ElfType_>,
+ RelocationSection<ElfType_, Relocation<ElfType_> >,
+ RelocationSection<ElfType_, RelocationA<ElfType_> >
+ >::Type>
{
friend class littlelf_internals::SectionNameResolvingVisitor<ElfType_>;
@@ -146,7 +112,7 @@ class Section :
template <typename ElfType_>
class GenericSection :
public Section<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<SectionVisitorTypes<ElfType_> , GenericSection<ElfType_> >
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, GenericSection<ElfType_> >
{
public:
GenericSection(typename ElfType_::Word, const typename ElfType_::SectionHeader &);
@@ -157,7 +123,7 @@ class GenericSection :
template <typename ElfType_>
class StringSection :
public Section<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<SectionVisitorTypes<ElfType_> , StringSection<ElfType_> >
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, StringSection<ElfType_> >
{
private:
std::string _stringTable;
diff --git a/src/clients/reconcilio/littlelf/elf_symbol_section.cc b/src/clients/reconcilio/littlelf/elf_symbol_section.cc
index 97baada..2141920 100644
--- a/src/clients/reconcilio/littlelf/elf_symbol_section.cc
+++ b/src/clients/reconcilio/littlelf/elf_symbol_section.cc
@@ -19,7 +19,10 @@
*/
#include "elf_symbol_section.hh"
+#include "elf_sections.hh"
#include "elf_types.hh"
+#include "elf_relocation_section.hh"
+#include "elf_dynamic_section.hh"
#include "elf.hh"
#include <paludis/util/byte_swap.hh>
@@ -63,11 +66,8 @@ namespace
namespace littlelf_internals
{
template <typename ElfType_>
- class SymbolStringResolvingVisitor :
- public SectionVisitor<ElfType_>
+ class SymbolStringResolvingVisitor
{
- using SectionVisitor<ElfType_>::visit;
-
private:
const SymbolSection<ElfType_> & _sym_section;
typename std::vector<Symbol<ElfType_> >::iterator _begin, _end;
@@ -82,7 +82,11 @@ namespace littlelf_internals
{
}
- virtual void visit(StringSection<ElfType_> & string_section)
+ void visit(Section<ElfType_> &)
+ {
+ }
+
+ void visit(StringSection<ElfType_> & string_section)
{
for (typename std::vector<Symbol<ElfType_> >::iterator i = _begin; i != _end; ++i)
try
diff --git a/src/clients/reconcilio/littlelf/elf_symbol_section.hh b/src/clients/reconcilio/littlelf/elf_symbol_section.hh
index 66d6fee..0a087d9 100644
--- a/src/clients/reconcilio/littlelf/elf_symbol_section.hh
+++ b/src/clients/reconcilio/littlelf/elf_symbol_section.hh
@@ -77,7 +77,7 @@ class Symbol
template <typename ElfType_>
class SymbolSection :
public Section<ElfType_>,
- public paludis::AcceptInterfaceVisitsThis<SectionVisitorTypes<ElfType_> , SymbolSection<ElfType_> >,
+ public paludis::ImplementAcceptMethods<Section<ElfType_>, SymbolSection<ElfType_> >,
private paludis::PrivateImplementationPattern<SymbolSection<ElfType_> >
{
using paludis::PrivateImplementationPattern<SymbolSection>::_imp;
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index bab568b..47eccbd 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -33,7 +33,7 @@
#include <paludis/util/fd_output_stream.hh>
#include <paludis/util/system.hh>
#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/pretty_print.hh>
#include <paludis/action.hh>
@@ -1620,7 +1620,7 @@ ConsoleInstallTask::on_all_masked_error(const AllMaskedError & e)
output_stream() << "No versions of '" << e.query() << "' are available.";
if (want_suggestions()
- && e.query().tag() && visitor_cast<const TargetDepTag>(*e.query().tag()))
+ && e.query().tag() && simple_visitor_cast<const TargetDepTag>(*e.query().tag()))
{
output_stream() << " Looking for suggestions:" << endl;
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 2fedde5..60ee838 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -31,8 +31,7 @@ namespace paludis
{
class ConsoleInstallTask;
- class PALUDIS_VISIBLE DepTagSummaryDisplayer :
- public ConstVisitor<DepTagVisitorTypes>
+ class PALUDIS_VISIBLE DepTagSummaryDisplayer
{
private:
ConsoleInstallTask * _task;
@@ -52,8 +51,7 @@ namespace paludis
}
};
- class PALUDIS_VISIBLE EntryDepTagDisplayer :
- public ConstVisitor<DepTagVisitorTypes>
+ class PALUDIS_VISIBLE EntryDepTagDisplayer
{
private:
std::string _text;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 5790d12..19ee6bf 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -270,8 +270,7 @@ namespace
}
};
- class Displayer :
- public ConstVisitor<MetadataKeyVisitorTypes>
+ class Displayer
{
private:
const ConsoleQueryTask * const task;
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index c655dbe..04d20e1 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -54,8 +54,7 @@ namespace paludis
namespace
{
- struct KeyPrettyPrinter :
- ConstVisitor<MetadataKeyVisitorTypes>
+ struct KeyPrettyPrinter
{
std::ostringstream s;
diff --git a/src/output/mask_displayer.hh b/src/output/mask_displayer.hh
index 714d84e..8a69f27 100644
--- a/src/output/mask_displayer.hh
+++ b/src/output/mask_displayer.hh
@@ -28,7 +28,6 @@
namespace paludis
{
class MaskDisplayer :
- public ConstVisitor<MaskVisitorTypes>,
private PrivateImplementationPattern<MaskDisplayer>
{
public: