aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-13 16:48:50 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-13 16:48:50 +0100
commit892bc68690922bdb7e7bc6617631978b43e2d766 (patch)
tree05133edb4ef674ee83bbddc91c3002616c3d8d9e
parent2ce428add61463e110c195bb9f12c5080f4fee7a (diff)
downloadpaludis-892bc68690922bdb7e7bc6617631978b43e2d766.tar.gz
paludis-892bc68690922bdb7e7bc6617631978b43e2d766.tar.xz
Remove trickery that only works with 0x
-rw-r--r--paludis/environment_factory.cc24
-rw-r--r--paludis/environment_factory.hh4
-rw-r--r--paludis/environments/no_config/registration.cc3
-rw-r--r--paludis/environments/paludis/registration.cc3
-rw-r--r--paludis/environments/portage/registration.cc3
-rw-r--r--paludis/environments/test/registration.cc3
-rw-r--r--paludis/repositories/accounts/registration.cc3
-rw-r--r--paludis/repositories/cran/registration.cc2
-rw-r--r--paludis/repositories/e/registration.cc3
-rw-r--r--paludis/repositories/fake/registration.cc3
-rw-r--r--paludis/repositories/gems/registration.cc3
-rw-r--r--paludis/repositories/unavailable/registration.cc3
-rw-r--r--paludis/repositories/unpackaged/registration.cc3
-rw-r--r--paludis/repositories/unwritten/registration.cc3
-rw-r--r--paludis/repositories/virtuals/registration.cc3
-rw-r--r--paludis/repository_factory.cc34
-rw-r--r--paludis/repository_factory.hh4
17 files changed, 70 insertions, 34 deletions
diff --git a/paludis/environment_factory.cc b/paludis/environment_factory.cc
index 11003ae..0f2c9b5 100644
--- a/paludis/environment_factory.cc
+++ b/paludis/environment_factory.cc
@@ -52,21 +52,33 @@ namespace paludis
}
template <>
- void register_environment<NoType<0u> >(EnvironmentFactory * const)
+ void register_environment<NoType<0u> >(const NoType<0u> * const, EnvironmentFactory * const)
{
}
}
+namespace
+{
+ /**
+ * Alas, fefault template types for functions only works with 0x.
+ */
+ template <typename T_ = NoType<0u> >
+ struct TypeOrNoType
+ {
+ typedef T_ Type;
+ };
+}
+
EnvironmentFactory::EnvironmentFactory() :
PrivateImplementationPattern<EnvironmentFactory>(new Implementation<EnvironmentFactory>)
{
using namespace environment_groups;
- register_environment<ENVIRONMENT_GROUP_IF_dummy>(this);
- register_environment<ENVIRONMENT_GROUP_IF_no_config>(this);
- register_environment<ENVIRONMENT_GROUP_IF_paludis>(this);
- register_environment<ENVIRONMENT_GROUP_IF_portage>(this);
- register_environment<ENVIRONMENT_GROUP_IF_test>(this);
+ register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_dummy>::Type *>(0), this);
+ register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_no_config>::Type *>(0), this);
+ register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_paludis>::Type *>(0), this);
+ register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_portage>::Type *>(0), this);
+ register_environment(static_cast<const TypeOrNoType<ENVIRONMENT_GROUP_IF_test>::Type *>(0), this);
}
EnvironmentFactory::~EnvironmentFactory()
diff --git a/paludis/environment_factory.hh b/paludis/environment_factory.hh
index 6b9b346..98526ec 100644
--- a/paludis/environment_factory.hh
+++ b/paludis/environment_factory.hh
@@ -87,8 +87,8 @@ namespace paludis
);
};
- template <typename EnvironmentClass_ = NoType<0u> >
- void register_environment(EnvironmentFactory * const);
+ template <typename EnvironmentClass_>
+ void register_environment(const EnvironmentClass_ * const, EnvironmentFactory * const);
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class PrivateImplementationPattern<EnvironmentFactory>;
diff --git a/paludis/environments/no_config/registration.cc b/paludis/environments/no_config/registration.cc
index 8b27039..41cf543 100644
--- a/paludis/environments/no_config/registration.cc
+++ b/paludis/environments/no_config/registration.cc
@@ -108,7 +108,8 @@ namespace paludis
}
template <>
- void register_environment<environment_groups::no_config>(EnvironmentFactory * const factory)
+ void register_environment<environment_groups::no_config>(const environment_groups::no_config * const,
+ EnvironmentFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > no_config_formats(new Set<std::string>);
no_config_formats->insert("no_config");
diff --git a/paludis/environments/paludis/registration.cc b/paludis/environments/paludis/registration.cc
index 943754f..f0568fc 100644
--- a/paludis/environments/paludis/registration.cc
+++ b/paludis/environments/paludis/registration.cc
@@ -41,7 +41,8 @@ namespace paludis
}
template <>
- void register_environment<environment_groups::paludis>(EnvironmentFactory * const factory)
+ void register_environment<environment_groups::paludis>(const environment_groups::paludis * const,
+ EnvironmentFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > paludis_formats(new Set<std::string>);
paludis_formats->insert("paludis");
diff --git a/paludis/environments/portage/registration.cc b/paludis/environments/portage/registration.cc
index eac02bb..92c8248 100644
--- a/paludis/environments/portage/registration.cc
+++ b/paludis/environments/portage/registration.cc
@@ -41,7 +41,8 @@ namespace paludis
}
template <>
- void register_environment<environment_groups::portage>(EnvironmentFactory * const factory)
+ void register_environment<environment_groups::portage>(const environment_groups::portage * const,
+ EnvironmentFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > portage_formats(new Set<std::string>);
portage_formats->insert("portage");
diff --git a/paludis/environments/test/registration.cc b/paludis/environments/test/registration.cc
index dae7c0c..343bd9a 100644
--- a/paludis/environments/test/registration.cc
+++ b/paludis/environments/test/registration.cc
@@ -31,7 +31,8 @@ namespace paludis
}
template <>
- void register_environment<environment_groups::test>(EnvironmentFactory * const)
+ void register_environment<environment_groups::test>(const environment_groups::test * const,
+ EnvironmentFactory * const)
{
}
}
diff --git a/paludis/repositories/accounts/registration.cc b/paludis/repositories/accounts/registration.cc
index 67d8f48..27e7161 100644
--- a/paludis/repositories/accounts/registration.cc
+++ b/paludis/repositories/accounts/registration.cc
@@ -45,7 +45,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::accounts>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::accounts>(const repository_groups::accounts * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > accounts_formats(new Set<std::string>);
accounts_formats->insert("accounts");
diff --git a/paludis/repositories/cran/registration.cc b/paludis/repositories/cran/registration.cc
index d1edb44..2fabe1b 100644
--- a/paludis/repositories/cran/registration.cc
+++ b/paludis/repositories/cran/registration.cc
@@ -45,7 +45,7 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::cran>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::cran>(const repository_groups::cran * const, RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > cran_formats(new Set<std::string>);
cran_formats->insert("cran");
diff --git a/paludis/repositories/e/registration.cc b/paludis/repositories/e/registration.cc
index 4000ed2..9f69347 100644
--- a/paludis/repositories/e/registration.cc
+++ b/paludis/repositories/e/registration.cc
@@ -50,7 +50,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::e>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::e>(const repository_groups::e * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > ebuild_formats(new Set<std::string>);
ebuild_formats->insert("ebuild");
diff --git a/paludis/repositories/fake/registration.cc b/paludis/repositories/fake/registration.cc
index 2cfc9da..bd6ee29 100644
--- a/paludis/repositories/fake/registration.cc
+++ b/paludis/repositories/fake/registration.cc
@@ -46,7 +46,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::fake>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::fake>(const repository_groups::fake * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > fake_formats(new Set<std::string>);
fake_formats->insert("fake_installed");
diff --git a/paludis/repositories/gems/registration.cc b/paludis/repositories/gems/registration.cc
index 6b8286c..46d6510 100644
--- a/paludis/repositories/gems/registration.cc
+++ b/paludis/repositories/gems/registration.cc
@@ -51,7 +51,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::gems>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::gems>(const repository_groups::gems * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > gems_formats(new Set<std::string>);
gems_formats->insert("gems");
diff --git a/paludis/repositories/unavailable/registration.cc b/paludis/repositories/unavailable/registration.cc
index 7634e3f..46871e4 100644
--- a/paludis/repositories/unavailable/registration.cc
+++ b/paludis/repositories/unavailable/registration.cc
@@ -45,7 +45,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::unavailable>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::unavailable>(const repository_groups::unavailable * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > unavailable_formats(new Set<std::string>);
unavailable_formats->insert("unavailable");
diff --git a/paludis/repositories/unpackaged/registration.cc b/paludis/repositories/unpackaged/registration.cc
index 1ac7126..a453461 100644
--- a/paludis/repositories/unpackaged/registration.cc
+++ b/paludis/repositories/unpackaged/registration.cc
@@ -46,7 +46,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::unpackaged>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::unpackaged>(const repository_groups::unpackaged * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > unpackaged_formats(new Set<std::string>);
unpackaged_formats->insert("unpackaged");
diff --git a/paludis/repositories/unwritten/registration.cc b/paludis/repositories/unwritten/registration.cc
index f3a8b59..849cb41 100644
--- a/paludis/repositories/unwritten/registration.cc
+++ b/paludis/repositories/unwritten/registration.cc
@@ -45,7 +45,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::unwritten>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::unwritten>(const repository_groups::unwritten * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > unwritten_formats(new Set<std::string>);
unwritten_formats->insert("unwritten");
diff --git a/paludis/repositories/virtuals/registration.cc b/paludis/repositories/virtuals/registration.cc
index 8f5effa..cbae652 100644
--- a/paludis/repositories/virtuals/registration.cc
+++ b/paludis/repositories/virtuals/registration.cc
@@ -45,7 +45,8 @@ namespace paludis
}
template <>
- void register_repositories<repository_groups::virtuals>(RepositoryFactory * const factory)
+ void register_repositories<repository_groups::virtuals>(const repository_groups::virtuals * const,
+ RepositoryFactory * const factory)
{
std::tr1::shared_ptr<Set<std::string> > virtuals_formats(new Set<std::string>);
virtuals_formats->insert("virtuals");
diff --git a/paludis/repository_factory.cc b/paludis/repository_factory.cc
index acc23c3..dcd24ae 100644
--- a/paludis/repository_factory.cc
+++ b/paludis/repository_factory.cc
@@ -89,26 +89,38 @@ namespace paludis
}
template <>
- void register_repositories<NoType<0u> >(RepositoryFactory * const)
+ void register_repositories<NoType<0u> >(const NoType<0u> *, RepositoryFactory * const)
{
}
}
+namespace
+{
+ /**
+ * Alas, fefault template types for functions only works with 0x.
+ */
+ template <typename T_ = NoType<0u> >
+ struct TypeOrNoType
+ {
+ typedef T_ Type;
+ };
+}
+
RepositoryFactory::RepositoryFactory() :
PrivateImplementationPattern<RepositoryFactory>(new Implementation<RepositoryFactory>)
{
using namespace repository_groups;
- register_repositories<REPOSITORY_GROUP_IF_accounts>(this);
- register_repositories<REPOSITORY_GROUP_IF_cran>(this);
- register_repositories<REPOSITORY_GROUP_IF_dummy>(this);
- register_repositories<REPOSITORY_GROUP_IF_e>(this);
- register_repositories<REPOSITORY_GROUP_IF_gems>(this);
- register_repositories<REPOSITORY_GROUP_IF_fake>(this);
- register_repositories<REPOSITORY_GROUP_IF_unavailable>(this);
- register_repositories<REPOSITORY_GROUP_IF_unwritten>(this);
- register_repositories<REPOSITORY_GROUP_IF_unpackaged>(this);
- register_repositories<REPOSITORY_GROUP_IF_virtuals>(this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_accounts>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_cran>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_dummy>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_e>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_gems>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_fake>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_unavailable>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_unwritten>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_unpackaged>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_virtuals>::Type *>(0), this);
}
RepositoryFactory::~RepositoryFactory()
diff --git a/paludis/repository_factory.hh b/paludis/repository_factory.hh
index 135aec9..a7a4e26 100644
--- a/paludis/repository_factory.hh
+++ b/paludis/repository_factory.hh
@@ -153,8 +153,8 @@ namespace paludis
ConstIterator end_keys() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
- template <typename RepositoryClass_ = NoType<0u> >
- void register_repositories(RepositoryFactory * const);
+ template <typename RepositoryClass_>
+ void register_repositories(const RepositoryClass_ * const, RepositoryFactory * const);
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class PrivateImplementationPattern<RepositoryFactory>;