aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-19 16:01:04 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-19 16:01:04 +0100
commitcc129190d549f69eccc67407946261544d538a91 (patch)
tree08f0ffe78b5c3f63dfc89d32dba1d828a5107dd0 /paludis/environments
parentb22056183d6a0e94e28e025c6bae6970979c26c0 (diff)
downloadpaludis-cc129190d549f69eccc67407946261544d538a91.tar.gz
paludis-cc129190d549f69eccc67407946261544d538a91.tar.xz
New improved NamedValue syntax
Diffstat (limited to 'paludis/environments')
-rw-r--r--paludis/environments/no_config/no_config_environment.cc2
-rw-r--r--paludis/environments/no_config/no_config_environment.hh20
-rw-r--r--paludis/environments/no_config/no_config_environment_TEST.cc22
-rw-r--r--paludis/environments/no_config/registration.cc22
-rw-r--r--paludis/environments/paludis/extra_distribution_data.cc26
-rw-r--r--paludis/environments/paludis/extra_distribution_data.hh26
-rw-r--r--paludis/environments/paludis/output_conf.cc28
-rw-r--r--paludis/environments/paludis/paludis_environment.cc14
-rw-r--r--paludis/environments/paludis/use_conf.cc9
-rw-r--r--paludis/environments/paludis/world.cc36
-rw-r--r--paludis/environments/portage/portage_environment.cc40
-rw-r--r--paludis/environments/test/test_environment.cc2
12 files changed, 124 insertions, 123 deletions
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index ac67532ff..ac408eef9 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -542,7 +542,7 @@ NoConfigEnvironment::root() const
HookResult
NoConfigEnvironment::perform_hook(const Hook &) const
{
- return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+ return make_named_values<HookResult>(n::max_exit_status() = 0, n::output() = "");
}
std::tr1::shared_ptr<const FSEntrySequence>
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index ecd784167..ef2ca72fe 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -29,16 +29,16 @@ namespace paludis
{
namespace n
{
- struct accept_unstable;
- struct disable_metadata_cache;
- struct extra_accept_keywords;
- struct extra_params;
- struct extra_repository_dirs;
- struct master_repository_name;
- struct profiles_if_not_auto;
- struct repository_dir;
- struct repository_type;
- struct write_cache;
+ typedef Name<struct accept_unstable_name> accept_unstable;
+ typedef Name<struct disable_metadata_cache_name> disable_metadata_cache;
+ typedef Name<struct extra_accept_keywords_name> extra_accept_keywords;
+ typedef Name<struct extra_params_name> extra_params;
+ typedef Name<struct extra_repository_dirs_name> extra_repository_dirs;
+ typedef Name<struct master_repository_name_name> master_repository_name;
+ typedef Name<struct profiles_if_not_auto_name> profiles_if_not_auto;
+ typedef Name<struct repository_dir_name> repository_dir;
+ typedef Name<struct repository_type_name> repository_type;
+ typedef Name<struct write_cache_name> write_cache;
}
namespace no_config_environment
diff --git a/paludis/environments/no_config/no_config_environment_TEST.cc b/paludis/environments/no_config/no_config_environment_TEST.cc
index 3e1671ae0..0b2f2bc87 100644
--- a/paludis/environments/no_config/no_config_environment_TEST.cc
+++ b/paludis/environments/no_config/no_config_environment_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010 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
@@ -37,16 +37,16 @@ namespace test_cases
void run()
{
NoConfigEnvironment e(make_named_values<no_config_environment::Params>(
- value_for<n::accept_unstable>(false),
- value_for<n::disable_metadata_cache>(false),
- value_for<n::extra_accept_keywords>(""),
- value_for<n::extra_params>(std::tr1::shared_ptr<Map<std::string, std::string> >()),
- value_for<n::extra_repository_dirs>(make_shared_ptr(new FSEntrySequence)),
- value_for<n::master_repository_name>(""),
- value_for<n::profiles_if_not_auto>(""),
- value_for<n::repository_dir>(FSEntry("no_config_environment_TEST_dir/repo")),
- value_for<n::repository_type>(no_config_environment::ncer_auto),
- value_for<n::write_cache>(FSEntry("/var/empty"))
+ n::accept_unstable() = false,
+ n::disable_metadata_cache() = false,
+ n::extra_accept_keywords() = "",
+ n::extra_params() = std::tr1::shared_ptr<Map<std::string, std::string> >(),
+ n::extra_repository_dirs() = make_shared_ptr(new FSEntrySequence),
+ n::master_repository_name() = "",
+ n::profiles_if_not_auto() = "",
+ n::repository_dir() = FSEntry("no_config_environment_TEST_dir/repo"),
+ n::repository_type() = no_config_environment::ncer_auto,
+ n::write_cache() = FSEntry("/var/empty")
));
TEST_CHECK(e.package_database());
diff --git a/paludis/environments/no_config/registration.cc b/paludis/environments/no_config/registration.cc
index f4e316e17..c1d7e1950 100644
--- a/paludis/environments/no_config/registration.cc
+++ b/paludis/environments/no_config/registration.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -90,16 +90,16 @@ namespace
return std::tr1::shared_ptr<Environment>(new NoConfigEnvironment(
make_named_values<no_config_environment::Params>(
- value_for<n::accept_unstable>(accept_unstable),
- value_for<n::disable_metadata_cache>(disable_metadata_cache),
- value_for<n::extra_accept_keywords>(extra_accept_keywords),
- value_for<n::extra_params>(extra_params),
- value_for<n::extra_repository_dirs>(extra_repository_dirs),
- value_for<n::master_repository_name>(master_repository_name),
- value_for<n::profiles_if_not_auto>(profile),
- value_for<n::repository_dir>(repository_dir),
- value_for<n::repository_type>(repository_type),
- value_for<n::write_cache>(write_cache)
+ n::accept_unstable() = accept_unstable,
+ n::disable_metadata_cache() = disable_metadata_cache,
+ n::extra_accept_keywords() = extra_accept_keywords,
+ n::extra_params() = extra_params,
+ n::extra_repository_dirs() = extra_repository_dirs,
+ n::master_repository_name() = master_repository_name,
+ n::profiles_if_not_auto() = profile,
+ n::repository_dir() = repository_dir,
+ n::repository_type() = repository_type,
+ n::write_cache() = write_cache
)));
}
}
diff --git a/paludis/environments/paludis/extra_distribution_data.cc b/paludis/environments/paludis/extra_distribution_data.cc
index dc27afe49..cffe8ea04 100644
--- a/paludis/environments/paludis/extra_distribution_data.cc
+++ b/paludis/environments/paludis/extra_distribution_data.cc
@@ -39,19 +39,19 @@ namespace paludis
static std::tr1::shared_ptr<PaludisDistribution> make_data(const std::tr1::shared_ptr<const KeyValueConfigFile> & k)
{
return make_shared_ptr(new PaludisDistribution(make_named_values<PaludisDistribution>(
- value_for<n::bashrc_filename>(k->get("bashrc_filename")),
- value_for<n::info_messages_are_spam>(destringify<bool>(k->get("info_messages_are_spam"))),
- value_for<n::keywords_filename_part>(k->get("keywords_filename_part")),
- value_for<n::licenses_filename_part>(k->get("licenses_filename_part")),
- value_for<n::mandatory_userpriv>(destringify<bool>(k->get("mandatory_userpriv"))),
- value_for<n::mirrors_filename_part>(k->get("mirrors_filename_part")),
- value_for<n::output_filename_part>(k->get("output_filename_part")),
- value_for<n::output_managers_directory>(k->get("output_managers_directory")),
- value_for<n::package_mask_filename_part>(k->get("package_mask_filename_part")),
- value_for<n::package_unmask_filename_part>(k->get("package_unmask_filename_part")),
- value_for<n::repositories_directory>(k->get("repositories_directory")),
- value_for<n::repository_defaults_filename_part>(k->get("repository_defaults_filename_part")),
- value_for<n::use_filename_part>(k->get("use_filename_part"))
+ n::bashrc_filename() = k->get("bashrc_filename"),
+ n::info_messages_are_spam() = destringify<bool>(k->get("info_messages_are_spam")),
+ n::keywords_filename_part() = k->get("keywords_filename_part"),
+ n::licenses_filename_part() = k->get("licenses_filename_part"),
+ n::mandatory_userpriv() = destringify<bool>(k->get("mandatory_userpriv")),
+ n::mirrors_filename_part() = k->get("mirrors_filename_part"),
+ n::output_filename_part() = k->get("output_filename_part"),
+ n::output_managers_directory() = k->get("output_managers_directory"),
+ n::package_mask_filename_part() = k->get("package_mask_filename_part"),
+ n::package_unmask_filename_part() = k->get("package_unmask_filename_part"),
+ n::repositories_directory() = k->get("repositories_directory"),
+ n::repository_defaults_filename_part() = k->get("repository_defaults_filename_part"),
+ n::use_filename_part() = k->get("use_filename_part")
)));
}
};
diff --git a/paludis/environments/paludis/extra_distribution_data.hh b/paludis/environments/paludis/extra_distribution_data.hh
index 34b2217b1..aa49b8d29 100644
--- a/paludis/environments/paludis/extra_distribution_data.hh
+++ b/paludis/environments/paludis/extra_distribution_data.hh
@@ -28,19 +28,19 @@ namespace paludis
{
namespace n
{
- struct bashrc_filename;
- struct info_messages_are_spam;
- struct keywords_filename_part;
- struct licenses_filename_part;
- struct mandatory_userpriv;
- struct mirrors_filename_part;
- struct output_filename_part;
- struct output_managers_directory;
- struct package_mask_filename_part;
- struct package_unmask_filename_part;
- struct repositories_directory;
- struct repository_defaults_filename_part;
- struct use_filename_part;
+ typedef Name<struct bashrc_filename_name> bashrc_filename;
+ typedef Name<struct info_messages_are_spam_name> info_messages_are_spam;
+ typedef Name<struct keywords_filename_part_name> keywords_filename_part;
+ typedef Name<struct licenses_filename_part_name> licenses_filename_part;
+ typedef Name<struct mandatory_userpriv_name> mandatory_userpriv;
+ typedef Name<struct mirrors_filename_part_name> mirrors_filename_part;
+ typedef Name<struct output_filename_part_name> output_filename_part;
+ typedef Name<struct output_managers_directory_name> output_managers_directory;
+ typedef Name<struct package_mask_filename_part_name> package_mask_filename_part;
+ typedef Name<struct package_unmask_filename_part_name> package_unmask_filename_part;
+ typedef Name<struct repositories_directory_name> repositories_directory;
+ typedef Name<struct repository_defaults_filename_part_name> repository_defaults_filename_part;
+ typedef Name<struct use_filename_part_name> use_filename_part;
}
namespace paludis_environment
diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc
index 44bed42df..9e37a53c7 100644
--- a/paludis/environments/paludis/output_conf.cc
+++ b/paludis/environments/paludis/output_conf.cc
@@ -56,13 +56,13 @@ namespace paludis
{
namespace n
{
- struct action_requirement;
- struct ignore_unfetched_requirement;
- struct manager;
- struct matches_requirement;
- struct name_requirement;
- struct output_exclusivity_requirement;
- struct type_requirement;
+ typedef Name<struct action_requirement_name> action_requirement;
+ typedef Name<struct ignore_unfetched_requirement_name> ignore_unfetched_requirement;
+ typedef Name<struct manager_name> manager;
+ typedef Name<struct matches_requirement_name> matches_requirement;
+ typedef Name<struct name_requirement_name> name_requirement;
+ typedef Name<struct output_exclusivity_requirement_name> output_exclusivity_requirement;
+ typedef Name<struct type_requirement_name> type_requirement;
}
}
@@ -379,13 +379,13 @@ OutputConf::add(const FSEntry & filename)
r != r_end ; ++r)
{
Rule rule(make_named_values<Rule>(
- value_for<n::action_requirement>("*"),
- value_for<n::ignore_unfetched_requirement>(indeterminate),
- value_for<n::manager>("unset"),
- value_for<n::matches_requirement>(make_null_shared_ptr()),
- value_for<n::name_requirement>("*"),
- value_for<n::output_exclusivity_requirement>(static_cast<OutputExclusivity>(-1)),
- value_for<n::type_requirement>("*")
+ n::action_requirement() = "*",
+ n::ignore_unfetched_requirement() = Tribool(indeterminate),
+ n::manager() = "unset",
+ n::matches_requirement() = make_null_shared_ptr(),
+ n::name_requirement() = "*",
+ n::output_exclusivity_requirement() = static_cast<OutputExclusivity>(-1),
+ n::type_requirement() = "*"
));
for (Map<std::string, std::string>::ConstIterator m(r->second->begin()), m_end(r->second->end()) ;
m != m_end ; ++m)
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 9bbb11839..23cbe58e0 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -507,14 +507,14 @@ namespace
const std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(n, stringify(f.basename())));
SetFile s(make_named_values<SetFileParams>(
- value_for<n::environment>(env),
- value_for<n::file_name>(f),
- value_for<n::parser>(std::tr1::bind(&parse_user_package_dep_spec,
+ n::environment() = env,
+ n::file_name() = f,
+ n::parser() = std::tr1::bind(&parse_user_package_dep_spec,
std::tr1::placeholders::_1, env, UserPackageDepSpecOptions() + updso_allow_wildcards,
- filter::All())),
- value_for<n::set_operator_mode>(mode),
- value_for<n::tag>(tag),
- value_for<n::type>(type)
+ filter::All()),
+ n::set_operator_mode() = mode,
+ n::tag() = tag,
+ n::type() = type
));
return s.contents();
}
diff --git a/paludis/environments/paludis/use_conf.cc b/paludis/environments/paludis/use_conf.cc
index a965daf91..68ad11fc7 100644
--- a/paludis/environments/paludis/use_conf.cc
+++ b/paludis/environments/paludis/use_conf.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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,6 +23,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/tribool.hh>
#include <paludis/paludislike_options_conf.hh>
#include <paludis/choice.hh>
@@ -40,9 +41,9 @@ namespace paludis
Implementation(const PaludisEnvironment * const e) :
env(e),
handler(new PaludisLikeOptionsConf(make_named_values<PaludisLikeOptionsConfParams>(
- value_for<n::allow_locking>(false),
- value_for<n::environment>(e),
- value_for<n::make_config_file>(&make_bashable_conf)
+ n::allow_locking() = false,
+ n::environment() = e,
+ n::make_config_file() = &make_bashable_conf
)))
{
}
diff --git a/paludis/environments/paludis/world.cc b/paludis/environments/paludis/world.cc
index e642547ed..02e1841e2 100644
--- a/paludis/environments/paludis/world.cc
+++ b/paludis/environments/paludis/world.cc
@@ -116,12 +116,12 @@ World::_add_string_to_world(const std::string & n) const
}
SetFile world(make_named_values<SetFileParams>(
- value_for<n::environment>(_imp->env),
- value_for<n::file_name>(*_imp->maybe_world_file),
- value_for<n::parser>(std::tr1::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All())),
- value_for<n::set_operator_mode>(sfsmo_natural),
- value_for<n::tag>(std::tr1::shared_ptr<DepTag>()),
- value_for<n::type>(sft_simple)
+ n::environment() = _imp->env,
+ n::file_name() = *_imp->maybe_world_file,
+ n::parser() = std::tr1::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All()),
+ n::set_operator_mode() = sfsmo_natural,
+ n::tag() = std::tr1::shared_ptr<DepTag>(),
+ n::type() = sft_simple
));
world.add(n);
world.rewrite();
@@ -147,12 +147,12 @@ World::_remove_string_from_world(const std::string & n) const
if (_imp->maybe_world_file->exists())
{
SetFile world(make_named_values<SetFileParams>(
- value_for<n::environment>(_imp->env),
- value_for<n::file_name>(*_imp->maybe_world_file),
- value_for<n::parser>(std::tr1::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All())),
- value_for<n::set_operator_mode>(sfsmo_natural),
- value_for<n::tag>(std::tr1::shared_ptr<DepTag>()),
- value_for<n::type>(sft_simple)
+ n::environment() = _imp->env,
+ n::file_name() = *_imp->maybe_world_file,
+ n::parser() = std::tr1::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All()),
+ n::set_operator_mode() = sfsmo_natural,
+ n::tag() = std::tr1::shared_ptr<DepTag>(),
+ n::type() = sft_simple
));
result = world.remove(n);
@@ -181,12 +181,12 @@ World::world_set() const
if (_imp->maybe_world_file->exists())
{
SetFile world(make_named_values<SetFileParams>(
- value_for<n::environment>(_imp->env),
- value_for<n::file_name>(*_imp->maybe_world_file),
- value_for<n::parser>(std::tr1::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All())),
- value_for<n::set_operator_mode>(sfsmo_natural),
- value_for<n::tag>(tag),
- value_for<n::type>(sft_simple)
+ n::environment() = _imp->env,
+ n::file_name() = *_imp->maybe_world_file,
+ n::parser() = std::tr1::bind(&parse_user_package_dep_spec, _1, _imp->env, UserPackageDepSpecOptions() + updso_no_disambiguation + updso_throw_if_set, filter::All()),
+ n::set_operator_mode() = sfsmo_natural,
+ n::tag() = tag,
+ n::type() = sft_simple
));
return world.contents();
}
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 247da9b4a..0f6b53b7b 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -918,12 +918,12 @@ PortageEnvironment::_add_string_to_world(const std::string & s) const
}
SetFile world(make_named_values<SetFileParams>(
- value_for<n::environment>(this),
- value_for<n::file_name>(_imp->world_file),
- value_for<n::parser>(std::tr1::bind(&parse_user_package_dep_spec, _1, this, UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All())),
- value_for<n::set_operator_mode>(sfsmo_natural),
- value_for<n::tag>(std::tr1::shared_ptr<DepTag>()),
- value_for<n::type>(sft_simple)
+ n::environment() = this,
+ n::file_name() = _imp->world_file,
+ n::parser() = std::tr1::bind(&parse_user_package_dep_spec, _1, this, UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All()),
+ n::set_operator_mode() = sfsmo_natural,
+ n::tag() = std::tr1::shared_ptr<DepTag>(),
+ n::type() = sft_simple
));
world.add(s);
world.rewrite();
@@ -942,13 +942,13 @@ PortageEnvironment::_remove_string_from_world(const std::string & s) const
if (_imp->world_file.exists())
{
SetFile world(make_named_values<SetFileParams>(
- value_for<n::environment>(this),
- value_for<n::file_name>(_imp->world_file),
- value_for<n::parser>(std::tr1::bind(&parse_user_package_dep_spec, _1, this,
- UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All())),
- value_for<n::set_operator_mode>(sfsmo_natural),
- value_for<n::tag>(std::tr1::shared_ptr<DepTag>()),
- value_for<n::type>(sft_simple)
+ n::environment() = this,
+ n::file_name() = _imp->world_file,
+ n::parser() = std::tr1::bind(&parse_user_package_dep_spec, _1, this,
+ UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All()),
+ n::set_operator_mode() = sfsmo_natural,
+ n::tag() = std::tr1::shared_ptr<DepTag>(),
+ n::type() = sft_simple
));
result = world.remove(s);
@@ -1005,13 +1005,13 @@ namespace
const std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(SetName("world::environment"), "Environment"));
SetFile world(make_named_values<SetFileParams>(
- value_for<n::environment>(env),
- value_for<n::file_name>(f),
- value_for<n::parser>(std::tr1::bind(&parse_user_package_dep_spec, std::tr1::placeholders::_1,
- env, UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All())),
- value_for<n::set_operator_mode>(sfsmo_natural),
- value_for<n::tag>(tag),
- value_for<n::type>(sft_simple)
+ n::environment() = env,
+ n::file_name() = f,
+ n::parser() = std::tr1::bind(&parse_user_package_dep_spec, std::tr1::placeholders::_1,
+ env, UserPackageDepSpecOptions() + updso_no_disambiguation, filter::All()),
+ n::set_operator_mode() = sfsmo_natural,
+ n::tag() = tag,
+ n::type() = sft_simple
));
return world.contents();
}
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 707b02cd2..593729fa3 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -165,7 +165,7 @@ TestEnvironment::mirrors(const std::string & s) const
HookResult
TestEnvironment::perform_hook(const Hook &) const
{
- return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+ return make_named_values<HookResult>(n::max_exit_status() = 0, n::output() = "");
}
std::tr1::shared_ptr<const FSEntrySequence>