aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-04 01:23:03 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-04 01:23:03 +0000
commit3ef47f233d579b338cb5e757ee73a3c9382c87ed (patch)
tree208992cee404233edf4bc67c045feed3613d3f4b
parent6ef9fda358a0541b5a5f70011f70adcdc1e30134 (diff)
downloadpaludis-3ef47f233d579b338cb5e757ee73a3c9382c87ed.tar.gz
paludis-3ef47f233d579b338cb5e757ee73a3c9382c87ed.tar.xz
kc some more sr
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc6
-rw-r--r--paludis/action.hh1
-rw-r--r--paludis/dep_list.cc7
-rw-r--r--paludis/distribution-fwd.hh36
-rw-r--r--paludis/distribution.cc43
-rw-r--r--paludis/distribution.hh5
-rw-r--r--paludis/distribution.sr43
-rw-r--r--paludis/environment_implementation.cc5
-rw-r--r--paludis/environment_maker.cc11
-rw-r--r--paludis/environments/no_config/no_config_environment.cc7
-rw-r--r--paludis/environments/paludis/paludis_config.cc5
-rw-r--r--paludis/files.m46
-rw-r--r--paludis/mask-fwd.hh24
-rw-r--r--paludis/mask.cc4
-rw-r--r--paludis/mask.hh5
-rwxr-xr-xpaludis/mask.sr25
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc5
-rw-r--r--paludis/repositories/e/e_repository.cc12
-rw-r--r--paludis/repositories/e/e_repository_mask_file.cc1
-rw-r--r--paludis/repositories/e/e_repository_profile.cc9
-rw-r--r--paludis/repositories/e/exndbam_repository.cc4
-rw-r--r--paludis/repositories/e/make_ebuild_repository.cc33
-rw-r--r--paludis/repositories/e/vdb_repository.cc12
-rw-r--r--paludis/repositories/fake/fake_repository.cc11
-rw-r--r--paludis/repositories/gems/registration.cc7
-rw-r--r--paludis/util/keys.hh22
-rw-r--r--paludis/version_spec.cc99
-rw-r--r--paludis/version_spec.sr17
-rw-r--r--python/action.cc15
-rw-r--r--python/mask.cc11
-rw-r--r--python/paludis_python.hh14
-rw-r--r--ruby/metadata_key.cc9
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc5
-rw-r--r--src/clients/qualudis/qualudis.cc7
-rw-r--r--src/output/console_query_task.cc13
-rw-r--r--src/output/mask_displayer.cc7
36 files changed, 273 insertions, 273 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 404f297..239910e 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -104,13 +104,13 @@ namespace
* pointer. Other keys can't. */
if (key.value())
{
- cout << indent << left << setw(30) << " Mask file:" << " " << key.value()->mask_file << endl;
+ cout << indent << left << setw(30) << " Mask file:" << " " << (*key.value())[k::mask_file()] << endl;
/* Comment looks best if it's outputted over multiple lines,
* as that's how it tends to be stored in package.mask. */
cout << indent << left << setw(30) << " Comment:" << " ";
bool first(true);
- for (Sequence<std::string>::ConstIterator i(key.value()->comment->begin()),
- i_end(key.value()->comment->end()) ;
+ for (Sequence<std::string>::ConstIterator i((*key.value())[k::comment()]->begin()),
+ i_end((*key.value())[k::comment()]->end()) ;
i != i_end ; ++i)
{
if (! first)
diff --git a/paludis/action.hh b/paludis/action.hh
index f090795..c983552 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -26,7 +26,6 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/visitor.hh>
#include <paludis/util/exception.hh>
-#include <paludis/util/sr.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/sequence-fwd.hh>
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 1151ff8..d99acf6 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 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
@@ -50,6 +50,7 @@
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/kc.hh>
#include <algorithm>
#include <functional>
@@ -1028,8 +1029,8 @@ DepList::add_package(const tr1::shared_ptr<const PackageID> & p, tr1::shared_ptr
DepSpecFlattener<ProvideSpecTree, PackageDepSpec> f(_imp->env, *_imp->current_package_id());
p->provide_key()->value()->accept(f);
- if (f.begin() != f.end() && ! DistributionData::get_instance()->distribution_from_string(
- _imp->env->default_distribution())->support_old_style_virtuals)
+ if (f.begin() != f.end() && ! (*DistributionData::get_instance()->distribution_from_string(
+ _imp->env->default_distribution()))[k::support_old_style_virtuals()])
throw DistributionConfigurationError("Package '" + stringify(*p) + "' has PROVIDEs, but this distribution "
"does not support old style virtuals");
diff --git a/paludis/distribution-fwd.hh b/paludis/distribution-fwd.hh
index 01a8563..fb7b802 100644
--- a/paludis/distribution-fwd.hh
+++ b/paludis/distribution-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
@@ -26,11 +26,43 @@
* \ingroup g_dep_spec
*/
+#include <paludis/util/kc-fwd.hh>
+#include <paludis/util/keys.hh>
+#include <string>
+
namespace paludis
{
- class Distribution;
class DistributionData;
class DistributionConfigurationError;
+
+ /**
+ * Information about a distribution.
+ *
+ * \see DistributionData
+ * \ingroup g_distribution
+ * \since 0.26
+ * \nosubgrouping
+ */
+ typedef kc::KeyedClass<
+ kc::Field<k::default_environment, std::string>,
+ kc::Field<k::fallback_environment, std::string>,
+ kc::Field<k::support_old_style_virtuals, bool>,
+ kc::Field<k::default_ebuild_distdir, std::string>,
+ kc::Field<k::default_ebuild_write_cache, std::string>,
+ kc::Field<k::default_ebuild_names_cache, std::string>,
+ kc::Field<k::default_ebuild_builddir, std::string>,
+ kc::Field<k::default_ebuild_layout, std::string>,
+ kc::Field<k::default_ebuild_eapi_when_unknown, std::string>,
+ kc::Field<k::default_ebuild_eapi_when_unspecified, std::string>,
+ kc::Field<k::default_ebuild_profile_eapi, std::string>,
+ kc::Field<k::default_vdb_provides_cache, std::string>,
+ kc::Field<k::default_vdb_names_cache, std::string>,
+ kc::Field<k::paludis_environment_use_conf_filename, std::string>,
+ kc::Field<k::paludis_environment_keywords_conf_filename, std::string>,
+ kc::Field<k::concept_use, std::string>,
+ kc::Field<k::concept_keyword, std::string>,
+ kc::Field<k::paludis_package, std::string>
+ > Distribution;
}
#endif
diff --git a/paludis/distribution.cc b/paludis/distribution.cc
index bff51e6..75dcbd8 100644
--- a/paludis/distribution.cc
+++ b/paludis/distribution.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
@@ -29,13 +29,12 @@
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/kc.hh>
using namespace paludis;
template class InstantiationPolicy<DistributionData, instantiation_method::SingletonTag>;
-#include <paludis/distribution-sr.cc>
-
DistributionConfigurationError::DistributionConfigurationError(const std::string & s) throw () :
ConfigurationError("Distribution configuration error: " + s)
{
@@ -63,25 +62,25 @@ namespace paludis
KeyValueConfigFile k(*d, KeyValueConfigFileOptions());
values.insert(std::make_pair(strip_trailing_string(d->basename(), ".conf"),
- make_shared_ptr(new Distribution(Distribution::create()
- .default_environment(k.get("default_environment"))
- .fallback_environment(k.get("fallback_environment"))
- .support_old_style_virtuals(destringify<bool>(k.get("support_old_style_virtuals")))
- .default_ebuild_distdir(k.get("default_ebuild_distdir"))
- .default_ebuild_write_cache(k.get("default_ebuild_write_cache"))
- .default_ebuild_names_cache(k.get("default_ebuild_names_cache"))
- .default_ebuild_builddir(k.get("default_ebuild_builddir"))
- .default_ebuild_layout(k.get("default_ebuild_layout"))
- .default_ebuild_eapi_when_unknown(k.get("default_ebuild_eapi_when_unknown"))
- .default_ebuild_eapi_when_unspecified(k.get("default_ebuild_eapi_when_unspecified"))
- .default_ebuild_profile_eapi(k.get("default_ebuild_profile_eapi"))
- .default_vdb_provides_cache(k.get("default_vdb_provides_cache"))
- .default_vdb_names_cache(k.get("default_vdb_names_cache"))
- .paludis_environment_use_conf_filename(k.get("paludis_environment_use_conf_filename"))
- .paludis_environment_keywords_conf_filename(k.get("paludis_environment_keywords_conf_filename"))
- .concept_use(k.get("concept_use"))
- .concept_keyword(k.get("concept_keyword"))
- .paludis_package(k.get("paludis_package"))
+ make_shared_ptr(new Distribution(Distribution::named_create()
+ (k::default_environment(), k.get("default_environment"))
+ (k::fallback_environment(), k.get("fallback_environment"))
+ (k::support_old_style_virtuals(), destringify<bool>(k.get("support_old_style_virtuals")))
+ (k::default_ebuild_distdir(), k.get("default_ebuild_distdir"))
+ (k::default_ebuild_write_cache(), k.get("default_ebuild_write_cache"))
+ (k::default_ebuild_names_cache(), k.get("default_ebuild_names_cache"))
+ (k::default_ebuild_builddir(), k.get("default_ebuild_builddir"))
+ (k::default_ebuild_layout(), k.get("default_ebuild_layout"))
+ (k::default_ebuild_eapi_when_unknown(), k.get("default_ebuild_eapi_when_unknown"))
+ (k::default_ebuild_eapi_when_unspecified(), k.get("default_ebuild_eapi_when_unspecified"))
+ (k::default_ebuild_profile_eapi(), k.get("default_ebuild_profile_eapi"))
+ (k::default_vdb_provides_cache(), k.get("default_vdb_provides_cache"))
+ (k::default_vdb_names_cache(), k.get("default_vdb_names_cache"))
+ (k::paludis_environment_use_conf_filename(), k.get("paludis_environment_use_conf_filename"))
+ (k::paludis_environment_keywords_conf_filename(), k.get("paludis_environment_keywords_conf_filename"))
+ (k::concept_use(), k.get("concept_use"))
+ (k::concept_keyword(), k.get("concept_keyword"))
+ (k::paludis_package(), k.get("paludis_package"))
))));
}
}
diff --git a/paludis/distribution.hh b/paludis/distribution.hh
index 1e8e6e4..c7fb3d0 100644
--- a/paludis/distribution.hh
+++ b/paludis/distribution.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
@@ -23,7 +23,6 @@
#include <paludis/distribution-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/exception.hh>
-#include <paludis/util/sr.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/tr1_memory.hh>
@@ -41,8 +40,6 @@
namespace paludis
{
-#include <paludis/distribution-sr.hh>
-
/**
* Thrown if an invalid distribution file is encountered.
*
diff --git a/paludis/distribution.sr b/paludis/distribution.sr
deleted file mode 100644
index c8e97a9..0000000
--- a/paludis/distribution.sr
+++ /dev/null
@@ -1,43 +0,0 @@
-make_class_Distribution()
-{
- visible
-
- key default_environment std::string
- key fallback_environment std::string
-
- key support_old_style_virtuals bool
-
- key default_ebuild_distdir std::string
- key default_ebuild_write_cache std::string
- key default_ebuild_names_cache std::string
- key default_ebuild_builddir std::string
- key default_ebuild_layout std::string
- key default_ebuild_eapi_when_unknown std::string
- key default_ebuild_eapi_when_unspecified std::string
- key default_ebuild_profile_eapi std::string
-
- key default_vdb_provides_cache std::string
- key default_vdb_names_cache std::string
-
- key paludis_environment_use_conf_filename std::string
- key paludis_environment_keywords_conf_filename std::string
-
- key concept_use std::string
- key concept_keyword std::string
-
- key paludis_package std::string
-
- allow_named_args
-
- doxygen_comment << "END"
- /**
- * Information about a distribution.
- *
- * \see DistributionData
- * \ingroup g_distribution
- * \since 0.26
- * \nosubgrouping
- */
-END
-}
-
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index 2e497d9..8fe9ded 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 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
@@ -27,6 +27,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/system.hh>
+#include <paludis/util/kc.hh>
#include <paludis/hook.hh>
#include <paludis/distribution.hh>
#include <algorithm>
@@ -177,6 +178,6 @@ EnvironmentImplementation::set_names() const
bool
EnvironmentImplementation::is_paludis_package(const QualifiedPackageName & n) const
{
- return stringify(n) == DistributionData::get_instance()->distribution_from_string(default_distribution())->paludis_package;
+ return stringify(n) == (*DistributionData::get_instance()->distribution_from_string(default_distribution()))[k::paludis_package()];
}
diff --git a/paludis/environment_maker.cc b/paludis/environment_maker.cc
index 7a8e34b..51b5e40 100644
--- a/paludis/environment_maker.cc
+++ b/paludis/environment_maker.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
@@ -25,6 +25,7 @@
#include <paludis/util/virtual_constructor-impl.hh>
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/kc.hh>
#include <paludis/distribution.hh>
#include <paludis/about.hh>
#include <list>
@@ -151,8 +152,8 @@ EnvironmentMaker::make_from_spec(const std::string & s) const
}
if (key.empty())
- key = DistributionData::get_instance()->distribution_from_string(
- getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION))->default_environment;
+ key = (*DistributionData::get_instance()->distribution_from_string(
+ getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION)))[k::default_environment()];
try
{
@@ -160,8 +161,8 @@ EnvironmentMaker::make_from_spec(const std::string & s) const
}
catch (const FallBackToAnotherMakerError &)
{
- std::string f(DistributionData::get_instance()->distribution_from_string(
- getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION))->fallback_environment);
+ std::string f((*DistributionData::get_instance()->distribution_from_string(
+ getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION)))[k::fallback_environment()]);
if (s.empty() && ! f.empty())
{
std::set<std::string> keys;
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index e2bba70..8cd1b2b 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -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
@@ -27,6 +27,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/kc.hh>
#include <paludis/repository_maker.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/config_file.hh>
@@ -196,7 +197,7 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
package_database->add_repository(2, ((main_repo =
RepositoryMaker::get_instance()->find_maker("ebuild")(env, keys))));
- if (DistributionData::get_instance()->distribution_from_string(env->default_distribution())->support_old_style_virtuals)
+ if ((*DistributionData::get_instance()->distribution_from_string(env->default_distribution()))[k::support_old_style_virtuals()])
package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("virtuals")(env,
tr1::shared_ptr<Map<std::string, std::string> >()));
}
@@ -219,7 +220,7 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
new Map<std::string, std::string>);
iv_keys->insert("root", "/");
- if (DistributionData::get_instance()->distribution_from_string(env->default_distribution())->support_old_style_virtuals)
+ if ((*DistributionData::get_instance()->distribution_from_string(env->default_distribution()))[k::support_old_style_virtuals()])
package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env,
iv_keys));
}
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 4310b3a..c9b9a9a 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -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
@@ -43,6 +43,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/kc.hh>
#include <paludis/util/tr1_functional.hh>
#include <fstream>
@@ -280,7 +281,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
{
/* add virtuals repositories */
- if (DistributionData::get_instance()->distribution_from_string(distribution())->support_old_style_virtuals)
+ if ((*DistributionData::get_instance()->distribution_from_string(distribution()))[k::support_old_style_virtuals()])
{
tr1::shared_ptr<Map<std::string, std::string> > iv_keys(
new Map<std::string, std::string>);
diff --git a/paludis/files.m4 b/paludis/files.m4
index a629d7b..a64b81d 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -20,7 +20,7 @@ add(`dep_spec', `hh', `cc', `se', `test', `fwd')
add(`dep_spec_flattener', `hh', `cc')
add(`dep_tree', `hh', `cc', `fwd')
add(`dep_tag', `hh', `cc', `fwd', `sr')
-add(`distribution', `hh', `cc', `fwd', `sr')
+add(`distribution', `hh', `cc', `fwd')
add(`environment', `hh', `fwd', `cc')
add(`environment_implementation', `hh', `cc')
add(`environment_maker', `hh', `cc')
@@ -34,7 +34,7 @@ add(`hooker', `hh', `cc', `test', `testscript')
add(`host_tuple_name', `hh', `cc', `sr', `test')
add(`install_task', `hh', `cc', `se')
add(`literal_metadata_key', `hh', `cc')
-add(`mask', `hh', `cc', `fwd', `sr')
+add(`mask', `hh', `cc', `fwd')
add(`match_package', `hh', `cc')
add(`merger', `hh', `cc', `se', `sr', `test', `testscript')
add(`merger_entry_type', `hh', `cc', `se')
@@ -70,5 +70,5 @@ add(`unmerger', `hh', `cc', `sr')
add(`use_requirements', `hh', `cc', `fwd')
add(`version_operator', `hh', `cc', `fwd', `se', `test')
add(`version_requirements', `hh', `cc', `fwd', `sr')
-add(`version_spec', `hh', `cc', `sr', `fwd', `test')
+add(`version_spec', `hh', `cc', `fwd', `test')
diff --git a/paludis/mask-fwd.hh b/paludis/mask-fwd.hh
index 6ae3e59..294eeb2 100644
--- a/paludis/mask-fwd.hh
+++ b/paludis/mask-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
@@ -21,6 +21,10 @@
#define PALUDIS_GUARD_PALUDIS_MASK_FWD_HH 1
#include <paludis/util/visitor-fwd.hh>
+#include <paludis/util/kc-fwd.hh>
+#include <paludis/util/keys.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/util/tr1_memory.hh>
/** \file
* Forward declarations for paludis/mask.hh .
@@ -37,9 +41,23 @@ namespace paludis
class UnsupportedMask;
class AssociationMask;
- class RepositoryMaskInfo;
-
class MaskVisitorTypes;
+
+ /**
+ * Information about a RepositoryMask.
+ *
+ * The mask_file key holds the file whence the mask originates.
+ *
+ * The comment key is a sequence of lines explaining the mask.
+ *
+ * \ingroup g_package_id
+ * \since 0.26
+ * \nosubgrouping
+ */
+ typedef kc::KeyedClass<
+ kc::Field<k::mask_file, FSEntry>,
+ kc::Field<k::comment, tr1::shared_ptr<const Sequence<std::string> > >
+ > RepositoryMaskInfo;
}
#endif
diff --git a/paludis/mask.cc b/paludis/mask.cc
index bc88800..137a792 100644
--- a/paludis/mask.cc
+++ b/paludis/mask.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
@@ -22,8 +22,6 @@
using namespace paludis;
-#include <paludis/mask-sr.cc>
-
template class ConstAcceptInterface<MaskVisitorTypes>;
template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UserMask>;
template class ConstAcceptInterfaceVisitsThis<MaskVisitorTypes, UnacceptedMask>;
diff --git a/paludis/mask.hh b/paludis/mask.hh
index 143b95b..09024e5 100644
--- a/paludis/mask.hh
+++ b/paludis/mask.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
@@ -41,9 +41,6 @@
namespace paludis
{
-
-#include <paludis/mask-sr.hh>
-
/**
* Types for a visitor that can visit a Mask subclass.
*
diff --git a/paludis/mask.sr b/paludis/mask.sr
deleted file mode 100755
index f754270..0000000
--- a/paludis/mask.sr
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-make_class_RepositoryMaskInfo()
-{
- visible
-
- key mask_file "FSEntry"
- key comment "tr1::shared_ptr<const Sequence<std::string> >"
-
- doxygen_comment << "END"
- /**
- * Information about a RepositoryMask.
- *
- * The mask_file key holds the file whence the mask originates.
- *
- * The comment key is a sequence of lines explaining the mask.
- *
- * \ingroup g_package_id
- * \since 0.26
- * \nosubgrouping
- */
-END
-}
-
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index d2ef306..b9554b0 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -38,6 +38,7 @@
#include <paludis/util/strip.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/kc.hh>
#include <paludis/literal_metadata_key.hh>
#include <iterator>
#include <fstream>
@@ -467,8 +468,8 @@ EInstalledRepositoryID::eapi() const
Log::get_instance()->message(ll_debug, lc_context) << "No EAPI entry in '" << _imp->dir << "', pretending '"
<< _imp->environment->default_distribution() << "'";
_imp->eapi = EAPIData::get_instance()->eapi_from_string(
- DistributionData::get_instance()->distribution_from_string(
- _imp->environment->default_distribution())->default_ebuild_eapi_when_unspecified);
+ (*DistributionData::get_instance()->distribution_from_string(
+ _imp->environment->default_distribution()))[k::default_ebuild_eapi_when_unspecified()]);
}
return _imp->eapi;
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index c9ea0a6..dd6e028 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -72,7 +72,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/is_file_with_extension.hh>
-
+#include <paludis/util/kc.hh>
#include <paludis/util/rmd160.hh>
#include <paludis/util/sha256.hh>
@@ -458,8 +458,8 @@ ERepository::ERepository(const ERepositoryParams & p) :
.world_interface(0)
.environment_variable_interface(this)
.mirrors_interface(this)
- .virtuals_interface(DistributionData::get_instance()->distribution_from_string(
- p.environment->default_distribution())->support_old_style_virtuals ? this : 0)
+ .virtuals_interface((*DistributionData::get_instance()->distribution_from_string(
+ p.environment->default_distribution()))[k::support_old_style_virtuals()] ? this : 0)
.provides_interface(0)
.destination_interface(p.binary_destination ? this : 0)
.make_virtuals_interface(0)
@@ -820,7 +820,8 @@ ERepository::invalidate_masks()
{
_imp->layout->invalidate_masks();
- if (DistributionData::get_instance()->distribution_from_string(_imp->params.environment->default_distribution())->support_old_style_virtuals)
+ if ((*DistributionData::get_instance()->distribution_from_string(_imp->params.environment->default_distribution()))
+ [k::support_old_style_virtuals()])
if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals")))
_imp->params.environment->package_database()->fetch_repository(
RepositoryName("virtuals"))->invalidate_masks();
@@ -1030,7 +1031,8 @@ ERepository::set_profile(const ProfilesConstIterator & iter)
_imp->profile_ptr = iter->profile;
- if (DistributionData::get_instance()->distribution_from_string(_imp->params.environment->default_distribution())->support_old_style_virtuals)
+ if ((*DistributionData::get_instance()->distribution_from_string(_imp->params.environment->default_distribution()))
+ [k::support_old_style_virtuals()])
if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals")))
_imp->params.environment->package_database()->fetch_repository(
RepositoryName("virtuals"))->invalidate();
diff --git a/paludis/repositories/e/e_repository_mask_file.cc b/paludis/repositories/e/e_repository_mask_file.cc
index f681af7..3593177 100644
--- a/paludis/repositories/e/e_repository_mask_file.cc
+++ b/paludis/repositories/e/e_repository_mask_file.cc
@@ -25,6 +25,7 @@
#include <paludis/util/strip.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/kc.hh>
#include <paludis/mask.hh>
#include <list>
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index addfbe8..988300d 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 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
@@ -38,6 +38,7 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/config_file.hh>
+#include <paludis/util/kc.hh>
#include <paludis/dep_tag.hh>
#include <paludis/environment.hh>
#include <paludis/match_package.hh>
@@ -243,7 +244,7 @@ Implementation<ERepositoryProfile>::load_profile_directory_recursively(const FSE
load_spec_use_file(dir / "package.use.force", stacked_values_list.back().package_use_force);
packages_file.add_file(dir / "packages");
- if (DistributionData::get_instance()->distribution_from_string(env->default_distribution())->support_old_style_virtuals)
+ if ((*DistributionData::get_instance()->distribution_from_string(env->default_distribution()))[k::support_old_style_virtuals()])
virtuals_file.add_file(dir / "virtuals");
package_mask_file.add_file(dir / "package.mask");
}
@@ -455,8 +456,8 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
" failed due to exception: " + e.message() + " (" + e.what() + ")");
}
- if (DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->support_old_style_virtuals)
+ if ((*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::support_old_style_virtuals()])
try
{
for (erepository::ProfileFile<LineConfigFile>::ConstIterator line(virtuals_file.begin()), line_end(virtuals_file.end()) ;
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 46369f9..bc11a49 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -158,8 +158,8 @@ ExndbamRepository::make_exndbam_repository(
if (m->end() == m->find("builddir") || ((builddir = m->find("builddir")->second)).empty())
{
if (m->end() == m->find("buildroot") || ((builddir = m->find("buildroot")->second)).empty())
- builddir = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_builddir;
+ builddir = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_builddir()];
else
Log::get_instance()->message(ll_warning, lc_context) << "Key 'buildroot' is deprecated, use 'builddir' instead";
}
diff --git a/paludis/repositories/e/make_ebuild_repository.cc b/paludis/repositories/e/make_ebuild_repository.cc
index 5de781a..66ec1a0 100644
--- a/paludis/repositories/e/make_ebuild_repository.cc
+++ b/paludis/repositories/e/make_ebuild_repository.cc
@@ -28,6 +28,7 @@
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/options.hh>
#include <paludis/util/config_file.hh>
+#include <paludis/util/kc.hh>
#include <paludis/repositories/e/e_repository_exceptions.hh>
#include <paludis/environment.hh>
#include <paludis/distribution.hh>
@@ -117,8 +118,8 @@ paludis::make_ebuild_repository(
distdir = stringify(master_repository->params().distdir);
else
{
- distdir = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_distdir;
+ distdir = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_distdir()];
if (distdir.empty())
distdir = location + "/distfiles";
else if ('/' != distdir.at(0))
@@ -148,8 +149,8 @@ paludis::make_ebuild_repository(
std::string write_cache;
if (m->end() == m->find("write_cache") || ((write_cache = m->find("write_cache")->second)).empty())
- write_cache = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_write_cache;
+ write_cache = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_write_cache()];
bool append_repository_name_to_write_cache(true);
if (m->end() != m->find("append_repository_name_to_write_cache") && ! m->find("append_repository_name_to_write_cache")->second.empty())
@@ -170,8 +171,8 @@ paludis::make_ebuild_repository(
{
if (! layout_conf
|| (eapi_when_unknown = layout_conf->get("eapi_when_unknown")).empty())
- eapi_when_unknown = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_eapi_when_unknown;
+ eapi_when_unknown = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_eapi_when_unknown()];
}
std::string eapi_when_unspecified;
@@ -179,8 +180,8 @@ paludis::make_ebuild_repository(
{
if (! layout_conf
|| (eapi_when_unspecified = layout_conf->get("eapi_when_unspecified")).empty())
- eapi_when_unspecified = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_eapi_when_unspecified;
+ eapi_when_unspecified = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_eapi_when_unspecified()];
}
std::string profile_eapi;
@@ -188,15 +189,15 @@ paludis::make_ebuild_repository(
{
if (! layout_conf
|| (profile_eapi = layout_conf->get("eapi_when_unspecified")).empty())
- profile_eapi = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_profile_eapi;
+ profile_eapi = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_profile_eapi()];
}
std::string names_cache;
if (m->end() == m->find("names_cache") || ((names_cache = m->find("names_cache")->second)).empty())
{
- names_cache = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_names_cache;
+ names_cache = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_names_cache()];
if (names_cache.empty())
{
Log::get_instance()->message(ll_warning, lc_no_context, "The names_cache key is not set in '"
@@ -227,8 +228,8 @@ paludis::make_ebuild_repository(
if (m->end() == m->find("builddir") || ((builddir = m->find("builddir")->second)).empty())
{
if (m->end() == m->find("buildroot") || ((builddir = m->find("buildroot")->second)).empty())
- builddir = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_builddir;
+ builddir = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_builddir()];
else
Log::get_instance()->message(ll_warning, lc_context) << "Key 'buildroot' is deprecated, use 'builddir' instead";
}
@@ -238,8 +239,8 @@ paludis::make_ebuild_repository(
{
if (! layout_conf
|| (layout = layout_conf->get("layout")).empty())
- layout = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_layout;
+ layout = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_layout()];
}
erepository::UseManifest use_manifest(erepository::manifest_use);
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 49a0b40..441c25c 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -294,8 +294,8 @@ VDBRepository::make_vdb_repository(
std::string provides_cache;
if (m->end() == m->find("provides_cache") || ((provides_cache = m->find("provides_cache")->second)).empty())
{
- provides_cache = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_vdb_provides_cache;
+ provides_cache = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_vdb_provides_cache()];
if (provides_cache.empty())
{
Log::get_instance()->message(ll_warning, lc_no_context, "The provides_cache key is not set in '"
@@ -308,8 +308,8 @@ VDBRepository::make_vdb_repository(
std::string names_cache;
if (m->end() == m->find("names_cache") || ((names_cache = m->find("names_cache")->second)).empty())
{
- names_cache = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_vdb_names_cache;
+ names_cache = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_vdb_names_cache()];
if (names_cache.empty())
{
Log::get_instance()->message(ll_warning, lc_no_context, "The names_cache key is not set in '"
@@ -323,8 +323,8 @@ VDBRepository::make_vdb_repository(
if (m->end() == m->find("builddir") || ((builddir = m->find("builddir")->second)).empty())
{
if (m->end() == m->find("buildroot") || ((builddir = m->find("buildroot")->second)).empty())
- builddir = DistributionData::get_instance()->distribution_from_string(
- env->default_distribution())->default_ebuild_builddir;
+ builddir = (*DistributionData::get_instance()->distribution_from_string(
+ env->default_distribution()))[k::default_ebuild_builddir()];
else
Log::get_instance()->message(ll_warning, lc_context) << "Key 'buildroot' is deprecated, use 'builddir' instead";
}
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 477f7eb..28f3c6f 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 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
@@ -24,6 +24,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/kc.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
@@ -67,8 +68,8 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName
.mirrors_interface(this)
.environment_variable_interface(0)
.provides_interface(0)
- .virtuals_interface(DistributionData::get_instance()->distribution_from_string(
- e->default_distribution())->support_old_style_virtuals ? this : 0)
+ .virtuals_interface((*DistributionData::get_instance()->distribution_from_string(
+ e->default_distribution()))[k::support_old_style_virtuals()] ? this : 0)
.destination_interface(0)
.e_interface(0)
.make_virtuals_interface(0)
@@ -91,8 +92,8 @@ FakeRepository::FakeRepository(const FakeRepositoryParams & params) :
.mirrors_interface(this)
.environment_variable_interface(0)
.provides_interface(0)
- .virtuals_interface(DistributionData::get_instance()->distribution_from_string(
- params.environment->default_distribution())->support_old_style_virtuals ? this : 0)
+ .virtuals_interface((*DistributionData::get_instance()->distribution_from_string(
+ params.environment->default_distribution()))[k::support_old_style_virtuals()] ? this : 0)
.destination_interface(0)
.e_interface(0)
.make_virtuals_interface(0)
diff --git a/paludis/repositories/gems/registration.cc b/paludis/repositories/gems/registration.cc
index 078271a..13c2705 100644
--- a/paludis/repositories/gems/registration.cc
+++ b/paludis/repositories/gems/registration.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
@@ -25,6 +25,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/map.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/kc.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
@@ -55,7 +56,7 @@ namespace
std::string builddir;
if (m->end() == m->find("builddir") || ((builddir = m->find("builddir")->second)).empty())
- builddir = DistributionData::get_instance()->distribution_from_string(env->default_distribution())->default_ebuild_builddir;
+ builddir = (*DistributionData::get_instance()->distribution_from_string(env->default_distribution()))[k::default_ebuild_builddir()];
return make_shared_ptr(new GemsRepository(gems::RepositoryParams::create()
.location(location)
@@ -77,7 +78,7 @@ namespace
std::string builddir;
if (m->end() == m->find("builddir") || ((builddir = m->find("builddir")->second)).empty())
- builddir = DistributionData::get_instance()->distribution_from_string(env->default_distribution())->default_ebuild_builddir;
+ builddir = (*DistributionData::get_instance()->distribution_from_string(env->default_distribution()))[k::default_ebuild_builddir()];
std::string root;
if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
diff --git a/paludis/util/keys.hh b/paludis/util/keys.hh
index 4879bb3..4998ba8 100644
--- a/paludis/util/keys.hh
+++ b/paludis/util/keys.hh
@@ -37,6 +37,28 @@ namespace paludis
typedef kc::Key<9> requires_manual_fetching;
typedef kc::Key<10> failed_automatic_fetching;
typedef kc::Key<11> failed_integrity_checks;
+ typedef kc::Key<12> default_environment;
+ typedef kc::Key<13> fallback_environment;
+ typedef kc::Key<14> support_old_style_virtuals;
+ typedef kc::Key<15> default_ebuild_distdir;
+ typedef kc::Key<16> default_ebuild_write_cache;
+ typedef kc::Key<17> default_ebuild_names_cache;
+ typedef kc::Key<18> default_ebuild_builddir;
+ typedef kc::Key<19> default_ebuild_layout;
+ typedef kc::Key<20> default_ebuild_eapi_when_unknown;
+ typedef kc::Key<21> default_ebuild_eapi_when_unspecified;
+ typedef kc::Key<22> default_ebuild_profile_eapi;
+ typedef kc::Key<23> default_vdb_provides_cache;
+ typedef kc::Key<24> default_vdb_names_cache;
+ typedef kc::Key<25> paludis_environment_use_conf_filename;
+ typedef kc::Key<26> paludis_environment_keywords_conf_filename;
+ typedef kc::Key<27> concept_use;
+ typedef kc::Key<28> concept_keyword;
+ typedef kc::Key<29> paludis_package;
+ typedef kc::Key<30> kind;
+ typedef kc::Key<31> value;
+ typedef kc::Key<32> mask_file;
+ typedef kc::Key<33> comment;
}
}
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 52f8a81..fbeecff 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 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
@@ -26,6 +26,8 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/iterator_funcs.hh>
+#include <paludis/util/kc.hh>
+#include <paludis/util/keys.hh>
#include <paludis/version_spec.hh>
#include <vector>
#include <limits>
@@ -58,12 +60,13 @@ namespace
number,
scm
};
-
-#include <paludis/version_spec-sr.hh>
-#include <paludis/version_spec-sr.cc>
-
}
+typedef kc::KeyedClass<
+ kc::Field<k::kind, PartKind>,
+ kc::Field<k::value, std::string>
+ > Part;
+
namespace paludis
{
template<>
@@ -223,16 +226,16 @@ VersionSpec::VersionSpec(const std::string & text) :
{
p += 4;
/* _suffix-scm? */
- if (_imp->parts.back().value.empty())
- _imp->parts.back().value = "MAX";
+ if (_imp->parts.back()[k::value()].empty())
+ _imp->parts.back()[k::value()] = "MAX";
_imp->parts.push_back(Part(scm, ""));
}
/* Now we can change empty values to "0" */
for (std::vector<Part>::iterator i(_imp->parts.begin()),
i_end(_imp->parts.end()) ; i != i_end ; ++i)
- if (i->value.empty())
- i->value = "0";
+ if ((*i)[k::value()].empty())
+ (*i)[k::value()] = "0";
}
/* revision */
@@ -327,49 +330,49 @@ VersionSpec::compare(const VersionSpec & other) const
if (&end_part == p1 && &end_part == p2)
break;
- if (p1 == &end_part && p2->kind == revision && p2->value == "0")
+ if (p1 == &end_part && (*p2)[k::kind()] == revision && (*p2)[k::value()] == "0")
continue;
- if (p2 == &end_part && p1->kind == revision && p1->value == "0")
+ if (p2 == &end_part && (*p1)[k::kind()] == revision && (*p1)[k::value()] == "0")
continue;
- if (p1->kind < p2->kind)
+ if ((*p1)[k::kind()] < (*p2)[k::kind()])
return -1;
- if (p1->kind > p2->kind)
+ if ((*p1)[k::kind()] > (*p2)[k::kind()])
return 1;
std::string p1s, p2s;
bool length_cmp(true);
/* number parts */
- if (p1->kind == number)
+ if ((*p1)[k::kind()] == number)
{
if (first)
{
/* first component - always as integer (leading zeroes removed) */
first = false;
- p1s = strip_leading(p1->value, "0");
- p2s = strip_leading(p2->value, "0");
+ p1s = strip_leading((*p1)[k::value()], "0");
+ p2s = strip_leading((*p2)[k::value()], "0");
}
- else if ((! p1->value.empty() && p1->value.at(0) == '0') ||
- (! p2->value.empty() && p2->value.at(0) == '0'))
+ else if ((! (*p1)[k::value()].empty() && (*p1)[k::value()].at(0) == '0') ||
+ (! (*p2)[k::value()].empty() && (*p2)[k::value()].at(0) == '0'))
{
/* leading zeroes - stringwise compare with trailing zeroes removed */
length_cmp = false;
- p1s = strip_trailing(p1->value, "0");
- p2s = strip_trailing(p2->value, "0");
+ p1s = strip_trailing((*p1)[k::value()], "0");
+ p2s = strip_trailing((*p2)[k::value()], "0");
}
else
{
- p1s = p1->value;
- p2s = p2->value;
+ p1s = (*p1)[k::value()];
+ p2s = (*p2)[k::value()];
}
}
/* anything else than number parts */
else
{
- p1s = p1->value;
- p2s = p2->value;
+ p1s = (*p1)[k::value()];
+ p2s = (*p2)[k::value()];
/* _suffix-scm? */
if (p1s == "MAX" && p2s == "MAX")
@@ -414,49 +417,49 @@ VersionSpec::tilde_compare(const VersionSpec & other) const
if (&end_part == p1 && &end_part == p2)
break;
- if (p1->kind != p2->kind)
+ if ((*p1)[k::kind()] != (*p2)[k::kind()])
{
- if (p2 != &end_part || p1->kind != revision)
+ if (p2 != &end_part || (*p1)[k::kind()] != revision)
return false;
}
else
{
std::string p1s, p2s;
/* number part */
- if (p1->kind == number)
+ if ((*p1)[k::kind()] == number)
{
if (first)
{
/* first component - remove leading zeroes and check whether equal */
first = false;
- if (strip_leading(p1->value, "0") != strip_leading(p2->value, "0"))
+ if (strip_leading((*p1)[k::value()], "0") != strip_leading((*p2)[k::value()], "0"))
return false;
}
- else if ((! p1->value.empty() && p1->value.at(0) == '0') ||
- (! p2->value.empty() && p2->value.at(0) == '0'))
+ else if ((! (*p1)[k::value()].empty() && (*p1)[k::value()].at(0) == '0') ||
+ (! (*p2)[k::value()].empty() && (*p2)[k::value()].at(0) == '0'))
{
/* leading zeroes - remove trailing zeroes and check whether equal */
- if (strip_trailing(p1->value, "0") != strip_trailing(p2->value, "0"))
+ if (strip_trailing((*p1)[k::value()], "0") != strip_trailing((*p2)[k::value()], "0"))
return false;
}
else
{
/* normal(!) case */
- if (p1->value != p2->value)
+ if ((*p1)[k::value()] != (*p2)[k::value()])
return false;
}
}
/* revision - compare as integers */
- else if (p1->kind == revision)
+ else if ((*p1)[k::kind()] == revision)
{
- int c = p1->value.size() - p2->value.size();
+ int c = (*p1)[k::value()].size() - (*p2)[k::value()].size();
if (c < 0)
return false;
- else if (c == 0 && p1->value.compare(p2->value) == -1)
+ else if (c == 0 && (*p1)[k::value()].compare((*p2)[k::value()]) == -1)
return false;
}
/* not a number part nor revision - must be just equal */
- else if (p1->value != p2->value)
+ else if ((*p1)[k::value()] != (*p2)[k::value()])
return false;
}
}
@@ -489,7 +492,7 @@ VersionSpec::hash_value() const
for (std::vector<Part>::const_iterator r(_imp->parts.begin()), r_end(_imp->parts.end()) ;
r != r_end ; ++r)
{
- if (r->value == "0" && r->kind == revision)
+ if ((*r)[k::value()] == "0" && (*r)[k::kind()] == revision)
continue;
std::size_t hh(result & h_mask);
@@ -497,10 +500,10 @@ VersionSpec::hash_value() const
result ^= (hh >> h_shift);
std::string r_v;
- if (! r->value.empty() && r->value.at(0) == '0')
- r_v = strip_trailing(r->value, "0");
+ if (! (*r)[k::value()].empty() && (*r)[k::value()].at(0) == '0')
+ r_v = strip_trailing((*r)[k::value()], "0");
else
- r_v = r->value;
+ r_v = (*r)[k::value()];
size_t x(0);
int zeroes(0);
@@ -515,7 +518,7 @@ VersionSpec::hash_value() const
}
first = false;
- result ^= (static_cast<std::size_t>(r->kind) + (x << 3) + (zeroes << 12));
+ result ^= (static_cast<std::size_t>((*r)[k::kind()]) + (x << 3) + (zeroes << 12));
}
} while (false);
@@ -532,7 +535,7 @@ namespace
{
bool operator() (const Part & p) const
{
- return p.kind == p_;
+ return p[k::kind()] == p_;
}
};
}
@@ -570,7 +573,7 @@ VersionSpec::revision_only() const
else
result = "r";
- result.append(r->value);
+ result.append((*r)[k::value()]);
r = std::find_if(next(r), _imp->parts.end(), IsPart<revision>());
} while (r != _imp->parts.end());
@@ -614,7 +617,7 @@ VersionSpec::is_scm() const
/* are we a -r9999? */
r = std::find_if(_imp->parts.begin(), _imp->parts.end(), IsPart<revision>());
if (r != _imp->parts.end())
- if (r->value == "9999")
+ if ((*r)[k::value()] == "9999")
{
result = true;
break;
@@ -660,8 +663,8 @@ VersionSpec::bump() const
number_parts.pop_back();
/* ++string */
- std::string::reverse_iterator i(number_parts.back().value.rbegin()),
- i_end(number_parts.back().value.rend());
+ std::string::reverse_iterator i(number_parts.back()[k::value()].rbegin()),
+ i_end(number_parts.back()[k::value()].rend());
bool add1(true);
while (i != i_end && add1)
{
@@ -675,7 +678,7 @@ VersionSpec::bump() const
++i;
}
if (add1)
- number_parts.back().value.insert(0, "1");
+ number_parts.back()[k::value()].insert(0, "1");
bool need_dot(false);
std::string str;
@@ -684,7 +687,7 @@ VersionSpec::bump() const
{
if (need_dot)
str.append(".");
- str.append(r->value);
+ str.append((*r)[k::value()]);
need_dot = true;
}
return VersionSpec(str);
diff --git a/paludis/version_spec.sr b/paludis/version_spec.sr
deleted file mode 100644
index 666c705..0000000
--- a/paludis/version_spec.sr
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-make_class_Part()
-{
- key kind PartKind
- key value std::string
-
- doxygen_comment << "END"
- /**
- * Internal use by VersionSpec.
- *
- * \ingroup g_names
- * \nosubgrouping
- */
-END
-}
diff --git a/python/action.cc b/python/action.cc
index 7229aa9..700df21 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -30,21 +30,6 @@ using namespace paludis;
using namespace paludis::python;
namespace bp = boost::python;
-namespace
-{
- template <typename C_, typename T_, typename K_>
- T_ kc_getter(const C_ & c)
- {
- return c[K_()];
- }
-
- template <typename C_, typename T_, typename K_>
- void kc_setter(C_ & c, const T_ & t)
- {
- c[K_()] = t;
- }
-}
-
template <typename A_>
class class_supports_action_test :
public bp::class_<SupportsActionTest<A_>, bp::bases<SupportsActionTestBase> >
diff --git a/python/mask.cc b/python/mask.cc
index 585182a..f42b8fa 100644
--- a/python/mask.cc
+++ b/python/mask.cc
@@ -22,6 +22,7 @@
#include <paludis/mask.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/kc.hh>
using namespace paludis;
using namespace paludis::python;
@@ -287,14 +288,16 @@ void expose_mask()
"__init__(path_str, list of string)"
)
)
- .add_property("mask_file", bp::make_getter(&RepositoryMaskInfo::mask_file,
- bp::return_value_policy<bp::return_by_value>()),
+ .add_property("mask_file",
+ &kc_getter<RepositoryMaskInfo, FSEntry, k::mask_file>,
+ &kc_setter<RepositoryMaskInfo, FSEntry, k::mask_file>,
"[ro] str\n"
"Holds the file whence the mask originates."
)
- .add_property("comment", bp::make_getter(&RepositoryMaskInfo::comment,
- bp::return_value_policy<bp::return_by_value>()),
+ .add_property("comment",
+ &kc_getter<RepositoryMaskInfo, tr1::shared_ptr<const Sequence<std::string> >, k::comment>,
+ &kc_setter<RepositoryMaskInfo, tr1::shared_ptr<const Sequence<std::string> >, k::comment>,
"[ro] Iterable of str\n"
"Sequence of lines explaining the mask."
)
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index 9e20f1a..26da695 100644
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -154,6 +154,20 @@ namespace paludis
return boost::python::incref(boost::python::make_tuple(x.first, x.second).ptr());
}
};
+
+ // helper for kc getters
+ template <typename C_, typename T_, typename K_>
+ T_ kc_getter(const C_ & c)
+ {
+ return c[K_()];
+ }
+
+ // helper for kc setters
+ template <typename C_, typename T_, typename K_>
+ void kc_setter(C_ & c, const T_ & t)
+ {
+ c[K_()] = t;
+ }
} // namespace paludis::python
} // namespace paludis
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index e411a87..871b66c 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2007, 2008 Richard Brown
- * 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,6 +21,7 @@
#include <paludis_ruby.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/kc.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
@@ -508,7 +509,7 @@ namespace
{
tr1::shared_ptr<const RepositoryMaskInfo> * ptr;
Data_Get_Struct(self, tr1::shared_ptr<const RepositoryMaskInfo>, ptr);
- return rb_str_new2(stringify((*ptr)->mask_file).c_str());
+ return rb_str_new2(stringify((**ptr)[k::mask_file()]).c_str());
}
/*
@@ -523,8 +524,8 @@ namespace
tr1::shared_ptr<const RepositoryMaskInfo> * ptr;
Data_Get_Struct(self, tr1::shared_ptr<const RepositoryMaskInfo>, ptr);
VALUE result(rb_ary_new());
- for (Sequence<std::string>::ConstIterator it((*ptr)->comment->begin()),
- it_end((*ptr)->comment->end()); it_end != it; ++it)
+ for (Sequence<std::string>::ConstIterator it((**ptr)[k::comment()]->begin()),
+ it_end((**ptr)[k::comment()]->end()); it_end != it; ++it)
rb_ary_push(result, rb_str_new2(it->c_str()));
return result;
}
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index bf154ee..003b5c7 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -12,6 +12,7 @@
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/kc.hh>
#include <paludis/query.hh>
#include <paludis/mask.hh>
#include <paludis/metadata_key.hh>
@@ -194,8 +195,8 @@ namespace gtkpaludis
if (! k.value())
return;
- got_key(k, markup_escape(stringify(k.value()->mask_file) + ": " +
- join(k.value()->comment->begin(), k.value()->comment->end(), " ")));
+ got_key(k, markup_escape(stringify((*k.value())[k::mask_file()]) + ": " +
+ join((*k.value())[k::comment()]->begin(), (*k.value())[k::comment()]->end(), " ")));
}
void visit(const MetadataFSEntryKey & k)
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 8624c34..d87fac6 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -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
@@ -29,6 +29,7 @@
#include <paludis/util/virtual_constructor-impl.hh>
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/kc.hh>
#include <paludis/stringify_formatter.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
@@ -168,8 +169,8 @@ namespace
void visit(const MetadataRepositoryMaskInfoKey & k)
{
if (k.value())
- stream << k.raw_name() << ": " << k.value()->mask_file << ": "
- << join(k.value()->comment->begin(), k.value()->comment->end(), " ") << "\n";
+ stream << k.raw_name() << ": " << (*k.value())[k::mask_file()] << ": "
+ << join((*k.value())[k::comment()]->begin(), (*k.value())[k::comment()]->end(), " ") << "\n";
else
stream << k.raw_name() << "\n";
}
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index dbd0d7f..6da8dcf 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.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
@@ -29,6 +29,7 @@
#include <paludis/util/map-impl.hh>
#include <paludis/util/join.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/kc.hh>
#include <paludis/query.hh>
#include <paludis/mask.hh>
#include <paludis/metadata_key.hh>
@@ -589,15 +590,15 @@ namespace
if (task->want_raw())
{
task->output_left_column(k.raw_name() + ":", in);
- task->output_right_column(stringify(k.value()->mask_file) + ": " +
- join(k.value()->comment->begin(), k.value()->comment->end(), " "));
+ task->output_right_column(stringify((*k.value())[k::mask_file()]) + ": " +
+ join((*k.value())[k::comment()]->begin(), (*k.value())[k::comment()]->end(), " "));
}
else
{
task->output_left_column(k.human_name() + ":", in);
- task->output_right_column(stringify(k.value()->mask_file) + ":");
- for (Sequence<std::string>::ConstIterator it(k.value()->comment->begin()),
- it_end(k.value()->comment->end()); it_end != it; ++it)
+ task->output_right_column(stringify((*k.value())[k::mask_file()]) + ":");
+ for (Sequence<std::string>::ConstIterator it((*k.value())[k::comment()]->begin()),
+ it_end((*k.value())[k::comment()]->end()); it_end != it; ++it)
{
task->output_left_column("", in);
task->output_right_column(*it);
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index 7e4c83f..13fa6f4 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.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
@@ -26,6 +26,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/kc.hh>
#include <paludis/metadata_key.hh>
#include <sstream>
@@ -110,8 +111,8 @@ namespace
void visit(const MetadataRepositoryMaskInfoKey & k)
{
- s << k.value()->mask_file << ": " <<
- join(k.value()->comment->begin(), k.value()->comment->end(), " ");
+ s << (*k.value())[k::mask_file()] << ": " <<
+ join((*k.value())[k::comment()]->begin(), (*k.value())[k::comment()]->end(), " ");
}
void visit(const MetadataFSEntryKey & k)