aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-29 22:09:45 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-29 22:09:45 +0000
commit5e5ba2d50752c7c2b83ca75ce124ea66a0946e50 (patch)
tree313807da773d21a9d8204d8ed9f0f53eb7bcbd45
parent78a2a6998dfb6cd7049539e15d9083c34049b9d2 (diff)
downloadpaludis-5e5ba2d50752c7c2b83ca75ce124ea66a0946e50.tar.gz
paludis-5e5ba2d50752c7c2b83ca75ce124ea66a0946e50.tar.xz
Use std::tr1::shared_ptr<> instead of paludis::CountedPtr.
-rw-r--r--configure.ac15
-rw-r--r--doc/doc_references.doxygen4
-rw-r--r--doc/examples/pwp_basic_cplusplus_app.cc3
-rw-r--r--doc/programmingwithpaludis.html.skel10
-rw-r--r--paludis/args/args_group.cc5
-rw-r--r--paludis/args/args_handler.cc3
-rw-r--r--paludis/args/args_option.cc12
-rw-r--r--paludis/config_file.cc14
-rw-r--r--paludis/config_file.hh9
-rw-r--r--paludis/config_file_TEST.cc4
-rw-r--r--paludis/contents.cc7
-rw-r--r--paludis/contents.hh34
-rw-r--r--paludis/dep_atom.cc38
-rw-r--r--paludis/dep_atom.hh103
-rw-r--r--paludis/dep_atom_TEST.cc14
-rw-r--r--paludis/dep_atom_flattener.cc11
-rw-r--r--paludis/dep_atom_flattener.hh4
-rw-r--r--paludis/dep_list/dep_list.cc129
-rw-r--r--paludis/dep_list/dep_list.hh16
-rw-r--r--paludis/dep_list/dep_list.sr6
-rw-r--r--paludis/dep_list/dep_list_TEST.cc28
-rw-r--r--paludis/dep_list/dep_list_TEST.hh8
-rw-r--r--paludis/dep_list/dep_list_TEST_blockers.cc18
-rw-r--r--paludis/dep_list/range_rewriter.cc3
-rw-r--r--paludis/dep_list/range_rewriter.hh6
-rw-r--r--paludis/dep_list/range_rewriter_TEST.cc2
-rw-r--r--paludis/dep_list/uninstall_list.cc85
-rw-r--r--paludis/dep_list/uninstall_list.hh10
-rw-r--r--paludis/dep_list/uninstall_list.sr2
-rw-r--r--paludis/dep_list/uninstall_list_TEST.cc6
-rw-r--r--paludis/dep_tag.cc14
-rw-r--r--paludis/dep_tag.hh17
-rw-r--r--paludis/dep_tag.sr2
-rw-r--r--paludis/ebuild.cc5
-rw-r--r--paludis/ebuild.hh7
-rw-r--r--paludis/ebuild.sr10
-rw-r--r--paludis/environment.cc33
-rw-r--r--paludis/environment.hh25
-rw-r--r--paludis/environment/default/default_config.cc84
-rw-r--r--paludis/environment/default/default_config.hh10
-rw-r--r--paludis/environment/default/default_environment.cc52
-rw-r--r--paludis/environment/default/default_environment.hh10
-rw-r--r--paludis/environment/default/repository_config_entry.sr2
-rw-r--r--paludis/environment/default/use_config_entry.sr12
-rw-r--r--paludis/environment/no_config/no_config_environment.cc25
-rw-r--r--paludis/environment/no_config/no_config_environment.hh4
-rw-r--r--paludis/environment/test/test_environment.cc2
-rw-r--r--paludis/match_package.cc52
-rw-r--r--paludis/match_package.hh110
-rw-r--r--paludis/package_database.cc37
-rw-r--r--paludis/package_database.hh18
-rw-r--r--paludis/package_database_TEST.cc36
-rw-r--r--paludis/portage_dep_lexer.cc5
-rw-r--r--paludis/portage_dep_parser.cc18
-rw-r--r--paludis/portage_dep_parser.hh29
-rw-r--r--paludis/qa/create_metadata_check.cc4
-rw-r--r--paludis/qa/dep_any_check.cc2
-rw-r--r--paludis/qa/dep_flags_check.cc6
-rw-r--r--paludis/qa/dep_packages_check.cc2
-rw-r--r--paludis/qa/deps_exist_check.cc2
-rw-r--r--paludis/qa/deps_visible_check.cc10
-rw-r--r--paludis/qa/description_check.cc4
-rw-r--r--paludis/qa/ebuild_check.hh14
-rw-r--r--paludis/qa/extract_check.cc2
-rw-r--r--paludis/qa/file_check.hh18
-rw-r--r--paludis/qa/homepage_check.cc4
-rw-r--r--paludis/qa/inherits_check.cc2
-rw-r--r--paludis/qa/iuse_check.cc2
-rw-r--r--paludis/qa/keywords_check.cc2
-rw-r--r--paludis/qa/license_check.cc7
-rw-r--r--paludis/qa/metadata_file.cc5
-rw-r--r--paludis/qa/package_dir_check.hh16
-rw-r--r--paludis/qa/parse_deps_check.cc2
-rw-r--r--paludis/qa/pdepend_overlap_check.cc2
-rw-r--r--paludis/qa/per_profile_ebuild_check.hh14
-rw-r--r--paludis/qa/profile_check.hh20
-rw-r--r--paludis/qa/profiles_check.hh18
-rw-r--r--paludis/qa/qa_environment.sr2
-rw-r--r--paludis/qa/restrict_check.cc2
-rw-r--r--paludis/qa/slot_check.cc4
-rw-r--r--paludis/qa/src_uri_check.cc4
-rw-r--r--paludis/repositories/cran/cran_dep_parser.cc6
-rw-r--r--paludis/repositories/cran/cran_dep_parser.hh2
-rw-r--r--paludis/repositories/cran/cran_description.hh2
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc67
-rw-r--r--paludis/repositories/cran/cran_installed_repository.hh18
-rw-r--r--paludis/repositories/cran/cran_repository.cc45
-rw-r--r--paludis/repositories/cran/cran_repository.hh16
-rw-r--r--paludis/repositories/cran/cran_repository_TEST.cc8
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc20
-rw-r--r--paludis/repositories/fake/fake_installed_repository.hh4
-rw-r--r--paludis/repositories/fake/fake_repository.cc10
-rw-r--r--paludis/repositories/fake/fake_repository.hh11
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc65
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh36
-rw-r--r--paludis/repositories/gems/cache.cc23
-rw-r--r--paludis/repositories/gems/cache.hh5
-rw-r--r--paludis/repositories/gems/cache.sr8
-rw-r--r--paludis/repositories/gems/gems_repository.cc37
-rw-r--r--paludis/repositories/gems/gems_repository.hh17
-rw-r--r--paludis/repositories/gems/gems_repository.sr2
-rw-r--r--paludis/repositories/gems/gems_repository_TEST.cc4
-rw-r--r--paludis/repositories/gems/make_gems_repository.cc6
-rw-r--r--paludis/repositories/gems/make_gems_repository.hh4
-rw-r--r--paludis/repositories/gems/yaml.cc45
-rw-r--r--paludis/repositories/gems/yaml.hh27
-rw-r--r--paludis/repositories/nothing/nothing_repository.cc25
-rw-r--r--paludis/repositories/nothing/nothing_repository.hh15
-rw-r--r--paludis/repositories/portage/ebuild_entries.cc29
-rw-r--r--paludis/repositories/portage/ebuild_entries.hh10
-rw-r--r--paludis/repositories/portage/ebuild_flat_metadata_cache.cc6
-rw-r--r--paludis/repositories/portage/ebuild_flat_metadata_cache.hh8
-rw-r--r--paludis/repositories/portage/eclass_mtimes.cc11
-rw-r--r--paludis/repositories/portage/eclass_mtimes.hh7
-rw-r--r--paludis/repositories/portage/glsa.cc18
-rw-r--r--paludis/repositories/portage/glsa.hh13
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.cc14
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.hh8
-rw-r--r--paludis/repositories/portage/portage_repository.cc112
-rw-r--r--paludis/repositories/portage/portage_repository.hh33
-rw-r--r--paludis/repositories/portage/portage_repository.sr2
-rw-r--r--paludis/repositories/portage/portage_repository_TEST.cc84
-rw-r--r--paludis/repositories/portage/portage_repository_entries.hh18
-rw-r--r--paludis/repositories/portage/portage_repository_news.cc10
-rw-r--r--paludis/repositories/portage/portage_repository_news.hh5
-rw-r--r--paludis/repositories/portage/portage_repository_params.sr4
-rw-r--r--paludis/repositories/portage/portage_repository_profile.cc35
-rw-r--r--paludis/repositories/portage/portage_repository_profile.hh9
-rw-r--r--paludis/repositories/portage/portage_repository_profile_file.cc5
-rw-r--r--paludis/repositories/portage/portage_repository_sets.cc41
-rw-r--r--paludis/repositories/portage/portage_repository_sets.hh11
-rw-r--r--paludis/repositories/portage/portage_virtual_version_metadata.hh3
-rw-r--r--paludis/repositories/portage/registration.cc4
-rw-r--r--paludis/repositories/portage/use_desc.cc5
-rw-r--r--paludis/repositories/portage/use_desc.hh4
-rw-r--r--paludis/repositories/portage/xml_things.cc14
-rw-r--r--paludis/repositories/portage/xml_things_TEST.cc6
-rw-r--r--paludis/repositories/repository_maker.cc3
-rw-r--r--paludis/repositories/repository_maker.hh8
-rw-r--r--paludis/repositories/vdb/vdb_repository.cc126
-rw-r--r--paludis/repositories/vdb/vdb_repository.hh35
-rw-r--r--paludis/repositories/vdb/vdb_repository_TEST.cc51
-rw-r--r--paludis/repositories/vdb/vdb_version_metadata.hh6
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc33
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.hh12
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc75
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.hh12
-rw-r--r--paludis/repositories/virtuals/vr_entry.hh6
-rw-r--r--paludis/repository.cc18
-rw-r--r--paludis/repository.hh66
-rw-r--r--paludis/repository.sr4
-rw-r--r--paludis/repository_name_cache.cc21
-rw-r--r--paludis/repository_name_cache.hh5
-rw-r--r--paludis/repository_name_cache_TEST.cc36
-rw-r--r--paludis/selinux/security_context.cc14
-rw-r--r--paludis/selinux/security_context.hh18
-rw-r--r--paludis/syncer.hh5
-rw-r--r--paludis/tasks/find_unused_packages_task.cc8
-rw-r--r--paludis/tasks/find_unused_packages_task.hh2
-rw-r--r--paludis/tasks/install_task.cc18
-rw-r--r--paludis/tasks/report_task.cc23
-rw-r--r--paludis/tasks/stage_builder_task.cc9
-rw-r--r--paludis/tasks/stage_builder_task.hh19
-rw-r--r--paludis/tasks/sync_task.cc7
-rw-r--r--paludis/tasks/uninstall_task.cc19
-rw-r--r--paludis/tasks/uninstall_task.hh6
-rw-r--r--paludis/util/collection.hh7
-rw-r--r--paludis/util/collection_concrete.hh12
-rw-r--r--paludis/util/counted_ptr.hh451
-rw-r--r--paludis/util/counted_ptr_TEST.cc358
-rw-r--r--paludis/util/dir_iterator.cc16
-rw-r--r--paludis/util/dir_iterator.hh3
-rw-r--r--paludis/util/files.m41
-rw-r--r--paludis/util/fs_entry.cc9
-rw-r--r--paludis/util/fs_entry.hh4
-rw-r--r--paludis/util/instantiation_policy.hh75
-rw-r--r--paludis/util/instantiation_policy_TEST.cc58
-rw-r--r--paludis/util/iterator_TEST.cc32
-rw-r--r--paludis/util/log.cc5
-rw-r--r--paludis/util/log.hh6
-rw-r--r--paludis/util/private_implementation_pattern.hh44
-rw-r--r--paludis/util/stringify.hh12
-rw-r--r--paludis/util/tokeniser.hh6
-rw-r--r--paludis/util/virtual_constructor_TEST.cc27
-rw-r--r--paludis/version_metadata.cc16
-rw-r--r--paludis/version_metadata.hh3
-rw-r--r--paludis/version_metadata.sr16
-rw-r--r--paludis/version_spec.cc8
-rw-r--r--ruby/check.cc96
-rw-r--r--ruby/contents.cc78
-rw-r--r--ruby/dep_atom.cc106
-rw-r--r--ruby/dep_list.cc50
-rw-r--r--ruby/package_database.cc38
-rw-r--r--ruby/paludis_ruby.cc9
-rw-r--r--ruby/paludis_ruby.hh36
-rw-r--r--ruby/repository.cc125
-rw-r--r--ruby/version_metadata.cc66
-rw-r--r--src/clients/adjutrix/command_line.hh6
-rw-r--r--src/clients/adjutrix/find_dropped_keywords.cc8
-rw-r--r--src/clients/adjutrix/find_insecure_packages.cc4
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc30
-rw-r--r--src/clients/adjutrix/find_stable_candidates.cc8
-rw-r--r--src/clients/adjutrix/find_unused_packages.cc6
-rw-r--r--src/clients/adjutrix/keywords_graph.cc14
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc4
-rw-r--r--src/clients/contrarius/command_line.hh4
-rw-r--r--src/clients/contrarius/contrarius.cc12
-rw-r--r--src/clients/contrarius/contrarius_stage_options.sr8
-rw-r--r--src/clients/contrarius/install.cc8
-rw-r--r--src/clients/contrarius/install.hh2
-rw-r--r--src/clients/contrarius/stage.cc4
-rw-r--r--src/clients/contrarius/stage_builder.cc10
-rw-r--r--src/clients/contrarius/stage_builder.hh10
-rw-r--r--src/clients/gtkpaludis/categories_list.cc9
-rw-r--r--src/clients/gtkpaludis/command_line.hh6
-rw-r--r--src/clients/gtkpaludis/install.cc5
-rw-r--r--src/clients/gtkpaludis/main_window.cc5
-rw-r--r--src/clients/gtkpaludis/main_window.hh6
-rw-r--r--src/clients/gtkpaludis/menu.cc5
-rw-r--r--src/clients/gtkpaludis/messages.cc5
-rw-r--r--src/clients/gtkpaludis/package_info.cc5
-rw-r--r--src/clients/gtkpaludis/package_overview.cc13
-rw-r--r--src/clients/gtkpaludis/packages_list.cc11
-rw-r--r--src/clients/gtkpaludis/packages_page.cc5
-rw-r--r--src/clients/gtkpaludis/paludis_thread.cc9
-rw-r--r--src/clients/gtkpaludis/paludis_thread.hh14
-rw-r--r--src/clients/gtkpaludis/queue_list.cc11
-rw-r--r--src/clients/gtkpaludis/queue_options.cc5
-rw-r--r--src/clients/gtkpaludis/queue_page.cc5
-rw-r--r--src/clients/gtkpaludis/repositories_list.cc7
-rw-r--r--src/clients/gtkpaludis/repositories_page.cc9
-rw-r--r--src/clients/gtkpaludis/repository_overview.cc9
-rw-r--r--src/clients/gtkpaludis/set_overview.cc9
-rw-r--r--src/clients/gtkpaludis/sets_list.cc11
-rw-r--r--src/clients/gtkpaludis/sets_page.cc5
-rw-r--r--src/clients/gtkpaludis/tasks_page.cc5
-rw-r--r--src/clients/gtkpaludis/vtemm/reaper.hg4
-rw-r--r--src/clients/paludis/applets.cc20
-rw-r--r--src/clients/paludis/command_line.hh4
-rw-r--r--src/clients/paludis/do_contents.cc56
-rw-r--r--src/clients/paludis/install.cc6
-rw-r--r--src/clients/paludis/list.cc72
-rw-r--r--src/clients/paludis/owner.cc40
-rw-r--r--src/clients/paludis/paludis.cc2
-rw-r--r--src/clients/paludis/query.cc18
-rw-r--r--src/clients/paludis/uninstall.cc4
-rw-r--r--src/clients/qualudis/qualudis_command_line.hh4
-rw-r--r--src/output/console_install_task.cc48
-rw-r--r--src/output/console_install_task.hh34
-rw-r--r--src/output/use_flag_pretty_printer.cc14
-rw-r--r--src/output/use_flag_pretty_printer.hh24
-rw-r--r--test/test_framework.cc8
252 files changed, 2146 insertions, 3417 deletions
diff --git a/configure.ac b/configure.ac
index 5dbba0c..59817e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -197,6 +197,21 @@ AC_DEFINE_UNQUOTED([HAVE_STD_HASHES], $have_std_hashes, [Do we have std:: hashes
AC_SUBST([HAVE_STD_HASHES])
dnl }}}
+dnl {{{ tr1 shared pointers
+AC_MSG_CHECKING([for std::tr1::shared_ptr<>])
+AC_COMPILE_IFELSE([
+#include <tr1/memory>
+int main(int, char *[])
+{
+ std::tr1::shared_ptr<int> x(new int(10));
+ return *x;
+}
+],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Your compiler doesn't support std::tr1])])
+dnl }}}
+
need_xml_check=
dnl {{{ we need libebt.
diff --git a/doc/doc_references.doxygen b/doc/doc_references.doxygen
index 2609f8d..3bc3e59 100644
--- a/doc/doc_references.doxygen
+++ b/doc/doc_references.doxygen
@@ -35,6 +35,10 @@ ISBN 0-201-89684-2
<strong>TCppSL</strong>: The C++ Standard Library / Nicolai M. Josuttis /
Addison-Wesley / ISBN 0-201-37926-0
+\anchor TCppSLE
+<strong>TCppSLE</strong>: The C++ Standard Library Extensions / Pete Becker /
+Addison-Wesley / ISBN 0-321-41299-0
+
\anchor TCppPL
<strong>TCppPL</strong>: The C++ Programming Language Third Edition / Bjarne
Stroustrup / Addison-Wesley / ISBN 0-201-88954-4
diff --git a/doc/examples/pwp_basic_cplusplus_app.cc b/doc/examples/pwp_basic_cplusplus_app.cc
index 98ada3e..3e25d7f 100644
--- a/doc/examples/pwp_basic_cplusplus_app.cc
+++ b/doc/examples/pwp_basic_cplusplus_app.cc
@@ -4,6 +4,7 @@
#include <paludis/environment/default/default_environment.hh>
#include <iostream>
+#include <tr1/memory>
#include <cstdlib>
using std::cout;
@@ -14,7 +15,7 @@ int main(int, char *[])
{
try
{
- paludis::PackageDatabaseEntryCollection::ConstPointer packages(
+ std::tr1::shared_ptr<const paludis::PackageDatabaseEntryCollection> packages(
paludis::DefaultEnvironment::get_instance()->package_database()->query(
paludis::PackageDepAtom("app-editors/vim"), paludis::is_installed_only, paludis::qo_order_by_version));
diff --git a/doc/programmingwithpaludis.html.skel b/doc/programmingwithpaludis.html.skel
index 7bc3ca7..eccd7f6 100644
--- a/doc/programmingwithpaludis.html.skel
+++ b/doc/programmingwithpaludis.html.skel
@@ -76,14 +76,8 @@ iterator range. This is slower, but much easier.</p>
<h3>Pointers</h3>
-<p>We have a reference-counted smart pointer template class,
-<code>paludis::CountedPtr</code>. It's
-used to avoid expensive copying and tricky memory management. Most classes that
-are suitable for being held by a smart pointer have member typedefs named
-<code>Pointer</code> and <code>ConstPointer</code>.</p>
-
-<p>We don't use <code>std::tr1::shared_ptr</code> because most of our target compilers don't have
-it yet. This is mildly annoying.</p>
+<p>We make extensive use of <code>std::tr1::shared_ptr</code>. Make sure you know how it
+works. See <a href="doc/html/References.html">TCppSLE</a>.</p>
<p>This is all hidden in the Ruby interface. You shouldn't have to care about
memory management.</p>
diff --git a/paludis/args/args_group.cc b/paludis/args/args_group.cc
index 45b6d74..eaa0eea 100644
--- a/paludis/args/args_group.cc
+++ b/paludis/args/args_group.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -36,8 +36,7 @@ namespace paludis
* \ingroup grplibpaludisargs
*/
template<>
- struct Implementation<ArgsGroup> :
- InternalCounted<ArgsGroup>
+ struct Implementation<ArgsGroup>
{
std::list<ArgsOption *> args_options;
};
diff --git a/paludis/args/args_handler.cc b/paludis/args/args_handler.cc
index 6e7f445..f1287c1 100644
--- a/paludis/args/args_handler.cc
+++ b/paludis/args/args_handler.cc
@@ -42,8 +42,7 @@ namespace paludis
* \ingroup grplibpaludisargs
*/
template<>
- struct Implementation<ArgsHandler> :
- InternalCounted<Implementation<ArgsHandler> >
+ struct Implementation<ArgsHandler>
{
std::list<ArgsGroup *> groups;
std::list<std::string> parameters;
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index 68de31c..6731f74 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -113,8 +113,7 @@ namespace paludis
* \ingroup grplibpaludisargs
*/
template<>
- struct Implementation<StringSetArg> :
- InternalCounted<Implementation<StringSetArg> >
+ struct Implementation<StringSetArg>
{
std::set<std::string> args;
std::vector<std::pair<std::string, std::string> > allowed_args;
@@ -126,8 +125,7 @@ namespace paludis
* \ingroup grplibpaludisargs
*/
template<>
- struct Implementation<StringSetArg::StringSetArgOptions> :
- InternalCounted<Implementation<StringSetArg::StringSetArgOptions> >
+ struct Implementation<StringSetArg::StringSetArgOptions>
{
std::vector<std::pair<std::string, std::string> > options;
};
@@ -197,8 +195,7 @@ namespace paludis
* \ingroup grplibpaludisargs
*/
template<>
- struct Implementation<EnumArg> :
- InternalCounted<Implementation<EnumArg> >
+ struct Implementation<EnumArg>
{
std::vector<std::pair<std::string, std::string> > allowed_args;
};
@@ -209,8 +206,7 @@ namespace paludis
* \ingroup grplibpaludisargs
*/
template<>
- struct Implementation<EnumArg::EnumArgOptions> :
- InternalCounted<Implementation<EnumArg::EnumArgOptions> >
+ struct Implementation<EnumArg::EnumArgOptions>
{
std::vector<std::pair<std::string, std::string> > options;
};
diff --git a/paludis/config_file.cc b/paludis/config_file.cc
index 6bf6785..7b60aa5 100644
--- a/paludis/config_file.cc
+++ b/paludis/config_file.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
* Copyright (c) 2006 Danny van Dyk <kugelfang@gentoo.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -163,8 +163,7 @@ namespace paludis
* \ingroup grplineconfigfile
*/
template<>
- struct Implementation<LineConfigFile> :
- InternalCounted<Implementation<LineConfigFile> >
+ struct Implementation<LineConfigFile>
{
mutable std::list<std::string> lines;
};
@@ -228,8 +227,7 @@ namespace paludis
* \ingroup grpkvconfigfile
*/
template <>
- struct Implementation<KeyValueConfigFile> :
- InternalCounted<Implementation<KeyValueConfigFile> >
+ struct Implementation<KeyValueConfigFile>
{
mutable std::map<std::string, std::string> entries;
mutable std::string accum;
@@ -259,7 +257,7 @@ KeyValueConfigFile::KeyValueConfigFile(const FSEntry & our_filename) :
}
KeyValueConfigFile::KeyValueConfigFile(std::istream * const s,
- AssociativeCollection<std::string, std::string>::ConstPointer m) :
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m) :
ConfigFile(s),
PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
@@ -268,7 +266,7 @@ KeyValueConfigFile::KeyValueConfigFile(std::istream * const s,
}
KeyValueConfigFile::KeyValueConfigFile(const std::string & our_filename,
- AssociativeCollection<std::string, std::string>::ConstPointer m) :
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m) :
ConfigFile(our_filename),
PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
@@ -277,7 +275,7 @@ KeyValueConfigFile::KeyValueConfigFile(const std::string & our_filename,
}
KeyValueConfigFile::KeyValueConfigFile(const FSEntry & our_filename,
- AssociativeCollection<std::string, std::string>::ConstPointer m) :
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m):
ConfigFile(our_filename),
PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
diff --git a/paludis/config_file.hh b/paludis/config_file.hh
index 6e95fc8..73cc2e0 100644
--- a/paludis/config_file.hh
+++ b/paludis/config_file.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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 <iosfwd>
#include <string>
+#include <tr1/memory>
/** \file
* Declarations for the ConfigFile classes.
@@ -269,19 +270,19 @@ namespace paludis
* Constructor, from a stream, with defaults.
*/
KeyValueConfigFile(std::istream * const,
- AssociativeCollection<std::string, std::string>::ConstPointer);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >);
/**
* Constructor, from a filename, with defaults.
*/
KeyValueConfigFile(const std::string & filename,
- AssociativeCollection<std::string, std::string>::ConstPointer);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >);
/**
* Constructor, from a filename, with defaults.
*/
KeyValueConfigFile(const FSEntry & filename,
- AssociativeCollection<std::string, std::string>::ConstPointer);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >);
~KeyValueConfigFile();
diff --git a/paludis/config_file_TEST.cc b/paludis/config_file_TEST.cc
index ffaa09e..c921f8b 100644
--- a/paludis/config_file_TEST.cc
+++ b/paludis/config_file_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -248,7 +248,7 @@ namespace test_cases
TEST_CHECK_EQUAL(ff.get("z"), "foofoo\\$");
std::stringstream t;
- AssociativeCollection<std::string, std::string>::Pointer t_defs(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > t_defs(
new AssociativeCollection<std::string, std::string>::Concrete);
t_defs->insert("a", "moo");
t_defs->insert("d", "bar");
diff --git a/paludis/contents.cc b/paludis/contents.cc
index b643238..b271fd3 100644
--- a/paludis/contents.cc
+++ b/paludis/contents.cc
@@ -71,10 +71,9 @@ namespace paludis
* \ingroup grpcontents
*/
template<>
- struct Implementation<Contents> :
- InternalCounted<Implementation<Contents> >
+ struct Implementation<Contents>
{
- std::list<ContentsEntry::ConstPointer> c;
+ std::list<std::tr1::shared_ptr<const ContentsEntry> > c;
};
}
@@ -88,7 +87,7 @@ Contents::~Contents()
}
void
-Contents::add(ContentsEntry::ConstPointer c)
+Contents::add(std::tr1::shared_ptr<const ContentsEntry> c)
{
_imp->c.push_back(c);
}
diff --git a/paludis/contents.hh b/paludis/contents.hh
index dab5794..8e8040b 100644
--- a/paludis/contents.hh
+++ b/paludis/contents.hh
@@ -21,10 +21,10 @@
#define PALUDIS_GUARD_PALUDIS_CONTENTS_HH 1
#include <paludis/util/visitor.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <string>
+#include <tr1/memory>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -60,7 +60,6 @@ namespace paludis
*/
class ContentsEntry :
private InstantiationPolicy<ContentsEntry, instantiation_method::NonCopyableTag>,
- public InternalCounted<ContentsEntry>,
public virtual VisitableInterface<ContentsVisitorTypes>
{
private:
@@ -109,10 +108,6 @@ namespace paludis
ContentsFileEntry(const std::string & name);
///\}
-
- typedef CountedPtr<ContentsFileEntry, count_policy::InternalCountTag> Pointer;
-
- typedef CountedPtr<const ContentsFileEntry, count_policy::InternalCountTag> ConstPointer;
};
/**
@@ -132,10 +127,6 @@ namespace paludis
ContentsDirEntry(const std::string & name);
///\}
-
- typedef CountedPtr<ContentsDirEntry, count_policy::InternalCountTag> Pointer;
-
- typedef CountedPtr<const ContentsDirEntry, count_policy::InternalCountTag> ConstPointer;
};
/**
@@ -155,10 +146,6 @@ namespace paludis
ContentsMiscEntry(const std::string & name);
///\}
-
- typedef CountedPtr<ContentsMiscEntry, count_policy::InternalCountTag> Pointer;
-
- typedef CountedPtr<const ContentsMiscEntry, count_policy::InternalCountTag> ConstPointer;
};
/**
@@ -178,10 +165,6 @@ namespace paludis
ContentsFifoEntry(const std::string & name);
///\}
-
- typedef CountedPtr<ContentsFifoEntry, count_policy::InternalCountTag> Pointer;
-
- typedef CountedPtr<const ContentsFifoEntry, count_policy::InternalCountTag> ConstPointer;
};
/**
@@ -201,10 +184,6 @@ namespace paludis
ContentsDevEntry(const std::string & name);
///\}
-
- typedef CountedPtr<ContentsDevEntry, count_policy::InternalCountTag> Pointer;
-
- typedef CountedPtr<const ContentsDevEntry, count_policy::InternalCountTag> ConstPointer;
};
/**
@@ -233,10 +212,6 @@ namespace paludis
{
return _target;
}
-
- typedef CountedPtr<ContentsSymEntry, count_policy::InternalCountTag> Pointer;
-
- typedef CountedPtr<const ContentsSymEntry, count_policy::InternalCountTag> ConstPointer;
};
/**
@@ -247,8 +222,7 @@ namespace paludis
*/
class Contents :
private InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>,
- private PrivateImplementationPattern<Contents>,
- public InternalCounted<Contents>
+ private PrivateImplementationPattern<Contents>
{
public:
///\name Basic operations
@@ -260,12 +234,12 @@ namespace paludis
///\}
/// Add a new entry.
- void add(ContentsEntry::ConstPointer c);
+ void add(std::tr1::shared_ptr<const ContentsEntry> c);
///\name Iterate over our entries
///\{
- typedef libwrapiter::ForwardIterator<Contents, const ContentsEntry::ConstPointer> Iterator;
+ typedef libwrapiter::ForwardIterator<Contents, const std::tr1::shared_ptr<const ContentsEntry> > Iterator;
Iterator begin() const;
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index b6e641a..dd3941f 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -60,10 +60,9 @@ namespace paludis
* \ingroup grpdepatoms
*/
template<>
- struct Implementation<CompositeDepAtom> :
- InternalCounted<Implementation<CompositeDepAtom> >
+ struct Implementation<CompositeDepAtom>
{
- std::list<DepAtom::ConstPointer> children;
+ std::list<std::tr1::shared_ptr<const DepAtom> > children;
};
}
@@ -77,7 +76,7 @@ CompositeDepAtom::~CompositeDepAtom()
}
void
-CompositeDepAtom::add_child(DepAtom::ConstPointer c)
+CompositeDepAtom::add_child(std::tr1::shared_ptr<const DepAtom> c)
{
_imp->children.push_back(c);
}
@@ -120,7 +119,7 @@ PackageDepAtom::as_package_dep_atom() const
return this;
}
-BlockDepAtom::BlockDepAtom(PackageDepAtom::ConstPointer a) :
+BlockDepAtom::BlockDepAtom(std::tr1::shared_ptr<const PackageDepAtom> a) :
StringDepAtom("!" + a->text()),
_atom(a)
{
@@ -129,12 +128,7 @@ BlockDepAtom::BlockDepAtom(PackageDepAtom::ConstPointer a) :
PackageDepAtom::PackageDepAtom(const QualifiedPackageName & our_package) :
StringDepAtom(stringify(our_package)),
_package(our_package),
- _version_requirements(0),
- _version_requirements_mode(vr_and),
- _slot(0),
- _repository(0),
- _use_requirements(0),
- _tag(0)
+ _version_requirements_mode(vr_and)
{
}
@@ -157,12 +151,7 @@ PackageDepAtom::PackageDepAtom(const PackageDepAtom & other) :
PackageDepAtom::PackageDepAtom(const std::string & ss) :
StringDepAtom(ss),
_package(CategoryNamePart("later"), PackageNamePart("later")),
- _version_requirements(0),
- _version_requirements_mode(vr_and),
- _slot(0),
- _repository(0),
- _use_requirements(0),
- _tag(0)
+ _version_requirements_mode(vr_and)
{
Context context("When parsing package dep atom '" + ss + "':");
@@ -193,7 +182,7 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
}
UseFlagName name(flag);
if (0 == _use_requirements)
- _use_requirements.assign(new UseRequirements);
+ _use_requirements.reset(new UseRequirements);
if (! _use_requirements->insert(name, state))
throw PackageDepAtomError("Conflicting [] contents");
@@ -203,14 +192,14 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
std::string::size_type repo_p;
if (std::string::npos != ((repo_p = s.rfind("::"))))
{
- _repository.assign(new RepositoryName(s.substr(repo_p + 2)));
+ _repository.reset(new RepositoryName(s.substr(repo_p + 2)));
s.erase(repo_p);
}
std::string::size_type slot_p;
if (std::string::npos != ((slot_p = s.rfind(':'))))
{
- _slot.assign(new SlotName(s.substr(slot_p + 1)));
+ _slot.reset(new SlotName(s.substr(slot_p + 1)));
s.erase(slot_p);
}
@@ -248,7 +237,7 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
_package = QualifiedPackageName(s.substr(p, q - p - 1));
- _version_requirements.assign(new VersionRequirements::Concrete);
+ _version_requirements.reset(new VersionRequirements::Concrete);
if ('*' == s.at(s.length() - 1))
{
@@ -393,8 +382,7 @@ namespace paludis
* \ingroup grpdepatoms
*/
template<>
- struct Implementation<UseRequirements> :
- InternalCounted<Implementation<UseRequirements> >
+ struct Implementation<UseRequirements>
{
std::map<UseFlagName, UseFlagState> reqs;
};
@@ -442,12 +430,12 @@ UseRequirements::state(const UseFlagName & u) const
return i->second;
}
-PackageDepAtom::Pointer
+std::tr1::shared_ptr<PackageDepAtom>
PackageDepAtom::without_use_requirements() const
{
std::string s(text());
if (std::string::npos != s.find('['))
s.erase(s.find('['));
- return Pointer(new PackageDepAtom(s));
+ return std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom(s));
}
diff --git a/paludis/dep_atom.hh b/paludis/dep_atom.hh
index eadae34..d58a364 100644
--- a/paludis/dep_atom.hh
+++ b/paludis/dep_atom.hh
@@ -23,7 +23,6 @@
#include <paludis/dep_tag.hh>
#include <paludis/name.hh>
#include <paludis/util/attributes.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/visitor.hh>
#include <paludis/version_requirements.hh>
@@ -32,6 +31,8 @@
#include <libwrapiter/libwrapiter_forward_iterator.hh>
+#include <tr1/memory>
+
/** \file
* Declarations for the DepAtom classes.
*
@@ -65,8 +66,7 @@ namespace paludis
*/
class DepAtom :
public virtual VisitableInterface<DepAtomVisitorTypes>,
- private InstantiationPolicy<DepAtom, instantiation_method::NonCopyableTag>,
- public InternalCounted<DepAtom>
+ private InstantiationPolicy<DepAtom, instantiation_method::NonCopyableTag>
{
protected:
DepAtom();
@@ -130,24 +130,19 @@ namespace paludis
/**
* Append a child to our collection.
*/
- virtual void add_child(DepAtom::ConstPointer);
+ virtual void add_child(std::tr1::shared_ptr<const DepAtom>);
///\}
///\name Iterate over our children
///\{
- typedef libwrapiter::ForwardIterator<CompositeDepAtom, const DepAtom::ConstPointer> Iterator;
+ typedef libwrapiter::ForwardIterator<CompositeDepAtom, const std::tr1::shared_ptr<const DepAtom> > Iterator;
Iterator begin() const;
Iterator end() const;
- ///\name Pointer types
- ///\{
- typedef CountedPtr<CompositeDepAtom, count_policy::InternalCountTag> Pointer;
-
- typedef CountedPtr<const CompositeDepAtom, count_policy::InternalCountTag> ConstPointer;
///\}
};
@@ -229,16 +224,6 @@ namespace paludis
}
virtual const UseDepAtom * as_use_dep_atom() const;
-
- /**
- * A non-constant smart pointer to ourself.
- */
- typedef CountedPtr<UseDepAtom, count_policy::InternalCountTag> Pointer;
-
- /**
- * A constant smart pointer to ourself.
- */
- typedef CountedPtr<const UseDepAtom, count_policy::InternalCountTag> ConstPointer;
};
/**
@@ -281,7 +266,6 @@ namespace paludis
* \nosubgrouping
*/
class UseRequirements :
- public InternalCounted<UseRequirements>,
private PrivateImplementationPattern<UseRequirements>
{
public:
@@ -328,12 +312,12 @@ namespace paludis
{
private:
QualifiedPackageName _package;
- VersionRequirements::Pointer _version_requirements;
+ std::tr1::shared_ptr<VersionRequirements> _version_requirements;
VersionRequirementsMode _version_requirements_mode;
- CountedPtr<SlotName, count_policy::ExternalCountTag> _slot;
- CountedPtr<RepositoryName, count_policy::ExternalCountTag> _repository;
- UseRequirements::Pointer _use_requirements;
- DepTag::ConstPointer _tag;
+ std::tr1::shared_ptr<SlotName> _slot;
+ std::tr1::shared_ptr<RepositoryName> _repository;
+ std::tr1::shared_ptr<UseRequirements> _use_requirements;
+ std::tr1::shared_ptr<const DepTag> _tag;
const PackageDepAtom & operator= (const PackageDepAtom &);
@@ -371,7 +355,7 @@ namespace paludis
/**
* Fetch the version requirements (may be a zero pointer).
*/
- VersionRequirements::ConstPointer version_requirements_ptr() const
+ std::tr1::shared_ptr<const VersionRequirements> version_requirements_ptr() const
{
return _version_requirements;
}
@@ -379,7 +363,7 @@ namespace paludis
/**
* Fetch the version requirements (may be a zero pointer).
*/
- VersionRequirements::Pointer version_requirements_ptr()
+ std::tr1::shared_ptr<VersionRequirements> version_requirements_ptr()
{
return _version_requirements;
}
@@ -403,7 +387,7 @@ namespace paludis
/**
* Fetch the slot name (may be a zero pointer).
*/
- CountedPtr<SlotName, count_policy::ExternalCountTag> slot_ptr() const
+ std::tr1::shared_ptr<const SlotName> slot_ptr() const
{
return _slot;
}
@@ -411,7 +395,7 @@ namespace paludis
/**
* Fetch the repo name (may be a zero pointer).
*/
- CountedPtr<RepositoryName, count_policy::ExternalCountTag> repository_ptr() const
+ std::tr1::shared_ptr<const RepositoryName> repository_ptr() const
{
return _repository;
}
@@ -419,30 +403,15 @@ namespace paludis
/**
* Fetch the use requirements (may be a zero pointer).
*/
- UseRequirements::ConstPointer use_requirements_ptr() const
+ std::tr1::shared_ptr<const UseRequirements> use_requirements_ptr() const
{
return _use_requirements;
}
- ///\name Pointer types
- ///\{
-
- /**
- * A non-constant smart pointer to ourself.
- */
- typedef CountedPtr<PackageDepAtom, count_policy::InternalCountTag> Pointer;
-
- /**
- * A constant smart pointer to ourself.
- */
- typedef CountedPtr<const PackageDepAtom, count_policy::InternalCountTag> ConstPointer;
-
- ///\}
-
/**
* Fetch our tag.
*/
- DepTag::ConstPointer tag() const
+ std::tr1::shared_ptr<const DepTag> tag() const
{
return _tag;
}
@@ -450,7 +419,7 @@ namespace paludis
/**
* Set our tag.
*/
- void set_tag(const DepTag::ConstPointer & s)
+ void set_tag(const std::tr1::shared_ptr<const DepTag> & s)
{
_tag = s;
}
@@ -458,7 +427,7 @@ namespace paludis
/**
* Fetch a copy of ourself without the USE requirements.
*/
- Pointer without_use_requirements() const;
+ std::tr1::shared_ptr<PackageDepAtom> without_use_requirements() const;
virtual const PackageDepAtom * as_package_dep_atom() const;
};
@@ -481,21 +450,6 @@ namespace paludis
PlainTextDepAtom(const std::string &);
///\}
-
- ///\name Pointer types
- ///\{
-
- /**
- * A non-constant smart pointer to ourself.
- */
- typedef CountedPtr<PlainTextDepAtom, count_policy::InternalCountTag> Pointer;
-
- /**
- * A constant smart pointer to ourself.
- */
- typedef CountedPtr<const PlainTextDepAtom, count_policy::InternalCountTag> ConstPointer;
-
- ///\}
};
/**
@@ -544,7 +498,7 @@ namespace paludis
public Visitable<BlockDepAtom, DepAtomVisitorTypes>
{
private:
- PackageDepAtom::ConstPointer _atom;
+ std::tr1::shared_ptr<const PackageDepAtom> _atom;
public:
///\name Basic operations
@@ -553,32 +507,17 @@ namespace paludis
/**
* Constructor, with blocking atom.
*/
- BlockDepAtom(PackageDepAtom::ConstPointer atom);
+ BlockDepAtom(std::tr1::shared_ptr<const PackageDepAtom> atom);
///\}
/**
* Fetch the atom we're blocking.
*/
- PackageDepAtom::ConstPointer blocked_atom() const
+ std::tr1::shared_ptr<const PackageDepAtom> blocked_atom() const
{
return _atom;
}
-
- ///\name Pointer operations
- ///\{
-
- /**
- * A non-constant smart pointer to ourself.
- */
- typedef CountedPtr<BlockDepAtom, count_policy::InternalCountTag> Pointer;
-
- /**
- * A constant smart pointer to ourself.
- */
- typedef CountedPtr<const BlockDepAtom, count_policy::InternalCountTag> ConstPointer;
-
- ///\}
};
}
diff --git a/paludis/dep_atom_TEST.cc b/paludis/dep_atom_TEST.cc
index 27fd571..72d43f2 100644
--- a/paludis/dep_atom_TEST.cc
+++ b/paludis/dep_atom_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,12 +41,12 @@ namespace test_cases
void run()
{
- PackageDepAtom::Pointer x(new PackageDepAtom("foo/bar"));
+ std::tr1::shared_ptr<PackageDepAtom> x(new PackageDepAtom("foo/bar"));
TEST_CHECK(0 == x->as_use_dep_atom());
- UseDepAtom::Pointer y(new UseDepAtom(UseFlagName("foo"), x));
+ std::tr1::shared_ptr<UseDepAtom> y(new UseDepAtom(UseFlagName("foo"), x));
TEST_CHECK(0 != y->as_use_dep_atom());
- TEST_CHECK(y.raw_pointer() == y->as_use_dep_atom());
+ TEST_CHECK(y.get() == y->as_use_dep_atom());
}
} test_dep_atom_as;
@@ -60,14 +60,14 @@ namespace test_cases
void run()
{
- AllDepAtom::Pointer x(new AllDepAtom);
+ std::tr1::shared_ptr<AllDepAtom> x(new AllDepAtom);
TEST_CHECK(x->begin() == x->end());
- x->add_child(PackageDepAtom::Pointer(new PackageDepAtom("x/y")));
+ x->add_child(std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom("x/y")));
TEST_CHECK(x->begin() != x->end());
TEST_CHECK_EQUAL(1, std::distance(x->begin(), x->end()));
- x->add_child(PackageDepAtom::Pointer(new PackageDepAtom("x/y")));
+ x->add_child(std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom("x/y")));
TEST_CHECK(x->begin() != x->end());
TEST_CHECK_EQUAL(2, std::distance(x->begin(), x->end()));
}
diff --git a/paludis/dep_atom_flattener.cc b/paludis/dep_atom_flattener.cc
index 6b01eb7..6cd0218 100644
--- a/paludis/dep_atom_flattener.cc
+++ b/paludis/dep_atom_flattener.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,14 +37,13 @@ namespace paludis
* \ingroup grpdepatomflattener
*/
template<>
- struct Implementation<DepAtomFlattener> :
- InternalCounted<Implementation<DepAtomFlattener> >
+ struct Implementation<DepAtomFlattener>
{
const Environment * const env;
const PackageDatabaseEntry * const pkg;
- DepAtom::ConstPointer a;
+ std::tr1::shared_ptr<const DepAtom> a;
mutable std::list<const StringDepAtom *> atoms;
@@ -52,7 +51,7 @@ namespace paludis
Implementation(const Environment * const e,
const PackageDatabaseEntry * const p,
- DepAtom::ConstPointer aa) :
+ std::tr1::shared_ptr<const DepAtom> aa) :
env(e),
pkg(p),
a(aa),
@@ -65,7 +64,7 @@ namespace paludis
DepAtomFlattener::DepAtomFlattener(
const Environment * const env,
const PackageDatabaseEntry * const pkg,
- DepAtom::ConstPointer a) :
+ std::tr1::shared_ptr<const DepAtom> a) :
PrivateImplementationPattern<DepAtomFlattener>(new Implementation<DepAtomFlattener>(
env, pkg, a))
{
diff --git a/paludis/dep_atom_flattener.hh b/paludis/dep_atom_flattener.hh
index b0bc0c0..32d0769 100644
--- a/paludis/dep_atom_flattener.hh
+++ b/paludis/dep_atom_flattener.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -68,7 +68,7 @@ namespace paludis
DepAtomFlattener(const Environment * const,
const PackageDatabaseEntry * const,
- const DepAtom::ConstPointer);
+ const std::tr1::shared_ptr<const DepAtom>);
~DepAtomFlattener();
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 2215866..c267d72 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -72,11 +72,10 @@ namespace paludis
typedef MakeHashedMultiMap<QualifiedPackageName, MergeList::iterator>::Type MergeListIndex;
template<>
- struct Implementation<DepList> :
- InternalCounted<Implementation<DepList> >
+ struct Implementation<DepList>
{
const Environment * const env;
- CountedPtr<DepListOptions, count_policy::ExternalCountTag> opts;
+ std::tr1::shared_ptr<DepListOptions> opts;
MergeList merge_list;
MergeList::const_iterator current_merge_list_entry;
@@ -85,7 +84,7 @@ namespace paludis
MergeListIndex merge_list_index;
- DepAtom::ConstPointer current_top_level_target;
+ std::tr1::shared_ptr<const DepAtom> current_top_level_target;
bool throw_on_blocker;
@@ -102,7 +101,6 @@ namespace paludis
current_merge_list_entry(merge_list.end()),
merge_list_insert_position(merge_list.end()),
merge_list_generation(0),
- current_top_level_target(0),
throw_on_blocker(o.blocks == dl_blocks_error)
{
}
@@ -161,7 +159,7 @@ namespace
/* see EffSTL 9 for why this is so painful */
if (e.tags->empty())
return;
- DepListEntryTags::Pointer t(new DepListEntryTags::Concrete);
+ std::tr1::shared_ptr<DepListEntryTags> t(new DepListEntryTags::Concrete);
GenerationGreaterThan pred(g);
for (DepListEntryTags::Iterator i(e.tags->begin()), i_end(e.tags->end()) ;
i != i_end ; ++i)
@@ -246,7 +244,7 @@ namespace
case dlk_provided:
case dlk_already_installed:
case dlk_subpackage:
- return match_package(env, a, e.second->package);
+ return match_package(*env, *a, e.second->package);
case dlk_block:
case dlk_masked:
@@ -272,7 +270,7 @@ namespace
{
}
- bool operator() (PackageDepAtom::ConstPointer atom)
+ bool operator() (std::tr1::shared_ptr<const DepAtom> atom)
{
const UseDepAtom * const u(atom->as_use_dep_atom());
if (0 != u)
@@ -291,7 +289,7 @@ namespace
{
}
- bool operator() (PackageDepAtom::ConstPointer atom)
+ bool operator() (std::tr1::shared_ptr<const DepAtom> atom)
{
const PackageDepAtom * const u(atom->as_package_dep_atom());
if (0 != u)
@@ -340,14 +338,14 @@ DepList::QueryVisitor::visit(const PackageDepAtom * const a)
result = false;
- PackageDatabaseEntryCollection::ConstPointer matches(d->_imp->env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> matches(d->_imp->env->package_database()->query(
*a, is_installed_only, qo_whatever));
for (PackageDatabaseEntryCollection::Iterator m(matches->begin()), m_end(matches->end()) ;
m != m_end ; ++m)
{
/* check that we haven't been replaced by something in the same slot */
- VersionMetadata::ConstPointer vm(d->_imp->env->package_database()->fetch_repository(m->repository)->
+ std::tr1::shared_ptr<const VersionMetadata> vm(d->_imp->env->package_database()->fetch_repository(m->repository)->
version_metadata(m->name, m->version));
SlotName slot(vm->slot);
@@ -410,7 +408,7 @@ void
DepList::QueryVisitor::visit(const AnyDepAtom * const a)
{
/* empty || ( ) must resolve to true */
- std::list<DepAtom::ConstPointer> viable_children;
+ std::list<std::tr1::shared_ptr<const DepAtom> > viable_children;
std::copy(a->begin(), a->end(), filter_inserter(std::back_inserter(viable_children),
IsViableAnyDepAtomChild(d->_imp->env, d->_imp->current_pde())));
@@ -423,7 +421,7 @@ DepList::QueryVisitor::visit(const AnyDepAtom * const a)
}
result = true;
- for (std::list<DepAtom::ConstPointer>::const_iterator c(viable_children.begin()),
+ for (std::list<std::tr1::shared_ptr<const DepAtom> >::const_iterator c(viable_children.begin()),
c_end(viable_children.end()) ; c != c_end ; ++c)
{
(*c)->accept(this);
@@ -481,7 +479,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
Context context("When adding PackageDepAtom '" + stringify(*a) + "':");
/* find already installed things */
- PackageDatabaseEntryCollection::ConstPointer already_installed(d->_imp->env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> already_installed(d->_imp->env->package_database()->query(
*a, is_installed_only, qo_order_by_version));
/* are we already on the merge list? */
@@ -501,7 +499,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
if (d->_imp->opts->dependency_tags && d->_imp->current_pde())
existing_merge_list_entry->tags->insert(DepTagEntry::create()
- .tag(DepTag::Pointer(new DependencyDepTag(*d->_imp->current_pde())))
+ .tag(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*d->_imp->current_pde())))
.generation(d->_imp->merge_list_generation));
/* have our deps been merged already, or is this a circular dep? */
@@ -530,7 +528,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
/* find installable candidates, and find the best visible candidate */
const PackageDatabaseEntry * best_visible_candidate(0);
- PackageDatabaseEntryCollection::ConstPointer installable_candidates(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> installable_candidates(
d->_imp->env->package_database()->query(*a, is_installable_only, qo_order_by_version));
for (PackageDatabaseEntryCollection::ReverseIterator p(installable_candidates->rbegin()),
@@ -631,7 +629,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
if (! a->use_requirements_ptr())
throw AllMaskedError(stringify(*a));
- PackageDatabaseEntryCollection::ConstPointer match_except_reqs(d->_imp->env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> match_except_reqs(d->_imp->env->package_database()->query(
*a->without_use_requirements(), is_any, qo_whatever));
for (PackageDatabaseEntryCollection::Iterator i(match_except_reqs->begin()),
@@ -653,7 +651,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
SlotName slot(d->_imp->env->package_database()->fetch_repository(best_visible_candidate->repository)->
version_metadata(best_visible_candidate->name, best_visible_candidate->version)->slot);
- PackageDatabaseEntryCollection::Pointer already_installed_in_same_slot(
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> already_installed_in_same_slot(
new PackageDatabaseEntryCollection::Concrete);
for (PackageDatabaseEntryCollection::Iterator aa(already_installed->begin()),
aa_end(already_installed->end()) ; aa != aa_end ; ++aa)
@@ -707,7 +705,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
case dl_downgrade_error:
case dl_downgrade_warning:
{
- PackageDatabaseEntryCollection::Pointer are_we_downgrading(
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> are_we_downgrading(
d->_imp->env->package_database()->query(PackageDepAtom(
stringify(a->package()) + ":" + stringify(slot)),
is_installed_only, qo_order_by_version));
@@ -744,7 +742,7 @@ DepList::AddVisitor::visit(const UseDepAtom * const a)
}
else
{
- RepositoryUseInterface * u;
+ RepositoryUseInterface * u(0);
if ((! d->_imp->current_pde()) || (! ((u = d->_imp->env->package_database()->fetch_repository(
d->_imp->current_pde()->repository)->use_interface))))
std::for_each(a->begin(), a->end(), accept_visitor(this));
@@ -765,7 +763,7 @@ void
DepList::AddVisitor::visit(const AnyDepAtom * const a)
{
/* annoying requirement: || ( foo? ( ... ) ) resolves to empty if !foo. */
- std::list<DepAtom::ConstPointer> viable_children;
+ std::list<std::tr1::shared_ptr<const DepAtom> > viable_children;
std::copy(a->begin(), a->end(), filter_inserter(std::back_inserter(viable_children),
IsViableAnyDepAtomChild(d->_imp->env, d->_imp->current_pde())));
@@ -782,7 +780,7 @@ DepList::AddVisitor::visit(const AnyDepAtom * const a)
/* see if any of our children is already installed. if any is, add it so that
* any upgrades kick in */
- for (std::list<DepAtom::ConstPointer>::const_iterator c(viable_children.begin()),
+ for (std::list<std::tr1::shared_ptr<const DepAtom> >::const_iterator c(viable_children.begin()),
c_end(viable_children.end()) ; c != c_end ; ++c)
{
if (d->already_installed(**c))
@@ -794,11 +792,11 @@ DepList::AddVisitor::visit(const AnyDepAtom * const a)
/* if we have something like || ( a >=b-2 ) and b-1 is installed, try to go for
* the b-2 bit first */
- std::list<DepAtom::ConstPointer> pda_children;
+ std::list<std::tr1::shared_ptr<const DepAtom> > pda_children;
std::copy(viable_children.begin(), viable_children.end(),
filter_inserter(std::back_inserter(pda_children), IsInterestingPDADepAtomChild(d->_imp->env)));
- for (std::list<DepAtom::ConstPointer>::const_iterator c(pda_children.begin()),
+ for (std::list<std::tr1::shared_ptr<const DepAtom> >::const_iterator c(pda_children.begin()),
c_end(pda_children.end()) ; c != c_end ; ++c)
{
try
@@ -814,7 +812,7 @@ DepList::AddVisitor::visit(const AnyDepAtom * const a)
}
/* install first available viable option */
- for (std::list<DepAtom::ConstPointer>::const_iterator c(viable_children.begin()),
+ for (std::list<std::tr1::shared_ptr<const DepAtom> >::const_iterator c(viable_children.begin()),
c_end(viable_children.end()) ; c != c_end ; ++c)
{
try
@@ -845,7 +843,7 @@ DepList::AddVisitor::visit(const BlockDepAtom * const a)
Context context("When checking BlockDepAtom '!" + stringify(*a->blocked_atom()) + "':");
PackageDepAtom just_package(a->blocked_atom()->package());
- PackageDatabaseEntryCollection::ConstPointer already_installed(d->_imp->env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> already_installed(d->_imp->env->package_database()->query(
just_package, is_installed_only, qo_whatever));
std::list<MergeList::const_iterator> will_be_installed;
@@ -873,10 +871,10 @@ DepList::AddVisitor::visit(const BlockDepAtom * const a)
for (PackageDatabaseEntryCollection::Iterator aa(already_installed->begin()),
aa_end(already_installed->end()) ; aa != aa_end ; ++aa)
{
- if (! match_package(d->_imp->env, *a->blocked_atom(), *aa))
+ if (! match_package(*d->_imp->env, *a->blocked_atom(), *aa))
continue;
- VersionMetadata::ConstPointer metadata(d->_imp->env->package_database()->fetch_repository(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(d->_imp->env->package_database()->fetch_repository(
aa->repository)->version_metadata(aa->name, aa->version));
bool replaced(false);
for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()),
@@ -932,7 +930,7 @@ DepList::AddVisitor::visit(const BlockDepAtom * const a)
for (std::list<MergeList::const_iterator>::const_iterator r(will_be_installed.begin()),
r_end(will_be_installed.end()) ; r != r_end ; ++r)
{
- if (! match_package(d->_imp->env, *a->blocked_atom(), (*r)->package))
+ if (! match_package(*d->_imp->env, *a->blocked_atom(), (*r)->package))
continue;
/* ignore if it's a virtual/blah (not <virtual/blah-1) block and it's blocking
@@ -996,7 +994,7 @@ DepList::ShowSuggestVisitor::visit(const PackageDepAtom * const a)
{
Context context("When adding suggested dep '" + stringify(*a) + "':");
- PackageDatabaseEntryCollection::ConstPointer matches(d->_imp->env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> matches(d->_imp->env->package_database()->query(
*a, is_installable_only, qo_order_by_version));
if (matches->empty())
{
@@ -1026,7 +1024,7 @@ DepList::~DepList()
{
}
-CountedPtr<DepListOptions, count_policy::ExternalCountTag>
+std::tr1::shared_ptr<DepListOptions>
DepList::options()
{
return _imp->opts;
@@ -1036,22 +1034,22 @@ void
DepList::clear()
{
DepListOptions o(*options());
- _imp.assign(new Implementation<DepList>(_imp->env, o));
+ _imp.reset(new Implementation<DepList>(_imp->env, o));
}
void
-DepList::add_in_role(DepAtom::ConstPointer atom, const std::string & role)
+DepList::add_in_role(std::tr1::shared_ptr<const DepAtom> atom, const std::string & role)
{
Context context("When adding " + role + ":");
add(atom);
}
void
-DepList::add(DepAtom::ConstPointer atom)
+DepList::add(std::tr1::shared_ptr<const DepAtom> atom)
{
DepListTransaction transaction(_imp->merge_list, _imp->merge_list_index, _imp->merge_list_generation);
- Save<DepAtom::ConstPointer> save_current_top_level_target(&_imp->current_top_level_target,
+ Save<std::tr1::shared_ptr<const DepAtom> > save_current_top_level_target(&_imp->current_top_level_target,
_imp->current_top_level_target ? _imp->current_top_level_target : atom);
AddVisitor visitor(this);
@@ -1060,13 +1058,13 @@ DepList::add(DepAtom::ConstPointer atom)
}
void
-DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
+DepList::add_package(const PackageDatabaseEntry & p, std::tr1::shared_ptr<const DepTag> tag)
{
Context context("When adding package '" + stringify(p) + "':");
Save<MergeList::iterator> save_merge_list_insert_position(&_imp->merge_list_insert_position);
- VersionMetadata::ConstPointer metadata(_imp->env->package_database()->fetch_repository(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(_imp->env->package_database()->fetch_repository(
p.repository)->version_metadata(p.name, p.version));
/* create our merge list entry. insert pre deps before ourself in the list. insert
@@ -1078,8 +1076,8 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
.metadata(metadata)
.generation(_imp->merge_list_generation)
.state(dle_no_deps)
- .tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
- .destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
+ .tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
+ .destinations(std::tr1::shared_ptr<RepositoryNameCollection>(new RepositoryNameCollection::Concrete))
.associated_entry(0)
.kind(metadata->virtual_interface ? dlk_virtual : dlk_package))),
our_merge_entry_post_position(our_merge_entry_position);
@@ -1093,7 +1091,7 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
if (_imp->opts->dependency_tags && _imp->current_pde())
our_merge_entry_position->tags->insert(DepTagEntry::create()
- .tag(DepTag::Pointer(new DependencyDepTag(*_imp->current_pde())))
+ .tag(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*_imp->current_pde())))
.generation(_imp->merge_list_generation));
Save<MergeList::const_iterator> save_current_merge_list_entry(&_imp->current_merge_list_entry,
@@ -1107,17 +1105,17 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
DepAtomFlattener f(_imp->env, _imp->current_pde(), metadata->ebuild_interface->provide());
for (DepAtomFlattener::Iterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
{
- PackageDepAtom::Pointer pp(new PackageDepAtom("=" + (*i)->text() + "-" + stringify(p.version)));
+ std::tr1::shared_ptr<PackageDepAtom> pp(new PackageDepAtom("=" + (*i)->text() + "-" + stringify(p.version)));
std::pair<MergeListIndex::iterator, MergeListIndex::iterator> z(
_imp->merge_list_index.equal_range(pp->package()));
MergeListIndex::iterator zz(std::find_if(z.first, z.second,
- MatchDepListEntryAgainstPackageDepAtom(_imp->env, pp.raw_pointer())));
+ MatchDepListEntryAgainstPackageDepAtom(_imp->env, pp.get())));
if (z.first != z.second)
continue;
- VersionMetadata::ConstPointer m(0);
+ std::tr1::shared_ptr<const VersionMetadata> m;
if (_imp->env->package_database()->fetch_repository(RepositoryName("virtuals"))->has_version(
QualifiedPackageName((*i)->text()), p.version))
@@ -1125,8 +1123,7 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
QualifiedPackageName((*i)->text()), p.version);
else
{
- VersionMetadata::Pointer mm(0);
- mm.assign(new FakedVirtualVersionMetadata(metadata->slot,
+ std::tr1::shared_ptr<VersionMetadata> mm(new FakedVirtualVersionMetadata(metadata->slot,
PackageDatabaseEntry(p.name, p.version, RepositoryName("virtuals"))));
m = mm;
}
@@ -1137,8 +1134,8 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
.metadata(m)
.generation(_imp->merge_list_generation)
.state(dle_has_all_deps)
- .tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
- .destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
+ .tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
+ .destinations(std::tr1::shared_ptr<RepositoryNameCollection>(new RepositoryNameCollection::Concrete))
.associated_entry(&*_imp->current_merge_list_entry)
.kind(dlk_provided)));
_imp->merge_list_index.insert(std::make_pair((*i)->text(), our_merge_entry_post_position));
@@ -1194,7 +1191,7 @@ DepList::add_error_package(const PackageDatabaseEntry & p, const DepListEntryKin
{
if (_imp->current_pde())
pp.first->second->tags->insert(DepTagEntry::create()
- .tag(DepTag::Pointer(new DependencyDepTag(*_imp->current_pde())))
+ .tag(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*_imp->current_pde())))
.generation(_imp->merge_list_generation));
return;
}
@@ -1208,14 +1205,14 @@ DepList::add_error_package(const PackageDatabaseEntry & p, const DepListEntryKin
p.repository)->version_metadata(p.name, p.version))
.generation(_imp->merge_list_generation)
.state(dle_has_all_deps)
- .tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
- .destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
+ .tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
+ .destinations(std::tr1::shared_ptr<RepositoryNameCollection>(new RepositoryNameCollection::Concrete))
.associated_entry(&*_imp->current_merge_list_entry)
.kind(kind)));
if (_imp->current_pde())
our_merge_entry_position->tags->insert(DepTagEntry::create()
- .tag(DepTag::Pointer(new DependencyDepTag(*_imp->current_pde())))
+ .tag(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*_imp->current_pde())))
.generation(_imp->merge_list_generation));
_imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry_position));
@@ -1243,21 +1240,21 @@ DepList::add_suggested_package(const PackageDatabaseEntry & p)
p.repository)->version_metadata(p.name, p.version))
.generation(_imp->merge_list_generation)
.state(dle_has_all_deps)
- .tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
- .destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
+ .tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
+ .destinations(std::tr1::shared_ptr<RepositoryNameCollection>(new RepositoryNameCollection::Concrete))
.associated_entry(&*_imp->current_merge_list_entry)
.kind(dlk_suggested)));
if (_imp->current_pde())
our_merge_entry_position->tags->insert(DepTagEntry::create()
- .tag(DepTag::Pointer(new DependencyDepTag(*_imp->current_pde())))
+ .tag(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*_imp->current_pde())))
.generation(_imp->merge_list_generation));
_imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry_position));
}
void
-DepList::add_predeps(DepAtom::ConstPointer d, const DepListDepsOption opt, const std::string & s)
+DepList::add_predeps(std::tr1::shared_ptr<const DepAtom> d, const DepListDepsOption opt, const std::string & s)
{
if (dl_deps_pre == opt || dl_deps_pre_or_post == opt)
{
@@ -1277,7 +1274,7 @@ DepList::add_predeps(DepAtom::ConstPointer d, const DepListDepsOption opt, const
}
void
-DepList::add_postdeps(DepAtom::ConstPointer d, const DepListDepsOption opt, const std::string & s)
+DepList::add_postdeps(std::tr1::shared_ptr<const DepAtom> d, const DepListDepsOption opt, const std::string & s)
{
if (dl_deps_pre_or_post == opt || dl_deps_post == opt || dl_deps_try_post == opt)
{
@@ -1309,12 +1306,12 @@ DepList::add_postdeps(DepAtom::ConstPointer d, const DepListDepsOption opt, cons
}
void
-DepList::add_already_installed_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
+DepList::add_already_installed_package(const PackageDatabaseEntry & p, std::tr1::shared_ptr<const DepTag> tag)
{
Context context("When adding installed package '" + stringify(p) + "':");
Save<MergeList::iterator> save_merge_list_insert_position(&_imp->merge_list_insert_position);
- VersionMetadata::ConstPointer metadata(_imp->env->package_database()->fetch_repository(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(_imp->env->package_database()->fetch_repository(
p.repository)->version_metadata(p.name, p.version));
MergeList::iterator our_merge_entry(_imp->merge_list.insert(_imp->merge_list_insert_position,
@@ -1322,9 +1319,9 @@ DepList::add_already_installed_package(const PackageDatabaseEntry & p, DepTag::C
.package(p)
.metadata(metadata)
.generation(_imp->merge_list_generation)
- .tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
+ .tags(std::tr1::shared_ptr<DepListEntryTags>(new DepListEntryTags::Concrete))
.state(dle_has_pre_deps)
- .destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
+ .destinations(std::tr1::shared_ptr<RepositoryNameCollection>(new RepositoryNameCollection::Concrete))
.associated_entry(0)
.kind(dlk_already_installed)));
_imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry));
@@ -1336,7 +1333,7 @@ DepList::add_already_installed_package(const PackageDatabaseEntry & p, DepTag::C
if (_imp->opts->dependency_tags && _imp->current_pde())
our_merge_entry->tags->insert(DepTagEntry::create()
- .tag(DepTag::Pointer(new DependencyDepTag(*_imp->current_pde())))
+ .tag(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*_imp->current_pde())))
.generation(_imp->merge_list_generation));
Save<MergeList::const_iterator> save_current_merge_list_entry(&_imp->current_merge_list_entry,
@@ -1490,9 +1487,9 @@ DepList::prefer_installed_over_uninstalled(const PackageDatabaseEntry & installe
}
bool
-DepList::already_installed(DepAtom::ConstPointer atom, const bool) const
+DepList::already_installed(std::tr1::shared_ptr<const DepAtom> atom, const bool) const
{
- return already_installed(*atom.raw_pointer());
+ return already_installed(*atom.get());
}
bool
@@ -1528,11 +1525,11 @@ namespace
std::unary_function<PackageDatabaseEntry, bool>
{
const Environment * const env;
- DepAtom::ConstPointer target;
+ std::tr1::shared_ptr<const DepAtom> target;
const PackageDatabaseEntry * dbe;
bool matched;
- IsTopLevelTarget(const Environment * const e, DepAtom::ConstPointer t) :
+ IsTopLevelTarget(const Environment * const e, std::tr1::shared_ptr<const DepAtom> t) :
env(e),
target(t),
matched(false)
@@ -1560,7 +1557,7 @@ namespace
if (matched)
return;
- if (match_package(env, a, *dbe))
+ if (match_package(*env, *a, *dbe))
matched = true;
}
diff --git a/paludis/dep_list/dep_list.hh b/paludis/dep_list/dep_list.hh
index 59f03c7..da140e0 100644
--- a/paludis/dep_list/dep_list.hh
+++ b/paludis/dep_list/dep_list.hh
@@ -58,17 +58,17 @@ namespace paludis
friend class QueryVisitor;
friend class ShowSuggestVisitor;
- void add_in_role(DepAtom::ConstPointer, const std::string & role);
+ void add_in_role(std::tr1::shared_ptr<const DepAtom>, const std::string & role);
bool prefer_installed_over_uninstalled(const PackageDatabaseEntry &,
const PackageDatabaseEntry &);
- void add_package(const PackageDatabaseEntry &, DepTag::ConstPointer);
- void add_already_installed_package(const PackageDatabaseEntry &, DepTag::ConstPointer);
+ void add_package(const PackageDatabaseEntry &, std::tr1::shared_ptr<const DepTag>);
+ void add_already_installed_package(const PackageDatabaseEntry &, std::tr1::shared_ptr<const DepTag>);
void add_error_package(const PackageDatabaseEntry &, const DepListEntryKind);
void add_suggested_package(const PackageDatabaseEntry &);
- void add_predeps(DepAtom::ConstPointer, const DepListDepsOption, const std::string &);
- void add_postdeps(DepAtom::ConstPointer, const DepListDepsOption, const std::string &);
+ void add_predeps(std::tr1::shared_ptr<const DepAtom>, const DepListDepsOption, const std::string &);
+ void add_postdeps(std::tr1::shared_ptr<const DepAtom>, const DepListDepsOption, const std::string &);
bool is_top_level_target(const PackageDatabaseEntry &) const;
@@ -85,13 +85,13 @@ namespace paludis
/**
* Our options.
*/
- CountedPtr<DepListOptions, count_policy::ExternalCountTag> options();
+ std::tr1::shared_ptr<DepListOptions> options();
/**
* Add the packages required to resolve an additional dependency
* atom.
*/
- void add(DepAtom::ConstPointer);
+ void add(std::tr1::shared_ptr<const DepAtom>);
/**
* Clear the list.
@@ -103,7 +103,7 @@ namespace paludis
*
* \deprecated Use the one arg form.
*/
- bool already_installed(DepAtom::ConstPointer, const bool dummy) const
+ bool already_installed(std::tr1::shared_ptr<const DepAtom>, const bool dummy) const
PALUDIS_ATTRIBUTE((deprecated));
/**
diff --git a/paludis/dep_list/dep_list.sr b/paludis/dep_list/dep_list.sr
index d547717..1cf0381 100644
--- a/paludis/dep_list/dep_list.sr
+++ b/paludis/dep_list/dep_list.sr
@@ -51,9 +51,9 @@ make_class_DepListEntry()
key package PackageDatabaseEntry
key associated_entry "const DepListEntry *"
- key metadata VersionMetadata::ConstPointer
- key tags DepListEntryTags::Pointer
- key destinations RepositoryNameCollection::Pointer
+ key metadata "std::tr1::shared_ptr<const VersionMetadata>"
+ key tags "std::tr1::shared_ptr<DepListEntryTags>"
+ key destinations "std::tr1::shared_ptr<RepositoryNameCollection>"
key generation long
key state DepListEntryState
diff --git a/paludis/dep_list/dep_list_TEST.cc b/paludis/dep_list/dep_list_TEST.cc
index 99db71b..9be6851 100644
--- a/paludis/dep_list/dep_list_TEST.cc
+++ b/paludis/dep_list/dep_list_TEST.cc
@@ -1254,7 +1254,7 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
@@ -1288,7 +1288,7 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two cat/three";
@@ -1323,11 +1323,11 @@ namespace test_cases
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "one", "1");
- FakeInstalledRepository::Pointer installed_repo(
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
env.package_database()->add_repository(installed_repo);
installed_repo->add_version("cat", "one", "2");
@@ -1349,11 +1349,11 @@ namespace test_cases
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- FakeInstalledRepository::Pointer installed_repo(
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
env.package_database()->add_repository(installed_repo);
installed_repo->add_version("cat", "two", "2");
@@ -1375,11 +1375,11 @@ namespace test_cases
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- FakeInstalledRepository::Pointer installed_repo(
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
env.package_database()->add_repository(installed_repo);
installed_repo->add_version("cat", "two", "2");
@@ -1403,11 +1403,11 @@ namespace test_cases
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- FakeInstalledRepository::Pointer installed_repo(
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
env.package_database()->add_repository(installed_repo);
installed_repo->add_version("cat", "two", "2");
@@ -1444,12 +1444,12 @@ namespace test_cases
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
repo->add_version("cat", "two", "2");
- FakeInstalledRepository::Pointer installed_repo(
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
env.package_database()->add_repository(installed_repo);
installed_repo->add_version("cat", "two", "0");
@@ -1477,7 +1477,7 @@ namespace test_cases
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
repo->add_version("cat", "zero", "1")->deps_interface->build_depend_string =
"( cat/one cat/two cat/three-live cat/four-cvs cat/five-svn cat/six-darcs )";
@@ -1488,7 +1488,7 @@ namespace test_cases
repo->add_version("cat", "five-svn", "0");
repo->add_version("cat", "six-darcs", "0");
- FakeInstalledRepository::Pointer installed_repo(
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(
new FakeInstalledRepository(&env, RepositoryName("installed_repo")));
env.package_database()->add_repository(installed_repo);
installed_repo->add_version("cat", "one", "scm");
diff --git a/paludis/dep_list/dep_list_TEST.hh b/paludis/dep_list/dep_list_TEST.hh
index dd10f65..31a7c8b 100644
--- a/paludis/dep_list/dep_list_TEST.hh
+++ b/paludis/dep_list/dep_list_TEST.hh
@@ -83,10 +83,10 @@ namespace test_cases
{
protected:
TestEnvironment env;
- FakeRepository::Pointer repo;
- FakeInstalledRepository::Pointer installed_repo;
- VirtualsRepository::Pointer virtuals_repo;
- InstalledVirtualsRepository::Pointer installed_virtuals_repo;
+ std::tr1::shared_ptr<FakeRepository> repo;
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo;
+ std::tr1::shared_ptr<VirtualsRepository> virtuals_repo;
+ std::tr1::shared_ptr<InstalledVirtualsRepository> installed_virtuals_repo;
std::list<std::string> expected;
std::string merge_target;
bool done_populate;
diff --git a/paludis/dep_list/dep_list_TEST_blockers.cc b/paludis/dep_list/dep_list_TEST_blockers.cc
index 3dddac5..5e138bc 100644
--- a/paludis/dep_list/dep_list_TEST_blockers.cc
+++ b/paludis/dep_list/dep_list_TEST_blockers.cc
@@ -82,7 +82,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- VersionMetadata::Pointer two_m(repo->add_version("cat", "two", "1"));
+ std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "1"));
two_m->deps_interface->build_depend_string = "!virtual/two";
two_m->ebuild_interface->provide_string = "virtual/two";
}
@@ -103,7 +103,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- VersionMetadata::Pointer two_m(repo->add_version("cat", "two", "1"));
+ std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "1"));
two_m->deps_interface->build_depend_string = "!virtual/two";
two_m->ebuild_interface->provide_string = "virtual/two";
installed_repo->add_version("other", "two", "1")->ebuild_interface->provide_string = "virtual/two";
@@ -208,11 +208,11 @@ namespace test_cases
void populate_repo()
{
- VersionMetadata::Pointer one_m(repo->add_version("cat", "one", "1"));
+ std::tr1::shared_ptr<VersionMetadata> one_m(repo->add_version("cat", "one", "1"));
one_m->ebuild_interface->provide_string = "virtual/one";
one_m->deps_interface->build_depend_string = "!virtual/one";
one_m->deps_interface->run_depend_string = "!virtual/one";
- VersionMetadata::Pointer i_one_m(installed_repo->add_version("cat", "one", "1"));
+ std::tr1::shared_ptr<VersionMetadata> i_one_m(installed_repo->add_version("cat", "one", "1"));
i_one_m->ebuild_interface->provide_string = "virtual/one";
i_one_m->deps_interface->run_depend_string = "!virtual/one";
}
@@ -231,11 +231,11 @@ namespace test_cases
void populate_repo()
{
- VersionMetadata::Pointer one_m(repo->add_version("cat", "one", "1"));
+ std::tr1::shared_ptr<VersionMetadata> one_m(repo->add_version("cat", "one", "1"));
one_m->ebuild_interface->provide_string = "virtual/one";
one_m->deps_interface->build_depend_string = "!virtual/one";
one_m->deps_interface->run_depend_string = "!virtual/one";
- VersionMetadata::Pointer i_one_m(installed_repo->add_version("cat", "one", "1"));
+ std::tr1::shared_ptr<VersionMetadata> i_one_m(installed_repo->add_version("cat", "one", "1"));
i_one_m->ebuild_interface->provide_string = "virtual/one";
i_one_m->deps_interface->run_depend_string = "!virtual/one";
}
@@ -260,7 +260,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- VersionMetadata::Pointer two_m(repo->add_version("cat", "two", "2"));
+ std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "2"));
two_m->ebuild_interface->provide_string = "virtual/two";
two_m->deps_interface->build_depend_string = "!virtual/two";
installed_repo->add_version("cat", "two", "1")->ebuild_interface->provide_string = "virtual/two";
@@ -308,7 +308,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- VersionMetadata::Pointer two_m(repo->add_version("cat", "two", "2"));
+ std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "2"));
two_m->deps_interface->build_depend_string = "!<virtual/two-2";
two_m->ebuild_interface->provide_string = "virtual/two";
installed_repo->add_version("cat", "two", "1")->ebuild_interface->provide_string = "virtual/two";
@@ -336,7 +336,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->deps_interface->build_depend_string = "cat/two";
- VersionMetadata::Pointer two_m(repo->add_version("cat", "two", "2"));
+ std::tr1::shared_ptr<VersionMetadata> two_m(repo->add_version("cat", "two", "2"));
two_m->deps_interface->build_depend_string = "!<virtual/two-2";
two_m->ebuild_interface->provide_string = "virtual/two";
installed_repo->add_version("other", "two", "1")->ebuild_interface->provide_string = "virtual/two";
diff --git a/paludis/dep_list/range_rewriter.cc b/paludis/dep_list/range_rewriter.cc
index 053d5ae..3b4d263 100644
--- a/paludis/dep_list/range_rewriter.cc
+++ b/paludis/dep_list/range_rewriter.cc
@@ -22,7 +22,6 @@
using namespace paludis;
RangeRewriter::RangeRewriter() :
- _atom(0),
_invalid(false)
{
}
@@ -90,7 +89,7 @@ RangeRewriter::visit(const PackageDepAtom * a)
}
else
{
- _atom.assign(new PackageDepAtom(*a));
+ _atom.reset(new PackageDepAtom(*a));
_atom->set_version_requirements_mode(vr_or);
}
}
diff --git a/paludis/dep_list/range_rewriter.hh b/paludis/dep_list/range_rewriter.hh
index 0d4e984..9a3ef5c 100644
--- a/paludis/dep_list/range_rewriter.hh
+++ b/paludis/dep_list/range_rewriter.hh
@@ -28,17 +28,17 @@ namespace paludis
public DepAtomVisitorTypes::ConstVisitor
{
private:
- PackageDepAtom::Pointer _atom;
+ std::tr1::shared_ptr<PackageDepAtom> _atom;
bool _invalid;
public:
RangeRewriter();
virtual ~RangeRewriter();
- PackageDepAtom::ConstPointer atom() const
+ std::tr1::shared_ptr<const PackageDepAtom> atom() const
{
if (_invalid)
- return PackageDepAtom::ConstPointer(0);
+ return std::tr1::shared_ptr<const PackageDepAtom>();
return _atom;
}
diff --git a/paludis/dep_list/range_rewriter_TEST.cc b/paludis/dep_list/range_rewriter_TEST.cc
index 6ef8b5e..50ea97d 100644
--- a/paludis/dep_list/range_rewriter_TEST.cc
+++ b/paludis/dep_list/range_rewriter_TEST.cc
@@ -37,7 +37,7 @@ namespace test_cases
void run()
{
- AllDepAtom::ConstPointer p(PortageDepParser::parse_depend("=a/b-1 =a/b-2"));
+ std::tr1::shared_ptr<const CompositeDepAtom> p(PortageDepParser::parse_depend("=a/b-1 =a/b-2"));
RangeRewriter r;
TEST_CHECK(! r.atom());
diff --git a/paludis/dep_list/uninstall_list.cc b/paludis/dep_list/uninstall_list.cc
index 681ac8f..f928033 100644
--- a/paludis/dep_list/uninstall_list.cc
+++ b/paludis/dep_list/uninstall_list.cc
@@ -54,14 +54,13 @@ namespace paludis
};
template<>
- struct Implementation<UninstallList> :
- InternalCounted<Implementation<UninstallList> >
+ struct Implementation<UninstallList>
{
const Environment * const env;
UninstallListOptions options;
std::list<UninstallListEntry> uninstall_list;
- mutable MakeHashedMap<PackageDatabaseEntry, ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer>::Type
+ mutable MakeHashedMap<PackageDatabaseEntry, std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> >::Type
dep_collector_cache;
Implementation(const Environment * const e, const UninstallListOptions & o) :
@@ -94,7 +93,7 @@ namespace
std::unary_function<PackageDatabaseEntry, bool>
{
const Environment * const env;
- DepAtom::ConstPointer world;
+ std::tr1::shared_ptr<const DepAtom> world;
const PackageDatabaseEntry * dbe;
bool matched;
@@ -126,7 +125,7 @@ namespace
if (matched)
return;
- if (match_package(env, a, *dbe))
+ if (match_package(*env, *a, *dbe))
matched = true;
}
@@ -175,7 +174,7 @@ UninstallList::add(const PackageDatabaseEntry & e, const PackageDatabaseEntry *
_imp->uninstall_list.end(), MatchUninstallListEntry(e)))))
{
if (t)
- i->tags->insert(DepTag::Pointer(new DependencyDepTag(*t)));
+ i->tags->insert(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*t)));
return;
}
@@ -198,10 +197,10 @@ UninstallList::add_unused()
{
Context context("When finding unused packages:");
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer world(collect_world()),
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> world(collect_world()),
everything(collect_all_installed());
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection>
world_plus_deps(new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete),
unused(new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete);
@@ -211,7 +210,7 @@ UninstallList::add_unused()
while (old_size != world_plus_deps->size())
{
old_size = world_plus_deps->size();
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer new_world_deps(collect_depped_upon(world_plus_deps));
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> new_world_deps(collect_depped_upon(world_plus_deps));
world_plus_deps->insert(new_world_deps->begin(), new_world_deps->end());
}
@@ -247,15 +246,15 @@ UninstallList::add_package(const PackageDatabaseEntry & e, const PackageDatabase
{
Context context("When adding package '" + stringify(e) + "' to the uninstall list:");
- VersionMetadata::ConstPointer m(_imp->env->package_database()->fetch_repository(
+ std::tr1::shared_ptr<const VersionMetadata> m(_imp->env->package_database()->fetch_repository(
e.repository)->version_metadata(e.name, e.version));
std::list<UninstallListEntry>::iterator i(_imp->uninstall_list.insert(
_imp->uninstall_list.end(), UninstallListEntry(
- e, m->virtual_interface, SortedCollection<DepTag::Pointer>::Pointer(
- new SortedCollection<DepTag::Pointer>::Concrete))));
+ e, m->virtual_interface, std::tr1::shared_ptr<SortedCollection<std::tr1::shared_ptr<DepTag> > >(
+ new SortedCollection<std::tr1::shared_ptr<DepTag> >::Concrete))));
if (t)
- i->tags->insert(DepTag::Pointer(new DependencyDepTag(*t)));
+ i->tags->insert(std::tr1::shared_ptr<DepTag>(new DependencyDepTag(*t)));
}
void
@@ -269,12 +268,12 @@ UninstallList::move_package_to_end(const PackageDatabaseEntry & e)
_imp->uninstall_list.splice(_imp->uninstall_list.end(), _imp->uninstall_list, i);
}
-ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer
+std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection>
UninstallList::collect_all_installed() const
{
Context context("When collecting all installed packages:");
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer result(
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection> result(
new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete);
for (PackageDatabase::RepositoryIterator i(_imp->env->package_database()->begin_repositories()),
i_end(_imp->env->package_database()->end_repositories()) ; i != i_end ; ++i)
@@ -282,15 +281,15 @@ UninstallList::collect_all_installed() const
if (! (*i)->installed_interface)
continue;
- CategoryNamePartCollection::ConstPointer cats((*i)->category_names());
+ std::tr1::shared_ptr<const CategoryNamePartCollection> cats((*i)->category_names());
for (CategoryNamePartCollection::Iterator c(cats->begin()), c_end(cats->end()) ;
c != c_end ; ++c)
{
- QualifiedPackageNameCollection::ConstPointer pkgs((*i)->package_names(*c));
+ std::tr1::shared_ptr<const QualifiedPackageNameCollection> pkgs((*i)->package_names(*c));
for (QualifiedPackageNameCollection::Iterator p(pkgs->begin()), p_end(pkgs->end()) ;
p != p_end ; ++p)
{
- VersionSpecCollection::ConstPointer vers((*i)->version_specs(*p));
+ std::tr1::shared_ptr<const VersionSpecCollection> vers((*i)->version_specs(*p));
for (VersionSpecCollection::Iterator v(vers->begin()), v_end(vers->end()) ;
v != v_end ; ++v)
result->insert(PackageDatabaseEntry(*p, *v, (*i)->name()));
@@ -313,7 +312,7 @@ namespace
const Environment * const env;
const PackageDatabaseEntry pkg;
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer matches;
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection> matches;
DepCollector(const Environment * const ee, const PackageDatabaseEntry & e) :
env(ee),
@@ -324,7 +323,7 @@ namespace
void visit(const PackageDepAtom * const a)
{
- PackageDatabaseEntryCollection::ConstPointer m(env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> m(env->package_database()->query(
*a, is_installed_only, qo_order_by_version));
matches->insert(m->begin(), m->end());
}
@@ -346,12 +345,12 @@ namespace
};
}
-ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer
-UninstallList::collect_depped_upon(ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer targets) const
+std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection>
+UninstallList::collect_depped_upon(std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> targets) const
{
Context context("When collecting depended upon packages:");
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer result(
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection> result(
new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete);
for (PackageDatabaseEntryCollection::Iterator i(targets->begin()), i_end(targets->end()) ;
@@ -359,12 +358,14 @@ UninstallList::collect_depped_upon(ArbitrarilyOrderedPackageDatabaseEntryCollect
{
Context local_context("When collecting depended upon packages for '" + stringify(*i) + "':");
- MakeHashedMap<PackageDatabaseEntry, ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer>::Type::const_iterator
- cache(_imp->dep_collector_cache.find(*i));
+ MakeHashedMap<PackageDatabaseEntry,
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> >::Type::const_iterator
+ cache(_imp->dep_collector_cache.find(*i));
+
if (cache == _imp->dep_collector_cache.end())
{
DepCollector c(_imp->env, *i);
- VersionMetadata::ConstPointer metadata(_imp->env->package_database()->fetch_repository(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(_imp->env->package_database()->fetch_repository(
i->repository)->version_metadata(i->name, i->version));
if (metadata->deps_interface)
{
@@ -374,7 +375,7 @@ UninstallList::collect_depped_upon(ArbitrarilyOrderedPackageDatabaseEntryCollect
metadata->deps_interface->suggested_depend()->accept(&c);
}
cache = _imp->dep_collector_cache.insert(std::make_pair(*i,
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer(c.matches))).first;
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection>(c.matches))).first;
}
result->insert(cache->second->begin(), cache->second->end());
@@ -389,23 +390,23 @@ UninstallList::add_unused_dependencies()
Context context("When adding unused dependencies:");
bool added(true);
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer everything(collect_all_installed());
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> everything(collect_all_installed());
while (added)
{
added = false;
/* find packages that're depped upon by anything in our uninstall list */
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer uninstall_list_targets(
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection> uninstall_list_targets(
new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete);
for (std::list<UninstallListEntry>::const_iterator i(_imp->uninstall_list.begin()),
i_end(_imp->uninstall_list.end()) ; i != i_end ; ++i)
uninstall_list_targets->insert(i->package);
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer depped_upon_list(
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> depped_upon_list(
collect_depped_upon(uninstall_list_targets));
/* find packages that're depped upon by anything not in our uninstall list */
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer everything_except_uninstall_list_targets(
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection> everything_except_uninstall_list_targets(
new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete);
std::set_difference(everything->begin(), everything->end(),
uninstall_list_targets->begin(), uninstall_list_targets->end(),
@@ -416,11 +417,11 @@ UninstallList::add_unused_dependencies()
+ join(everything_except_uninstall_list_targets->begin(),
everything_except_uninstall_list_targets->end(), " ") + "'");
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer depped_upon_not_list(
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> depped_upon_not_list(
collect_depped_upon(everything_except_uninstall_list_targets));
/* find unused dependencies */
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer unused_dependencies(
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection> unused_dependencies(
new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete);
std::set_difference(depped_upon_list->begin(), depped_upon_list->end(),
depped_upon_not_list->begin(), depped_upon_not_list->end(), unused_dependencies->inserter(),
@@ -449,18 +450,20 @@ UninstallList::add_dependencies(const PackageDatabaseEntry & e)
{
Context context("When adding things that depend upon '" + stringify(e) + "':");
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer everything(collect_all_installed());
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> everything(collect_all_installed());
for (PackageDatabaseEntryCollection::Iterator i(everything->begin()),
i_end(everything->end()) ; i != i_end ; ++i)
{
Context local_context("When seeing whether '" + stringify(*i) + "' has a dep:");
- MakeHashedMap<PackageDatabaseEntry, ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer>::Type::const_iterator
- cache(_imp->dep_collector_cache.find(*i));
+ MakeHashedMap<PackageDatabaseEntry,
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> >::Type::const_iterator
+ cache(_imp->dep_collector_cache.find(*i));
+
if (cache == _imp->dep_collector_cache.end())
{
DepCollector c(_imp->env, *i);
- VersionMetadata::ConstPointer metadata(_imp->env->package_database()->fetch_repository(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(_imp->env->package_database()->fetch_repository(
i->repository)->version_metadata(i->name, i->version));
if (metadata->deps_interface)
{
@@ -470,7 +473,7 @@ UninstallList::add_dependencies(const PackageDatabaseEntry & e)
metadata->deps_interface->suggested_depend()->accept(&c);
}
cache = _imp->dep_collector_cache.insert(std::make_pair(*i,
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer(c.matches))).first;
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection>(c.matches))).first;
}
if (cache->second->end() == cache->second->find(e))
@@ -483,14 +486,14 @@ UninstallList::add_dependencies(const PackageDatabaseEntry & e)
}
}
-ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer
+std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection>
UninstallList::collect_world() const
{
Context local_context("When collecting world packages:");
- ArbitrarilyOrderedPackageDatabaseEntryCollection::Pointer result(
+ std::tr1::shared_ptr<ArbitrarilyOrderedPackageDatabaseEntryCollection> result(
new ArbitrarilyOrderedPackageDatabaseEntryCollection::Concrete);
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer everything(collect_all_installed());
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> everything(collect_all_installed());
IsWorld w(_imp->env);
for (PackageDatabaseEntryCollection::Iterator i(everything->begin()),
diff --git a/paludis/dep_list/uninstall_list.hh b/paludis/dep_list/uninstall_list.hh
index 0bd14e1..dede3e5 100644
--- a/paludis/dep_list/uninstall_list.hh
+++ b/paludis/dep_list/uninstall_list.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -44,12 +44,12 @@ namespace paludis
void add_unused_dependencies();
void add_dependencies(const PackageDatabaseEntry &);
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer collect_depped_upon(
- const ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer targets) const;
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> collect_depped_upon(
+ const std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> targets) const;
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer collect_all_installed() const;
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> collect_all_installed() const;
- ArbitrarilyOrderedPackageDatabaseEntryCollection::ConstPointer collect_world() const;
+ std::tr1::shared_ptr<const ArbitrarilyOrderedPackageDatabaseEntryCollection> collect_world() const;
public:
UninstallList(const Environment * const, const UninstallListOptions &);
diff --git a/paludis/dep_list/uninstall_list.sr b/paludis/dep_list/uninstall_list.sr
index ad6d5ae..9a93807 100644
--- a/paludis/dep_list/uninstall_list.sr
+++ b/paludis/dep_list/uninstall_list.sr
@@ -27,7 +27,7 @@ make_class_UninstallListEntry()
{
key package PackageDatabaseEntry
key skip_uninstall bool
- key tags "SortedCollection<DepTag::Pointer>::Pointer"
+ key tags "std::tr1::shared_ptr<SortedCollection<std::tr1::shared_ptr<DepTag> > >"
allow_named_args
diff --git a/paludis/dep_list/uninstall_list_TEST.cc b/paludis/dep_list/uninstall_list_TEST.cc
index 36befe9..2be3364 100644
--- a/paludis/dep_list/uninstall_list_TEST.cc
+++ b/paludis/dep_list/uninstall_list_TEST.cc
@@ -54,9 +54,9 @@ namespace test_cases
{
protected:
TestEnvironment env;
- FakeInstalledRepository::Pointer installed_repo;
- VirtualsRepository::Pointer virtuals_repo;
- PackageDatabaseEntryCollection::Pointer targets;
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo;
+ std::tr1::shared_ptr<VirtualsRepository> virtuals_repo;
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> targets;
std::list<std::string> expected;
bool done_populate;
diff --git a/paludis/dep_tag.cc b/paludis/dep_tag.cc
index 76f91fd..77c6885 100644
--- a/paludis/dep_tag.cc
+++ b/paludis/dep_tag.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -39,10 +39,10 @@ namespace
*
* \ingroup grpdeptag
*/
- DepTagCategory::ConstPointer
+ std::tr1::shared_ptr<const DepTagCategory>
make_glsa_dep_tag()
{
- return DepTagCategory::ConstPointer(new DepTagCategory(
+ return std::tr1::shared_ptr<const DepTagCategory>(new DepTagCategory(
true,
"glsa",
"Security advisories",
@@ -57,10 +57,10 @@ namespace
*
* \ingroup grpdeptag
*/
- DepTagCategory::ConstPointer
+ std::tr1::shared_ptr<const DepTagCategory>
make_general_set_dep_tag()
{
- return DepTagCategory::ConstPointer(new DepTagCategory(
+ return std::tr1::shared_ptr<const DepTagCategory>(new DepTagCategory(
true,
"general",
"General sets",
@@ -75,10 +75,10 @@ namespace
*
* \ingroup grpdeptag
*/
- DepTagCategory::ConstPointer
+ std::tr1::shared_ptr<const DepTagCategory>
make_dependency_set_dep_tag()
{
- return DepTagCategory::ConstPointer(new DepTagCategory(
+ return std::tr1::shared_ptr<const DepTagCategory>(new DepTagCategory(
false,
"dependency",
"Dependencies",
diff --git a/paludis/dep_tag.hh b/paludis/dep_tag.hh
index d443c91..6c7b3a4 100644
--- a/paludis/dep_tag.hh
+++ b/paludis/dep_tag.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,16 +26,17 @@
* \ingroup grpdeptag
*/
-#include <string>
#include <paludis/package_database_entry.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/visitor.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/collection.hh>
#include <paludis/util/sr.hh>
+#include <string>
+#include <tr1/memory>
+
namespace paludis
{
/**
@@ -51,8 +52,7 @@ namespace paludis
* \nosubgrouping
*/
class DepTagCategory :
- InstantiationPolicy<DepTagCategory, instantiation_method::NonCopyableTag>,
- public InternalCounted<DepTagCategory>
+ private InstantiationPolicy<DepTagCategory, instantiation_method::NonCopyableTag>
{
private:
bool _visible;
@@ -141,11 +141,11 @@ namespace paludis
* \ingroup grpdeptag
*/
class DepTagCategoryMaker :
- public VirtualConstructor<std::string, DepTagCategory::ConstPointer (*) (),
+ public VirtualConstructor<std::string, std::tr1::shared_ptr<const DepTagCategory> (*) (),
virtual_constructor_not_found::ThrowException<NoSuchDepTagCategory> >,
- public InstantiationPolicy<DepTagCategoryMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<DepTagCategoryMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<DepTagCategoryMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<DepTagCategoryMaker, instantiation_method::SingletonTag>;
private:
DepTagCategoryMaker();
@@ -176,7 +176,6 @@ namespace paludis
*/
class DepTag :
InstantiationPolicy<DepTag, instantiation_method::NonCopyableTag>,
- public InternalCounted<DepTag>,
public virtual VisitableInterface<DepTagVisitorTypes>,
public ComparisonPolicy<DepTag,
comparison_mode::FullComparisonTag,
diff --git a/paludis/dep_tag.sr b/paludis/dep_tag.sr
index 99bbff2..474e525 100644
--- a/paludis/dep_tag.sr
+++ b/paludis/dep_tag.sr
@@ -1,6 +1,6 @@
make_class_DepTagEntry()
{
- key tag DepTag::ConstPointer
+ key tag "std::tr1::shared_ptr<const DepTag>"
key generation long
allow_named_args
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index e58d092..0c97ce0 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -147,8 +147,7 @@ EbuildCommand::do_run_command(const std::string & cmd)
}
EbuildMetadataCommand::EbuildMetadataCommand(const EbuildCommandParams & p) :
- EbuildCommand(p),
- _metadata(0)
+ EbuildCommand(p)
{
}
@@ -175,7 +174,7 @@ EbuildMetadataCommand::do_run_command(const std::string & cmd)
{
PStream prog(cmd);
KeyValueConfigFile f(&prog);
- _metadata.assign(new EbuildVersionMetadata);
+ _metadata.reset(new EbuildVersionMetadata);
bool ok(false);
try
diff --git a/paludis/ebuild.hh b/paludis/ebuild.hh
index aecab42..d65abda 100644
--- a/paludis/ebuild.hh
+++ b/paludis/ebuild.hh
@@ -67,9 +67,6 @@ namespace paludis
public VersionMetadataLicenseInterface
{
public:
- typedef CountedPtr<EbuildVersionMetadata, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const EbuildVersionMetadata, count_policy::InternalCountTag> ConstPointer;
-
EbuildVersionMetadata();
virtual ~EbuildVersionMetadata();
};
@@ -162,7 +159,7 @@ namespace paludis
public EbuildCommand
{
private:
- EbuildVersionMetadata::Pointer _metadata;
+ std::tr1::shared_ptr<EbuildVersionMetadata> _metadata;
protected:
virtual std::string commands() const;
@@ -183,7 +180,7 @@ namespace paludis
* Return a pointer to our generated metadata. If operator() has not
* yet been called, will be a zero pointer.
*/
- EbuildVersionMetadata::Pointer metadata() const
+ std::tr1::shared_ptr<EbuildVersionMetadata> metadata() const
{
return _metadata;
}
diff --git a/paludis/ebuild.sr b/paludis/ebuild.sr
index 380e24c..1fc9745 100644
--- a/paludis/ebuild.sr
+++ b/paludis/ebuild.sr
@@ -7,7 +7,7 @@ make_class_EbuildCommandParams()
key db_entry "const PackageDatabaseEntry *"
key ebuild_dir FSEntry
key files_dir FSEntry
- key eclassdirs FSEntryCollection::ConstPointer
+ key eclassdirs "std::tr1::shared_ptr<const FSEntryCollection>"
key portdir FSEntry
key distdir FSEntry
key buildroot FSEntry
@@ -33,8 +33,8 @@ make_class_EbuildFetchCommandParams()
key use_expand std::string
key flat_src_uri std::string
key root std::string
- key profiles FSEntryCollection::ConstPointer
- key expand_vars "AssociativeCollection<std::string, std::string>::ConstPointer"
+ key profiles "std::tr1::shared_ptr<const FSEntryCollection>"
+ key expand_vars "std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >"
key no_fetch bool
key safe_resume bool
@@ -58,8 +58,8 @@ make_class_EbuildInstallCommandParams()
key use std::string
key use_expand std::string
key root std::string
- key profiles FSEntryCollection::ConstPointer
- key expand_vars "AssociativeCollection<std::string, std::string>::ConstPointer"
+ key profiles "std::tr1::shared_ptr<const FSEntryCollection>"
+ key expand_vars "std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >"
key disable_cfgpro bool
key debug_build InstallDebugOption
key slot SlotName
diff --git a/paludis/environment.cc b/paludis/environment.cc
index 589b765..efdc030 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -36,7 +36,7 @@
using namespace paludis;
-Environment::Environment(PackageDatabase::Pointer d) :
+Environment::Environment(std::tr1::shared_ptr<PackageDatabase> d) :
_package_database(d),
_has_provide_map(false)
{
@@ -129,7 +129,7 @@ Environment::mask_reasons(const PackageDatabaseEntry & e, const bool override_ti
Context context("When checking mask reasons for '" + stringify(e) + "'");
MaskReasons result;
- VersionMetadata::ConstPointer metadata(package_database()->fetch_repository(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(package_database()->fetch_repository(
e.repository)->version_metadata(e.name, e.version));
if (! accept_eapi(metadata->eapi))
@@ -190,8 +190,7 @@ Environment::mask_reasons(const PackageDatabaseEntry & e, const bool override_ti
if (query_user_masks(e))
result.set(mr_user_mask);
- const Repository * const repo(package_database()->fetch_repository(
- e.repository).raw_pointer());
+ const Repository * const repo(package_database()->fetch_repository(e.repository).get());
if (repo->mask_interface)
{
@@ -209,17 +208,17 @@ Environment::mask_reasons(const PackageDatabaseEntry & e, const bool override_ti
return result;
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
Environment::package_set(const SetName & s) const
{
/* favour local sets first */
- CompositeDepAtom::Pointer result(local_package_set(s));
+ std::tr1::shared_ptr<CompositeDepAtom> result(local_package_set(s));
if (0 != result)
return result;
/* these sets always exist, even if empty */
if (s.data() == "everything" || s.data() == "system" || s.data() == "world" || s.data() == "security")
- result.assign(new AllDepAtom);
+ result.reset(new AllDepAtom);
for (PackageDatabase::RepositoryIterator r(package_database()->begin_repositories()),
r_end(package_database()->end_repositories()) ;
@@ -228,11 +227,11 @@ Environment::package_set(const SetName & s) const
if (! (*r)->sets_interface)
continue;
- DepAtom::Pointer add((*r)->sets_interface->package_set(s));
+ std::tr1::shared_ptr<DepAtom> add((*r)->sets_interface->package_set(s));
if (0 != add)
{
if (! result)
- result.assign(new AllDepAtom);
+ result.reset(new AllDepAtom);
result->add_child(add);
}
@@ -336,7 +335,7 @@ namespace
}
void
-Environment::add_appropriate_to_world(DepAtom::ConstPointer a,
+Environment::add_appropriate_to_world(std::tr1::shared_ptr<const DepAtom> a,
Environment::WorldCallbacks * const ww) const
{
WorldTargetFinder w(ww);
@@ -353,7 +352,7 @@ Environment::add_appropriate_to_world(DepAtom::ConstPointer a,
}
void
-Environment::remove_appropriate_from_world(DepAtom::ConstPointer a,
+Environment::remove_appropriate_from_world(std::tr1::shared_ptr<const DepAtom> a,
Environment::WorldCallbacks * const ww) const
{
WorldTargetFinder w(ww);
@@ -388,9 +387,7 @@ bool
Environment::query_use(const UseFlagName & f, const PackageDatabaseEntry * e) const
{
/* first check package database use masks... */
- const Repository * const repo((e ?
- package_database()->fetch_repository(e->repository).raw_pointer() :
- 0));
+ const Repository * const repo((e ? package_database()->fetch_repository(e->repository).get() : 0));
if (repo && repo->use_interface)
{
@@ -502,16 +499,16 @@ Environment::perform_hook(const Hook &) const
{
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
Environment::known_use_expand_names(const UseFlagName &, const PackageDatabaseEntry *) const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
Environment::sets_list() const
{
- return SetsCollection::ConstPointer(new SetsCollection::Concrete);
+ return std::tr1::shared_ptr<const SetsCollection>(new SetsCollection::Concrete);
}
bool
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 4564638..6366210 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -23,7 +23,6 @@
#include <paludis/mask_reasons.hh>
#include <paludis/name.hh>
#include <paludis/package_database.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
/** \file
@@ -97,7 +96,7 @@ namespace paludis
private InstantiationPolicy<Environment, instantiation_method::NonCopyableTag>
{
private:
- PackageDatabase::Pointer _package_database;
+ std::tr1::shared_ptr<PackageDatabase> _package_database;
mutable bool _has_provide_map;
@@ -107,20 +106,20 @@ namespace paludis
/**
* Constructor.
*/
- Environment(PackageDatabase::Pointer);
+ Environment(std::tr1::shared_ptr<PackageDatabase>);
/**
* Local package set, or zero.
*/
- virtual CompositeDepAtom::Pointer local_package_set(const SetName &) const
+ virtual std::tr1::shared_ptr<CompositeDepAtom> local_package_set(const SetName &) const
{
- return AllDepAtom::Pointer(0);
+ return std::tr1::shared_ptr<AllDepAtom>();
}
/**
* Change our package database.
*/
- void change_package_database(PackageDatabase::Pointer _p)
+ void change_package_database(std::tr1::shared_ptr<PackageDatabase> _p)
{
_package_database = _p;
}
@@ -141,7 +140,7 @@ namespace paludis
*
* Default behaviour: no names known.
*/
- virtual UseFlagNameCollection::ConstPointer known_use_expand_names(const UseFlagName &,
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> known_use_expand_names(const UseFlagName &,
const PackageDatabaseEntry *) const;
/**
@@ -190,7 +189,7 @@ namespace paludis
/**
* Fetch our package database.
*/
- PackageDatabase::ConstPointer package_database() const
+ std::tr1::shared_ptr<const PackageDatabase> package_database() const
{
return _package_database;
}
@@ -198,7 +197,7 @@ namespace paludis
/**
* Fetch our package database.
*/
- PackageDatabase::Pointer package_database()
+ std::tr1::shared_ptr<PackageDatabase> package_database()
{
return _package_database;
}
@@ -265,14 +264,14 @@ namespace paludis
/**
* Fetch a named package set.
*/
- DepAtom::Pointer package_set(const SetName &) const;
+ std::tr1::shared_ptr<DepAtom> package_set(const SetName &) const;
/**
* Fetch all named sets. Does not include sets from repositories.
*
* Default behaviour: no sets.
*/
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
/**
* Subclass for callbacks used by add_appropriate_to_world and
@@ -331,12 +330,12 @@ namespace paludis
* not a restricted atom.
*/
void
- add_appropriate_to_world(DepAtom::ConstPointer a, WorldCallbacks * const) const;
+ add_appropriate_to_world(std::tr1::shared_ptr<const DepAtom> a, WorldCallbacks * const) const;
/**
* Remove packages from world, if they are there.
*/
- void remove_appropriate_from_world(DepAtom::ConstPointer, WorldCallbacks * const) const;
+ void remove_appropriate_from_world(std::tr1::shared_ptr<const DepAtom>, WorldCallbacks * const) const;
/**
* Perform a hook.
diff --git a/paludis/environment/default/default_config.cc b/paludis/environment/default/default_config.cc
index 70908bd..40ba3d2 100644
--- a/paludis/environment/default/default_config.cc
+++ b/paludis/environment/default/default_config.cc
@@ -60,9 +60,7 @@ namespace paludis
* \ingroup grpdefaultconfig
*/
template<>
- struct Implementation<DefaultConfig> :
- InternalCounted<DefaultConfig>,
- InstantiationPolicy<DefaultConfig, instantiation_method::NonCopyableTag>
+ struct Implementation<DefaultConfig>
{
static std::string config_suffix;
static bool config_suffix_can_be_set;
@@ -76,28 +74,28 @@ namespace paludis
std::list<RepositoryConfigEntry> repos;
std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, KeywordName> > > keywords;
+ std::pair<std::tr1::shared_ptr<const PackageDepAtom>, KeywordName> > > keywords;
- const std::vector<std::pair<PackageDepAtom::ConstPointer, KeywordName> > empty_keywords;
+ const std::vector<std::pair<std::tr1::shared_ptr<const PackageDepAtom>, KeywordName> > empty_keywords;
std::vector<KeywordName> default_keywords;
mutable std::vector<SetKeywordConfigEntry> set_keywords;
std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, std::string> > > licenses;
+ std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > > licenses;
- const std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > empty_licenses;
+ const std::vector<std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > empty_licenses;
std::vector<std::string> default_licenses;
mutable std::vector<SetLicenseConfigEntry> set_licenses;
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > user_masks;
+ std::map<QualifiedPackageName, std::vector<std::tr1::shared_ptr<const PackageDepAtom> > > user_masks;
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > user_unmasks;
+ std::map<QualifiedPackageName, std::vector<std::tr1::shared_ptr<const PackageDepAtom> > > user_unmasks;
- std::vector<PackageDepAtom::ConstPointer> empty_masks;
+ std::vector<std::tr1::shared_ptr<const PackageDepAtom> > empty_masks;
mutable std::vector<SetMaskConfigEntry> set_masks;
mutable std::vector<SetMaskConfigEntry> set_unmasks;
@@ -108,9 +106,9 @@ namespace paludis
mutable std::vector<SetUseConfigMinusStarEntry> set_use_prefixes_that_have_minus_star;
- std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > empty_use_prefixes;
+ std::vector<std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > empty_use_prefixes;
- std::map<QualifiedPackageName, std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > >
+ std::map<QualifiedPackageName, std::vector<std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > >
use_prefixes_that_have_minus_star;
std::vector<UseConfigEntry> empty_use;
@@ -153,7 +151,7 @@ namespace paludis
{
Log::get_instance()->message(ll_warning, lc_context, "Set '" +
stringify(s->set_name) + "' doesn't exist");
- s->dep_atom.assign(new AllDepAtom);
+ s->dep_atom.reset(new AllDepAtom);
}
}
@@ -166,7 +164,7 @@ namespace paludis
{
Log::get_instance()->message(ll_warning, lc_context, "Set '" +
stringify(s->set_name) + "' doesn't exist");
- s->dep_atom.assign(new AllDepAtom);
+ s->dep_atom.reset(new AllDepAtom);
}
}
}
@@ -183,7 +181,7 @@ namespace paludis
{
Log::get_instance()->message(ll_warning, lc_context, "Set '" +
stringify(s->set_name) + "' doesn't exist");
- s->dep_atom.assign(new AllDepAtom);
+ s->dep_atom.reset(new AllDepAtom);
}
}
}
@@ -200,7 +198,7 @@ namespace paludis
{
Log::get_instance()->message(ll_warning, lc_context, "Set '" +
stringify(s->set_name) + "' doesn't exist");
- s->dep_atom.assign(new AllDepAtom);
+ s->dep_atom.reset(new AllDepAtom);
}
}
}
@@ -217,7 +215,7 @@ namespace paludis
{
Log::get_instance()->message(ll_warning, lc_context, "Set '" +
stringify(s->set_name) + "' doesn't exist");
- s->dep_atom.assign(new AllDepAtom);
+ s->dep_atom.reset(new AllDepAtom);
}
}
}
@@ -234,7 +232,7 @@ namespace paludis
{
Log::get_instance()->message(ll_warning, lc_context, "Set '" +
stringify(s->set_name) + "' doesn't exist");
- s->dep_atom.assign(new AllDepAtom);
+ s->dep_atom.reset(new AllDepAtom);
}
}
}
@@ -297,7 +295,7 @@ DefaultConfig::DefaultConfig() :
_imp->root = root_prefix;
_imp->config_dir = stringify(local_config_dir);
- AssociativeCollection<std::string, std::string>::Pointer conf_vars(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > conf_vars(
new AssociativeCollection<std::string, std::string>::Concrete);
conf_vars->insert("ROOT", root_prefix);
@@ -343,7 +341,7 @@ DefaultConfig::DefaultConfig() :
if (! k.get("importance").empty())
importance = destringify<int>(k.get("importance"));
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete(k.begin(), k.end()));
keys->erase("repo_file");
@@ -360,9 +358,9 @@ DefaultConfig::DefaultConfig() :
/* add virtuals repositories */
_imp->repos.push_back(RepositoryConfigEntry("installed_virtuals", -1,
- AssociativeCollection<std::string, std::string>::Pointer(0)));
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> >()));
_imp->repos.push_back(RepositoryConfigEntry("virtuals", -2,
- AssociativeCollection<std::string, std::string>::Pointer(0)));
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> >()));
_imp->repos.sort();
}
@@ -396,11 +394,11 @@ DefaultConfig::DefaultConfig() :
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
_imp->set_keywords.push_back(SetKeywordConfigEntry(
- SetName(tokens.at(0)), DepAtom::Pointer(0), KeywordName(*t)));
+ SetName(tokens.at(0)), std::tr1::shared_ptr<DepAtom>(), KeywordName(*t)));
}
else
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(tokens.at(0)));
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
_imp->keywords[a->package()].push_back(std::make_pair(a, *t));
@@ -438,7 +436,7 @@ DefaultConfig::DefaultConfig() :
std::copy(next(tokens.begin()), tokens.end(), std::back_inserter(_imp->default_licenses));
else
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(tokens.at(0)));
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
_imp->licenses[a->package()].push_back(std::make_pair(a, *t));
@@ -474,10 +472,10 @@ DefaultConfig::DefaultConfig() :
if (std::string::npos == line->find('/'))
_imp->set_masks.push_back(SetMaskConfigEntry(SetName(*line),
- DepAtom::ConstPointer(0)));
+ std::tr1::shared_ptr<const DepAtom>()));
else
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(*line));
_imp->user_masks[a->package()].push_back(a);
}
}
@@ -506,10 +504,10 @@ DefaultConfig::DefaultConfig() :
if (std::string::npos == line->find('/'))
_imp->set_unmasks.push_back(SetMaskConfigEntry(SetName(*line),
- DepAtom::ConstPointer(0)));
+ std::tr1::shared_ptr<const DepAtom>()));
else
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(*line));
_imp->user_unmasks[a->package()].push_back(a);
}
}
@@ -578,10 +576,10 @@ DefaultConfig::DefaultConfig() :
{
if ("-*" == *t)
_imp->set_use_prefixes_that_have_minus_star.push_back(SetUseConfigMinusStarEntry(
- SetName(tokens.at(0)), DepAtom::ConstPointer(0), prefix));
+ SetName(tokens.at(0)), std::tr1::shared_ptr<const DepAtom>(), prefix));
else
_imp->set_use.push_back(SetUseConfigEntry(SetName(tokens.at(0)),
- DepAtom::ConstPointer(0), UseFlagName(prefix + t->substr(1)), use_disabled));
+ std::tr1::shared_ptr<const DepAtom>(), UseFlagName(prefix + t->substr(1)), use_disabled));
}
else if (':' == t->at(t->length() - 1))
{
@@ -592,12 +590,12 @@ DefaultConfig::DefaultConfig() :
}
else
_imp->set_use.push_back(SetUseConfigEntry(SetName(tokens.at(0)),
- DepAtom::ConstPointer(0), UseFlagName(prefix + *t), use_enabled));
+ std::tr1::shared_ptr<const DepAtom>(), UseFlagName(prefix + *t), use_enabled));
}
}
else
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(tokens.at(0)));
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
{
@@ -742,7 +740,7 @@ DefaultConfig::PackageKeywordsIterator
DefaultConfig::begin_package_keywords(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r;
+ std::pair<std::tr1::shared_ptr<const PackageDepAtom>, KeywordName> > >::const_iterator r;
if (_imp->keywords.end() != ((r = _imp->keywords.find(d))))
return PackageKeywordsIterator(r->second.begin());
else
@@ -753,7 +751,7 @@ DefaultConfig::PackageKeywordsIterator
DefaultConfig::end_package_keywords(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r;
+ std::pair<std::tr1::shared_ptr<const PackageDepAtom>, KeywordName> > >::const_iterator r;
if (_imp->keywords.end() != ((r = _imp->keywords.find(d))))
return PackageKeywordsIterator(r->second.end());
else
@@ -776,7 +774,7 @@ DefaultConfig::PackageLicensesIterator
DefaultConfig::begin_package_licenses(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
+ std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > >::const_iterator r;
if (_imp->licenses.end() != ((r = _imp->licenses.find(d))))
return PackageLicensesIterator(r->second.begin());
else
@@ -787,7 +785,7 @@ DefaultConfig::PackageLicensesIterator
DefaultConfig::end_package_licenses(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
+ std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > >::const_iterator r;
if (_imp->licenses.end() != ((r = _imp->licenses.find(d))))
return PackageLicensesIterator(r->second.end());
else
@@ -809,7 +807,7 @@ DefaultConfig::end_default_licenses() const
DefaultConfig::UserMasksIterator
DefaultConfig::begin_user_masks(const QualifiedPackageName & d) const
{
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
+ std::map<QualifiedPackageName, std::vector<std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator r;
if (_imp->user_masks.end() != ((r = _imp->user_masks.find(d))))
return UserMasksIterator(indirect_iterator<const PackageDepAtom>(r->second.begin()));
else
@@ -819,7 +817,7 @@ DefaultConfig::begin_user_masks(const QualifiedPackageName & d) const
DefaultConfig::UserMasksIterator
DefaultConfig::end_user_masks(const QualifiedPackageName & d) const
{
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
+ std::map<QualifiedPackageName, std::vector<std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator r;
if (_imp->user_masks.end() != ((r = _imp->user_masks.find(d))))
return UserMasksIterator(indirect_iterator<const PackageDepAtom>(r->second.end()));
else
@@ -829,7 +827,7 @@ DefaultConfig::end_user_masks(const QualifiedPackageName & d) const
DefaultConfig::UserUnmasksIterator
DefaultConfig::begin_user_unmasks(const QualifiedPackageName & d) const
{
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
+ std::map<QualifiedPackageName, std::vector<std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator r;
if (_imp->user_unmasks.end() != ((r = _imp->user_unmasks.find(d))))
return UserUnmasksIterator(indirect_iterator<const PackageDepAtom>(r->second.begin()));
else
@@ -839,7 +837,7 @@ DefaultConfig::begin_user_unmasks(const QualifiedPackageName & d) const
DefaultConfig::UserUnmasksIterator
DefaultConfig::end_user_unmasks(const QualifiedPackageName & d) const
{
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
+ std::map<QualifiedPackageName, std::vector<std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator r;
if (_imp->user_unmasks.end() != ((r = _imp->user_unmasks.find(d))))
return UserUnmasksIterator(indirect_iterator<const PackageDepAtom>(r->second.end()));
else
@@ -929,7 +927,7 @@ DefaultConfig::end_use_prefixes_with_minus_star() const
DefaultConfig::PackageUseMinusStarIterator
DefaultConfig::begin_package_use_prefixes_with_minus_star(const QualifiedPackageName & d) const
{
- std::map<QualifiedPackageName, std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
+ std::map<QualifiedPackageName, std::vector<std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > >::const_iterator r;
if (_imp->use_prefixes_that_have_minus_star.end() != ((r = _imp->use_prefixes_that_have_minus_star.find(d))))
return PackageUseMinusStarIterator(r->second.begin());
else
@@ -939,7 +937,7 @@ DefaultConfig::begin_package_use_prefixes_with_minus_star(const QualifiedPackage
DefaultConfig::PackageUseMinusStarIterator
DefaultConfig::end_package_use_prefixes_with_minus_star(const QualifiedPackageName & d) const
{
- std::map<QualifiedPackageName, std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
+ std::map<QualifiedPackageName, std::vector<std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > >::const_iterator r;
if (_imp->use_prefixes_that_have_minus_star.end() != ((r = _imp->use_prefixes_that_have_minus_star.find(d))))
return PackageUseMinusStarIterator(r->second.end());
else
diff --git a/paludis/environment/default/default_config.hh b/paludis/environment/default/default_config.hh
index a804b8b..fb8327b 100644
--- a/paludis/environment/default/default_config.hh
+++ b/paludis/environment/default/default_config.hh
@@ -75,10 +75,10 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE DefaultConfig :
- public InstantiationPolicy<DefaultConfig, instantiation_method::SingletonAsNeededTag>,
+ public InstantiationPolicy<DefaultConfig, instantiation_method::SingletonTag>,
private PrivateImplementationPattern<DefaultConfig>
{
- friend class InstantiationPolicy<DefaultConfig, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<DefaultConfig, instantiation_method::SingletonTag>;
private:
DefaultConfig();
@@ -112,7 +112,7 @@ namespace paludis
///\{
typedef libwrapiter::ForwardIterator<DefaultConfig,
- const std::pair<PackageDepAtom::ConstPointer, KeywordName> > PackageKeywordsIterator;
+ const std::pair<std::tr1::shared_ptr<const PackageDepAtom>, KeywordName> > PackageKeywordsIterator;
PackageKeywordsIterator begin_package_keywords(const QualifiedPackageName & d) const;
@@ -135,7 +135,7 @@ namespace paludis
///\{
typedef libwrapiter::ForwardIterator<DefaultConfig,
- const std::pair<PackageDepAtom::ConstPointer, std::string> > PackageLicensesIterator;
+ const std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > PackageLicensesIterator;
PackageLicensesIterator begin_package_licenses(const QualifiedPackageName & d) const;
@@ -200,7 +200,7 @@ namespace paludis
UseMinusStarIterator end_use_prefixes_with_minus_star() const;
typedef libwrapiter::ForwardIterator<DefaultConfig,
- const std::pair<PackageDepAtom::ConstPointer, std::string> > PackageUseMinusStarIterator;
+ const std::pair<std::tr1::shared_ptr<const PackageDepAtom>, std::string> > PackageUseMinusStarIterator;
PackageUseMinusStarIterator begin_package_use_prefixes_with_minus_star(const QualifiedPackageName &) const;
PackageUseMinusStarIterator end_package_use_prefixes_with_minus_star(const QualifiedPackageName &) const;
diff --git a/paludis/environment/default/default_environment.cc b/paludis/environment/default/default_environment.cc
index 690c4c2..a0c3aaf 100644
--- a/paludis/environment/default/default_environment.cc
+++ b/paludis/environment/default/default_environment.cc
@@ -38,7 +38,7 @@
using namespace paludis;
DefaultEnvironment::DefaultEnvironment() :
- Environment(PackageDatabase::Pointer(new PackageDatabase(this)))
+ Environment(std::tr1::shared_ptr<PackageDatabase>(new PackageDatabase(this)))
{
Context context("When loading default environment:");
@@ -59,11 +59,11 @@ namespace
std::unary_function<PackageDatabaseEntry, bool>
{
const Environment * const env;
- DepAtom::ConstPointer set;
+ std::tr1::shared_ptr<const DepAtom> set;
const PackageDatabaseEntry * dbe;
bool matched;
- IsInSet(const Environment * const e, DepAtom::ConstPointer s) :
+ IsInSet(const Environment * const e, std::tr1::shared_ptr<const DepAtom> s) :
env(e),
set(s),
matched(false)
@@ -91,7 +91,7 @@ namespace
if (matched)
return;
- if (match_package(env, a, *dbe))
+ if (match_package(*env, *a, *dbe))
matched = true;
}
@@ -126,9 +126,7 @@ bool
DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry * e) const
{
/* first check package database use masks... */
- const Repository * const repo((e ?
- package_database()->fetch_repository(e->repository).raw_pointer() :
- 0));
+ const Repository * const repo((e ? package_database()->fetch_repository(e->repository).get() : 0));
if (repo && repo->use_interface)
{
@@ -147,7 +145,7 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
if (u->flag_name != f)
continue;
- if (! match_package(this, *u->dep_atom, *e))
+ if (! match_package(*this, *u->dep_atom, *e))
continue;
Log::get_instance()->message(ll_debug, lc_no_context, "Forced use flag: "
@@ -170,7 +168,7 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
if (f != u->flag_name)
continue;
- if (! match_package(this, *u->dep_atom, *e))
+ if (! match_package(*this, *u->dep_atom, *e))
continue;
switch (u->flag_state)
@@ -212,7 +210,7 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
i_end(DefaultConfig::get_instance()->end_package_use_prefixes_with_minus_star(e->name)) ;
i != i_end ; ++i)
{
- if (! match_package(this, *i->first, *e))
+ if (! match_package(*this, *i->first, *e))
continue;
if (0 == i->second.compare(0, i->second.length(), stringify(f), 0, i->second.length()))
@@ -317,7 +315,7 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
bool consider_minus_star(true);
if (e && repo && repo->use_interface)
{
- UseFlagNameCollection::ConstPointer prefixes(repo->use_interface->use_expand_prefixes());
+ std::tr1::shared_ptr<const UseFlagNameCollection> prefixes(repo->use_interface->use_expand_prefixes());
for (UseFlagNameCollection::Iterator i(prefixes->begin()), i_end(prefixes->end()) ;
i != i_end ; ++i)
if (0 == i->data().compare(0, i->data().length(), stringify(f), 0, i->data().length()))
@@ -412,7 +410,7 @@ DefaultEnvironment::accept_keyword(const KeywordName & keyword, const PackageDat
k_end(DefaultConfig::get_instance()->end_package_keywords(d->name)) ;
k != k_end ; ++k)
{
- if (! match_package(this, k->first, d))
+ if (! match_package(*this, *k->first, *d))
continue;
if (k->second == minus_star_keyword)
@@ -480,7 +478,7 @@ DefaultEnvironment::accept_license(const std::string & license, const PackageDat
k_end(DefaultConfig::get_instance()->end_package_licenses(d->name)) ;
k != k_end ; ++k)
{
- if (! match_package(this, k->first, d))
+ if (! match_package(*this, *k->first, *d))
continue;
if (k->second == "-*")
@@ -504,7 +502,7 @@ DefaultEnvironment::query_user_masks(const PackageDatabaseEntry & d) const
k_end(DefaultConfig::get_instance()->end_user_masks(d.name)) ;
k != k_end ; ++k)
{
- if (! match_package(this, *k, d))
+ if (! match_package(*this, *k, d))
continue;
return true;
@@ -533,7 +531,7 @@ DefaultEnvironment::query_user_unmasks(const PackageDatabaseEntry & d) const
k_end(DefaultConfig::get_instance()->end_user_unmasks(d.name)) ;
k != k_end ; ++k)
{
- if (! match_package(this, *k, d))
+ if (! match_package(*this, *k, d))
continue;
return true;
@@ -698,7 +696,7 @@ DefaultEnvironment::syncers_dirs() const
return dirs;
}
-CompositeDepAtom::Pointer
+std::tr1::shared_ptr<CompositeDepAtom>
DefaultEnvironment::local_package_set(const SetName & s) const
{
Context context("When looking for package set '" + stringify(s) + "' in default environment:");
@@ -707,8 +705,8 @@ DefaultEnvironment::local_package_set(const SetName & s) const
if (ff.exists())
{
LineConfigFile f(ff);
- AllDepAtom::Pointer result(new AllDepAtom);
- GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(s, stringify(s) + ".conf"));
+ std::tr1::shared_ptr<AllDepAtom> result(new AllDepAtom);
+ std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(s, stringify(s) + ".conf"));
for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
@@ -722,19 +720,19 @@ DefaultEnvironment::local_package_set(const SetName & s) const
{
Log::get_instance()->message(ll_warning, lc_context, "Line '" + *line + "' in set file '"
+ stringify(ff) + "' does not specify '*' or '?', assuming '*'");
- PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(0)));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(tokens.at(0)));
atom->set_tag(tag);
result->add_child(atom);
}
else if ("*" == tokens.at(0))
{
- PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(1)));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(tokens.at(1)));
atom->set_tag(tag);
result->add_child(atom);
}
else if ("?" == tokens.at(0))
{
- PackageDepAtom::Pointer p(new PackageDepAtom(tokens.at(1)));
+ std::tr1::shared_ptr<PackageDepAtom> p(new PackageDepAtom(tokens.at(1)));
p->set_tag(tag);
if (! package_database()->query(PackageDepAtom(p->package()), is_installed_only, qo_whatever)->empty())
result->add_child(p);
@@ -751,13 +749,13 @@ DefaultEnvironment::local_package_set(const SetName & s) const
return result;
}
- return DepAtom::Pointer(0);
+ return std::tr1::shared_ptr<AllDepAtom>();
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
DefaultEnvironment::sets_list() const
{
- SetsCollection::Pointer result(new SetsCollection::Concrete);
+ std::tr1::shared_ptr<SetsCollection> result(new SetsCollection::Concrete);
if ((FSEntry(DefaultConfig::get_instance()->config_dir()) / "sets").exists())
for (DirIterator d(FSEntry(DefaultConfig::get_instance()->config_dir()) / "sets"), d_end ;
@@ -784,10 +782,10 @@ DefaultEnvironment::end_mirrors(const std::string & mirror) const
return DefaultConfig::get_instance()->end_mirrors(mirror);
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
DefaultEnvironment::known_use_expand_names(const UseFlagName & prefix, const PackageDatabaseEntry * pde) const
{
- UseFlagNameCollection::Pointer result(new UseFlagNameCollection::Concrete);
+ std::tr1::shared_ptr<UseFlagNameCollection> result(new UseFlagNameCollection::Concrete);
std::string prefix_lower;
std::transform(prefix.data().begin(), prefix.data().end(), std::back_inserter(prefix_lower), &::tolower);
@@ -805,7 +803,7 @@ DefaultEnvironment::known_use_expand_names(const UseFlagName & prefix, const Pac
if (! i->dep_atom)
continue;
- if (! match_package(this, *i->dep_atom, *pde))
+ if (! match_package(*this, *i->dep_atom, *pde))
continue;
if (i->flag_name.data().length() > prefix_lower.length() &&
diff --git a/paludis/environment/default/default_environment.hh b/paludis/environment/default/default_environment.hh
index 7babf7b..7153c02 100644
--- a/paludis/environment/default/default_environment.hh
+++ b/paludis/environment/default/default_environment.hh
@@ -39,9 +39,9 @@ namespace paludis
*/
class PALUDIS_VISIBLE DefaultEnvironment :
public Environment,
- public InstantiationPolicy<DefaultEnvironment, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<DefaultEnvironment, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<DefaultEnvironment, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<DefaultEnvironment, instantiation_method::SingletonTag>;
private:
DefaultEnvironment();
@@ -49,10 +49,10 @@ namespace paludis
~DefaultEnvironment();
protected:
- CompositeDepAtom::Pointer local_package_set(const SetName &) const;
+ std::tr1::shared_ptr<CompositeDepAtom> local_package_set(const SetName &) const;
public:
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
virtual bool query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
@@ -75,7 +75,7 @@ namespace paludis
virtual std::string paludis_command() const;
- virtual UseFlagNameCollection::ConstPointer known_use_expand_names(const UseFlagName &,
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> known_use_expand_names(const UseFlagName &,
const PackageDatabaseEntry *) const;
virtual void perform_hook(const Hook & hook) const;
diff --git a/paludis/environment/default/repository_config_entry.sr b/paludis/environment/default/repository_config_entry.sr
index fa1f8e8..c2c3a34 100644
--- a/paludis/environment/default/repository_config_entry.sr
+++ b/paludis/environment/default/repository_config_entry.sr
@@ -5,7 +5,7 @@ make_class_RepositoryConfigEntry()
{
key format std::string
key importance int
- key keys "AssociativeCollection<std::string, std::string>::Pointer"
+ key keys "std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> >"
doxygen_comment << "END"
/**
diff --git a/paludis/environment/default/use_config_entry.sr b/paludis/environment/default/use_config_entry.sr
index f25028e..c364eb3 100644
--- a/paludis/environment/default/use_config_entry.sr
+++ b/paludis/environment/default/use_config_entry.sr
@@ -3,7 +3,7 @@
make_class_UseConfigEntry()
{
- key dep_atom PackageDepAtom::ConstPointer
+ key dep_atom "std::tr1::shared_ptr<const PackageDepAtom>"
key flag_name UseFlagName
key flag_state UseFlagState
@@ -21,7 +21,7 @@ END
make_class_SetUseConfigEntry()
{
key set_name SetName
- key dep_atom DepAtom::ConstPointer
+ key dep_atom "std::tr1::shared_ptr<const DepAtom>"
key flag_name UseFlagName
key flag_state UseFlagState
@@ -39,7 +39,7 @@ END
make_class_SetUseConfigMinusStarEntry()
{
key set_name SetName
- key dep_atom DepAtom::ConstPointer
+ key dep_atom "std::tr1::shared_ptr<const DepAtom>"
key prefix std::string
doxygen_comment << "END"
@@ -56,7 +56,7 @@ END
make_class_SetKeywordConfigEntry()
{
key set_name SetName
- key dep_atom DepAtom::ConstPointer
+ key dep_atom "std::tr1::shared_ptr<const DepAtom>"
key keyword KeywordName
doxygen_comment << "END"
@@ -73,7 +73,7 @@ END
make_class_SetLicenseConfigEntry()
{
key set_name SetName
- key dep_atom DepAtom::ConstPointer
+ key dep_atom "std::tr1::shared_ptr<const DepAtom>"
key license std::string
doxygen_comment << "END"
@@ -90,7 +90,7 @@ END
make_class_SetMaskConfigEntry()
{
key set_name SetName
- key dep_atom DepAtom::ConstPointer
+ key dep_atom "std::tr1::shared_ptr<const DepAtom>"
doxygen_comment << "END"
/**
diff --git a/paludis/environment/no_config/no_config_environment.cc b/paludis/environment/no_config/no_config_environment.cc
index 4dd785a..6533912 100644
--- a/paludis/environment/no_config/no_config_environment.cc
+++ b/paludis/environment/no_config/no_config_environment.cc
@@ -34,15 +34,14 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<NoConfigEnvironment> :
- InternalCounted<Implementation<NoConfigEnvironment> >
+ struct Implementation<NoConfigEnvironment>
{
const FSEntry top_level_dir;
const FSEntry write_cache;
bool accept_unstable;
bool is_vdb;
- PortageRepository::Pointer portage_repo;
+ std::tr1::shared_ptr<PortageRepository> portage_repo;
Implementation(Environment * const env, const NoConfigEnvironmentParams & params);
};
@@ -111,14 +110,13 @@ Implementation<NoConfigEnvironment>::Implementation(
top_level_dir(params.repository_dir),
write_cache(params.write_cache),
accept_unstable(params.accept_unstable),
- is_vdb(is_vdb_repository(params.repository_dir, params.repository_type)),
- portage_repo(0)
+ is_vdb(is_vdb_repository(params.repository_dir, params.repository_type))
{
Context context("When initialising NoConfigEnvironment at '" + stringify(params.repository_dir) + "':");
if (! is_vdb)
{
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
@@ -128,15 +126,16 @@ Implementation<NoConfigEnvironment>::Implementation(
keys->insert("names_cache", "/var/empty");
env->package_database()->add_repository(((portage_repo =
- RepositoryMaker::get_instance()->find_maker("ebuild")(env, keys))));
+ std::tr1::static_pointer_cast<PortageRepository>(
+ RepositoryMaker::get_instance()->find_maker("ebuild")(env, keys)))));
env->package_database()->add_repository(RepositoryMaker::get_instance()->find_maker("virtuals")(env,
- AssociativeCollection<std::string, std::string>::Pointer(0)));
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> >()));
}
else
{
Log::get_instance()->message(ll_debug, lc_context, "VDB, using vdb_db");
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
@@ -146,12 +145,12 @@ Implementation<NoConfigEnvironment>::Implementation(
env->package_database()->add_repository(RepositoryMaker::get_instance()->find_maker("vdb")(env, keys));
env->package_database()->add_repository(RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env,
- AssociativeCollection<std::string, std::string>::Pointer(0)));
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> >()));
}
}
NoConfigEnvironment::NoConfigEnvironment(const NoConfigEnvironmentParams & params) :
- Environment(PackageDatabase::Pointer(new PackageDatabase(this))),
+ Environment(std::tr1::shared_ptr<PackageDatabase>(new PackageDatabase(this))),
PrivateImplementationPattern<NoConfigEnvironment>(
new Implementation<NoConfigEnvironment>(this, params))
{
@@ -238,13 +237,13 @@ NoConfigEnvironment::set_accept_unstable(const bool value)
_imp->accept_unstable = value;
}
-PortageRepository::Pointer
+std::tr1::shared_ptr<PortageRepository>
NoConfigEnvironment::portage_repository()
{
return _imp->portage_repo;
}
-PortageRepository::ConstPointer
+std::tr1::shared_ptr<const PortageRepository>
NoConfigEnvironment::portage_repository() const
{
return _imp->portage_repo;
diff --git a/paludis/environment/no_config/no_config_environment.hh b/paludis/environment/no_config/no_config_environment.hh
index a211c9c..9aaed3e 100644
--- a/paludis/environment/no_config/no_config_environment.hh
+++ b/paludis/environment/no_config/no_config_environment.hh
@@ -78,8 +78,8 @@ namespace paludis
*/
void set_accept_unstable(const bool value);
- CountedPtr<PortageRepository> portage_repository();
- CountedPtr<const PortageRepository> portage_repository() const;
+ std::tr1::shared_ptr<PortageRepository> portage_repository();
+ std::tr1::shared_ptr<const PortageRepository> portage_repository() const;
};
}
diff --git a/paludis/environment/test/test_environment.cc b/paludis/environment/test/test_environment.cc
index 751bc07..07735db 100644
--- a/paludis/environment/test/test_environment.cc
+++ b/paludis/environment/test/test_environment.cc
@@ -31,7 +31,7 @@
using namespace paludis;
TestEnvironment::TestEnvironment() :
- Environment(PackageDatabase::Pointer(new PackageDatabase(this)))
+ Environment(std::tr1::shared_ptr<PackageDatabase>(new PackageDatabase(this)))
{
}
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 9c3d0c3..d4dc04c 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -28,30 +28,30 @@
using namespace paludis;
bool
-match_package_internals::do_match(
- const Environment * const env,
- const PackageDepAtom * const atom,
- const PackageDatabaseEntry * const entry)
+paludis::match_package(
+ const Environment & env,
+ const PackageDepAtom & atom,
+ const PackageDatabaseEntry & entry)
{
- if (atom->package() != entry->name)
+ if (atom.package() != entry.name)
return false;
- if (atom->version_requirements_ptr())
- switch (atom->version_requirements_mode())
+ if (atom.version_requirements_ptr())
+ switch (atom.version_requirements_mode())
{
case vr_and:
- for (VersionRequirements::Iterator r(atom->version_requirements_ptr()->begin()),
- r_end(atom->version_requirements_ptr()->end()) ; r != r_end ; ++r)
- if (! (((entry->version).*(r->version_operator.as_version_spec_operator()))(r->version_spec)))
+ for (VersionRequirements::Iterator r(atom.version_requirements_ptr()->begin()),
+ r_end(atom.version_requirements_ptr()->end()) ; r != r_end ; ++r)
+ if (! (((entry.version).*(r->version_operator.as_version_spec_operator()))(r->version_spec)))
return false;
break;
case vr_or:
{
bool matched(false);
- for (VersionRequirements::Iterator r(atom->version_requirements_ptr()->begin()),
- r_end(atom->version_requirements_ptr()->end()) ; r != r_end ; ++r)
- if ((((entry->version).*(r->version_operator.as_version_spec_operator()))(r->version_spec)))
+ for (VersionRequirements::Iterator r(atom.version_requirements_ptr()->begin()),
+ r_end(atom.version_requirements_ptr()->end()) ; r != r_end ; ++r)
+ if ((((entry.version).*(r->version_operator.as_version_spec_operator()))(r->version_spec)))
{
matched = true;
break;
@@ -66,24 +66,24 @@ match_package_internals::do_match(
;
}
- if (atom->repository_ptr())
- if (*atom->repository_ptr() != entry->repository)
+ if (atom.repository_ptr())
+ if (*atom.repository_ptr() != entry.repository)
return false;
- if (atom->slot_ptr() || atom->use_requirements_ptr())
+ if (atom.slot_ptr() || atom.use_requirements_ptr())
{
- VersionMetadata::ConstPointer metadata(env->package_database()->fetch_repository(
- entry->repository)->version_metadata(
- entry->name, entry->version));
+ std::tr1::shared_ptr<const VersionMetadata> metadata(env.package_database()->fetch_repository(
+ entry.repository)->version_metadata(
+ entry.name, entry.version));
- if (atom->slot_ptr())
- if (*atom->slot_ptr() != SlotName(metadata->slot))
+ if (atom.slot_ptr())
+ if (*atom.slot_ptr() != SlotName(metadata->slot))
return false;
- if (atom->use_requirements_ptr())
+ if (atom.use_requirements_ptr())
{
- for (UseRequirements::Iterator u(atom->use_requirements_ptr()->begin()),
- u_end(atom->use_requirements_ptr()->end()) ; u != u_end ; ++u)
+ for (UseRequirements::Iterator u(atom.use_requirements_ptr()->begin()),
+ u_end(atom.use_requirements_ptr()->end()) ; u != u_end ; ++u)
{
switch (u->second)
{
@@ -91,12 +91,12 @@ match_package_internals::do_match(
continue;
case use_enabled:
- if (! env->query_use(u->first, entry))
+ if (! env.query_use(u->first, &entry))
return false;
continue;
case use_disabled:
- if (env->query_use(u->first, entry))
+ if (env.query_use(u->first, &entry))
return false;
continue;
}
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index 66bcf78..c244a42 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -20,118 +20,14 @@
namespace paludis
{
/**
- * For internal use by match_package.
- *
- * \ingroup grpmatchpackage
- */
- namespace match_package_internals
- {
- /**
- * Do the match on a PackageDatabaseEntry.
- *
- * \ingroup grpmatchpackage
- */
- bool do_match(
- const Environment * const env,
- const PackageDepAtom * const atom,
- const PackageDatabaseEntry * const entry)
- PALUDIS_ATTRIBUTE((nonnull(1, 2, 3)));
-
- /**
- * Normalise env type.
- *
- * \ingroup grpmatchpackage
- */
- inline const Environment * sanitise_env(const Environment * env)
- {
- return env;
- }
-
- /**
- * Normalise DB type.
- *
- * \ingroup grpmatchpackage
- */
- template <typename P1_>
- inline const Environment * sanitise_env(const CountedPtr<const Environment, P1_> env)
- {
- return env.raw_pointer();
- }
-
- /**
- * Normalise atom type.
- *
- * \ingroup grpmatchpackage
- */
- inline const PackageDepAtom * sanitise_atom(const PackageDepAtom * atom)
- {
- return atom;
- }
-
- /**
- * Normalise atom type.
- *
- * \ingroup grpmatchpackage
- */
- inline const PackageDepAtom * sanitise_atom(const PackageDepAtom & atom)
- {
- return &atom;
- }
-
- /**
- * Normalise atom type.
- *
- * \ingroup grpmatchpackage
- */
- template <typename P1_>
- inline const PackageDepAtom * sanitise_atom(const CountedPtr<const PackageDepAtom, P1_> atom)
- {
- return atom.raw_pointer();
- }
-
- /**
- * Normalise target type.
- *
- * \ingroup grpmatchpackage
- */
- template <typename T_>
- inline const T_ * sanitise_target(const T_ * e)
- {
- return e;
- }
-
- /**
- * Normalise target type.
- *
- * \ingroup grpmatchpackage
- */
- template <typename T_>
- inline const T_ * sanitise_target(const T_ & e)
- {
- return &e;
- }
- }
-
- /**
* Return whether the specified atom matches the specified target.
*
- * \param env Some kind of environment
- * \param atom Some kind of package dep atom
- * \param target Some kind of target
- *
* \ingroup grpmatchpackage
*/
- template <typename Env_, typename Atom_, typename Target_>
bool match_package(
- const Env_ & env,
- const Atom_ & atom,
- const Target_ & target)
- {
- return match_package_internals::do_match(
- match_package_internals::sanitise_env(env),
- match_package_internals::sanitise_atom(atom),
- match_package_internals::sanitise_target(target));
- }
+ const Environment & env,
+ const PackageDepAtom & atom,
+ const PackageDatabaseEntry & target);
}
#endif
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 9a20744..a4706e3 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -135,13 +135,12 @@ namespace paludis
* \ingroup grppackagedatabase
*/
template<>
- struct Implementation<PackageDatabase> :
- InternalCounted<Implementation<PackageDatabase> >
+ struct Implementation<PackageDatabase>
{
/**
* Our Repository instances.
*/
- std::list<Repository::Pointer> repositories;
+ std::list<std::tr1::shared_ptr<Repository> > repositories;
/// Our environment.
const Environment * environment;
@@ -159,11 +158,11 @@ PackageDatabase::~PackageDatabase()
}
void
-PackageDatabase::add_repository(const Repository::Pointer r)
+PackageDatabase::add_repository(const std::tr1::shared_ptr<Repository> r)
{
Context c("When adding a repository named '" + stringify(r->name()) + "':");
- IndirectIterator<std::list<Repository::Pointer>::const_iterator, const Repository>
+ IndirectIterator<std::list<std::tr1::shared_ptr<Repository> >::const_iterator, const Repository>
r_c(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r_c != r_end ; ++r_c)
@@ -179,16 +178,16 @@ PackageDatabase::fetch_unique_qualified_package_name(
{
Context context("When disambiguating package name '" + stringify(p) + "':");
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
- IndirectIterator<std::list<Repository::Pointer>::const_iterator, const Repository>
+ IndirectIterator<std::list<std::tr1::shared_ptr<Repository> >::const_iterator, const Repository>
r(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
{
Context local_context("When looking in repository '" + stringify(r->name()) + "':");
- CategoryNamePartCollection::ConstPointer cats(r->category_names_containing_package(p));
+ std::tr1::shared_ptr<const CategoryNamePartCollection> cats(r->category_names_containing_package(p));
for (CategoryNamePartCollection::Iterator c(cats->begin()), c_end(cats->end()) ;
c != c_end ; ++c)
result->insert(*c + p);
@@ -202,19 +201,19 @@ PackageDatabase::fetch_unique_qualified_package_name(
return *(result->begin());
}
-PackageDatabaseEntryCollection::Pointer
+std::tr1::shared_ptr<PackageDatabaseEntryCollection>
PackageDatabase::query(const PackageDepAtom & a, const InstallState installed_state) const
{
return query(a, installed_state, qo_order_by_version);
}
-PackageDatabaseEntryCollection::Pointer
+std::tr1::shared_ptr<PackageDatabaseEntryCollection>
PackageDatabase::query(const PackageDepAtom & a, const InstallState installed_state,
const QueryOrder query_order) const
{
- PackageDatabaseEntryCollection::Concrete::Pointer result(new PackageDatabaseEntryCollection::Concrete);
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection::Concrete> result(new PackageDatabaseEntryCollection::Concrete);
- IndirectIterator<std::list<Repository::Pointer>::const_iterator, const Repository>
+ IndirectIterator<std::list<std::tr1::shared_ptr<Repository> >::const_iterator, const Repository>
r(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
@@ -225,12 +224,12 @@ PackageDatabase::query(const PackageDepAtom & a, const InstallState installed_st
if ((installed_state == is_installable_only) && ! r->installable_interface)
continue;
- VersionSpecCollection::ConstPointer versions(r->version_specs(a.package()));
+ std::tr1::shared_ptr<const VersionSpecCollection> versions(r->version_specs(a.package()));
VersionSpecCollection::Iterator v(versions->begin()), v_end(versions->end());
for ( ; v != v_end ; ++v)
{
PackageDatabaseEntry e(a.package(), *v, r->name());
- if (! match_package(_imp->environment, a, e))
+ if (! match_package(*_imp->environment, a, e))
continue;
result->push_back(e);
@@ -264,10 +263,10 @@ PackageDatabase::query(const PackageDepAtom & a, const InstallState installed_st
return result;
}
-Repository::ConstPointer
+std::tr1::shared_ptr<const Repository>
PackageDatabase::fetch_repository(const RepositoryName & n) const
{
- std::list<Repository::Pointer>::const_iterator
+ std::list<std::tr1::shared_ptr<Repository> >::const_iterator
r(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
@@ -277,10 +276,10 @@ PackageDatabase::fetch_repository(const RepositoryName & n) const
throw NoSuchRepositoryError(stringify(n));
}
-Repository::Pointer
+std::tr1::shared_ptr<Repository>
PackageDatabase::fetch_repository(const RepositoryName & n)
{
- std::list<Repository::Pointer>::const_iterator
+ std::list<std::tr1::shared_ptr<Repository> >::const_iterator
r(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 281dff3..a42a1dd 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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/dep_atom.hh>
#include <paludis/name.hh>
#include <paludis/repository.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/instantiation_policy.hh>
@@ -229,8 +228,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE PackageDatabase :
private PrivateImplementationPattern<PackageDatabase>,
- private InstantiationPolicy<PackageDatabase, instantiation_method::NonCopyableTag>,
- public InternalCounted<PackageDatabase>
+ private InstantiationPolicy<PackageDatabase, instantiation_method::NonCopyableTag>
{
private:
void _sort_package_database_entry_collection(
@@ -256,17 +254,17 @@ namespace paludis
* same name as the new Repository already exists in our
* collection.
*/
- void add_repository(Repository::Pointer);
+ void add_repository(std::tr1::shared_ptr<Repository>);
/**
* Fetch a named repository.
*/
- Repository::ConstPointer fetch_repository(const RepositoryName &) const;
+ std::tr1::shared_ptr<const Repository> fetch_repository(const RepositoryName &) const;
/**
* Fetch a named repository.
*/
- Repository::Pointer fetch_repository(const RepositoryName &);
+ std::tr1::shared_ptr<Repository> fetch_repository(const RepositoryName &);
/**
* Fetch the name of our 'favourite' repository (if a repository's
@@ -289,14 +287,14 @@ namespace paludis
*
* \deprecated Use the three argument form.
*/
- PackageDatabaseEntryCollection::Pointer query(
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> query(
const PackageDepAtom & a,
const InstallState) const PALUDIS_ATTRIBUTE((deprecated));
/**
* Query the repository.
*/
- PackageDatabaseEntryCollection::Pointer query(
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> query(
const PackageDepAtom & a,
const InstallState,
const QueryOrder) const;
@@ -309,7 +307,7 @@ namespace paludis
///\name Iterate over our repositories
///\{
- typedef libwrapiter::ForwardIterator<PackageDatabase, const Repository::Pointer> RepositoryIterator;
+ typedef libwrapiter::ForwardIterator<PackageDatabase, const std::tr1::shared_ptr<Repository> > RepositoryIterator;
RepositoryIterator begin_repositories() const;
diff --git a/paludis/package_database_TEST.cc b/paludis/package_database_TEST.cc
index 8cdf93b..50792f4 100644
--- a/paludis/package_database_TEST.cc
+++ b/paludis/package_database_TEST.cc
@@ -46,8 +46,8 @@ namespace test_cases
TestEnvironment e;
PackageDatabase & p(*e.package_database());
- FakeRepository::Pointer r1(new FakeRepository(&e, RepositoryName("repo1")));
- FakeRepository::Pointer r2(new FakeRepository(&e, RepositoryName("repo2")));
+ std::tr1::shared_ptr<FakeRepository> r1(new FakeRepository(&e, RepositoryName("repo1")));
+ std::tr1::shared_ptr<FakeRepository> r2(new FakeRepository(&e, RepositoryName("repo2")));
TEST_CHECK_THROWS(p.fetch_repository(RepositoryName("repo1")), NoSuchRepositoryError);
TEST_CHECK_THROWS(p.fetch_repository(RepositoryName("repo2")), NoSuchRepositoryError);
@@ -98,7 +98,7 @@ namespace test_cases
TestEnvironment e;
PackageDatabase & p(*e.package_database());
- FakeRepository::Pointer r1(new FakeRepository(&e, RepositoryName("repo1")));
+ std::tr1::shared_ptr<FakeRepository> r1(new FakeRepository(&e, RepositoryName("repo1")));
r1->add_version("r1c1", "r1c1p1", "1");
r1->add_version("r1c1", "r1c1p2", "1");
r1->add_version("r1c1", "r1c1p2", "2");
@@ -107,42 +107,42 @@ namespace test_cases
p.add_repository(r1);
TEST_CHECK(true);
- FakeRepository::Pointer r2(new FakeRepository(&e, RepositoryName("repo2")));
+ std::tr1::shared_ptr<FakeRepository> r2(new FakeRepository(&e, RepositoryName("repo2")));
r2->add_version("rac1", "rac1pa", "1");
r2->add_version("rac1", "rac1pa", "3");
p.add_repository(r2);
TEST_CHECK(true);
PackageDepAtom d1("r1c1/r1c1p1");
- const PackageDatabaseEntryCollection::Pointer q1(p.query(d1, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q1(p.query(d1, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q1->begin(), q1->end()), 1);
PackageDepAtom d2("r1c1/r1c1p2");
- const PackageDatabaseEntryCollection::Pointer q2(p.query(d2, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q2(p.query(d2, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q2->begin(), q2->end()), 2);
PackageDepAtom d3(">=r1c1/r1c1p2-1");
- const PackageDatabaseEntryCollection::Pointer q3(p.query(d3, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q3(p.query(d3, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q3->begin(), q3->end()), 2);
PackageDepAtom d4(">=r1c1/r1c1p2-2");
- const PackageDatabaseEntryCollection::Pointer q4(p.query(d4, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q4(p.query(d4, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q4->begin(), q4->end()), 1);
PackageDepAtom d5(">=r1c1/r1c1p2-3");
- const PackageDatabaseEntryCollection::Pointer q5(p.query(d5, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q5(p.query(d5, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q5->begin(), q5->end()), 0);
PackageDepAtom d6("<r1c1/r1c1p2-3");
- const PackageDatabaseEntryCollection::Pointer q6(p.query(d6, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q6(p.query(d6, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q6->begin(), q6->end()), 2);
PackageDepAtom d7("rac1/rac1pa");
- const PackageDatabaseEntryCollection::Pointer q7(p.query(d7, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q7(p.query(d7, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q7->begin(), q7->end()), 4);
PackageDepAtom d8("foo/bar");
- const PackageDatabaseEntryCollection::Pointer q8(p.query(d8, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q8(p.query(d8, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(std::distance(q8->begin(), q8->end()), 0);
}
} package_database_query_test;
@@ -156,7 +156,7 @@ namespace test_cases
TestEnvironment e;
PackageDatabase & p(*e.package_database());
- FakeRepository::Pointer r1(new FakeRepository(&e, RepositoryName("repo1")));
+ std::tr1::shared_ptr<FakeRepository> r1(new FakeRepository(&e, RepositoryName("repo1")));
r1->add_version("cat", "pkg", "1")->slot = SlotName("a");
r1->add_version("cat", "pkg", "2")->slot = SlotName("c");
r1->add_version("cat", "pkg", "3")->slot = SlotName("c");
@@ -164,7 +164,7 @@ namespace test_cases
p.add_repository(r1);
TEST_CHECK(true);
- FakeRepository::Pointer r2(new FakeRepository(&e, RepositoryName("repo2")));
+ std::tr1::shared_ptr<FakeRepository> r2(new FakeRepository(&e, RepositoryName("repo2")));
r2->add_version("cat", "pkg", "1")->slot = SlotName("a");
r2->add_version("cat", "pkg", "3")->slot = SlotName("b");
p.add_repository(r2);
@@ -172,11 +172,11 @@ namespace test_cases
PackageDepAtom d("cat/pkg");
- const PackageDatabaseEntryCollection::Pointer q1(p.query(d, is_any, qo_order_by_version));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q1(p.query(d, is_any, qo_order_by_version));
TEST_CHECK_EQUAL(join(q1->begin(), q1->end(), " "),
"cat/pkg-1::repo1 cat/pkg-1::repo2 cat/pkg-2::repo1 cat/pkg-3::repo1 cat/pkg-3::repo2 cat/pkg-4::repo1");
- const PackageDatabaseEntryCollection::Pointer q2(p.query(d, is_any, qo_group_by_slot));
+ const std::tr1::shared_ptr<PackageDatabaseEntryCollection> q2(p.query(d, is_any, qo_group_by_slot));
TEST_CHECK_EQUAL(join(q2->begin(), q2->end(), " "),
"cat/pkg-2::repo1 cat/pkg-3::repo1 cat/pkg-3::repo2 cat/pkg-1::repo1 cat/pkg-1::repo2 cat/pkg-4::repo1");
}
@@ -195,7 +195,7 @@ namespace test_cases
TestEnvironment e;
PackageDatabase & p(*e.package_database());
- FakeRepository::Pointer r1(new FakeRepository(&e, RepositoryName("repo1")));
+ std::tr1::shared_ptr<FakeRepository> r1(new FakeRepository(&e, RepositoryName("repo1")));
r1->add_package(CategoryNamePart("cat-one") + PackageNamePart("pkg-one"));
r1->add_package(CategoryNamePart("cat-one") + PackageNamePart("pkg-two"));
r1->add_package(CategoryNamePart("cat-two") + PackageNamePart("pkg-two"));
@@ -203,7 +203,7 @@ namespace test_cases
p.add_repository(r1);
TEST_CHECK(true);
- FakeRepository::Pointer r2(new FakeRepository(&e, RepositoryName("repo2")));
+ std::tr1::shared_ptr<FakeRepository> r2(new FakeRepository(&e, RepositoryName("repo2")));
r1->add_package(CategoryNamePart("cat-three") + PackageNamePart("pkg-three"));
r1->add_package(CategoryNamePart("cat-three") + PackageNamePart("pkg-four"));
p.add_repository(r2);
diff --git a/paludis/portage_dep_lexer.cc b/paludis/portage_dep_lexer.cc
index 0d24839..60ba655 100644
--- a/paludis/portage_dep_lexer.cc
+++ b/paludis/portage_dep_lexer.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -40,8 +40,7 @@ namespace paludis
* \ingroup grpdeplexer
*/
template<>
- struct Implementation<PortageDepLexer> :
- InternalCounted<Implementation<PortageDepLexer> >
+ struct Implementation<PortageDepLexer>
{
std::list<std::pair<PortageDepLexerLexeme, std::string> > tokens;
};
diff --git a/paludis/portage_dep_parser.cc b/paludis/portage_dep_parser.cc
index 1b48b8b..ecd56fc 100644
--- a/paludis/portage_dep_parser.cc
+++ b/paludis/portage_dep_parser.cc
@@ -61,13 +61,13 @@ namespace
};
}
-CompositeDepAtom::Pointer
+std::tr1::shared_ptr<CompositeDepAtom>
PortageDepParser::parse(const std::string & s, const PortageDepParserPolicyInterface * const policy)
{
Context context("When parsing dependency string '" + s + "':");
- std::stack<CompositeDepAtom::Pointer> stack;
- stack.push(CompositeDepAtom::Pointer(new AllDepAtom));
+ std::stack<std::tr1::shared_ptr<CompositeDepAtom> > stack;
+ stack.push(std::tr1::shared_ptr<CompositeDepAtom>(new AllDepAtom));
PortageDepParserState state(dps_initial);
PortageDepLexer lexer(s);
@@ -99,7 +99,7 @@ PortageDepParser::parse(const std::string & s, const PortageDepParserPolicyInter
case dpl_open_paren:
{
- CompositeDepAtom::Pointer a(new AllDepAtom);
+ std::tr1::shared_ptr<CompositeDepAtom> a(new AllDepAtom);
stack.top()->add_child(a);
stack.push(a);
state = dps_had_paren;
@@ -118,7 +118,7 @@ PortageDepParser::parse(const std::string & s, const PortageDepParserPolicyInter
case dpl_double_bar:
if (policy->permit_any_deps())
{
- CompositeDepAtom::Pointer a(new AnyDepAtom);
+ std::tr1::shared_ptr<CompositeDepAtom> a(new AnyDepAtom);
stack.top()->add_child(a);
stack.push(a);
state = dps_had_double_bar;
@@ -143,7 +143,7 @@ PortageDepParser::parse(const std::string & s, const PortageDepParserPolicyInter
"Use flag name '" + i->second + "' missing '?'");
f.erase(f.length() - 1);
- CompositeDepAtom::Pointer a(
+ std::tr1::shared_ptr<CompositeDepAtom> a(
new UseDepAtom(UseFlagName(f), inv));
stack.top()->add_child(a);
stack.push(a);
@@ -272,20 +272,20 @@ PortageDepParser::parse(const std::string & s, const PortageDepParserPolicyInter
if (stack.empty())
throw DepStringNestingError(s);
- CompositeDepAtom::Pointer result(stack.top());
+ std::tr1::shared_ptr<CompositeDepAtom> result(stack.top());
stack.pop();
if (! stack.empty())
throw DepStringNestingError(s);
return result;
}
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const CompositeDepAtom>
PortageDepParser::parse_depend(const std::string & s)
{
return PortageDepParser::parse(s);
}
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const CompositeDepAtom>
PortageDepParser::parse_license(const std::string & s)
{
return PortageDepParser::parse(s, PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance());
diff --git a/paludis/portage_dep_parser.hh b/paludis/portage_dep_parser.hh
index 47a6181..30dade1 100644
--- a/paludis/portage_dep_parser.hh
+++ b/paludis/portage_dep_parser.hh
@@ -22,7 +22,6 @@
#include <paludis/dep_atom.hh>
#include <paludis/portage_dep_lexer.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
#include <string>
@@ -80,7 +79,7 @@ namespace paludis
/**
* Create a new text atom from the provided string.
*/
- virtual CountedPtr<DepAtom> new_text_atom(const std::string &) const = 0;
+ virtual std::tr1::shared_ptr<DepAtom> new_text_atom(const std::string &) const = 0;
/**
* Are || ( ) deps permitted?
@@ -106,10 +105,10 @@ namespace paludis
class PortageDepParserPolicy :
public PortageDepParserPolicyInterface,
public InstantiationPolicy<PortageDepParserPolicy<TextAtom_, permit_any_>,
- instantiation_method::SingletonAsNeededTag>
+ instantiation_method::SingletonTag>
{
friend class InstantiationPolicy<PortageDepParserPolicy<TextAtom_, permit_any_>,
- instantiation_method::SingletonAsNeededTag>;
+ instantiation_method::SingletonTag>;
private:
PortageDepParserPolicy()
@@ -117,9 +116,9 @@ namespace paludis
}
public:
- virtual CountedPtr<DepAtom> new_text_atom(const std::string & s) const
+ virtual std::tr1::shared_ptr<DepAtom> new_text_atom(const std::string & s) const
{
- return CountedPtr<DepAtom>(new TextAtom_(s));
+ return std::tr1::shared_ptr<DepAtom>(new TextAtom_(s));
}
virtual bool permit_any_deps() const
@@ -140,10 +139,10 @@ namespace paludis
class PortageDepParserPolicy<PackageDepAtom, permit_any_> :
public PortageDepParserPolicyInterface,
public InstantiationPolicy<PortageDepParserPolicy<PackageDepAtom, permit_any_>,
- instantiation_method::SingletonAsNeededTag>
+ instantiation_method::SingletonTag>
{
friend class InstantiationPolicy<PortageDepParserPolicy<PackageDepAtom, permit_any_>,
- instantiation_method::SingletonAsNeededTag>;
+ instantiation_method::SingletonTag>;
private:
PortageDepParserPolicy()
@@ -151,13 +150,13 @@ namespace paludis
}
public:
- virtual CountedPtr<DepAtom> new_text_atom(const std::string & s) const
+ virtual std::tr1::shared_ptr<DepAtom> new_text_atom(const std::string & s) const
{
if ((! s.empty()) && ('!' == s.at(0)))
- return CountedPtr<DepAtom>(new BlockDepAtom(
- CountedPtr<PackageDepAtom>(new PackageDepAtom(s.substr(1)))));
+ return std::tr1::shared_ptr<DepAtom>(new BlockDepAtom(
+ std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom(s.substr(1)))));
else
- return CountedPtr<DepAtom>(new PackageDepAtom(s));
+ return std::tr1::shared_ptr<DepAtom>(new PackageDepAtom(s));
}
virtual bool permit_any_deps() const
@@ -184,18 +183,18 @@ namespace paludis
* Parse a given dependency string, and return an appropriate
* DepAtom tree.
*/
- static CompositeDepAtom::Pointer parse(const std::string & s,
+ static std::tr1::shared_ptr<CompositeDepAtom> parse(const std::string & s,
const PortageDepParserPolicyInterface * const policy = DefaultPolicy::get_instance());
/**
* Convenience wrapper for parse for depend strings, for VersionMetadata.
*/
- static DepAtom::ConstPointer parse_depend(const std::string & s);
+ static std::tr1::shared_ptr<const CompositeDepAtom> parse_depend(const std::string & s);
/**
* Convenience wrapper for parse for license strings, for VersionMetadata.
*/
- static DepAtom::ConstPointer parse_license(const std::string & s);
+ static std::tr1::shared_ptr<const CompositeDepAtom> parse_license(const std::string & s);
};
}
diff --git a/paludis/qa/create_metadata_check.cc b/paludis/qa/create_metadata_check.cc
index 4bd5627..1429969 100644
--- a/paludis/qa/create_metadata_check.cc
+++ b/paludis/qa/create_metadata_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -39,7 +39,7 @@ CreateMetadataCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
if ("UNKNOWN" == metadata->eapi)
diff --git a/paludis/qa/dep_any_check.cc b/paludis/qa/dep_any_check.cc
index 5eecd88..e759c66 100644
--- a/paludis/qa/dep_any_check.cc
+++ b/paludis/qa/dep_any_check.cc
@@ -106,7 +106,7 @@ DepAnyCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
if (metadata->deps_interface)
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index db045a4..0806121 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -58,7 +58,7 @@ namespace
void visit(const UseDepAtom * const u)
{
- Repository::ConstPointer r(env->package_database()->fetch_repository(env->package_database()->
+ std::tr1::shared_ptr<const Repository> r(env->package_database()->fetch_repository(env->package_database()->
favourite_repository()));
if (! r->use_interface)
@@ -81,7 +81,7 @@ namespace
do
{
bool found_match(false);
- UseFlagNameCollection::ConstPointer c(r->use_interface->use_expand_prefixes());
+ std::tr1::shared_ptr<const UseFlagNameCollection> c(r->use_interface->use_expand_prefixes());
for (UseFlagNameCollection::Iterator i(c->begin()), i_end(c->end()) ;
i != i_end ; ++i)
@@ -130,7 +130,7 @@ DepFlagsCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
if (metadata->ebuild_interface == 0)
diff --git a/paludis/qa/dep_packages_check.cc b/paludis/qa/dep_packages_check.cc
index 51be2fb..937f25c 100644
--- a/paludis/qa/dep_packages_check.cc
+++ b/paludis/qa/dep_packages_check.cc
@@ -84,7 +84,7 @@ DepPackagesCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
static std::set<QualifiedPackageName> suspicious_depend;
diff --git a/paludis/qa/deps_exist_check.cc b/paludis/qa/deps_exist_check.cc
index 47f75ad..bfac6d2 100644
--- a/paludis/qa/deps_exist_check.cc
+++ b/paludis/qa/deps_exist_check.cc
@@ -97,7 +97,7 @@ DepsExistCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
Checker depend_checker(result, "DEPEND", e.environment);
diff --git a/paludis/qa/deps_visible_check.cc b/paludis/qa/deps_visible_check.cc
index 8f35e78..a77af9b 100644
--- a/paludis/qa/deps_visible_check.cc
+++ b/paludis/qa/deps_visible_check.cc
@@ -63,7 +63,7 @@ namespace
return false;
/* arch flags aren't necessarily use masked. stupid! */
- UseFlagNameCollection::ConstPointer arch_flags(i->arch_flags());
+ std::tr1::shared_ptr<const UseFlagNameCollection> arch_flags(i->arch_flags());
if (stringify(u->flag()) != env->portage_repository()->profile_variable("ARCH"))
if (arch_flags->end() != arch_flags->find(u->flag()))
return u->inverse();
@@ -101,7 +101,7 @@ namespace
{
bool found(false);
std::string candidates;
- PackageDatabaseEntryCollection::Pointer matches(env->package_database()->query(
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> matches(env->package_database()->query(
*p, is_any, qo_order_by_version));
for (PackageDatabaseEntryCollection::ReverseIterator m(matches->rbegin()),
m_end(matches->rend()) ; m != m_end ; ++m)
@@ -132,7 +132,7 @@ namespace
void visit(const AnyDepAtom * const a)
{
- std::list<DepAtom::ConstPointer> viable_children;
+ std::list<std::tr1::shared_ptr<const DepAtom> > viable_children;
std::copy(a->begin(), a->end(), filter_inserter(std::back_inserter(viable_children),
IsViableAnyDepAtomChild(env, pde)));
@@ -140,7 +140,7 @@ namespace
return;
bool found(false);
- for (std::list<DepAtom::ConstPointer>::const_iterator c(viable_children.begin()),
+ for (std::list<std::tr1::shared_ptr<const DepAtom> >::const_iterator c(viable_children.begin()),
c_end(viable_children.end()) ; c != c_end && ! found ; ++c)
{
Save<CheckResult> save_result(&result);
@@ -192,7 +192,7 @@ DepsVisibleCheck::operator() (const PerProfileEbuildCheckData & e) const
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
bool unstable(false);
diff --git a/paludis/qa/description_check.cc b/paludis/qa/description_check.cc
index 74b311d..38892d8 100644
--- a/paludis/qa/description_check.cc
+++ b/paludis/qa/description_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -39,7 +39,7 @@ DescriptionCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
const std::string::size_type length(metadata->description.length());
diff --git a/paludis/qa/ebuild_check.hh b/paludis/qa/ebuild_check.hh
index f50d68a..70b7b2b 100644
--- a/paludis/qa/ebuild_check.hh
+++ b/paludis/qa/ebuild_check.hh
@@ -23,7 +23,6 @@
#include <paludis/name.hh>
#include <paludis/qa/check.hh>
#include <paludis/qa/check_result.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/version_spec.hh>
@@ -42,8 +41,7 @@ namespace paludis
* \ingroup grpqa
*/
class PALUDIS_VISIBLE EbuildCheck :
- public Check,
- public InternalCounted<EbuildCheck>
+ public Check
{
protected:
EbuildCheck();
@@ -74,10 +72,10 @@ namespace paludis
template <typename T_>
struct MakeEbuildCheck
{
- static EbuildCheck::Pointer
+ static std::tr1::shared_ptr<EbuildCheck>
make_ebuild_check()
{
- return EbuildCheck::Pointer(new T_);
+ return std::tr1::shared_ptr<EbuildCheck>(new T_);
}
};
@@ -87,11 +85,11 @@ namespace paludis
* \ingroup grpqa
*/
class EbuildCheckMaker :
- public VirtualConstructor<std::string, EbuildCheck::Pointer (*) (),
+ public VirtualConstructor<std::string, std::tr1::shared_ptr<EbuildCheck> (*) (),
virtual_constructor_not_found::ThrowException<NoSuchEbuildCheckTypeError> >,
- public InstantiationPolicy<EbuildCheckMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<EbuildCheckMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<EbuildCheckMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<EbuildCheckMaker, instantiation_method::SingletonTag>;
private:
EbuildCheckMaker();
diff --git a/paludis/qa/extract_check.cc b/paludis/qa/extract_check.cc
index 7fb1596..4d14858 100644
--- a/paludis/qa/extract_check.cc
+++ b/paludis/qa/extract_check.cc
@@ -83,7 +83,7 @@ ExtractCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
Checker checker;
diff --git a/paludis/qa/file_check.hh b/paludis/qa/file_check.hh
index 17e5a20..bbe55b9 100644
--- a/paludis/qa/file_check.hh
+++ b/paludis/qa/file_check.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -22,7 +22,6 @@
#include <paludis/qa/check.hh>
#include <paludis/qa/check_result.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/virtual_constructor.hh>
@@ -43,8 +42,7 @@ namespace paludis
* \ingroup grpqa
*/
class PALUDIS_VISIBLE FileCheck :
- public Check,
- public InternalCounted<FileCheck>
+ public Check
{
protected:
FileCheck();
@@ -75,7 +73,7 @@ namespace paludis
template <typename T_>
struct MakeFileCheck
{
- static FileCheck::Pointer make_file_check();
+ static std::tr1::shared_ptr<FileCheck> make_file_check();
};
/**
@@ -84,11 +82,11 @@ namespace paludis
* \ingroup grpqa
*/
class FileCheckMaker :
- public VirtualConstructor<std::string, FileCheck::Pointer (*) (),
+ public VirtualConstructor<std::string, std::tr1::shared_ptr<FileCheck> (*) (),
virtual_constructor_not_found::ThrowException<NoSuchFileCheckTypeError> >,
- public InstantiationPolicy<FileCheckMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<FileCheckMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<FileCheckMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<FileCheckMaker, instantiation_method::SingletonTag>;
private:
FileCheckMaker();
@@ -98,10 +96,10 @@ namespace paludis
}
template <typename T_>
-paludis::qa::FileCheck::Pointer
+std::tr1::shared_ptr<paludis::qa::FileCheck>
paludis::qa::MakeFileCheck<T_>::make_file_check()
{
- return paludis::qa::FileCheck::Pointer(new T_);
+ return std::tr1::shared_ptr<paludis::qa::FileCheck>(new T_);
}
#endif
diff --git a/paludis/qa/homepage_check.cc b/paludis/qa/homepage_check.cc
index 5638c79..6e49c21 100644
--- a/paludis/qa/homepage_check.cc
+++ b/paludis/qa/homepage_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,7 +38,7 @@ HomepageCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::string homepage(metadata->homepage);
diff --git a/paludis/qa/inherits_check.cc b/paludis/qa/inherits_check.cc
index 6e330a2..712722d 100644
--- a/paludis/qa/inherits_check.cc
+++ b/paludis/qa/inherits_check.cc
@@ -46,7 +46,7 @@ InheritsCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::set<std::string> inherits;
diff --git a/paludis/qa/iuse_check.cc b/paludis/qa/iuse_check.cc
index 5b9584c..97b244a 100644
--- a/paludis/qa/iuse_check.cc
+++ b/paludis/qa/iuse_check.cc
@@ -48,7 +48,7 @@ IuseCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->
version_metadata(ee.name, ee.version));
diff --git a/paludis/qa/keywords_check.cc b/paludis/qa/keywords_check.cc
index 98333d2..fe210f1 100644
--- a/paludis/qa/keywords_check.cc
+++ b/paludis/qa/keywords_check.cc
@@ -40,7 +40,7 @@ KeywordsCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
try
diff --git a/paludis/qa/license_check.cc b/paludis/qa/license_check.cc
index f63b488..0a9e595 100644
--- a/paludis/qa/license_check.cc
+++ b/paludis/qa/license_check.cc
@@ -88,17 +88,16 @@ LicenseCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::string license(metadata->license_interface->license_string);
- DepAtom::ConstPointer license_parts(0);
+ std::tr1::shared_ptr<const DepAtom> license_parts;
try
{
- license_parts = PortageDepParser::parse(license,
- PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance());
+ license_parts = metadata->license_interface->license();
Checker checker(result, e.environment);
license_parts->accept(&checker);
diff --git a/paludis/qa/metadata_file.cc b/paludis/qa/metadata_file.cc
index ab5b288..f880a58 100644
--- a/paludis/qa/metadata_file.cc
+++ b/paludis/qa/metadata_file.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,8 +35,7 @@ using namespace paludis::qa;
namespace paludis
{
template<>
- class Implementation<MetadataFile> :
- public InternalCounted<Implementation<MetadataFile> >
+ class Implementation<MetadataFile>
{
private:
std::string _email, _name;
diff --git a/paludis/qa/package_dir_check.hh b/paludis/qa/package_dir_check.hh
index 3441814..9bb61f0 100644
--- a/paludis/qa/package_dir_check.hh
+++ b/paludis/qa/package_dir_check.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -22,7 +22,6 @@
#include <paludis/qa/check.hh>
#include <paludis/qa/check_result.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/virtual_constructor.hh>
@@ -43,8 +42,7 @@ namespace paludis
* \ingroup grpqa
*/
class PackageDirCheck :
- public Check,
- public InternalCounted<PackageDirCheck>
+ public Check
{
protected:
PackageDirCheck();
@@ -75,10 +73,10 @@ namespace paludis
template <typename T_>
struct MakePackageDirCheck
{
- static PackageDirCheck::Pointer
+ static std::tr1::shared_ptr<PackageDirCheck>
make_package_dir_check()
{
- return PackageDirCheck::Pointer(new T_);
+ return std::tr1::shared_ptr<PackageDirCheck>(new T_);
}
};
@@ -88,11 +86,11 @@ namespace paludis
* \ingroup grpqa
*/
class PackageDirCheckMaker :
- public VirtualConstructor<std::string, PackageDirCheck::Pointer (*) (),
+ public VirtualConstructor<std::string, std::tr1::shared_ptr<PackageDirCheck> (*) (),
virtual_constructor_not_found::ThrowException<NoSuchPackageDirCheckTypeError> >,
- public InstantiationPolicy<PackageDirCheckMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<PackageDirCheckMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<PackageDirCheckMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<PackageDirCheckMaker, instantiation_method::SingletonTag>;
private:
PackageDirCheckMaker();
diff --git a/paludis/qa/parse_deps_check.cc b/paludis/qa/parse_deps_check.cc
index b73d85e..0bfc91d 100644
--- a/paludis/qa/parse_deps_check.cc
+++ b/paludis/qa/parse_deps_check.cc
@@ -39,7 +39,7 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
try
diff --git a/paludis/qa/pdepend_overlap_check.cc b/paludis/qa/pdepend_overlap_check.cc
index 0bab7ef..899fdf4 100644
--- a/paludis/qa/pdepend_overlap_check.cc
+++ b/paludis/qa/pdepend_overlap_check.cc
@@ -75,7 +75,7 @@ PdependOverlapCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
Collector pdepend_collector;
diff --git a/paludis/qa/per_profile_ebuild_check.hh b/paludis/qa/per_profile_ebuild_check.hh
index 76449be..120a69d 100644
--- a/paludis/qa/per_profile_ebuild_check.hh
+++ b/paludis/qa/per_profile_ebuild_check.hh
@@ -23,7 +23,6 @@
#include <paludis/name.hh>
#include <paludis/qa/check.hh>
#include <paludis/qa/check_result.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/version_spec.hh>
@@ -43,8 +42,7 @@ namespace paludis
* \ingroup grpqa
*/
class PALUDIS_VISIBLE PerProfileEbuildCheck :
- public Check,
- public InternalCounted<PerProfileEbuildCheck>
+ public Check
{
protected:
PerProfileEbuildCheck();
@@ -75,10 +73,10 @@ namespace paludis
template <typename T_>
struct MakePerProfileEbuildCheck
{
- static PerProfileEbuildCheck::Pointer
+ static std::tr1::shared_ptr<PerProfileEbuildCheck>
make_per_profile_ebuild_check()
{
- return PerProfileEbuildCheck::Pointer(new T_);
+ return std::tr1::shared_ptr<PerProfileEbuildCheck>(new T_);
}
};
@@ -88,11 +86,11 @@ namespace paludis
* \ingroup grpqa
*/
class PerProfileEbuildCheckMaker :
- public VirtualConstructor<std::string, PerProfileEbuildCheck::Pointer (*) (),
+ public VirtualConstructor<std::string, std::tr1::shared_ptr<PerProfileEbuildCheck> (*) (),
virtual_constructor_not_found::ThrowException<NoSuchPerProfileEbuildCheckTypeError> >,
- public InstantiationPolicy<PerProfileEbuildCheckMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<PerProfileEbuildCheckMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<PerProfileEbuildCheckMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<PerProfileEbuildCheckMaker, instantiation_method::SingletonTag>;
private:
PerProfileEbuildCheckMaker();
diff --git a/paludis/qa/profile_check.hh b/paludis/qa/profile_check.hh
index 2b530bc..b1eb67f 100644
--- a/paludis/qa/profile_check.hh
+++ b/paludis/qa/profile_check.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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/qa/check.hh>
#include <paludis/qa/check_result.hh>
#include <paludis/repositories/portage/portage_repository.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/virtual_constructor.hh>
@@ -46,8 +45,7 @@ namespace paludis
* \ingroup grpqa
*/
class PALUDIS_VISIBLE ProfileCheck :
- public Check,
- public InternalCounted<ProfileCheck>
+ public Check
{
protected:
ProfileCheck();
@@ -78,7 +76,7 @@ namespace paludis
template <typename T_>
struct MakeProfileCheck
{
- static ProfileCheck::Pointer make_profile_check();
+ static std::tr1::shared_ptr<ProfileCheck> make_profile_check();
};
/**
@@ -87,11 +85,11 @@ namespace paludis
* \ingroup grpqa
*/
class ProfileCheckMaker :
- public VirtualConstructor<std::string, ProfileCheck::Pointer (*) (),
+ public VirtualConstructor<std::string, std::tr1::shared_ptr<ProfileCheck> (*) (),
virtual_constructor_not_found::ThrowException<NoSuchProfileCheckTypeError> >,
- public InstantiationPolicy<ProfileCheckMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<ProfileCheckMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<ProfileCheckMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<ProfileCheckMaker, instantiation_method::SingletonTag>;
private:
ProfileCheckMaker();
@@ -101,12 +99,10 @@ namespace paludis
}
template <typename T_>
-paludis::qa::ProfileCheck::Pointer
+std::tr1::shared_ptr<paludis::qa::ProfileCheck>
paludis::qa::MakeProfileCheck<T_>::make_profile_check()
{
- return paludis::qa::ProfileCheck::Pointer(new T_);
+ return std::tr1::shared_ptr<paludis::qa::ProfileCheck>(new T_);
}
-
-
#endif
diff --git a/paludis/qa/profiles_check.hh b/paludis/qa/profiles_check.hh
index e12fac1..a952657 100644
--- a/paludis/qa/profiles_check.hh
+++ b/paludis/qa/profiles_check.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -22,7 +22,6 @@
#include <paludis/qa/check.hh>
#include <paludis/qa/check_result.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/virtual_constructor.hh>
@@ -43,8 +42,7 @@ namespace paludis
* \ingroup grpqa
*/
class PALUDIS_VISIBLE ProfilesCheck :
- public Check,
- public InternalCounted<ProfilesCheck>
+ public Check
{
protected:
ProfilesCheck();
@@ -75,7 +73,7 @@ namespace paludis
template <typename T_>
struct MakeProfilesCheck
{
- static ProfilesCheck::Pointer make_profiles_check();
+ static std::tr1::shared_ptr<ProfilesCheck> make_profiles_check();
};
/**
@@ -84,11 +82,11 @@ namespace paludis
* \ingroup grpqa
*/
class ProfilesCheckMaker :
- public VirtualConstructor<std::string, ProfilesCheck::Pointer (*) (),
+ public VirtualConstructor<std::string, std::tr1::shared_ptr<ProfilesCheck> (*) (),
virtual_constructor_not_found::ThrowException<NoSuchProfilesCheckTypeError> >,
- public InstantiationPolicy<ProfilesCheckMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<ProfilesCheckMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<ProfilesCheckMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<ProfilesCheckMaker, instantiation_method::SingletonTag>;
private:
ProfilesCheckMaker();
@@ -98,10 +96,10 @@ namespace paludis
}
template <typename T_>
-paludis::qa::ProfilesCheck::Pointer
+std::tr1::shared_ptr<paludis::qa::ProfilesCheck>
paludis::qa::MakeProfilesCheck<T_>::make_profiles_check()
{
- return paludis::qa::ProfilesCheck::Pointer(new T_);
+ return std::tr1::shared_ptr<paludis::qa::ProfilesCheck>(new T_);
}
#endif
diff --git a/paludis/qa/qa_environment.sr b/paludis/qa/qa_environment.sr
index c7e9909..13cfe53 100644
--- a/paludis/qa/qa_environment.sr
+++ b/paludis/qa/qa_environment.sr
@@ -6,7 +6,7 @@ make_class_PackageDatabasesEntry()
key arch UseFlagName
key location FSEntry
key status std::string
- key package_database PackageDatabase::Pointer
+ key package_database "std::tr1::shared_ptr<PackageDatabase>"
allow_named_args
}
diff --git a/paludis/qa/restrict_check.cc b/paludis/qa/restrict_check.cc
index fc02cc3..8a5c682 100644
--- a/paludis/qa/restrict_check.cc
+++ b/paludis/qa/restrict_check.cc
@@ -42,7 +42,7 @@ RestrictCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::set<std::string> restricts;
diff --git a/paludis/qa/slot_check.cc b/paludis/qa/slot_check.cc
index 931ce83..9b0b189 100644
--- a/paludis/qa/slot_check.cc
+++ b/paludis/qa/slot_check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,7 +38,7 @@ SlotCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
try
diff --git a/paludis/qa/src_uri_check.cc b/paludis/qa/src_uri_check.cc
index fffb076..52b3aef 100644
--- a/paludis/qa/src_uri_check.cc
+++ b/paludis/qa/src_uri_check.cc
@@ -138,12 +138,12 @@ SrcUriCheck::operator() (const EbuildCheckData & e) const
{
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
- VersionMetadata::ConstPointer metadata(
+ std::tr1::shared_ptr<const VersionMetadata> metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::string src_uri(metadata->ebuild_interface->src_uri);
- DepAtom::ConstPointer src_uri_parts(0);
+ std::tr1::shared_ptr<const DepAtom> src_uri_parts;
try
{
src_uri_parts = PortageDepParser::parse(src_uri,
diff --git a/paludis/repositories/cran/cran_dep_parser.cc b/paludis/repositories/cran/cran_dep_parser.cc
index 456487e..3de5f37 100644
--- a/paludis/repositories/cran/cran_dep_parser.cc
+++ b/paludis/repositories/cran/cran_dep_parser.cc
@@ -9,12 +9,12 @@
using namespace paludis;
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const CompositeDepAtom>
CRANDepParser::parse(const std::string & s)
{
Context context("When parsing CRAN 'Depends:' string: '" + s + "':");
- CompositeDepAtom::Pointer result(new AllDepAtom);
+ std::tr1::shared_ptr<CompositeDepAtom> result(new AllDepAtom);
Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> atom_tokeniser(",");
std::list<std::string> atoms;
@@ -53,7 +53,7 @@ CRANDepParser::parse(const std::string & s)
atom_string = name;
else
atom_string = range + name + "-" + version;
- PackageDepAtom::Pointer atom(new PackageDepAtom(atom_string));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(atom_string));
result->add_child(atom);
}
diff --git a/paludis/repositories/cran/cran_dep_parser.hh b/paludis/repositories/cran/cran_dep_parser.hh
index d0c13d5..c862db2 100644
--- a/paludis/repositories/cran/cran_dep_parser.hh
+++ b/paludis/repositories/cran/cran_dep_parser.hh
@@ -17,7 +17,7 @@ namespace paludis
/**
* Parse function.
*/
- static DepAtom::ConstPointer parse(const std::string & s);
+ static std::tr1::shared_ptr<const CompositeDepAtom> parse(const std::string & s);
};
}
diff --git a/paludis/repositories/cran/cran_description.hh b/paludis/repositories/cran/cran_description.hh
index 81a4abc..b1522b7 100644
--- a/paludis/repositories/cran/cran_description.hh
+++ b/paludis/repositories/cran/cran_description.hh
@@ -39,7 +39,7 @@ namespace paludis
VersionSpec version;
/// Our metadata, may be zero.
- VersionMetadata::Pointer metadata;
+ std::tr1::shared_ptr<VersionMetadata> metadata;
/// Our installed date.
time_t installed_time;
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 98724eb..e767d55 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -48,11 +48,10 @@ using namespace paludis;
namespace paludis
{
/// Map for metadata.
- typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>, VersionMetadata::Pointer>::Type MetadataMap;
+ typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>, std::tr1::shared_ptr<VersionMetadata> >::Type MetadataMap;
template <>
- struct Implementation<CRANInstalledRepository> :
- InternalCounted<Implementation<CRANInstalledRepository> >
+ struct Implementation<CRANInstalledRepository>
{
CRANInstalledRepositoryParams params;
@@ -189,7 +188,7 @@ CRANInstalledRepository::CRANInstalledRepository(const CRANInstalledRepositoryPa
"cran_installed"),
PrivateImplementationPattern<CRANInstalledRepository>(new Implementation<CRANInstalledRepository>(p))
{
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("location", stringify(_imp->location));
config_info->add_kv("root", stringify(_imp->root));
@@ -227,18 +226,18 @@ CRANInstalledRepository::do_has_package_named(const QualifiedPackageName & q) co
return r.first != r.second;
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
CRANInstalledRepository::do_category_names() const
{
if (! _imp->entries_valid)
_imp->load_entries();
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
result->insert(CategoryNamePart("cran"));
return result;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
CRANInstalledRepository::do_package_names(const CategoryNamePart & c) const
{
Context context("When fetching package names in category '" + stringify(c)
@@ -247,7 +246,7 @@ CRANInstalledRepository::do_package_names(const CategoryNamePart & c) const
if (! _imp->entries_valid)
_imp->load_entries();
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
if (! do_has_category_named(c))
return result;
@@ -258,13 +257,13 @@ CRANInstalledRepository::do_package_names(const CategoryNamePart & c) const
return result;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
CRANInstalledRepository::do_version_specs(const QualifiedPackageName & n) const
{
Context context("When fetching versions of '" + stringify(n) + "' in "
+ stringify(name()) + ":");
- VersionSpecCollection::Pointer result(new VersionSpecCollection::Concrete);
+ std::tr1::shared_ptr<VersionSpecCollection> result(new VersionSpecCollection::Concrete);
if (! _imp->entries_valid)
_imp->load_entries();
@@ -284,7 +283,7 @@ CRANInstalledRepository::do_has_version(const QualifiedPackageName & q,
Context context("When checking for version '" + stringify(v) + "' in '"
+ stringify(q) + "' in " + stringify(name()) + ":");
- VersionSpecCollection::ConstPointer versions(do_version_specs(q));
+ std::tr1::shared_ptr<const VersionSpecCollection> versions(do_version_specs(q));
return versions->end() != versions->find(v);
}
@@ -314,7 +313,7 @@ namespace
}
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
CRANInstalledRepository::do_version_metadata(
const QualifiedPackageName & q, const VersionSpec & v) const
{
@@ -328,7 +327,7 @@ CRANInstalledRepository::do_version_metadata(
if (! has_version(q, v))
throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
- VersionMetadata::Pointer result(0);
+ std::tr1::shared_ptr<VersionMetadata> result;
FSEntry d(_imp->location);
d /= stringify(q.package);
@@ -340,7 +339,7 @@ CRANInstalledRepository::do_version_metadata(
// Don't put this into CRANDescription, as it's only relevant to CRANInstalledRepository
std::string repo(file_contents(_imp->location, q, "REPOSITORY"));
if (! repo.empty())
- description.metadata->origins_interface->source.assign(new PackageDatabaseEntry(stringify(q.package), v,
+ description.metadata->origins_interface->source.reset(new PackageDatabaseEntry(stringify(q.package), v,
RepositoryName(repo)));
result = description.metadata;
}
@@ -349,7 +348,7 @@ CRANInstalledRepository::do_version_metadata(
Log::get_instance()->message(ll_warning, lc_no_context, "has_version failed for request for '" +
stringify(q) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "': No DESCRIPTION file present.");
- result.assign(new CRANVersionMetadata(true));
+ result.reset(new CRANVersionMetadata(true));
result->eapi = "UNKNOWN";
return result;
}
@@ -358,14 +357,14 @@ CRANInstalledRepository::do_version_metadata(
return result;
}
-Contents::ConstPointer
+std::tr1::shared_ptr<const Contents>
CRANInstalledRepository::do_contents(
const QualifiedPackageName & q, const VersionSpec & v) const
{
Context context("When fetching contents for " + stringify(q) +
"-" + stringify(v));
- Contents::Pointer result(new Contents);
+ std::tr1::shared_ptr<Contents> result(new Contents);
if (! _imp->entries_valid)
_imp->load_entries();
@@ -410,11 +409,11 @@ CRANInstalledRepository::do_contents(
}
if ("obj" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsFileEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsFileEntry(tokens.at(1))));
else if ("dir" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsDirEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsDirEntry(tokens.at(1))));
else if ("misc" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsMiscEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsMiscEntry(tokens.at(1))));
else if ("sym" == tokens.at(0))
{
if (tokens.size() < 4)
@@ -426,7 +425,7 @@ CRANInstalledRepository::do_contents(
continue;
}
- result->add(ContentsEntry::Pointer(new ContentsSymEntry(
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsSymEntry(
tokens.at(1), tokens.at(3))));
}
}
@@ -476,10 +475,10 @@ CRANInstalledRepository::do_installed_time(const QualifiedPackageName & q,
}
}
-CountedPtr<Repository>
+std::tr1::shared_ptr<Repository>
CRANInstalledRepository::make_cran_installed_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
Context context("When making CRAN installed repository from repo_file '" +
(m->end() == m->find("repo_file") ? std::string("?") : m->find("repo_file")->second) + "':");
@@ -496,7 +495,7 @@ CRANInstalledRepository::make_cran_installed_repository(
if (m->end() == m->find("world") || ((world = m->find("world")->second)).empty())
world = location + "/world";
- return CountedPtr<Repository>(new CRANInstalledRepository(CRANInstalledRepositoryParams::create()
+ return std::tr1::shared_ptr<Repository>(new CRANInstalledRepository(CRANInstalledRepositoryParams::create()
.environment(env)
.location(location)
.root(root)
@@ -526,7 +525,7 @@ CRANInstalledRepository::do_uninstall(const QualifiedPackageName & q, const Vers
throw PackageInstallActionError("Couldn't uninstall '" + stringify(q) + "-" +
stringify(v) + "' because its location ('" + stringify(_imp->location) + "') is not a directory");
- VersionMetadata::ConstPointer vm(do_version_metadata(q, v));
+ std::tr1::shared_ptr<const VersionMetadata> vm(do_version_metadata(q, v));
MakeEnvCommand cmd(LIBEXECDIR "/paludis/cran.bash unmerge", "");
cmd = cmd("PN", vm->cran_interface->package);
@@ -539,7 +538,7 @@ CRANInstalledRepository::do_uninstall(const QualifiedPackageName & q, const Vers
throw PackageUninstallActionError("Couldn't unmerge '" + stringify(q) + "-" + stringify(v) + "'");
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
CRANInstalledRepository::do_package_set(const SetName & s) const
{
Context context("When fetching package set '" + stringify(s) + "' from '" +
@@ -547,14 +546,14 @@ CRANInstalledRepository::do_package_set(const SetName & s) const
if ("everything" == s.data())
{
- AllDepAtom::Pointer result(new AllDepAtom);
+ std::tr1::shared_ptr<AllDepAtom> result(new AllDepAtom);
if (! _imp->entries_valid)
_imp->load_entries();
for (std::vector<CRANDescription>::const_iterator p(_imp->entries.begin()),
p_end(_imp->entries.end()) ; p != p_end ; ++p)
{
- PackageDepAtom::Pointer atom(new PackageDepAtom(p->name));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(p->name));
result->add_child(atom);
}
@@ -562,7 +561,7 @@ CRANInstalledRepository::do_package_set(const SetName & s) const
}
else if ("world" == s.data())
{
- AllDepAtom::Pointer result(new AllDepAtom);
+ std::tr1::shared_ptr<AllDepAtom> result(new AllDepAtom);
if (_imp->world_file.exists())
{
@@ -571,7 +570,7 @@ CRANInstalledRepository::do_package_set(const SetName & s) const
for (LineConfigFile::Iterator line(world.begin()), line_end(world.end()) ;
line != line_end ; ++line)
{
- PackageDepAtom::Pointer atom(new PackageDepAtom(QualifiedPackageName(*line)));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(QualifiedPackageName(*line)));
result->add_child(atom);
}
}
@@ -582,15 +581,15 @@ CRANInstalledRepository::do_package_set(const SetName & s) const
return result;
}
else
- return DepAtom::Pointer(0);
+ return std::tr1::shared_ptr<DepAtom>();
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
CRANInstalledRepository::sets_list() const
{
Context context("While generating the list of sets:");
- SetsCollection::Pointer result(new SetsCollection::Concrete);
+ std::tr1::shared_ptr<SetsCollection> result(new SetsCollection::Concrete);
result->insert(SetName("everything"));
result->insert(SetName("world"));
return result;
@@ -599,7 +598,7 @@ CRANInstalledRepository::sets_list() const
void
CRANInstalledRepository::invalidate()
{
- _imp.assign(new Implementation<CRANInstalledRepository>(_imp->params));
+ _imp.reset(new Implementation<CRANInstalledRepository>(_imp->params));
}
void
diff --git a/paludis/repositories/cran/cran_installed_repository.hh b/paludis/repositories/cran/cran_installed_repository.hh
index f23ba29..b0f7157 100644
--- a/paludis/repositories/cran/cran_installed_repository.hh
+++ b/paludis/repositories/cran/cran_installed_repository.hh
@@ -58,22 +58,22 @@ namespace paludis
virtual bool do_has_package_named(const QualifiedPackageName &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
virtual bool do_has_version(const QualifiedPackageName &,
const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
- virtual Contents::ConstPointer do_contents(
+ virtual std::tr1::shared_ptr<const Contents> do_contents(
const QualifiedPackageName &,
const VersionSpec &) const;
@@ -86,9 +86,9 @@ namespace paludis
virtual void do_uninstall(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &) const;
- virtual DepAtom::Pointer do_package_set(const SetName &) const;
+ virtual std::tr1::shared_ptr<DepAtom> do_package_set(const SetName &) const;
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
public:
/**
@@ -99,9 +99,9 @@ namespace paludis
/**
* Virtual constructor.
*/
- static CountedPtr<Repository> make_cran_installed_repository(
+ static std::tr1::shared_ptr<Repository> make_cran_installed_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m);
/**
* Destructor.
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 87df9a7..ffc6d7d 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -79,7 +79,7 @@ namespace paludis
typedef MakeHashedMap<std::string, std::list<std::string> >::Type MirrorMap;
/// Map for metadata.
- typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>, VersionMetadata::Pointer>::Type MetadataMap;
+ typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>, std::tr1::shared_ptr<VersionMetadata> >::Type MetadataMap;
/**
* Implementation data for a CRANRepository.
@@ -87,8 +87,7 @@ namespace paludis
* \ingroup grpportagerepository
*/
template <>
- struct Implementation<CRANRepository> :
- InternalCounted<Implementation<CRANRepository> >
+ struct Implementation<CRANRepository>
{
CRANRepositoryParams params;
@@ -187,7 +186,7 @@ CRANRepository::CRANRepository(const CRANRepositoryParams & p) :
"cran"),
PrivateImplementationPattern<CRANRepository>(new Implementation<CRANRepository>(p))
{
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("location", stringify(_imp->location));
config_info->add_kv("distdir", stringify(_imp->distdir));
@@ -227,18 +226,18 @@ CRANRepository::do_has_package_named(const QualifiedPackageName & q) const
return _imp->package_names.end() != _imp->package_names.find(q);
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
CRANRepository::do_category_names() const
{
Context context("When fetching category names in " + stringify(name()) + ":");
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
result->insert(CategoryNamePart("cran"));
return result;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
CRANRepository::do_package_names(const CategoryNamePart & c) const
{
Context context("When fetching package names in category '" + stringify(c)
@@ -246,7 +245,7 @@ CRANRepository::do_package_names(const CategoryNamePart & c) const
need_packages();
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
if (! do_has_category_named(c))
return result;
@@ -257,7 +256,7 @@ CRANRepository::do_package_names(const CategoryNamePart & c) const
return result;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
CRANRepository::do_version_specs(const QualifiedPackageName & n) const
{
Context context("When fetching versions of '" + stringify(n) + "' in "
@@ -265,7 +264,7 @@ CRANRepository::do_version_specs(const QualifiedPackageName & n) const
need_packages();
- VersionSpecCollection::Pointer result(new VersionSpecCollection::Concrete);
+ std::tr1::shared_ptr<VersionSpecCollection> result(new VersionSpecCollection::Concrete);
if (_imp->version_specs.end() != _imp->version_specs.find(n))
result->insert(_imp->version_specs.find(n)->second);
@@ -384,7 +383,7 @@ CRANRepository::fetch_repo_name(const std::string & location)
return RepositoryName("cran-" + modified_location);
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
CRANRepository::do_version_metadata(
const QualifiedPackageName & q, const VersionSpec & v) const
{
@@ -398,7 +397,7 @@ CRANRepository::do_version_metadata(
if (! has_version(q, v))
throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
- VersionMetadata::Pointer result(new CRANVersionMetadata(false));
+ std::tr1::shared_ptr<VersionMetadata> result(new CRANVersionMetadata(false));
FSEntry d(_imp->location);
PackageNamePart p(q.package);
@@ -416,7 +415,7 @@ CRANRepository::do_version_metadata(
Log::get_instance()->message(ll_warning, lc_no_context, "has_version failed for request for '" +
stringify(q) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "': File '" + n + ".DESCRIPTION' not present.");
- result.assign(new CRANVersionMetadata(false));
+ result.reset(new CRANVersionMetadata(false));
result->eapi = "UNKNOWN";
}
@@ -424,10 +423,10 @@ CRANRepository::do_version_metadata(
return result;
}
-CountedPtr<Repository>
+std::tr1::shared_ptr<Repository>
CRANRepository::make_cran_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
Context context("When making CRAN repository from repo_file '" +
(m->end() == m->find("repo_file") ? std::string("?") : m->find("repo_file")->second) + "':");
@@ -460,7 +459,7 @@ CRANRepository::make_cran_repository(
if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
root = "/";
- return CountedPtr<Repository>(new CRANRepository(CRANRepositoryParams::create()
+ return std::tr1::shared_ptr<Repository>(new CRANRepository(CRANRepositoryParams::create()
.environment(env)
.location(location)
.distdir(distdir)
@@ -489,7 +488,7 @@ CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
{
PackageNamePart pn(q.package);
CategoryNamePart c("cran");
- VersionMetadata::ConstPointer vm(do_version_metadata(q, vn));
+ std::tr1::shared_ptr<const VersionMetadata> vm(do_version_metadata(q, vn));
if (vm->cran_interface->is_bundle_member)
{
@@ -564,7 +563,7 @@ CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
return;
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
CRANRepository::do_package_set(const SetName & s) const
{
if ("base" == s.data())
@@ -573,18 +572,18 @@ CRANRepository::do_package_set(const SetName & s) const
* \todo Implement system as all package which are installed
* by dev-lang/R by default.
*/
- return AllDepAtom::Pointer(new AllDepAtom);
+ return std::tr1::shared_ptr<AllDepAtom>(new AllDepAtom);
}
else
- return DepAtom::Pointer(0);
+ return std::tr1::shared_ptr<DepAtom>();
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
CRANRepository::sets_list() const
{
Context context("While generating the list of sets:");
- SetsCollection::Pointer result(new SetsCollection::Concrete);
+ std::tr1::shared_ptr<SetsCollection> result(new SetsCollection::Concrete);
result->insert(SetName("base"));
return result;
}
@@ -613,6 +612,6 @@ CRANRepository::do_sync() const
void
CRANRepository::invalidate()
{
- _imp.assign(new Implementation<CRANRepository>(_imp->params));
+ _imp.reset(new Implementation<CRANRepository>(_imp->params));
}
diff --git a/paludis/repositories/cran/cran_repository.hh b/paludis/repositories/cran/cran_repository.hh
index a9547dc..4bfa4a5 100644
--- a/paludis/repositories/cran/cran_repository.hh
+++ b/paludis/repositories/cran/cran_repository.hh
@@ -65,18 +65,18 @@ namespace paludis
virtual bool do_has_package_named(const QualifiedPackageName &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
virtual bool do_has_version(const QualifiedPackageName &,
const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
@@ -85,9 +85,9 @@ namespace paludis
virtual void do_install(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &) const;
- virtual DepAtom::Pointer do_package_set(const SetName &) const;
+ virtual std::tr1::shared_ptr<DepAtom> do_package_set(const SetName &) const;
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
virtual bool do_sync() const;
@@ -100,9 +100,9 @@ namespace paludis
/**
* Virtual constructor.
*/
- static CountedPtr<Repository> make_cran_repository(
+ static std::tr1::shared_ptr<Repository> make_cran_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m);
/**
* Destructor.
diff --git a/paludis/repositories/cran/cran_repository_TEST.cc b/paludis/repositories/cran/cran_repository_TEST.cc
index f4561ba..40bdb6a 100644
--- a/paludis/repositories/cran/cran_repository_TEST.cc
+++ b/paludis/repositories/cran/cran_repository_TEST.cc
@@ -51,13 +51,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "cran");
keys->insert("library", "cran_repository_TEST_dir/library");
keys->insert("location", "cran_repository_TEST_dir/repo1");
keys->insert("buildroot", "cran_repository_TEST_dir/tmp");
- CRANRepository::Pointer repo(CRANRepository::make_cran_repository(
+ std::tr1::shared_ptr<Repository> repo(CRANRepository::make_cran_repository(
&env, keys));
TEST_CHECK(repo->has_category_named(CategoryNamePart("cran")));
TEST_CHECK(repo->has_package_named(QualifiedPackageName("cran/testpackage1")));
@@ -77,13 +77,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "cran");
keys->insert("library", "cran_repository_TEST_dir/library");
keys->insert("location", "cran_repository_TEST_dir/repo2");
keys->insert("buildroot", "cran_repository_TEST_dir/tmp");
- CRANRepository::Pointer repo(CRANRepository::make_cran_repository(
+ std::tr1::shared_ptr<Repository> repo(CRANRepository::make_cran_repository(
&env, keys));
TEST_CHECK(repo->has_package_named(QualifiedPackageName("cran/testbundle")));
TEST_CHECK(repo->has_package_named(QualifiedPackageName("cran/bundlepkg1")));
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 500ff2e..8f535cb 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -51,28 +51,28 @@ FakeInstalledRepository::is_suitable_destination_for(const PackageDatabaseEntry
return true;
}
-FakeInstalledRepository::ProvidesCollection::ConstPointer
+std::tr1::shared_ptr<const FakeInstalledRepository::ProvidesCollection>
FakeInstalledRepository::provided_packages() const
{
- ProvidesCollection::Pointer result(new ProvidesCollection::Concrete);
+ std::tr1::shared_ptr<ProvidesCollection> result(new ProvidesCollection::Concrete);
- CategoryNamePartCollection::ConstPointer cats(category_names());
+ std::tr1::shared_ptr<const CategoryNamePartCollection> cats(category_names());
for (CategoryNamePartCollection::Iterator c(cats->begin()), c_end(cats->end()) ;
c != c_end ; ++c)
{
- QualifiedPackageNameCollection::ConstPointer pkgs(package_names(*c));
+ std::tr1::shared_ptr<const QualifiedPackageNameCollection> pkgs(package_names(*c));
for (QualifiedPackageNameCollection::Iterator p(pkgs->begin()), p_end(pkgs->end()) ;
p != p_end ; ++p)
{
- VersionSpecCollection::ConstPointer vers(version_specs(*p));
+ std::tr1::shared_ptr<const VersionSpecCollection> vers(version_specs(*p));
for (VersionSpecCollection::Iterator v(vers->begin()), v_end(vers->end()) ;
v != v_end ; ++v)
{
- VersionMetadata::ConstPointer m(version_metadata(*p, *v));
+ std::tr1::shared_ptr<const VersionMetadata> m(version_metadata(*p, *v));
if (! m->ebuild_interface)
continue;
- DepAtom::ConstPointer provide(PortageDepParser::parse(m->ebuild_interface->provide_string,
+ std::tr1::shared_ptr<const DepAtom> provide(PortageDepParser::parse(m->ebuild_interface->provide_string,
PortageDepParserPolicy<PackageDepAtom, false>::get_instance()));
PackageDatabaseEntry dbe(*p, *v, name());
DepAtomFlattener f(environment(), &dbe, provide);
@@ -89,11 +89,11 @@ FakeInstalledRepository::provided_packages() const
return result;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
FakeInstalledRepository::provided_package_version_metadata(const RepositoryProvidesEntry & p) const
{
- VersionMetadata::ConstPointer m(version_metadata(p.provided_by_name, p.version));
- FakeVirtualVersionMetadata::Pointer result(new FakeVirtualVersionMetadata(
+ std::tr1::shared_ptr<const VersionMetadata> m(version_metadata(p.provided_by_name, p.version));
+ std::tr1::shared_ptr<FakeVirtualVersionMetadata> result(new FakeVirtualVersionMetadata(
m->slot, PackageDatabaseEntry(p.provided_by_name, p.version, name())));
if (m->license_interface)
diff --git a/paludis/repositories/fake/fake_installed_repository.hh b/paludis/repositories/fake/fake_installed_repository.hh
index fadd246..ba14379 100644
--- a/paludis/repositories/fake/fake_installed_repository.hh
+++ b/paludis/repositories/fake/fake_installed_repository.hh
@@ -36,9 +36,9 @@ namespace paludis
public RepositoryProvidesInterface
{
protected:
- virtual ProvidesCollection::ConstPointer provided_packages() const;
+ virtual std::tr1::shared_ptr<const ProvidesCollection> provided_packages() const;
- virtual VersionMetadata::ConstPointer provided_package_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> provided_package_version_metadata(
const RepositoryProvidesEntry &) const;
public:
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 3f39183..6f7af2c 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -51,18 +51,18 @@ FakeRepository::do_install(const QualifiedPackageName &, const VersionSpec &,
{
}
-FakeRepository::VirtualsCollection::ConstPointer
+std::tr1::shared_ptr<const FakeRepository::VirtualsCollection>
FakeRepository::virtual_packages() const
{
return _virtual_packages;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
FakeRepository::virtual_package_version_metadata(
const RepositoryVirtualsEntry & p, const VersionSpec & v) const
{
- VersionMetadata::ConstPointer m(version_metadata(p.provided_by_atom->package(), v));
- FakeVirtualVersionMetadata::Pointer result(new FakeVirtualVersionMetadata(
+ std::tr1::shared_ptr<const VersionMetadata> m(version_metadata(p.provided_by_atom->package(), v));
+ std::tr1::shared_ptr<FakeVirtualVersionMetadata> result(new FakeVirtualVersionMetadata(
m->slot, PackageDatabaseEntry(p.provided_by_atom->package(), v, name())));
if (m->license_interface)
@@ -76,7 +76,7 @@ FakeRepository::virtual_package_version_metadata(
}
void
-FakeRepository::add_virtual_package(const QualifiedPackageName & q, PackageDepAtom::ConstPointer p)
+FakeRepository::add_virtual_package(const QualifiedPackageName & q, std::tr1::shared_ptr<const PackageDepAtom> p)
{
_virtual_packages->insert(RepositoryVirtualsEntry(q, p));
}
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index 94b66a4..02fc271 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -35,24 +35,21 @@ namespace paludis
public RepositoryVirtualsInterface
{
private:
- VirtualsCollection::Pointer _virtual_packages;
+ std::tr1::shared_ptr<VirtualsCollection> _virtual_packages;
protected:
virtual void do_install(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &) const;
- virtual VirtualsCollection::ConstPointer virtual_packages() const;
+ virtual std::tr1::shared_ptr<const VirtualsCollection> virtual_packages() const;
- virtual VersionMetadata::ConstPointer virtual_package_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> virtual_package_version_metadata(
const RepositoryVirtualsEntry &, const VersionSpec & v) const;
public:
FakeRepository(const Environment * const, const RepositoryName &);
- void add_virtual_package(const QualifiedPackageName &, PackageDepAtom::ConstPointer);
-
- typedef CountedPtr<const FakeRepository, count_policy::InternalCountTag> ConstPointer;
- typedef CountedPtr<FakeRepository, count_policy::InternalCountTag> Pointer;
+ void add_virtual_package(const QualifiedPackageName &, std::tr1::shared_ptr<const PackageDepAtom>);
};
}
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index f15cd2c..4da8914 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -42,23 +42,22 @@ namespace paludis
*/
template<>
struct Implementation<FakeRepositoryBase> :
- private InstantiationPolicy<Implementation<FakeRepositoryBase>, instantiation_method::NonCopyableTag>,
- InternalCounted<Implementation<FakeRepositoryBase> >
+ private InstantiationPolicy<Implementation<FakeRepositoryBase>, instantiation_method::NonCopyableTag>
{
/// Our category names.
- CategoryNamePartCollection::Pointer category_names;
+ std::tr1::shared_ptr<CategoryNamePartCollection> category_names;
/// Our package names.
- std::map<CategoryNamePart, PackageNamePartCollection::Pointer > package_names;
+ std::map<CategoryNamePart, std::tr1::shared_ptr<PackageNamePartCollection> > package_names;
/// Our versions.
- std::map<QualifiedPackageName, VersionSpecCollection::Pointer > versions;
+ std::map<QualifiedPackageName, std::tr1::shared_ptr<VersionSpecCollection> > versions;
/// Our metadata.
- std::map<std::string, VersionMetadata::Pointer > metadata;
+ std::map<std::string, std::tr1::shared_ptr<VersionMetadata> > metadata;
/// Our sets.
- std::map<SetName, DepAtom::Pointer > sets;
+ std::map<SetName, std::tr1::shared_ptr<DepAtom> > sets;
/// (Empty) provides map.
const std::map<QualifiedPackageName, QualifiedPackageName> provide_map;
@@ -84,7 +83,7 @@ FakeRepositoryBase::FakeRepositoryBase(const Environment * const e,
RepositoryUseInterface(),
PrivateImplementationPattern<FakeRepositoryBase>(new Implementation<FakeRepositoryBase>(e))
{
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("format", "fake");
_info->add_section(config_info);
@@ -108,16 +107,16 @@ FakeRepositoryBase::do_has_package_named(const QualifiedPackageName & q) const
_imp->package_names.find(q.category)->second->find(q.package));
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
FakeRepositoryBase::do_category_names() const
{
return _imp->category_names;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
FakeRepositoryBase::do_package_names(const CategoryNamePart & c) const
{
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
if (! has_category_named(c))
return result;
@@ -128,13 +127,13 @@ FakeRepositoryBase::do_package_names(const CategoryNamePart & c) const
return result;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
FakeRepositoryBase::do_version_specs(const QualifiedPackageName & n) const
{
if (! has_category_named(n.category))
- return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
+ return std::tr1::shared_ptr<VersionSpecCollection>(new VersionSpecCollection::Concrete);
if (! has_package_named(n))
- return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
+ return std::tr1::shared_ptr<VersionSpecCollection>(new VersionSpecCollection::Concrete);
return _imp->versions.find(n)->second;
}
@@ -164,21 +163,21 @@ FakeRepositoryBase::add_package(const QualifiedPackageName & q)
_imp->versions.insert(std::make_pair(q, new VersionSpecCollection::Concrete));
}
-VersionMetadata::Pointer
+std::tr1::shared_ptr<VersionMetadata>
FakeRepositoryBase::add_version(const QualifiedPackageName & q, const VersionSpec & v)
{
add_package(q);
_imp->versions.find(q)->second->insert(v);
_imp->metadata.insert(
std::make_pair(stringify(q) + "-" + stringify(v),
- VersionMetadata::Pointer(new FakeVersionMetadata)));
- VersionMetadata::Pointer r(_imp->metadata.find(stringify(q) + "-" + stringify(v))->second);
+ std::tr1::shared_ptr<VersionMetadata>(new FakeVersionMetadata)));
+ std::tr1::shared_ptr<VersionMetadata> r(_imp->metadata.find(stringify(q) + "-" + stringify(v))->second);
r->slot = SlotName("0");
r->eapi = "0";
return r;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
FakeRepositoryBase::do_version_metadata(
const QualifiedPackageName & q, const VersionSpec & v) const
{
@@ -218,10 +217,10 @@ FakeRepositoryBase::do_query_use_force(const UseFlagName &, const PackageDatabas
return false;
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
FakeRepositoryBase::do_arch_flags() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
bool
@@ -235,22 +234,22 @@ FakeRepositoryBase::invalidate()
{
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
FakeRepositoryBase::do_use_expand_flags() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
FakeRepositoryBase::do_use_expand_hidden_prefixes() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
FakeRepositoryBase::do_use_expand_prefixes() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
UseFlagName
@@ -266,27 +265,27 @@ FakeRepositoryBase::do_use_expand_value(const UseFlagName & u) const
}
void
-FakeRepositoryBase::add_package_set(const SetName & n, DepAtom::Pointer s)
+FakeRepositoryBase::add_package_set(const SetName & n, std::tr1::shared_ptr<DepAtom> s)
{
_imp->sets.insert(std::make_pair(n, s));
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
FakeRepositoryBase::do_package_set(const SetName & id) const
{
- std::map<SetName, DepAtom::Pointer >::const_iterator i(_imp->sets.find(id));
+ std::map<SetName, std::tr1::shared_ptr<DepAtom> >::const_iterator i(_imp->sets.find(id));
if (_imp->sets.end() == i)
- return DepAtom::Pointer(0);
+ return std::tr1::shared_ptr<DepAtom>();
else
return i->second;
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
FakeRepositoryBase::sets_list() const
{
- SetsCollection::Pointer result(new SetsCollection::Concrete);
+ std::tr1::shared_ptr<SetsCollection> result(new SetsCollection::Concrete);
std::copy(_imp->sets.begin(), _imp->sets.end(),
- transform_inserter(result->inserter(), SelectFirst<SetName, DepAtom::Pointer>()));
+ transform_inserter(result->inserter(), SelectFirst<SetName, std::tr1::shared_ptr<DepAtom> >()));
return result;
}
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index ccb92c2..f6b5fb7 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -90,10 +90,10 @@ namespace paludis
virtual UseFlagState do_query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
virtual bool do_query_use_mask(const UseFlagName &, const PackageDatabaseEntry *) const;
virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const;
- virtual UseFlagNameCollection::ConstPointer do_arch_flags() const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_flags() const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_hidden_prefixes() const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_prefixes() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_arch_flags() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_flags() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_hidden_prefixes() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_prefixes() const;
virtual UseFlagName do_use_expand_name(const UseFlagName & u) const;
virtual UseFlagName do_use_expand_value(const UseFlagName & u) const;
virtual std::string do_describe_use_flag(const UseFlagName &,
@@ -105,18 +105,18 @@ namespace paludis
virtual bool do_has_package_named(const QualifiedPackageName &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
virtual bool do_has_version(const QualifiedPackageName &,
const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
@@ -128,8 +128,8 @@ namespace paludis
virtual bool do_is_licence(const std::string &) const;
- virtual DepAtom::Pointer do_package_set(const SetName & id) const;
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<DepAtom> do_package_set(const SetName & id) const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
protected:
/**
@@ -159,7 +159,7 @@ namespace paludis
* Add a version, and a package and category if necessary, and set some
* default values for its metadata, and return said metadata.
*/
- VersionMetadata::Pointer add_version(
+ std::tr1::shared_ptr<VersionMetadata> add_version(
const QualifiedPackageName &, const VersionSpec &);
/**
@@ -167,7 +167,7 @@ namespace paludis
* default values for its metadata, and return said metadata (convenience
* overload taking strings).
*/
- VersionMetadata::Pointer add_version(
+ std::tr1::shared_ptr<VersionMetadata> add_version(
const std::string & c, const std::string & p, const std::string & v)
{
return add_version(CategoryNamePart(c) + PackageNamePart(p), VersionSpec(v));
@@ -176,17 +176,7 @@ namespace paludis
/**
* Add a package set.
*/
- void add_package_set(const SetName &, DepAtom::Pointer);
-
- /**
- * A non-constant smart pointer to ourself.
- */
- typedef CountedPtr<FakeRepositoryBase, count_policy::InternalCountTag> Pointer;
-
- /**
- * A constant smart pointer to ourself.
- */
- typedef CountedPtr<const FakeRepositoryBase, count_policy::InternalCountTag> ConstPointer;
+ void add_package_set(const SetName &, std::tr1::shared_ptr<DepAtom>);
virtual void invalidate();
diff --git a/paludis/repositories/gems/cache.cc b/paludis/repositories/gems/cache.cc
index 7d6daef..34bb33f 100644
--- a/paludis/repositories/gems/cache.cc
+++ b/paludis/repositories/gems/cache.cc
@@ -35,8 +35,7 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<GemsCache> :
- InternalCounted<Implementation<GemsCache> >
+ struct Implementation<GemsCache>
{
std::list<GemsCacheEntry> entries;
};
@@ -72,7 +71,7 @@ namespace
};
std::string
- as_string(YamlNode::ConstPointer n, const std::string & join = "")
+ as_string(std::tr1::shared_ptr<const YamlNode> n, const std::string & join = "")
{
AsStringVisitor v;
v.join = join;
@@ -107,13 +106,13 @@ namespace
struct RequirementsVisitor :
YamlNodeVisitorTypes::ConstVisitor
{
- VersionRequirements::Pointer r;
+ std::tr1::shared_ptr<VersionRequirements> r;
bool top_level;
std::string op;
std::string v;
- RequirementsVisitor(VersionRequirements::Pointer rr) :
+ RequirementsVisitor(std::tr1::shared_ptr<VersionRequirements> rr) :
r(rr),
top_level(true)
{
@@ -190,7 +189,7 @@ namespace
std::string summary;
std::string description;
std::string homepage;
- VersionRequirements::Pointer required_ruby_version;
+ std::tr1::shared_ptr<VersionRequirements> required_ruby_version;
EntryVisitor(const std::string & _id) :
id(_id),
@@ -210,9 +209,9 @@ namespace
.description(description)
.homepage(homepage)
.required_ruby_version(required_ruby_version)
- .authors(SequentialCollection<std::string>::Pointer(0))
- .dependencies(SequentialCollection<std::string>::Pointer(0))
- .requirements(SequentialCollection<std::string>::Pointer(0));
+ .authors(std::tr1::shared_ptr<SequentialCollection<std::string> >())
+ .dependencies(std::tr1::shared_ptr<SequentialCollection<std::string> >())
+ .requirements(std::tr1::shared_ptr<SequentialCollection<std::string> >());
}
void visit(const YamlSequenceNode *) PALUDIS_ATTRIBUTE((noreturn))
@@ -261,10 +260,10 @@ namespace
{
using YamlNodeVisitorTypes::ConstVisitor::VisitChildren<TopLevelVisitor, YamlSequenceNode>::visit;
- Implementation<GemsCache>::Pointer imp;
+ Implementation<GemsCache> * imp;
bool top_level;
- TopLevelVisitor(Implementation<GemsCache>::Pointer p) :
+ TopLevelVisitor(Implementation<GemsCache> * p) :
imp(p),
top_level(true)
{
@@ -317,7 +316,7 @@ GemsCache::GemsCache(const FSEntry & loc) :
YamlDocument doc(loc);
- TopLevelVisitor v(_imp);
+ TopLevelVisitor v(_imp.operator-> ());
doc.top()->accept(&v);
}
diff --git a/paludis/repositories/gems/cache.hh b/paludis/repositories/gems/cache.hh
index abb49c5..516f279 100644
--- a/paludis/repositories/gems/cache.hh
+++ b/paludis/repositories/gems/cache.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,8 +37,7 @@ namespace paludis
class GemsCache :
private InstantiationPolicy<GemsCache, instantiation_method::NonCopyableTag>,
- private PrivateImplementationPattern<GemsCache>,
- public InternalCounted<GemsCache>
+ private PrivateImplementationPattern<GemsCache>
{
public:
GemsCache(const FSEntry &);
diff --git a/paludis/repositories/gems/cache.sr b/paludis/repositories/gems/cache.sr
index 52b2d29..cae95a0 100644
--- a/paludis/repositories/gems/cache.sr
+++ b/paludis/repositories/gems/cache.sr
@@ -8,10 +8,10 @@ make_class_GemsCacheEntry()
key summary std::string
key description std::string
key homepage std::string
- key required_ruby_version "VersionRequirements::Pointer"
- key authors "SequentialCollection<std::string>::Pointer"
- key dependencies "SequentialCollection<std::string>::Pointer"
- key requirements "SequentialCollection<std::string>::Pointer"
+ key required_ruby_version "std::tr1::shared_ptr<VersionRequirements>"
+ key authors "std::tr1::shared_ptr<SequentialCollection<std::string> >"
+ key dependencies "std::tr1::shared_ptr<SequentialCollection<std::string> >"
+ key requirements "std::tr1::shared_ptr<SequentialCollection<std::string> >"
allow_named_args
}
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 91dbe24..869ec58 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -41,8 +41,7 @@ namespace paludis
typedef MakeHashedMap<PackageNamePart, Versions>::Type Packages;
template<>
- struct Implementation<GemsRepository> :
- InternalCounted<Implementation<GemsRepository> >
+ struct Implementation<GemsRepository>
{
const GemsRepositoryParams params;
@@ -70,7 +69,7 @@ namespace paludis
for (GemsCache::Iterator g(cache.begin()), g_end(cache.end()) ;
g != g_end ; ++g)
{
- VersionMetadata::Pointer m(new GemsVersionMetadata(g->version));
+ std::tr1::shared_ptr<VersionMetadata> m(new GemsVersionMetadata(g->version));
m->homepage = g->homepage;
if (g->description.empty())
m->description = g->summary;
@@ -103,25 +102,25 @@ GemsRepository::do_has_package_named(const QualifiedPackageName & c) const
return false;
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
GemsRepository::do_category_names() const
{
- static CategoryNamePartCollection::Pointer names(new CategoryNamePartCollection::Concrete);
+ static std::tr1::shared_ptr<CategoryNamePartCollection> names(new CategoryNamePartCollection::Concrete);
if (names->empty())
names->insert(CategoryNamePart("gems"));
return names;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
GemsRepository::do_package_names(const CategoryNamePart & c) const
{
if (! has_category_named(c))
- return QualifiedPackageNameCollection::ConstPointer(new QualifiedPackageNameCollection::Concrete);
+ return std::tr1::shared_ptr<const QualifiedPackageNameCollection>(new QualifiedPackageNameCollection::Concrete);
_imp->need_entries();
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
for (Packages::const_iterator i(_imp->packages.begin()), i_end(_imp->packages.end()) ;
i != i_end ; ++i)
result->insert(c + i->first);
@@ -129,15 +128,15 @@ GemsRepository::do_package_names(const CategoryNamePart & c) const
return result;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
GemsRepository::do_version_specs(const QualifiedPackageName & p) const
{
if (! has_category_named(p.category))
- return VersionSpecCollection::ConstPointer(new VersionSpecCollection::Concrete);
+ return std::tr1::shared_ptr<const VersionSpecCollection>(new VersionSpecCollection::Concrete);
_imp->need_entries();
- VersionSpecCollection::Pointer result(new VersionSpecCollection::Concrete);
+ std::tr1::shared_ptr<VersionSpecCollection> result(new VersionSpecCollection::Concrete);
Packages::const_iterator i(_imp->packages.find(p.package));
if (i != _imp->packages.end())
std::copy(i->second.begin(), i->second.end(), transform_inserter(
@@ -157,7 +156,7 @@ GemsRepository::do_has_version(const QualifiedPackageName & q, const VersionSpec
return false;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
GemsRepository::do_version_metadata(const QualifiedPackageName & q, const VersionSpec & v) const
{
if (! has_category_named(q.category))
@@ -187,16 +186,16 @@ GemsRepository::do_install(const QualifiedPackageName &, const VersionSpec &, co
{
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
GemsRepository::do_package_set(const SetName &) const
{
- return DepAtom::Pointer(0);
+ return std::tr1::shared_ptr<DepAtom>();
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
GemsRepository::sets_list() const
{
- return SetsCollection::Pointer(new SetsCollection::Concrete);
+ return std::tr1::shared_ptr<SetsCollection>(new SetsCollection::Concrete);
}
bool
@@ -274,7 +273,7 @@ GemsRepository::~GemsRepository()
void
GemsRepository::invalidate()
{
- _imp.assign(new Implementation<GemsRepository>(_imp->params));
+ _imp.reset(new Implementation<GemsRepository>(_imp->params));
}
void
@@ -282,9 +281,9 @@ GemsRepository::regenerate_cache() const
{
}
-RepositoryInfo::ConstPointer
+std::tr1::shared_ptr<const RepositoryInfo>
GemsRepository::info(bool) const
{
- return RepositoryInfo::Pointer(new RepositoryInfo);
+ return std::tr1::shared_ptr<RepositoryInfo>(new RepositoryInfo);
}
diff --git a/paludis/repositories/gems/gems_repository.hh b/paludis/repositories/gems/gems_repository.hh
index 5d54490..7927b60 100644
--- a/paludis/repositories/gems/gems_repository.hh
+++ b/paludis/repositories/gems/gems_repository.hh
@@ -26,17 +26,17 @@ namespace paludis
virtual bool do_has_package_named(const QualifiedPackageName &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
virtual bool do_has_version(const QualifiedPackageName &, const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
@@ -45,23 +45,20 @@ namespace paludis
virtual void do_install(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &) const;
- virtual DepAtom::Pointer do_package_set(const SetName &) const;
+ virtual std::tr1::shared_ptr<DepAtom> do_package_set(const SetName &) const;
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
virtual bool do_sync() const;
public:
- virtual RepositoryInfo::ConstPointer info(bool verbose) const;
+ virtual std::tr1::shared_ptr<const RepositoryInfo> info(bool verbose) const;
GemsRepository(const GemsRepositoryParams &);
~GemsRepository();
virtual void invalidate();
virtual void regenerate_cache() const;
-
- typedef CountedPtr<GemsRepository, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const GemsRepository, count_policy::InternalCountTag> ConstPointer;
};
}
diff --git a/paludis/repositories/gems/gems_repository.sr b/paludis/repositories/gems/gems_repository.sr
index cee9d73..416170f 100644
--- a/paludis/repositories/gems/gems_repository.sr
+++ b/paludis/repositories/gems/gems_repository.sr
@@ -15,6 +15,6 @@ make_class_GemsRepositoryParams()
make_class_GemsRepositoryEntry()
{
- key metadata VersionMetadata::Pointer
+ key metadata "std::tr1::shared_ptr<VersionMetadata>"
}
diff --git a/paludis/repositories/gems/gems_repository_TEST.cc b/paludis/repositories/gems/gems_repository_TEST.cc
index ab6ecc3..ca850c7 100644
--- a/paludis/repositories/gems/gems_repository_TEST.cc
+++ b/paludis/repositories/gems/gems_repository_TEST.cc
@@ -37,11 +37,11 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "gems");
keys->insert("location", "gems_repository_TEST_dir/repo1");
- GemsRepository::Pointer repo(make_gems_repository(
+ std::tr1::shared_ptr<Repository> repo(make_gems_repository(
&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "gems");
}
diff --git a/paludis/repositories/gems/make_gems_repository.cc b/paludis/repositories/gems/make_gems_repository.cc
index db11823..c9fd554 100644
--- a/paludis/repositories/gems/make_gems_repository.cc
+++ b/paludis/repositories/gems/make_gems_repository.cc
@@ -22,9 +22,9 @@
using namespace paludis;
-Repository::Pointer
+std::tr1::shared_ptr<Repository>
paludis::make_gems_repository(Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") :
m->find("repo_file")->second);
@@ -51,7 +51,7 @@ paludis::make_gems_repository(Environment * const env,
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
buildroot = "/var/tmp/paludis";
- return Repository::Pointer(new GemsRepository(GemsRepositoryParams::create()
+ return std::tr1::shared_ptr<Repository>(new GemsRepository(GemsRepositoryParams::create()
.environment(env)
.location(location)
.distdir(distdir)
diff --git a/paludis/repositories/gems/make_gems_repository.hh b/paludis/repositories/gems/make_gems_repository.hh
index 0de384c..154e446 100644
--- a/paludis/repositories/gems/make_gems_repository.hh
+++ b/paludis/repositories/gems/make_gems_repository.hh
@@ -24,9 +24,9 @@
namespace paludis
{
- Repository::Pointer
+ std::tr1::shared_ptr<Repository>
make_gems_repository(Environment * const,
- AssociativeCollection<std::string, std::string>::ConstPointer) PALUDIS_VISIBLE;
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/repositories/gems/yaml.cc b/paludis/repositories/gems/yaml.cc
index 20daff6..0a09e50 100644
--- a/paludis/repositories/gems/yaml.cc
+++ b/paludis/repositories/gems/yaml.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -42,17 +42,15 @@ YamlScalarNode::YamlScalarNode(const std::string & v, const std::string & t) :
namespace paludis
{
template<>
- struct Implementation<YamlMappingNode> :
- InternalCounted<Implementation<YamlMappingNode> >
+ struct Implementation<YamlMappingNode>
{
- std::list<std::pair<YamlScalarNode::Pointer, YamlNode::Pointer> > nodes;
+ std::list<std::pair<std::tr1::shared_ptr<YamlScalarNode>, std::tr1::shared_ptr<YamlNode> > > nodes;
};
template<>
- struct Implementation<YamlSequenceNode> :
- InternalCounted<Implementation<YamlSequenceNode> >
+ struct Implementation<YamlSequenceNode>
{
- std::list<YamlNode::Pointer> nodes;
+ std::list<std::tr1::shared_ptr<YamlNode> > nodes;
};
}
@@ -74,7 +72,7 @@ YamlMappingNode::end() const
return Iterator(_imp->nodes.end());
}
-std::pair<YamlScalarNode::Pointer, YamlNode::Pointer> &
+std::pair<std::tr1::shared_ptr<YamlScalarNode>, std::tr1::shared_ptr<YamlNode> > &
YamlMappingNode::back()
{
return _imp->nodes.back();
@@ -98,13 +96,13 @@ YamlSequenceNode::end() const
}
void
-YamlSequenceNode::add(YamlNode::Pointer node)
+YamlSequenceNode::add(std::tr1::shared_ptr<YamlNode> node)
{
_imp->nodes.push_back(node);
}
void
-YamlMappingNode::add(YamlScalarNode::Pointer a, YamlNode::Pointer b)
+YamlMappingNode::add(std::tr1::shared_ptr<YamlScalarNode> a, std::tr1::shared_ptr<YamlNode> b)
{
_imp->nodes.push_back(std::make_pair(a, b));
}
@@ -112,13 +110,12 @@ YamlMappingNode::add(YamlScalarNode::Pointer a, YamlNode::Pointer b)
namespace paludis
{
template<>
- struct Implementation<YamlDocument> :
- InternalCounted<Implementation<YamlDocument> >
+ struct Implementation<YamlDocument>
{
- YamlSequenceNode::Pointer top;
+ std::tr1::shared_ptr<YamlSequenceNode> top;
void parse(yaml_parser_t * parser);
- YamlScalarNode::Pointer parse_scalar(yaml_parser_t * parser);
+ std::tr1::shared_ptr<YamlScalarNode> parse_scalar(yaml_parser_t * parser);
Implementation() :
top(new YamlSequenceNode)
@@ -167,9 +164,9 @@ namespace
struct ScalarAdder :
YamlNodeVisitorTypes::Visitor
{
- YamlScalarNode::Pointer a;
+ std::tr1::shared_ptr<YamlScalarNode> a;
- ScalarAdder(YamlScalarNode::Pointer aa) :
+ ScalarAdder(std::tr1::shared_ptr<YamlScalarNode> aa) :
a(aa)
{
}
@@ -177,7 +174,7 @@ namespace
void visit(YamlMappingNode * n)
{
if (n->empty() || n->back().second)
- n->add(a, YamlNode::Pointer(0));
+ n->add(a, std::tr1::shared_ptr<YamlNode>());
else
n->back().second = a;
}
@@ -196,9 +193,9 @@ namespace
struct NonScalarAdder :
YamlNodeVisitorTypes::Visitor
{
- YamlNode::Pointer a;
+ std::tr1::shared_ptr<YamlNode> a;
- NonScalarAdder(YamlNode::Pointer aa) :
+ NonScalarAdder(std::tr1::shared_ptr<YamlNode> aa) :
a(aa)
{
}
@@ -259,7 +256,7 @@ YamlDocument::YamlDocument(const FSEntry & loc) :
void
Implementation<YamlDocument>::parse(yaml_parser_t * parser)
{
- std::list<YamlNode::Pointer> stack;
+ std::list<std::tr1::shared_ptr<YamlNode> > stack;
stack.push_back(top);
bool done(false);
@@ -284,7 +281,7 @@ Implementation<YamlDocument>::parse(yaml_parser_t * parser)
case YAML_MAPPING_START_EVENT:
{
- YamlMappingNode::Pointer node(new YamlMappingNode);
+ std::tr1::shared_ptr<YamlMappingNode> node(new YamlMappingNode);
if (stack.empty())
throw YamlError("Error building tree: stack empty on YAML_SEQUENCE_START_EVENT");
@@ -308,7 +305,7 @@ Implementation<YamlDocument>::parse(yaml_parser_t * parser)
case YAML_SEQUENCE_START_EVENT:
{
- YamlSequenceNode::Pointer node(new YamlSequenceNode);
+ std::tr1::shared_ptr<YamlSequenceNode> node(new YamlSequenceNode);
if (stack.empty())
throw YamlError("Error building tree: stack empty on YAML_SEQUENCE_START_EVENT");
if (stack.back())
@@ -326,7 +323,7 @@ Implementation<YamlDocument>::parse(yaml_parser_t * parser)
{
if (stack.empty())
throw YamlError("Error building tree: stack empty on YAML_SCALAR_EVENT");
- YamlScalarNode::Pointer node(new YamlScalarNode(
+ std::tr1::shared_ptr<YamlScalarNode> node(new YamlScalarNode(
event->data.scalar.value ? reinterpret_cast<const char *>(event->data.scalar.value) : "",
event->data.scalar.tag ? reinterpret_cast<const char *>(event->data.scalar.tag) : ""));
if (stack.back())
@@ -358,7 +355,7 @@ YamlDocument::~YamlDocument()
{
}
-YamlNode::ConstPointer
+std::tr1::shared_ptr<const YamlNode>
YamlDocument::top() const
{
return _imp->top;
diff --git a/paludis/repositories/gems/yaml.hh b/paludis/repositories/gems/yaml.hh
index 12cc369..31084fb 100644
--- a/paludis/repositories/gems/yaml.hh
+++ b/paludis/repositories/gems/yaml.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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/visitor.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <tr1/memory>
namespace paludis
{
@@ -44,8 +45,7 @@ namespace paludis
class YamlNode :
public virtual VisitableInterface<YamlNodeVisitorTypes>,
- private InstantiationPolicy<YamlNode, instantiation_method::NonCopyableTag>,
- public InternalCounted<YamlNode>
+ private InstantiationPolicy<YamlNode, instantiation_method::NonCopyableTag>
{
protected:
YamlNode();
@@ -63,9 +63,6 @@ namespace paludis
std::string _tag;
public:
- typedef CountedPtr<const YamlScalarNode, count_policy::InternalCountTag> ConstPointer;
- typedef CountedPtr<YamlScalarNode, count_policy::InternalCountTag> Pointer;
-
YamlScalarNode(const std::string &, const std::string &);
std::string value() const
@@ -85,19 +82,16 @@ namespace paludis
private PrivateImplementationPattern<YamlMappingNode>
{
public:
- typedef CountedPtr<const YamlMappingNode, count_policy::InternalCountTag> ConstPointer;
- typedef CountedPtr<YamlMappingNode, count_policy::InternalCountTag> Pointer;
-
YamlMappingNode();
- void add(YamlScalarNode::Pointer, YamlNode::Pointer);
+ void add(std::tr1::shared_ptr<YamlScalarNode>, std::tr1::shared_ptr<YamlNode>);
typedef libwrapiter::ForwardIterator<YamlMappingNode,
- const std::pair<YamlScalarNode::Pointer, YamlNode::Pointer> > Iterator;
+ const std::pair<std::tr1::shared_ptr<YamlScalarNode>, std::tr1::shared_ptr<YamlNode> > > Iterator;
Iterator begin() const;
Iterator end() const;
- std::pair<YamlScalarNode::Pointer, YamlNode::Pointer> & back();
+ std::pair<std::tr1::shared_ptr<YamlScalarNode>, std::tr1::shared_ptr<YamlNode> > & back();
bool empty() const
{
@@ -111,16 +105,13 @@ namespace paludis
private PrivateImplementationPattern<YamlSequenceNode>
{
public:
- typedef CountedPtr<YamlSequenceNode, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const YamlSequenceNode, count_policy::InternalCountTag> ConstPointer;
-
YamlSequenceNode();
- typedef libwrapiter::ForwardIterator<YamlSequenceNode, const YamlNode::Pointer> Iterator;
+ typedef libwrapiter::ForwardIterator<YamlSequenceNode, const std::tr1::shared_ptr<YamlNode> > Iterator;
Iterator begin() const;
Iterator end() const;
- void add(YamlNode::Pointer);
+ void add(std::tr1::shared_ptr<YamlNode>);
};
class YamlDocument :
@@ -132,7 +123,7 @@ namespace paludis
YamlDocument(const FSEntry &);
~YamlDocument();
- YamlNode::ConstPointer top() const;
+ std::tr1::shared_ptr<const YamlNode> top() const;
};
}
diff --git a/paludis/repositories/nothing/nothing_repository.cc b/paludis/repositories/nothing/nothing_repository.cc
index fef71e4..8c408f8 100644
--- a/paludis/repositories/nothing/nothing_repository.cc
+++ b/paludis/repositories/nothing/nothing_repository.cc
@@ -48,8 +48,7 @@ namespace paludis
* \ingroup grpnothingrepository
*/
template <>
- struct Implementation<NothingRepository> :
- InternalCounted<Implementation<NothingRepository> >
+ struct Implementation<NothingRepository>
{
/// Our name
std::string name;
@@ -111,7 +110,7 @@ NothingRepository::NothingRepository(const NothingRepositoryParams & p) try :
"nothing"),
PrivateImplementationPattern<NothingRepository>(new Implementation<NothingRepository>(p))
{
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("sync", _imp->sync);
config_info->add_kv("sync_options", _imp->sync_options);
config_info->add_kv("location", stringify(_imp->location));
@@ -140,24 +139,24 @@ NothingRepository::do_has_package_named(const QualifiedPackageName &) const
return false;
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
NothingRepository::do_category_names() const
{
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
return result;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
NothingRepository::do_package_names(const CategoryNamePart &) const
{
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
return result;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
NothingRepository::do_version_specs(const QualifiedPackageName &) const
{
- return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
+ return std::tr1::shared_ptr<VersionSpecCollection>(new VersionSpecCollection::Concrete);
}
bool
@@ -167,17 +166,17 @@ NothingRepository::do_has_version(const QualifiedPackageName &,
return false;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
NothingRepository::do_version_metadata(
const QualifiedPackageName & q, const VersionSpec & v) const
{
throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
}
-CountedPtr<Repository>
+std::tr1::shared_ptr<Repository>
NothingRepository::make_nothing_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") :
m->find("repo_file")->second);
@@ -213,7 +212,7 @@ NothingRepository::make_nothing_repository(
sync_options += "--exclude-from='" + m->find("sync_exclude")->second + "'";
}
- return CountedPtr<Repository>(new NothingRepository(NothingRepositoryParams::create()
+ return std::tr1::shared_ptr<Repository>(new NothingRepository(NothingRepositoryParams::create()
.name(name)
.location(location)
.sync(sync)
diff --git a/paludis/repositories/nothing/nothing_repository.hh b/paludis/repositories/nothing/nothing_repository.hh
index c3f2c92..970227b 100644
--- a/paludis/repositories/nothing/nothing_repository.hh
+++ b/paludis/repositories/nothing/nothing_repository.hh
@@ -52,17 +52,17 @@ namespace paludis
virtual bool do_has_package_named(const QualifiedPackageName &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
virtual bool do_has_version(const QualifiedPackageName &, const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const PALUDIS_ATTRIBUTE((noreturn));
@@ -79,9 +79,9 @@ namespace paludis
/**
* Virtual constructor.
*/
- static CountedPtr<Repository> make_nothing_repository(
+ static std::tr1::shared_ptr<Repository> make_nothing_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >);
/**
* Destructor.
@@ -89,9 +89,6 @@ namespace paludis
~NothingRepository();
virtual void invalidate();
-
- typedef CountedPtr<NothingRepository, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const NothingRepository, count_policy::InternalCountTag> ConstPointer;
};
/**
diff --git a/paludis/repositories/portage/ebuild_entries.cc b/paludis/repositories/portage/ebuild_entries.cc
index ac64004..21c7755 100644
--- a/paludis/repositories/portage/ebuild_entries.cc
+++ b/paludis/repositories/portage/ebuild_entries.cc
@@ -46,14 +46,13 @@ namespace paludis
* \ingroup grpportagerepository
*/
template<>
- struct Implementation<EbuildEntries> :
- InternalCounted<Implementation<EbuildEntries> >
+ struct Implementation<EbuildEntries>
{
const Environment * const environment;
PortageRepository * const portage_repository;
const PortageRepositoryParams params;
- EclassMtimes::Pointer eclass_mtimes;
+ std::tr1::shared_ptr<EclassMtimes> eclass_mtimes;
time_t master_mtime;
Implementation(const Environment * const e, PortageRepository * const p,
@@ -83,13 +82,13 @@ EbuildEntries::~EbuildEntries()
{
}
-VersionMetadata::Pointer
+std::tr1::shared_ptr<VersionMetadata>
EbuildEntries::generate_version_metadata(const QualifiedPackageName & q,
const VersionSpec & v) const
{
Context context("When generating version metadata for '" + stringify(q) + "-" + stringify(v) + "':");
- EbuildVersionMetadata::Pointer result(new EbuildVersionMetadata);
+ std::tr1::shared_ptr<EbuildVersionMetadata> result(new EbuildVersionMetadata);
FSEntry ebuild_file(_imp->params.location / stringify(q.category) /
stringify(q.package) / (stringify(q.package) + "-" + stringify(v) + ".ebuild"));
@@ -205,7 +204,7 @@ namespace
}
public:
- AAFinder(const DepAtom::ConstPointer a)
+ AAFinder(const std::tr1::shared_ptr<const DepAtom> a)
{
a->accept(static_cast<DepAtomVisitorTypes::ConstVisitor *>(this));
}
@@ -227,7 +226,7 @@ namespace
void
EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
- const InstallOptions & o, PortageRepositoryProfile::ConstPointer p) const
+ const InstallOptions & o, std::tr1::shared_ptr<const PortageRepositoryProfile> p) const
{
if (! _imp->portage_repository->has_version(q, v))
{
@@ -235,7 +234,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
+ stringify(v) + "' since has_version failed");
}
- VersionMetadata::ConstPointer metadata(_imp->portage_repository->version_metadata(q, v));
+ std::tr1::shared_ptr<const VersionMetadata> metadata(_imp->portage_repository->version_metadata(q, v));
PackageDatabaseEntry e(q, v, _imp->portage_repository->name());
@@ -255,7 +254,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
std::set<std::string> already_in_archives;
/* make A and FLAT_SRC_URI */
- DepAtom::ConstPointer f_atom(PortageDepParser::parse(metadata->ebuild_interface->src_uri,
+ std::tr1::shared_ptr<const DepAtom> f_atom(PortageDepParser::parse(metadata->ebuild_interface->src_uri,
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
DepAtomFlattener f(_imp->params.environment, &e, f_atom);
@@ -338,7 +337,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
}
/* make AA */
- DepAtom::ConstPointer g_atom(PortageDepParser::parse(
+ std::tr1::shared_ptr<const DepAtom> g_atom(PortageDepParser::parse(
metadata->ebuild_interface->src_uri,
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
AAFinder g(g_atom);
@@ -390,7 +389,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
/* add expand to use (iuse isn't reliable for use_expand things), and make the expand
* environment variables */
- AssociativeCollection<std::string, std::string>::Pointer expand_vars(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > expand_vars(
new AssociativeCollection<std::string, std::string>::Concrete);
for (PortageRepositoryProfile::UseExpandIterator x(p->begin_use_expand()),
x_end(p->end_use_expand()) ; x != x_end ; ++x)
@@ -406,7 +405,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
create_inserter<UseFlagName>(std::inserter(possible_values, possible_values.end())));
/* possible values from environment */
- UseFlagNameCollection::ConstPointer possible_values_from_env(_imp->params.environment->
+ std::tr1::shared_ptr<const UseFlagNameCollection> possible_values_from_env(_imp->params.environment->
known_use_expand_names(*x, &e));
for (UseFlagNameCollection::Iterator i(possible_values_from_env->begin()),
i_end(possible_values_from_env->end()) ; i != i_end ; ++i)
@@ -493,7 +492,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
std::string
EbuildEntries::get_environment_variable(const QualifiedPackageName & q,
const VersionSpec & v, const std::string & var,
- PortageRepositoryProfile::ConstPointer) const
+ std::tr1::shared_ptr<const PortageRepositoryProfile>) const
{
PackageDatabaseEntry for_package(q, v, _imp->portage_repository->name());
@@ -518,10 +517,10 @@ EbuildEntries::get_environment_variable(const QualifiedPackageName & q,
return cmd.result();
}
-EbuildEntries::Pointer
+std::tr1::shared_ptr<PortageRepositoryEntries>
EbuildEntries::make_ebuild_entries(
const Environment * const e, PortageRepository * const r, const PortageRepositoryParams & p)
{
- return Pointer(new EbuildEntries(e, r, p));
+ return std::tr1::shared_ptr<PortageRepositoryEntries>(new EbuildEntries(e, r, p));
}
diff --git a/paludis/repositories/portage/ebuild_entries.hh b/paludis/repositories/portage/ebuild_entries.hh
index 24cbad2..7116405 100644
--- a/paludis/repositories/portage/ebuild_entries.hh
+++ b/paludis/repositories/portage/ebuild_entries.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -45,7 +45,7 @@ namespace paludis
private PrivateImplementationPattern<EbuildEntries>
{
public:
- static EbuildEntries::Pointer
+ static std::tr1::shared_ptr<PortageRepositoryEntries>
make_ebuild_entries(const Environment * const,
PortageRepository * const, const PortageRepositoryParams &);
@@ -55,15 +55,15 @@ namespace paludis
virtual ~EbuildEntries();
- virtual VersionMetadata::Pointer generate_version_metadata(const QualifiedPackageName &,
+ virtual std::tr1::shared_ptr<VersionMetadata> generate_version_metadata(const QualifiedPackageName &,
const VersionSpec &) const;
virtual std::string get_environment_variable(const QualifiedPackageName &,
const VersionSpec &, const std::string & var,
- PortageRepositoryProfile::ConstPointer) const;
+ std::tr1::shared_ptr<const PortageRepositoryProfile>) const;
virtual void install(const QualifiedPackageName &, const VersionSpec &,
- const InstallOptions &, PortageRepositoryProfile::ConstPointer) const;
+ const InstallOptions &, std::tr1::shared_ptr<const PortageRepositoryProfile>) const;
};
}
diff --git a/paludis/repositories/portage/ebuild_flat_metadata_cache.cc b/paludis/repositories/portage/ebuild_flat_metadata_cache.cc
index ca83e19..e5873e4 100644
--- a/paludis/repositories/portage/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/portage/ebuild_flat_metadata_cache.cc
@@ -28,7 +28,7 @@
using namespace paludis;
EbuildFlatMetadataCache::EbuildFlatMetadataCache(const FSEntry & f,
- const FSEntry & e, time_t t, EclassMtimes::ConstPointer m, bool s) :
+ const FSEntry & e, time_t t, std::tr1::shared_ptr<const EclassMtimes> m, bool s) :
_filename(f),
_ebuild(e),
_master_mtime(t),
@@ -38,7 +38,7 @@ EbuildFlatMetadataCache::EbuildFlatMetadataCache(const FSEntry & f,
}
bool
-EbuildFlatMetadataCache::load(EbuildVersionMetadata::Pointer result)
+EbuildFlatMetadataCache::load(std::tr1::shared_ptr<EbuildVersionMetadata> result)
{
Context context("When loading version metadata to '" + stringify(_filename) + "':");
@@ -111,7 +111,7 @@ namespace
}
void
-EbuildFlatMetadataCache::save(EbuildVersionMetadata::ConstPointer v)
+EbuildFlatMetadataCache::save(std::tr1::shared_ptr<const EbuildVersionMetadata> v)
{
Context context("When saving version metadata to '" + stringify(_filename) + "':");
diff --git a/paludis/repositories/portage/ebuild_flat_metadata_cache.hh b/paludis/repositories/portage/ebuild_flat_metadata_cache.hh
index 496e96d..34abf6e 100644
--- a/paludis/repositories/portage/ebuild_flat_metadata_cache.hh
+++ b/paludis/repositories/portage/ebuild_flat_metadata_cache.hh
@@ -42,7 +42,7 @@ namespace paludis
const FSEntry & _filename;
const FSEntry & _ebuild;
time_t _master_mtime;
- EclassMtimes::ConstPointer _eclass_mtimes;
+ std::tr1::shared_ptr<const EclassMtimes> _eclass_mtimes;
bool _silent;
public:
@@ -50,15 +50,15 @@ namespace paludis
///\{
EbuildFlatMetadataCache(const FSEntry & filename, const FSEntry & ebuild,
- time_t master_mtime, EclassMtimes::ConstPointer eclass_mtimes, bool silent);
+ time_t master_mtime, std::tr1::shared_ptr<const EclassMtimes> eclass_mtimes, bool silent);
///\}
///\name Cache operations
///\{
- bool load(EbuildVersionMetadata::Pointer);
- void save(EbuildVersionMetadata::ConstPointer);
+ bool load(std::tr1::shared_ptr<EbuildVersionMetadata>);
+ void save(std::tr1::shared_ptr<const EbuildVersionMetadata>);
///\}
};
diff --git a/paludis/repositories/portage/eclass_mtimes.cc b/paludis/repositories/portage/eclass_mtimes.cc
index a4178a1..abc7e20 100644
--- a/paludis/repositories/portage/eclass_mtimes.cc
+++ b/paludis/repositories/portage/eclass_mtimes.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,20 +25,19 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<EclassMtimes> :
- public InternalCounted<Implementation<EclassMtimes> >
+ struct Implementation<EclassMtimes>
{
- FSEntryCollection::ConstPointer eclass_dirs;
+ std::tr1::shared_ptr<const FSEntryCollection> eclass_dirs;
mutable MakeHashedMap<std::string, time_t>::Type eclass_mtimes;
- Implementation(FSEntryCollection::ConstPointer d) :
+ Implementation(std::tr1::shared_ptr<const FSEntryCollection> d) :
eclass_dirs(d)
{
}
};
}
-EclassMtimes::EclassMtimes(FSEntryCollection::ConstPointer d) :
+EclassMtimes::EclassMtimes(std::tr1::shared_ptr<const FSEntryCollection> d) :
PrivateImplementationPattern<EclassMtimes>(new Implementation<EclassMtimes>(d))
{
}
diff --git a/paludis/repositories/portage/eclass_mtimes.hh b/paludis/repositories/portage/eclass_mtimes.hh
index 8570626..1bfdc46 100644
--- a/paludis/repositories/portage/eclass_mtimes.hh
+++ b/paludis/repositories/portage/eclass_mtimes.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -34,14 +34,13 @@ namespace paludis
* \nosubgrouping
*/
class EclassMtimes :
- private PrivateImplementationPattern<EclassMtimes>,
- public InternalCounted<EclassMtimes>
+ private PrivateImplementationPattern<EclassMtimes>
{
public:
///\name Basic operations
///\{
- EclassMtimes(FSEntryCollection::ConstPointer);
+ EclassMtimes(std::tr1::shared_ptr<const FSEntryCollection>);
~EclassMtimes();
///\}
diff --git a/paludis/repositories/portage/glsa.cc b/paludis/repositories/portage/glsa.cc
index 8fe3c71..4bdcb09 100644
--- a/paludis/repositories/portage/glsa.cc
+++ b/paludis/repositories/portage/glsa.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,8 +38,7 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<GLSAPackage> :
- InternalCounted<Implementation<GLSAPackage> >
+ struct Implementation<GLSAPackage>
{
QualifiedPackageName name;
std::list<UseFlagName> archs;
@@ -53,12 +52,11 @@ namespace paludis
};
template<>
- struct Implementation<GLSA> :
- InternalCounted<Implementation<GLSA> >
+ struct Implementation<GLSA>
{
std::string id;
std::string title;
- std::list<GLSAPackage::ConstPointer> packages;
+ std::list<std::tr1::shared_ptr<const GLSAPackage> > packages;
};
}
@@ -153,7 +151,7 @@ GLSA::end_packages() const
}
void
-GLSA::add_package(GLSAPackage::ConstPointer p)
+GLSA::add_package(std::tr1::shared_ptr<const GLSAPackage> p)
{
_imp->packages.push_back(p);
}
@@ -189,7 +187,7 @@ namespace
struct LibXMLHandle
{
void * handle;
- GLSA::Pointer (* create_glsa_from_xml_file_handle)(const std::string &);
+ std::tr1::shared_ptr<GLSA> (* create_glsa_from_xml_file_handle)(const std::string &);
LibXMLHandle() :
handle(0),
@@ -208,7 +206,7 @@ namespace
#endif
-GLSA::Pointer
+std::tr1::shared_ptr<GLSA>
GLSA::create_from_xml_file(const std::string & filename)
{
#if ENABLE_GLSA
@@ -223,7 +221,7 @@ GLSA::create_from_xml_file(const std::string & filename)
+ stringify(dlerror()) + "' when dlopen(libpaludisportagerepositoryxmlthings.so)");
if (0 == libxmlhandle.create_glsa_from_xml_file_handle)
- libxmlhandle.create_glsa_from_xml_file_handle = STUPID_CAST(GLSA::Pointer (*)(const std::string &),
+ libxmlhandle.create_glsa_from_xml_file_handle = STUPID_CAST(std::tr1::shared_ptr<GLSA> (*)(const std::string &),
dlsym(libxmlhandle.handle, "create_glsa_from_xml_file"));
if (0 == libxmlhandle.create_glsa_from_xml_file_handle)
throw NotAvailableError("Cannot create GLSA from XML file '" + filename + "' due to error '"
diff --git a/paludis/repositories/portage/glsa.hh b/paludis/repositories/portage/glsa.hh
index ca445c8..f855078 100644
--- a/paludis/repositories/portage/glsa.hh
+++ b/paludis/repositories/portage/glsa.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_GLSA_HH 1
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/sr.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
@@ -61,8 +60,7 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE GLSAPackage :
- private PrivateImplementationPattern<GLSAPackage>,
- public InternalCounted<GLSAPackage>
+ private PrivateImplementationPattern<GLSAPackage>
{
public:
GLSAPackage(const QualifiedPackageName & name);
@@ -91,19 +89,18 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE GLSA :
- private PrivateImplementationPattern<GLSA>,
- public InternalCounted<GLSA>
+ private PrivateImplementationPattern<GLSA>
{
public:
GLSA();
~GLSA();
- static GLSA::Pointer create_from_xml_file(const std::string & filename);
+ static std::tr1::shared_ptr<GLSA> create_from_xml_file(const std::string & filename);
typedef libwrapiter::ForwardIterator<GLSA, const GLSAPackage> PackagesIterator;
PackagesIterator begin_packages() const;
PackagesIterator end_packages() const;
- void add_package(GLSAPackage::ConstPointer);
+ void add_package(std::tr1::shared_ptr<const GLSAPackage>);
void set_id(const std::string &);
std::string id() const;
diff --git a/paludis/repositories/portage/make_ebuild_repository.cc b/paludis/repositories/portage/make_ebuild_repository.cc
index 36d1d89..87906e5 100644
--- a/paludis/repositories/portage/make_ebuild_repository.cc
+++ b/paludis/repositories/portage/make_ebuild_repository.cc
@@ -25,10 +25,10 @@
using namespace paludis;
-CountedPtr<PortageRepository>
+std::tr1::shared_ptr<PortageRepository>
paludis::make_ebuild_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") :
m->find("repo_file")->second);
@@ -39,7 +39,7 @@ paludis::make_ebuild_repository(
if (m->end() == m->find("location") || ((location = m->find("location")->second)).empty())
throw PortageRepositoryConfigurationError("Key 'location' not specified or empty");
- FSEntryCollection::Pointer profiles(new FSEntryCollection::Concrete);
+ std::tr1::shared_ptr<FSEntryCollection> profiles(new FSEntryCollection::Concrete);
if (m->end() != m->find("profiles"))
WhitespaceTokeniser::get_instance()->tokenise(m->find("profiles")->second,
create_inserter<FSEntry>(std::back_inserter(*profiles)));
@@ -56,7 +56,7 @@ paludis::make_ebuild_repository(
if (profiles->empty())
throw PortageRepositoryConfigurationError("No profiles have been specified");
- FSEntryCollection::Pointer eclassdirs(new FSEntryCollection::Concrete);
+ std::tr1::shared_ptr<FSEntryCollection> eclassdirs(new FSEntryCollection::Concrete);
if (m->end() != m->find("eclassdirs"))
WhitespaceTokeniser::get_instance()->tokenise(m->find("eclassdirs")->second,
create_inserter<FSEntry>(std::back_inserter(*eclassdirs)));
@@ -135,7 +135,7 @@ paludis::make_ebuild_repository(
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
buildroot = "/var/tmp/paludis";
- return CountedPtr<PortageRepository>(new PortageRepository(PortageRepositoryParams::create()
+ return std::tr1::shared_ptr<PortageRepository>(new PortageRepository(PortageRepositoryParams::create()
.entry_format("ebuild")
.environment(env)
.location(location)
@@ -155,10 +155,10 @@ paludis::make_ebuild_repository(
.buildroot(buildroot)));
}
-CountedPtr<Repository>
+std::tr1::shared_ptr<Repository>
paludis::make_ebuild_repository_wrapped(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
return make_ebuild_repository(env, m);
}
diff --git a/paludis/repositories/portage/make_ebuild_repository.hh b/paludis/repositories/portage/make_ebuild_repository.hh
index b54e4cc..3fb7484 100644
--- a/paludis/repositories/portage/make_ebuild_repository.hh
+++ b/paludis/repositories/portage/make_ebuild_repository.hh
@@ -30,15 +30,15 @@ namespace paludis
* \see PortageRepository
* \ingroup grpportagerepository
*/
- CountedPtr<PortageRepository>
+ std::tr1::shared_ptr<PortageRepository>
make_ebuild_repository(
Environment * const,
- AssociativeCollection<std::string, std::string>::ConstPointer) PALUDIS_VISIBLE;
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >) PALUDIS_VISIBLE;
- CountedPtr<Repository>
+ std::tr1::shared_ptr<Repository>
make_ebuild_repository_wrapped(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m);
}
#endif
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 0cea3d2..7f876cf 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -77,10 +77,10 @@ using namespace paludis;
namespace paludis
{
/// Map for versions.
- typedef MakeHashedMap<QualifiedPackageName, VersionSpecCollection::Pointer>::Type VersionsMap;
+ typedef MakeHashedMap<QualifiedPackageName, std::tr1::shared_ptr<VersionSpecCollection> >::Type VersionsMap;
/// Map for repository masks.
- typedef MakeHashedMap<QualifiedPackageName, std::list<PackageDepAtom::ConstPointer> >::Type RepositoryMaskMap;
+ typedef MakeHashedMap<QualifiedPackageName, std::list<std::tr1::shared_ptr<const PackageDepAtom> > >::Type RepositoryMaskMap;
/// Map for categories.
typedef MakeHashedMap<CategoryNamePart, bool>::Type CategoryMap;
@@ -93,10 +93,10 @@ namespace paludis
/// Map for metadata.
typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>,
- VersionMetadata::Pointer>::Type MetadataMap;
+ std::tr1::shared_ptr<VersionMetadata> >::Type MetadataMap;
/// Map for virtuals.
- typedef MakeHashedMap<QualifiedPackageName, PackageDepAtom::ConstPointer>::Type VirtualsMap;
+ typedef MakeHashedMap<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> >::Type VirtualsMap;
typedef std::list<PortageRepositoryProfilesDescLine> ProfilesDesc;
@@ -106,8 +106,7 @@ namespace paludis
* \ingroup grpportagerepository
*/
template <>
- struct Implementation<PortageRepository> :
- InternalCounted<Implementation<PortageRepository> >
+ struct Implementation<PortageRepository>
{
/// Our parameters
const PortageRepositoryParams params;
@@ -139,7 +138,7 @@ namespace paludis
mutable bool has_virtuals;
/// Arch flags
- mutable UseFlagNameCollection::Pointer arch_flags;
+ mutable std::tr1::shared_ptr<UseFlagNameCollection> arch_flags;
/// Do we have mirrors?
mutable bool has_mirrors;
@@ -162,16 +161,16 @@ namespace paludis
void need_profiles_desc() const;
/// Our profile handler.
- mutable PortageRepositoryProfile::Pointer profile_ptr;
+ mutable std::tr1::shared_ptr<PortageRepositoryProfile> profile_ptr;
/// Our news handler.
- mutable PortageRepositoryNews::Pointer news_ptr;
+ mutable std::tr1::shared_ptr<PortageRepositoryNews> news_ptr;
/// Our sets handler.
- mutable PortageRepositorySets::Pointer sets_ptr;
+ mutable std::tr1::shared_ptr<PortageRepositorySets> sets_ptr;
/// Our metadata handler.
- mutable PortageRepositoryEntries::Pointer entries_ptr;
+ mutable std::tr1::shared_ptr<PortageRepositoryEntries> entries_ptr;
/// Our virtuals
mutable VirtualsMap our_virtuals;
@@ -183,9 +182,9 @@ namespace paludis
mutable ProfilesDesc profiles_desc;
- RepositoryNameCache::Pointer names_cache;
+ std::tr1::shared_ptr<RepositoryNameCache> names_cache;
- mutable UseDesc::Pointer use_desc;
+ mutable std::tr1::shared_ptr<UseDesc> use_desc;
PortageRepository * const repo;
};
@@ -196,9 +195,7 @@ namespace paludis
has_category_names(false),
has_repo_mask(false),
has_virtuals(false),
- arch_flags(0),
has_mirrors(false),
- profile_ptr(0),
news_ptr(new PortageRepositoryNews(params.environment, r, p)),
sets_ptr(new PortageRepositorySets(params.environment, r, p)),
entries_ptr(PortageRepositoryEntriesMaker::get_instance()->find_maker(
@@ -206,7 +203,6 @@ namespace paludis
has_our_virtuals(false),
has_profiles_desc(false),
names_cache(new RepositoryNameCache(p.names_cache, r)),
- use_desc(0),
repo(r)
{
}
@@ -221,7 +217,7 @@ namespace paludis
if (profile_ptr)
return;
- profile_ptr.assign(new PortageRepositoryProfile(
+ profile_ptr.reset(new PortageRepositoryProfile(
params.environment, repo->name(), *params.profiles));
}
@@ -248,7 +244,7 @@ namespace paludis
.arch(tokens.at(0))
.path(*profiles.begin())
.status(tokens.at(2))
- .profile(PortageRepositoryProfile::Pointer(new PortageRepositoryProfile(
+ .profile(std::tr1::shared_ptr<PortageRepositoryProfile>(new PortageRepositoryProfile(
params.environment, repo->name(), profiles))));
}
@@ -279,7 +275,7 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
{
// the info_vars and info_pkgs info is only added on demand, since it's
// fairly slow to calculate.
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("location", stringify(_imp->params.location));
config_info->add_kv("profiles", join(_imp->params.profiles->begin(),
@@ -377,14 +373,14 @@ namespace
};
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
PortageRepository::do_category_names() const
{
Context context("When fetching category names in " + stringify(name()) + ":");
need_category_names();
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
CategoryMap::const_iterator i(_imp->category_names.begin()),
i_end(_imp->category_names.end());
for ( ; i != i_end ; ++i)
@@ -392,7 +388,7 @@ PortageRepository::do_category_names() const
return result;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
PortageRepository::do_package_names(const CategoryNamePart & c) const
{
/* this isn't particularly fast because it isn't called very often. avoid
@@ -405,7 +401,7 @@ PortageRepository::do_package_names(const CategoryNamePart & c) const
need_category_names();
if (_imp->category_names.end() == _imp->category_names.find(c))
- return QualifiedPackageNameCollection::Pointer(new QualifiedPackageNameCollection::Concrete);
+ return std::tr1::shared_ptr<QualifiedPackageNameCollection>(new QualifiedPackageNameCollection::Concrete);
if ((_imp->params.location / stringify(c)).is_directory())
for (DirIterator d(_imp->params.location / stringify(c)), d_end ; d != d_end ; ++d)
@@ -430,7 +426,7 @@ PortageRepository::do_package_names(const CategoryNamePart & c) const
_imp->category_names[c] = true;
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
std::copy(_imp->package_names.begin(), _imp->package_names.end(),
transform_inserter(filter_inserter(result->inserter(), CategoryFilter(c)),
@@ -439,7 +435,7 @@ PortageRepository::do_package_names(const CategoryNamePart & c) const
return result;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
PortageRepository::do_version_specs(const QualifiedPackageName & n) const
{
Context context("When fetching versions of '" + stringify(n) + "' in "
@@ -451,7 +447,7 @@ PortageRepository::do_version_specs(const QualifiedPackageName & n) const
return _imp->version_specs.find(n)->second;
}
else
- return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
+ return std::tr1::shared_ptr<VersionSpecCollection>(new VersionSpecCollection::Concrete);
}
bool
@@ -464,7 +460,7 @@ PortageRepository::do_has_version(const QualifiedPackageName & q,
if (has_package_named(q))
{
need_version_names(q);
- VersionSpecCollection::Pointer vv(_imp->version_specs.find(q)->second);
+ std::tr1::shared_ptr<VersionSpecCollection> vv(_imp->version_specs.find(q)->second);
return vv->end() != vv->find(v);
}
else
@@ -527,7 +523,7 @@ PortageRepository::need_version_names(const QualifiedPackageName & n) const
Log::get_instance()->message(ll_debug, lc_context, "need_version_names '" + stringify(n) + "'");
- VersionSpecCollection::Pointer v(new VersionSpecCollection::Concrete);
+ std::tr1::shared_ptr<VersionSpecCollection> v(new VersionSpecCollection::Concrete);
FSEntry path(_imp->params.location / stringify(n.category) /
stringify(n.package));
@@ -589,7 +585,7 @@ PortageRepository::fetch_repo_name(const std::string & location)
return RepositoryName("x-" + modified_location);
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
PortageRepository::do_version_metadata(
const QualifiedPackageName & q, const VersionSpec & v) const
{
@@ -603,7 +599,7 @@ PortageRepository::do_version_metadata(
if (! has_version(q, v))
throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
- VersionMetadata::Pointer result(_imp->entries_ptr->generate_version_metadata(q, v));
+ std::tr1::shared_ptr<VersionMetadata> result(_imp->entries_ptr->generate_version_metadata(q, v));
_imp->metadata.insert(std::make_pair(std::make_pair(q, v), result));
return result;
}
@@ -623,7 +619,7 @@ PortageRepository::do_query_repository_masks(const QualifiedPackageName & q, con
for (LineConfigFile::Iterator line(ff.begin()), line_end(ff.end()) ;
line != line_end ; ++line)
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(*line));
_imp->repo_mask[a->package()].push_back(a);
}
}
@@ -635,9 +631,9 @@ PortageRepository::do_query_repository_masks(const QualifiedPackageName & q, con
if (_imp->repo_mask.end() == r)
return false;
else
- for (IndirectIterator<std::list<PackageDepAtom::ConstPointer>::const_iterator, const PackageDepAtom>
+ for (IndirectIterator<std::list<std::tr1::shared_ptr<const PackageDepAtom> >::const_iterator, const PackageDepAtom>
k(r->second.begin()), k_end(r->second.end()) ; k != k_end ; ++k)
- if (match_package(_imp->params.environment, *k, PackageDatabaseEntry(q, v, name())))
+ if (match_package(*_imp->params.environment, *k, PackageDatabaseEntry(q, v, name())))
return true;
return false;
@@ -673,13 +669,13 @@ PortageRepository::do_query_use_force(const UseFlagName & u, const PackageDataba
return _imp->profile_ptr->use_forced(u, e);
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
PortageRepository::do_arch_flags() const
{
if (! _imp->arch_flags)
{
Context context("When loading arch list:");
- _imp->arch_flags.assign(new UseFlagNameCollection::Concrete);
+ _imp->arch_flags.reset(new UseFlagNameCollection::Concrete);
FSEntry a(_imp->params.location / "profiles" / "arch.list");
if (a.exists())
@@ -758,7 +754,7 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
_imp->entries_ptr->install(q, v, o, _imp->profile_ptr);
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
PortageRepository::do_package_set(const SetName & s) const
{
if (s.data() == "system")
@@ -770,7 +766,7 @@ PortageRepository::do_package_set(const SetName & s) const
return _imp->sets_ptr->package_set(s);
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
PortageRepository::sets_list() const
{
return _imp->sets_ptr->sets_list();
@@ -818,7 +814,7 @@ PortageRepository::do_sync() const
void
PortageRepository::invalidate()
{
- _imp.assign(new Implementation<PortageRepository>(this, _imp->params));
+ _imp.reset(new Implementation<PortageRepository>(this, _imp->params));
}
void
@@ -841,14 +837,14 @@ PortageRepository::get_environment_variable(
for_package.version, var, _imp->profile_ptr);
}
-RepositoryInfo::ConstPointer
+std::tr1::shared_ptr<const RepositoryInfo>
PortageRepository::info(bool verbose) const
{
- RepositoryInfo::ConstPointer result_non_verbose(Repository::info(verbose));
+ std::tr1::shared_ptr<const RepositoryInfo> result_non_verbose(Repository::info(verbose));
if (! verbose)
return result_non_verbose;
- RepositoryInfo::Pointer result(new RepositoryInfo);
+ std::tr1::shared_ptr<RepositoryInfo> result(new RepositoryInfo);
for (RepositoryInfo::SectionIterator s(result_non_verbose->begin_sections()),
s_end(result_non_verbose->end_sections()) ; s != s_end ; ++s)
@@ -863,11 +859,11 @@ PortageRepository::info(bool verbose) const
if (! info_pkgs.empty())
{
- RepositoryInfoSection::Pointer package_info(new RepositoryInfoSection("Package information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> package_info(new RepositoryInfoSection("Package information"));
for (std::set<std::string>::const_iterator i(info_pkgs.begin()),
i_end(info_pkgs.end()) ; i != i_end ; ++i)
{
- PackageDatabaseEntryCollection::ConstPointer q(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> q(
_imp->params.environment->package_database()->query(PackageDepAtom(*i), is_installed_only,
qo_order_by_version));
if (q->empty())
@@ -902,7 +898,7 @@ PortageRepository::info(bool verbose) const
PackageDatabaseEntry e(QualifiedPackageName(*info_pkgs.begin()),
*version_specs(QualifiedPackageName(*info_pkgs.begin()))->last(),
name());
- RepositoryInfoSection::Pointer variable_info(new RepositoryInfoSection("Variable information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> variable_info(new RepositoryInfoSection("Variable information"));
for (std::set<std::string>::const_iterator i(info_vars.begin()),
i_end(info_vars.end()) ; i != i_end ; ++i)
variable_info->add_kv(*i, get_environment_variable(e, *i));
@@ -939,7 +935,7 @@ PortageRepository::end_mirrors(const std::string & s) const
return MirrorsIterator(_imp->mirrors.equal_range(s).second);
}
-PortageRepository::VirtualsCollection::ConstPointer
+std::tr1::shared_ptr<const PortageRepository::VirtualsCollection>
PortageRepository::virtual_packages() const
{
Context context("When loading virtual packages for repository '" +
@@ -951,7 +947,7 @@ PortageRepository::virtual_packages() const
_imp->need_profiles();
need_category_names();
- VirtualsCollection::Pointer result(new VirtualsCollection::Concrete);
+ std::tr1::shared_ptr<VirtualsCollection> result(new VirtualsCollection::Concrete);
for (PortageRepositoryProfile::VirtualsIterator i(_imp->profile_ptr->begin_virtuals()),
i_end(_imp->profile_ptr->end_virtuals()) ; i != i_end ; ++i)
@@ -965,12 +961,12 @@ PortageRepository::virtual_packages() const
return result;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
PortageRepository::virtual_package_version_metadata(const RepositoryVirtualsEntry & p,
const VersionSpec & v) const
{
- VersionMetadata::ConstPointer m(version_metadata(p.provided_by_atom->package(), v));
- PortageVirtualVersionMetadata::Pointer result(new PortageVirtualVersionMetadata(
+ std::tr1::shared_ptr<const VersionMetadata> m(version_metadata(p.provided_by_atom->package(), v));
+ std::tr1::shared_ptr<PortageVirtualVersionMetadata> result(new PortageVirtualVersionMetadata(
m->slot, PackageDatabaseEntry(p.provided_by_atom->package(), v, name())));
if (m->license_interface)
@@ -984,12 +980,12 @@ PortageRepository::virtual_package_version_metadata(const RepositoryVirtualsEntr
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
PortageRepository::do_use_expand_flags() const
{
_imp->need_profiles();
- UseFlagNameCollection::Pointer result(new UseFlagNameCollection::Concrete);
+ std::tr1::shared_ptr<UseFlagNameCollection> result(new UseFlagNameCollection::Concrete);
for (PortageRepositoryProfile::UseExpandIterator i(_imp->profile_ptr->begin_use_expand()),
i_end(_imp->profile_ptr->end_use_expand()) ; i != i_end ; ++i)
{
@@ -1008,12 +1004,12 @@ PortageRepository::do_use_expand_flags() const
return result;
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
PortageRepository::do_use_expand_prefixes() const
{
_imp->need_profiles();
- UseFlagNameCollection::Pointer result(new UseFlagNameCollection::Concrete);
+ std::tr1::shared_ptr<UseFlagNameCollection> result(new UseFlagNameCollection::Concrete);
for (PortageRepositoryProfile::UseExpandIterator i(_imp->profile_ptr->begin_use_expand()),
i_end(_imp->profile_ptr->end_use_expand()) ; i != i_end ; ++i)
{
@@ -1025,12 +1021,12 @@ PortageRepository::do_use_expand_prefixes() const
return result;
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
PortageRepository::do_use_expand_hidden_prefixes() const
{
_imp->need_profiles();
- UseFlagNameCollection::Pointer result(new UseFlagNameCollection::Concrete);
+ std::tr1::shared_ptr<UseFlagNameCollection> result(new UseFlagNameCollection::Concrete);
for (PortageRepositoryProfile::UseExpandIterator i(_imp->profile_ptr->begin_use_expand_hidden()),
i_end(_imp->profile_ptr->end_use_expand_hidden()) ; i != i_end ; ++i)
{
@@ -1078,13 +1074,13 @@ PortageRepository::regenerate_cache() const
_imp->names_cache->regenerate_cache();
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
PortageRepository::do_category_names_containing_package(const PackageNamePart & p) const
{
if (! _imp->names_cache->usable())
return Repository::do_category_names_containing_package(p);
- CategoryNamePartCollection::ConstPointer result(
+ std::tr1::shared_ptr<const CategoryNamePartCollection> result(
_imp->names_cache->category_names_containing_package(p));
return result ? result : Repository::do_category_names_containing_package(p);
@@ -1159,7 +1155,7 @@ PortageRepository::do_describe_use_flag(const UseFlagName & f,
const PackageDatabaseEntry * const e) const
{
if (! _imp->use_desc)
- _imp->use_desc.assign(new UseDesc(_imp->params.location / "profiles"));
+ _imp->use_desc.reset(new UseDesc(_imp->params.location / "profiles"));
return _imp->use_desc->describe(f, e);
}
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index 582dd9b..e6326a0 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -78,20 +78,20 @@ namespace paludis
virtual bool do_has_package_named(const QualifiedPackageName &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
- CategoryNamePartCollection::ConstPointer do_category_names_containing_package(
+ std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names_containing_package(
const PackageNamePart & p) const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
virtual bool do_has_version(const QualifiedPackageName &, const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
@@ -106,15 +106,15 @@ namespace paludis
virtual void do_install(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &) const;
- virtual DepAtom::Pointer do_package_set(const SetName &) const;
+ virtual std::tr1::shared_ptr<DepAtom> do_package_set(const SetName &) const;
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
virtual bool do_sync() const;
- virtual VirtualsCollection::ConstPointer virtual_packages() const;
+ virtual std::tr1::shared_ptr<const VirtualsCollection> virtual_packages() const;
- virtual VersionMetadata::ConstPointer virtual_package_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> virtual_package_version_metadata(
const RepositoryVirtualsEntry &, const VersionSpec & v) const;
/* RepositoryUseInterface */
@@ -122,19 +122,19 @@ namespace paludis
virtual UseFlagState do_query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
virtual bool do_query_use_mask(const UseFlagName &, const PackageDatabaseEntry *) const;
virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const;
- virtual UseFlagNameCollection::ConstPointer do_arch_flags() const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_flags() const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_hidden_prefixes() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_arch_flags() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_flags() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_hidden_prefixes() const;
virtual UseFlagName do_use_expand_name(const UseFlagName & u) const;
virtual UseFlagName do_use_expand_value(const UseFlagName & u) const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_prefixes() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_prefixes() const;
virtual std::string do_describe_use_flag(const UseFlagName &,
const PackageDatabaseEntry * const) const;
/* end of RepositoryUseInterface */
public:
- virtual RepositoryInfo::ConstPointer info(bool verbose) const;
+ virtual std::tr1::shared_ptr<const RepositoryInfo> info(bool verbose) const;
/**
* Constructor.
@@ -158,16 +158,13 @@ namespace paludis
virtual MirrorsIterator begin_mirrors(const std::string & s) const;
virtual MirrorsIterator end_mirrors(const std::string & s) const;
- typedef CountedPtr<PortageRepository, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const PortageRepository, count_policy::InternalCountTag> ConstPointer;
-
///\name Information about PortageRepository
///\{
std::string profile_variable(const std::string &) const;
typedef libwrapiter::ForwardIterator<PortageRepository, std::pair<
- const QualifiedPackageName, PackageDepAtom::ConstPointer> > OurVirtualsIterator;
+ const QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > > OurVirtualsIterator;
///\}
diff --git a/paludis/repositories/portage/portage_repository.sr b/paludis/repositories/portage/portage_repository.sr
index 279f015..5f4c515 100644
--- a/paludis/repositories/portage/portage_repository.sr
+++ b/paludis/repositories/portage/portage_repository.sr
@@ -3,7 +3,7 @@ make_class_PortageRepositoryProfilesDescLine()
key path FSEntry
key arch std::string
key status std::string
- key profile PortageRepositoryProfile::Pointer
+ key profile "std::tr1::shared_ptr<PortageRepositoryProfile>"
allow_named_args
}
diff --git a/paludis/repositories/portage/portage_repository_TEST.cc b/paludis/repositories/portage/portage_repository_TEST.cc
index 98713cd..df15892 100644
--- a/paludis/repositories/portage/portage_repository_TEST.cc
+++ b/paludis/repositories/portage/portage_repository_TEST.cc
@@ -46,13 +46,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo1");
keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "test-repo-1");
}
@@ -69,13 +69,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo2");
keys->insert("profile", "portage_repository_TEST_dir/repo2/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "x-repo2");
}
@@ -92,13 +92,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo3");
keys->insert("profile", "portage_repository_TEST_dir/repo3/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "x-repo3");
}
@@ -115,13 +115,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo1");
keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -147,20 +147,20 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo1");
keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- CategoryNamePartCollection::ConstPointer c(repo->category_names());
+ std::tr1::shared_ptr<const CategoryNamePartCollection> c(repo->category_names());
TEST_CHECK(c->end() != c->find(CategoryNamePart("cat-one")));
TEST_CHECK(c->end() != c->find(CategoryNamePart("cat-two")));
TEST_CHECK(c->end() != c->find(CategoryNamePart("cat-three")));
@@ -181,13 +181,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -221,13 +221,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
repo->package_names(CategoryNamePart("cat-one"));
@@ -265,16 +265,16 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
- QualifiedPackageNameCollection::ConstPointer names(0);
+ std::tr1::shared_ptr<const QualifiedPackageNameCollection> names;
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -318,16 +318,16 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo5");
keys->insert("profile", "portage_repository_TEST_dir/repo5/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
- QualifiedPackageNameCollection::ConstPointer names(0);
+ std::tr1::shared_ptr<const QualifiedPackageNameCollection> names;
for (int pass = 1 ; pass <= 2 ; ++pass)
{
@@ -352,13 +352,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -396,20 +396,20 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- VersionSpecCollection::ConstPointer versions(0);
+ std::tr1::shared_ptr<const VersionSpecCollection> versions;
versions = repo->version_specs(QualifiedPackageName("cat-one/pkg-one"));
TEST_CHECK(! versions->empty());
@@ -439,20 +439,20 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo8");
keys->insert("profile", "portage_repository_TEST_dir/repo8/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- VersionSpecCollection::ConstPointer versions(0);
+ std::tr1::shared_ptr<const VersionSpecCollection> versions;
versions = repo->version_specs(QualifiedPackageName("cat-one/pkg-one"));
TEST_CHECK(! versions->empty());
@@ -482,19 +482,19 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo6");
keys->insert("profile", "portage_repository_TEST_dir/repo6/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- VersionMetadata::ConstPointer m(0);
+ std::tr1::shared_ptr<const VersionMetadata> m;
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
TEST_CHECK_EQUAL(m->description, "the-description");
@@ -523,19 +523,19 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo7");
keys->insert("profile", "portage_repository_TEST_dir/repo7/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- VersionMetadata::ConstPointer m(0);
+ std::tr1::shared_ptr<const VersionMetadata> m;
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
TEST_CHECK_EQUAL(m->description, "The Description");
@@ -560,19 +560,19 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo7");
keys->insert("profile", "portage_repository_TEST_dir/repo7/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- VersionMetadata::ConstPointer m(0);
+ std::tr1::shared_ptr<const VersionMetadata> m;
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-two"), VersionSpec("1"));
TEST_CHECK_EQUAL(m->eapi, "UNKNOWN");
@@ -591,13 +591,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo9");
keys->insert("profile", "portage_repository_TEST_dir/repo9/profiles/profile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -639,13 +639,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "ebuild");
keys->insert("names_cache", "/var/empty");
keys->insert("location", "portage_repository_TEST_dir/repo10");
keys->insert("profiles", "portage_repository_TEST_dir/repo10/profiles/profile/subprofile");
- PortageRepository::Pointer repo(make_ebuild_repository(
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
&env, keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
diff --git a/paludis/repositories/portage/portage_repository_entries.hh b/paludis/repositories/portage/portage_repository_entries.hh
index 99f1bc4..2cee993 100644
--- a/paludis/repositories/portage/portage_repository_entries.hh
+++ b/paludis/repositories/portage/portage_repository_entries.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -24,7 +24,6 @@
#include <paludis/repository.hh>
#include <paludis/version_spec.hh>
#include <paludis/version_metadata.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/repositories/portage/portage_repository_profile.hh>
@@ -48,8 +47,7 @@ namespace paludis
* \ingroup grpportagerepository
* \nosubgrouping
*/
- class PALUDIS_VISIBLE PortageRepositoryEntries :
- public InternalCounted<PortageRepositoryEntries>
+ class PALUDIS_VISIBLE PortageRepositoryEntries
{
private:
const std::string _ext;
@@ -82,7 +80,7 @@ namespace paludis
/**
* Generate version metadata.
*/
- virtual VersionMetadata::Pointer generate_version_metadata(const QualifiedPackageName &,
+ virtual std::tr1::shared_ptr<VersionMetadata> generate_version_metadata(const QualifiedPackageName &,
const VersionSpec &) const = 0;
/**
@@ -90,10 +88,10 @@ namespace paludis
*/
virtual std::string get_environment_variable(const QualifiedPackageName &,
const VersionSpec &, const std::string & var,
- PortageRepositoryProfile::ConstPointer) const = 0;
+ std::tr1::shared_ptr<const PortageRepositoryProfile>) const = 0;
virtual void install(const QualifiedPackageName &, const VersionSpec &,
- const InstallOptions &, PortageRepositoryProfile::ConstPointer) const = 0;
+ const InstallOptions &, std::tr1::shared_ptr<const PortageRepositoryProfile>) const = 0;
};
/**
@@ -119,12 +117,12 @@ namespace paludis
*/
class PortageRepositoryEntriesMaker :
public VirtualConstructor<std::string,
- PortageRepositoryEntries::Pointer (*) (const Environment * const, PortageRepository * const,
+ std::tr1::shared_ptr<PortageRepositoryEntries> (*) (const Environment * const, PortageRepository * const,
const PortageRepositoryParams &),
virtual_constructor_not_found::ThrowException<NoSuchPortageRepositoryEntriesType> >,
- public InstantiationPolicy<PortageRepositoryEntriesMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<PortageRepositoryEntriesMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<PortageRepositoryEntriesMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<PortageRepositoryEntriesMaker, instantiation_method::SingletonTag>;
private:
PortageRepositoryEntriesMaker();
diff --git a/paludis/repositories/portage/portage_repository_news.cc b/paludis/repositories/portage/portage_repository_news.cc
index b25affb..d36f5b3 100644
--- a/paludis/repositories/portage/portage_repository_news.cc
+++ b/paludis/repositories/portage/portage_repository_news.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -42,8 +42,7 @@ namespace paludis
* \ingroup grpportagerepository
*/
template<>
- struct Implementation<PortageRepositoryNews> :
- InternalCounted<Implementation<PortageRepositoryNews> >
+ struct Implementation<PortageRepositoryNews>
{
const Environment * const environment;
const PortageRepository * const portage_repository;
@@ -137,7 +136,7 @@ PortageRepositoryNews::update_news() const
if (news.begin_display_if_profile() != news.end_display_if_profile())
{
bool local_show(false);
- FSEntryCollection::ConstPointer c(_imp->params.profiles);
+ std::tr1::shared_ptr<const FSEntryCollection> c(_imp->params.profiles);
for (FSEntryCollection::Iterator p(c->begin()), p_end(c->end()) ; p != p_end ; ++p)
{
std::string profile(strip_leading_string(strip_trailing_string(
@@ -197,8 +196,7 @@ namespace paludis
* \ingroup grpnewsconfigfile
*/
template<>
- struct Implementation<NewsFile> :
- InternalCounted<Implementation<NewsFile> >
+ struct Implementation<NewsFile>
{
mutable bool in_header;
mutable std::list<std::string> display_if_installed;
diff --git a/paludis/repositories/portage/portage_repository_news.hh b/paludis/repositories/portage/portage_repository_news.hh
index c7e2020..bd1b67d 100644
--- a/paludis/repositories/portage/portage_repository_news.hh
+++ b/paludis/repositories/portage/portage_repository_news.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -44,8 +44,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE PortageRepositoryNews :
private PrivateImplementationPattern<PortageRepositoryNews>,
- private InstantiationPolicy<PortageRepositoryNews, instantiation_method::NonCopyableTag>,
- public InternalCounted<PortageRepositoryNews>
+ private InstantiationPolicy<PortageRepositoryNews, instantiation_method::NonCopyableTag>
{
public:
///\name Basic operations
diff --git a/paludis/repositories/portage/portage_repository_params.sr b/paludis/repositories/portage/portage_repository_params.sr
index 8e17650..8363d64 100644
--- a/paludis/repositories/portage/portage_repository_params.sr
+++ b/paludis/repositories/portage/portage_repository_params.sr
@@ -6,13 +6,13 @@ make_class_PortageRepositoryParams()
key entry_format std::string
key environment "Environment *"
key location FSEntry
- key profiles FSEntryCollection::ConstPointer
+ key profiles "std::tr1::shared_ptr<const FSEntryCollection>"
key cache FSEntry
key write_cache FSEntry
key names_cache FSEntry
key distdir FSEntry
key pkgdir FSEntry
- key eclassdirs FSEntryCollection::ConstPointer
+ key eclassdirs "std::tr1::shared_ptr<const FSEntryCollection>"
key setsdir FSEntry
key securitydir FSEntry
key newsdir FSEntry
diff --git a/paludis/repositories/portage/portage_repository_profile.cc b/paludis/repositories/portage/portage_repository_profile.cc
index 4edaad2..a411d9c 100644
--- a/paludis/repositories/portage/portage_repository_profile.cc
+++ b/paludis/repositories/portage/portage_repository_profile.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -44,11 +44,11 @@ namespace
{
typedef MakeHashedSet<UseFlagName>::Type UseFlagSet;
typedef MakeHashedMap<std::string, std::string>::Type EnvironmentVariablesMap;
- typedef MakeHashedMap<QualifiedPackageName, PackageDepAtom::ConstPointer>::Type VirtualsMap;
- typedef MakeHashedMap<QualifiedPackageName, std::list<PackageDepAtom::ConstPointer> >::Type PackageMaskMap;
+ typedef MakeHashedMap<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> >::Type VirtualsMap;
+ typedef MakeHashedMap<QualifiedPackageName, std::list<std::tr1::shared_ptr<const PackageDepAtom> > >::Type PackageMaskMap;
typedef MakeHashedMap<UseFlagName, bool>::Type FlagStatusMap;
- typedef std::list<std::pair<PackageDepAtom::ConstPointer, FlagStatusMap> > PackageFlagStatusMapList;
+ typedef std::list<std::pair<std::tr1::shared_ptr<const PackageDepAtom>, FlagStatusMap> > PackageFlagStatusMapList;
struct StackedValues
{
@@ -78,8 +78,7 @@ namespace paludis
* \see PortageRepositoryProfile
*/
template<>
- class Implementation<PortageRepositoryProfile> :
- public InternalCounted<PortageRepositoryProfile>
+ class Implementation<PortageRepositoryProfile>
{
private:
void load_profile_directory_recursively(const FSEntry & dir);
@@ -119,8 +118,8 @@ namespace paludis
///\name System package set
///\{
- AllDepAtom::Pointer system_packages;
- GeneralSetDepTag::Pointer system_tag;
+ std::tr1::shared_ptr<AllDepAtom> system_packages;
+ std::tr1::shared_ptr<GeneralSetDepTag> system_tag;
///\}
@@ -360,7 +359,7 @@ Implementation<PortageRepositoryProfile>::make_vars_from_file_vars()
continue;
Context context_atom("When parsing '" + *i + "':");
- PackageDepAtom::Pointer atom(new PackageDepAtom(i->substr(1)));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(i->substr(1)));
atom->set_tag(system_tag);
system_packages->add_child(atom);
}
@@ -383,7 +382,7 @@ Implementation<PortageRepositoryProfile>::make_vars_from_file_vars()
QualifiedPackageName v(tokens[0]);
virtuals.erase(v);
- virtuals.insert(std::make_pair(v, PackageDepAtom::Pointer(new PackageDepAtom(tokens[1]))));
+ virtuals.insert(std::make_pair(v, std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom(tokens[1]))));
}
}
catch (const NameError & e)
@@ -400,7 +399,7 @@ Implementation<PortageRepositoryProfile>::make_vars_from_file_vars()
try
{
- PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
+ std::tr1::shared_ptr<const PackageDepAtom> a(new PackageDepAtom(*line));
package_mask[a->package()].push_back(a);
}
catch (const NameError & e)
@@ -466,7 +465,7 @@ Implementation<PortageRepositoryProfile>::load_atom_use_file(const FSEntry & fil
try
{
- PackageDepAtom::ConstPointer atom(new PackageDepAtom(*tokens.begin()));
+ std::tr1::shared_ptr<const PackageDepAtom> atom(new PackageDepAtom(*tokens.begin()));
PackageFlagStatusMapList::iterator n(m.insert(m.end(), std::make_pair(atom, FlagStatusMap())));
for (std::list<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
@@ -569,7 +568,7 @@ PortageRepositoryProfile::use_masked(const UseFlagName & u,
for (PackageFlagStatusMapList::const_iterator g(i->package_use_mask.begin()),
g_end(i->package_use_mask.end()) ; g != g_end ; ++g)
{
- if (! match_package(_imp->env, g->first, e))
+ if (! match_package(*_imp->env, *g->first, *e))
continue;
FlagStatusMap::const_iterator h(g->second.find(u));
@@ -597,7 +596,7 @@ PortageRepositoryProfile::use_forced(const UseFlagName & u,
for (PackageFlagStatusMapList::const_iterator g(i->package_use_force.begin()),
g_end(i->package_use_force.end()) ; g != g_end ; ++g)
{
- if (! match_package(_imp->env, g->first, e))
+ if (! match_package(*_imp->env, *g->first, *e))
continue;
FlagStatusMap::const_iterator h(g->second.find(u));
@@ -624,7 +623,7 @@ PortageRepositoryProfile::use_state_ignoring_masks(const UseFlagName & u,
for (PackageFlagStatusMapList::const_iterator g(i->package_use.begin()),
g_end(i->package_use.end()) ; g != g_end ; ++g)
{
- if (! match_package(_imp->env, g->first, e))
+ if (! match_package(*_imp->env, *g->first, *e))
continue;
FlagStatusMap::const_iterator h(g->second.find(u));
@@ -653,7 +652,7 @@ PortageRepositoryProfile::environment_variable(const std::string & s) const
}
}
-AllDepAtom::Pointer
+std::tr1::shared_ptr<AllDepAtom>
PortageRepositoryProfile::system_packages() const
{
return _imp->system_packages;
@@ -705,9 +704,9 @@ PortageRepositoryProfile::profile_masked(const QualifiedPackageName & n,
else
{
PackageDatabaseEntry dbe(n, v, r);
- for (std::list<PackageDepAtom::ConstPointer>::const_iterator k(rr->second.begin()),
+ for (std::list<std::tr1::shared_ptr<const PackageDepAtom> >::const_iterator k(rr->second.begin()),
k_end(rr->second.end()) ; k != k_end ; ++k)
- if (match_package(_imp->env, **k, dbe))
+ if (match_package(*_imp->env, **k, dbe))
return true;
}
diff --git a/paludis/repositories/portage/portage_repository_profile.hh b/paludis/repositories/portage/portage_repository_profile.hh
index 281b0db..e914b0a 100644
--- a/paludis/repositories/portage/portage_repository_profile.hh
+++ b/paludis/repositories/portage/portage_repository_profile.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -48,8 +48,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE PortageRepositoryProfile :
private PrivateImplementationPattern<PortageRepositoryProfile>,
- private InstantiationPolicy<PortageRepositoryProfile, instantiation_method::NonCopyableTag>,
- public InternalCounted<PortageRepositoryProfile>
+ private InstantiationPolicy<PortageRepositoryProfile, instantiation_method::NonCopyableTag>
{
public:
///\name Basic operations
@@ -107,7 +106,7 @@ namespace paludis
///\name System package set
///\{
- AllDepAtom::Pointer system_packages() const;
+ std::tr1::shared_ptr<AllDepAtom> system_packages() const;
///\}
@@ -115,7 +114,7 @@ namespace paludis
///\{
typedef libwrapiter::ForwardIterator<PortageRepositoryProfile,
- const std::pair<const QualifiedPackageName, PackageDepAtom::ConstPointer> > VirtualsIterator;
+ const std::pair<const QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > > VirtualsIterator;
VirtualsIterator begin_virtuals() const;
VirtualsIterator end_virtuals() const;
diff --git a/paludis/repositories/portage/portage_repository_profile_file.cc b/paludis/repositories/portage/portage_repository_profile_file.cc
index 392c41d..04fa13a 100644
--- a/paludis/repositories/portage/portage_repository_profile_file.cc
+++ b/paludis/repositories/portage/portage_repository_profile_file.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -28,8 +28,7 @@ using namespace paludis;
namespace paludis
{
template <>
- struct Implementation<ProfileFile> :
- InternalCounted<Implementation<ProfileFile> >
+ struct Implementation<ProfileFile>
{
std::list<std::string> lines;
};
diff --git a/paludis/repositories/portage/portage_repository_sets.cc b/paludis/repositories/portage/portage_repository_sets.cc
index 5c0bbf9..ed80a26 100644
--- a/paludis/repositories/portage/portage_repository_sets.cc
+++ b/paludis/repositories/portage/portage_repository_sets.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
* Copyright (c) 2006 Danny van Dyk <kugelfang@gentoo.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -48,8 +48,7 @@ namespace paludis
* \ingroup grpportagerepository
*/
template<>
- struct Implementation<PortageRepositorySets> :
- InternalCounted<Implementation<PortageRepositorySets> >
+ struct Implementation<PortageRepositorySets>
{
const Environment * const environment;
const PortageRepository * const portage_repository;
@@ -76,7 +75,7 @@ PortageRepositorySets::~PortageRepositorySets()
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
PortageRepositorySets::package_set(const SetName & s) const
{
if ("system" == s.data())
@@ -87,12 +86,12 @@ PortageRepositorySets::package_set(const SetName & s) const
return security_set(true);
else if ((_imp->params.setsdir / (stringify(s) + ".conf")).exists())
{
- GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(s, stringify(_imp->portage_repository->name())));
+ std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(s, stringify(_imp->portage_repository->name())));
FSEntry ff(_imp->params.setsdir / (stringify(s) + ".conf"));
Context context("When loading package set '" + stringify(s) + "' from '" + stringify(ff) + "':");
- AllDepAtom::Pointer result(new AllDepAtom);
+ std::tr1::shared_ptr<AllDepAtom> result(new AllDepAtom);
LineConfigFile f(ff);
for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
@@ -107,19 +106,19 @@ PortageRepositorySets::package_set(const SetName & s) const
Log::get_instance()->message(ll_warning, lc_context,
"Line '" + *line + "' in set file '"
+ stringify(ff) + "' does not specify '*' or '?', assuming '*'");
- PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(0)));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(tokens.at(0)));
atom->set_tag(tag);
result->add_child(atom);
}
else if ("*" == tokens.at(0))
{
- PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(1)));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(tokens.at(1)));
atom->set_tag(tag);
result->add_child(atom);
}
else if ("?" == tokens.at(0))
{
- PackageDepAtom::Pointer p(new PackageDepAtom(tokens.at(1)));
+ std::tr1::shared_ptr<PackageDepAtom> p(new PackageDepAtom(tokens.at(1)));
p->set_tag(tag);
if (! _imp->environment->package_database()->query(PackageDepAtom(p->package()),
is_installed_only, qo_whatever)->empty())
@@ -139,15 +138,15 @@ PortageRepositorySets::package_set(const SetName & s) const
return result;
}
else
- return DepAtom::Pointer(0);
+ return std::tr1::shared_ptr<DepAtom>();
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
PortageRepositorySets::sets_list() const
{
Context context("While generating the list of sets:");
- SetsCollection::Pointer result(new SetsCollection::Concrete);
+ std::tr1::shared_ptr<SetsCollection> result(new SetsCollection::Concrete);
result->insert(SetName("insecurity"));
result->insert(SetName("security"));
result->insert(SetName("system"));
@@ -267,16 +266,16 @@ namespace
}
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
PortageRepositorySets::security_set(bool insecurity) const
{
Context context("When building security or insecurity package set:");
- AllDepAtom::Pointer security_packages(new AllDepAtom);
+ std::tr1::shared_ptr<AllDepAtom> security_packages(new AllDepAtom);
if (!_imp->params.securitydir.is_directory())
return security_packages;
- std::map<std::string, GLSADepTag::Pointer> glsa_tags;
+ std::map<std::string, std::tr1::shared_ptr<GLSADepTag> > glsa_tags;
for (DirIterator f(_imp->params.securitydir), f_end ; f != f_end; ++f)
{
@@ -287,14 +286,14 @@ PortageRepositorySets::security_set(bool insecurity) const
try
{
- GLSA::ConstPointer glsa(GLSA::create_from_xml_file(stringify(*f)));
+ std::tr1::shared_ptr<const GLSA> glsa(GLSA::create_from_xml_file(stringify(*f)));
Context local_local_context("When handling GLSA '" + glsa->id() + "' from '" +
stringify(*f) + "':");
for (GLSA::PackagesIterator glsa_pkg(glsa->begin_packages()),
glsa_pkg_end(glsa->end_packages()) ; glsa_pkg != glsa_pkg_end ; ++glsa_pkg)
{
- PackageDatabaseEntryCollection::ConstPointer candidates(_imp->environment->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> candidates(_imp->environment->package_database()->query(
PackageDepAtom(glsa_pkg->name()), insecurity ? is_any : is_installed_only,
qo_order_by_version));
for (PackageDatabaseEntryCollection::Iterator c(candidates->begin()), c_end(candidates->end()) ;
@@ -304,12 +303,12 @@ PortageRepositorySets::security_set(bool insecurity) const
continue;
if (glsa_tags.end() == glsa_tags.find(glsa->id()))
- glsa_tags.insert(std::make_pair(glsa->id(), GLSADepTag::Pointer(
+ glsa_tags.insert(std::make_pair(glsa->id(), std::tr1::shared_ptr<GLSADepTag>(
new GLSADepTag(glsa->id(), glsa->title()))));
if (insecurity)
{
- PackageDepAtom::Pointer atom(new PackageDepAtom(
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(
"=" + stringify(c->name) + "-" + stringify(c->version) +
"::" + stringify(c->repository)));
atom->set_tag(glsa_tags.find(glsa->id())->second);
@@ -323,7 +322,7 @@ PortageRepositorySets::security_set(bool insecurity) const
SlotName wanted_slot(_imp->environment->package_database()->fetch_repository(
c->repository)->version_metadata(c->name, c->version)->slot);
- PackageDatabaseEntryCollection::ConstPointer available(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> available(
_imp->environment->package_database()->query(PackageDepAtom(glsa_pkg->name()), is_installable_only,
qo_order_by_version));
for (PackageDatabaseEntryCollection::ReverseIterator r(available->rbegin()),
@@ -337,7 +336,7 @@ PortageRepositorySets::security_set(bool insecurity) const
if (is_vulnerable(*glsa_pkg, *r))
continue;
- PackageDepAtom::Pointer atom(new PackageDepAtom(
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(
"=" + stringify(r->name) + "-" + stringify(r->version) +
"::" + stringify(r->repository)));
atom->set_tag(glsa_tags.find(glsa->id())->second);
diff --git a/paludis/repositories/portage/portage_repository_sets.hh b/paludis/repositories/portage/portage_repository_sets.hh
index 22baf92..12cbabd 100644
--- a/paludis/repositories/portage/portage_repository_sets.hh
+++ b/paludis/repositories/portage/portage_repository_sets.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
* Copyright (c) 2006 Danny van Dyk <kugelfang@gentoo.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -43,8 +43,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE PortageRepositorySets :
private PrivateImplementationPattern<PortageRepositorySets>,
- private InstantiationPolicy<PortageRepositorySets, instantiation_method::NonCopyableTag>,
- public InternalCounted<PortageRepositorySets>
+ private InstantiationPolicy<PortageRepositorySets, instantiation_method::NonCopyableTag>
{
private:
PackageDatabaseEntryCollection::Iterator
@@ -63,17 +62,17 @@ namespace paludis
/**
* Fetch a package set other than system.
*/
- DepAtom::Pointer package_set(const SetName & s) const;
+ std::tr1::shared_ptr<DepAtom> package_set(const SetName & s) const;
/**
* Fetch the security or insecurity set.
*/
- DepAtom::Pointer security_set(bool insecure) const;
+ std::tr1::shared_ptr<DepAtom> security_set(bool insecure) const;
/**
* Give a list of all the sets in this repo.
*/
- SetsCollection::ConstPointer sets_list() const;
+ std::tr1::shared_ptr<const SetsCollection> sets_list() const;
};
}
diff --git a/paludis/repositories/portage/portage_virtual_version_metadata.hh b/paludis/repositories/portage/portage_virtual_version_metadata.hh
index 8eb244d..33af661 100644
--- a/paludis/repositories/portage/portage_virtual_version_metadata.hh
+++ b/paludis/repositories/portage/portage_virtual_version_metadata.hh
@@ -34,9 +34,6 @@ namespace paludis
public:
PortageVirtualVersionMetadata(const SlotName &, const PackageDatabaseEntry &);
virtual ~PortageVirtualVersionMetadata();
-
- typedef CountedPtr<const PortageVirtualVersionMetadata, count_policy::InternalCountTag> ConstPointer;
- typedef CountedPtr<PortageVirtualVersionMetadata, count_policy::InternalCountTag> Pointer;
};
}
diff --git a/paludis/repositories/portage/registration.cc b/paludis/repositories/portage/registration.cc
index 6a0adef..1b80763 100644
--- a/paludis/repositories/portage/registration.cc
+++ b/paludis/repositories/portage/registration.cc
@@ -33,10 +33,10 @@ extern "C"
namespace
{
- CountedPtr<Repository>
+ std::tr1::shared_ptr<Repository>
make_portage_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
std::string repo_file = "?";
if (m->end() != m->find("repo_file"))
diff --git a/paludis/repositories/portage/use_desc.cc b/paludis/repositories/portage/use_desc.cc
index 8ee0c48..1899d86 100644
--- a/paludis/repositories/portage/use_desc.cc
+++ b/paludis/repositories/portage/use_desc.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -32,8 +32,7 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<UseDesc> :
- InternalCounted<Implementation<UseDesc> >
+ struct Implementation<UseDesc>
{
MakeHashedMap<std::string, std::string>::Type desc;
diff --git a/paludis/repositories/portage/use_desc.hh b/paludis/repositories/portage/use_desc.hh
index ad17d60..64ffc02 100644
--- a/paludis/repositories/portage/use_desc.hh
+++ b/paludis/repositories/portage/use_desc.hh
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_PORTAGE_USE_DESC_HH 1
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/name.hh>
@@ -37,8 +36,7 @@ namespace paludis
*/
class UseDesc :
private PrivateImplementationPattern<UseDesc>,
- private InstantiationPolicy<UseDesc, instantiation_method::NonCopyableTag>,
- public InternalCounted<UseDesc>
+ private InstantiationPolicy<UseDesc, instantiation_method::NonCopyableTag>
{
public:
///\name Basic operations
diff --git a/paludis/repositories/portage/xml_things.cc b/paludis/repositories/portage/xml_things.cc
index fee3d7d..624a46e 100644
--- a/paludis/repositories/portage/xml_things.cc
+++ b/paludis/repositories/portage/xml_things.cc
@@ -29,7 +29,7 @@ using namespace paludis;
extern "C"
{
- GLSA::Pointer create_glsa_from_xml_file(const std::string &);
+ std::tr1::shared_ptr<GLSA> create_glsa_from_xml_file(const std::string &);
}
namespace
@@ -37,7 +37,7 @@ namespace
class Handler
{
private:
- GLSA::Pointer _glsa;
+ std::tr1::shared_ptr<GLSA> _glsa;
public:
Handler() :
@@ -73,7 +73,7 @@ namespace
}
}
- void handle_package_archs(xmlDocPtr doc, xmlAttr * const attr, GLSAPackage::Pointer pkg)
+ void handle_package_archs(xmlDocPtr doc, xmlAttr * const attr, std::tr1::shared_ptr<GLSAPackage> pkg)
{
for (xmlAttr * a(attr) ; a ; a = a->next)
{
@@ -109,7 +109,7 @@ namespace
}
}
- void handle_package_children(xmlDocPtr doc, xmlNode * const node, GLSAPackage::Pointer pkg)
+ void handle_package_children(xmlDocPtr doc, xmlNode * const node, std::tr1::shared_ptr<GLSAPackage> pkg)
{
for (xmlNode * n(node) ; n ; n = n->next)
{
@@ -153,7 +153,7 @@ namespace
{
std::string m;
handle_package_name(doc, n->properties, m);
- GLSAPackage::Pointer pkg(new GLSAPackage(QualifiedPackageName(m)));
+ std::tr1::shared_ptr<GLSAPackage> pkg(new GLSAPackage(QualifiedPackageName(m)));
handle_package_archs(doc, n->properties, pkg);
handle_package_children(doc, n->children, pkg);
_glsa->add_package(pkg);
@@ -167,14 +167,14 @@ namespace
}
- GLSA::Pointer glsa()
+ std::tr1::shared_ptr<GLSA> glsa()
{
return _glsa;
}
};
}
-GLSA::Pointer
+std::tr1::shared_ptr<GLSA>
create_glsa_from_xml_file(const std::string & filename)
{
LibXmlPtrHolder<xmlDocPtr> xml_doc(xmlReadFile(filename.c_str(), 0, 0), &xmlFreeDoc);
diff --git a/paludis/repositories/portage/xml_things_TEST.cc b/paludis/repositories/portage/xml_things_TEST.cc
index 748fc08..e993de0 100644
--- a/paludis/repositories/portage/xml_things_TEST.cc
+++ b/paludis/repositories/portage/xml_things_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -33,7 +33,7 @@ namespace test_cases
void run()
{
- GLSA::Pointer glsa(GLSA::create_from_xml_file("xml_things_TEST_dir/glsa-123456-78.xml"));
+ std::tr1::shared_ptr<GLSA> glsa(GLSA::create_from_xml_file("xml_things_TEST_dir/glsa-123456-78.xml"));
TEST_CHECK(glsa);
TEST_CHECK_EQUAL("123456-78", glsa->id());
@@ -63,7 +63,7 @@ namespace test_cases
void run()
{
- GLSA::Pointer glsa(GLSA::create_from_xml_file("xml_things_TEST_dir/glsa-987654-32.xml"));
+ std::tr1::shared_ptr<GLSA> glsa(GLSA::create_from_xml_file("xml_things_TEST_dir/glsa-987654-32.xml"));
TEST_CHECK(glsa);
TEST_CHECK_EQUAL("987654-32", glsa->id());
diff --git a/paludis/repositories/repository_maker.cc b/paludis/repositories/repository_maker.cc
index e1e583e..868408b 100644
--- a/paludis/repositories/repository_maker.cc
+++ b/paludis/repositories/repository_maker.cc
@@ -67,8 +67,7 @@ PaludisRepositorySoDirCannotDlopenError::what() const throw ()
namespace paludis
{
template<>
- struct Implementation<RepositoryMaker> :
- InternalCounted<Implementation<RepositoryMaker> >
+ struct Implementation<RepositoryMaker>
{
std::list<void *> dl_opened;
};
diff --git a/paludis/repositories/repository_maker.hh b/paludis/repositories/repository_maker.hh
index 0853c10..725e017 100644
--- a/paludis/repositories/repository_maker.hh
+++ b/paludis/repositories/repository_maker.hh
@@ -71,13 +71,13 @@ namespace paludis
*/
class PALUDIS_VISIBLE RepositoryMaker :
public VirtualConstructor<std::string,
- Repository::Pointer (*) (Environment * const,
- AssociativeCollection<std::string, std::string>::ConstPointer),
+ std::tr1::shared_ptr<Repository> (*) (Environment * const,
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >),
virtual_constructor_not_found::ThrowException<NoSuchRepositoryTypeError> >,
- public InstantiationPolicy<RepositoryMaker, instantiation_method::SingletonAsNeededTag>,
+ public InstantiationPolicy<RepositoryMaker, instantiation_method::SingletonTag>,
private PrivateImplementationPattern<RepositoryMaker>
{
- friend class InstantiationPolicy<RepositoryMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<RepositoryMaker, instantiation_method::SingletonTag>;
private:
RepositoryMaker();
diff --git a/paludis/repositories/vdb/vdb_repository.cc b/paludis/repositories/vdb/vdb_repository.cc
index cd7ca16..b9ee76a 100644
--- a/paludis/repositories/vdb/vdb_repository.cc
+++ b/paludis/repositories/vdb/vdb_repository.cc
@@ -73,7 +73,7 @@ namespace
VersionSpec version;
/// Our metadata, may be zero.
- VDBVersionMetadata::Pointer metadata;
+ std::tr1::shared_ptr<VDBVersionMetadata> metadata;
/// Our built USE flags.
std::set<UseFlagName> use;
@@ -85,7 +85,6 @@ namespace
VDBEntry(const QualifiedPackageName & n, const VersionSpec & v) :
name(n),
version(v),
- metadata(0),
installed_time(0)
{
}
@@ -296,8 +295,7 @@ namespace paludis
* \ingroup grpvdbrepository
*/
template <>
- struct Implementation<VDBRepository> :
- InternalCounted<Implementation<VDBRepository> >
+ struct Implementation<VDBRepository>
{
VDBRepositoryParams params;
@@ -336,11 +334,11 @@ namespace paludis
void load_entry(std::vector<VDBEntry>::iterator) const;
/// Provieds data
- mutable RepositoryProvidesInterface::ProvidesCollection::Pointer provides;
+ mutable std::tr1::shared_ptr<RepositoryProvidesInterface::ProvidesCollection> provides;
const FSEntry names_cache_dir;
- RepositoryNameCache::Pointer names_cache;
+ std::tr1::shared_ptr<RepositoryNameCache> names_cache;
/// Constructor.
Implementation(const VDBRepository * const, const VDBRepositoryParams &);
@@ -362,7 +360,6 @@ namespace paludis
world_file(p.world),
provides_cache(p.provides_cache),
entries_valid(false),
- provides(0),
names_cache_dir(p.names_cache),
names_cache(new RepositoryNameCache(names_cache_dir, r))
{
@@ -450,7 +447,7 @@ namespace paludis
Context context("When loading VDBRepository entry for '" + stringify(p->name)
+ "-" + stringify(p->version) + "' from '" + stringify(location) + "':");
- p->metadata = VDBVersionMetadata::Pointer(new VDBVersionMetadata);
+ p->metadata = std::tr1::shared_ptr<VDBVersionMetadata>(new VDBVersionMetadata);
p->metadata->build_depend_string = file_contents(location, p->name, p->version, "DEPEND");
p->metadata->run_depend_string = file_contents(location, p->name, p->version, "RDEPEND");
p->metadata->license_string = file_contents(location, p->name, p->version, "LICENSE");
@@ -476,7 +473,7 @@ namespace paludis
std::string repo(file_contents(location, p->name, p->version, "REPOSITORY"));
if (! repo.empty())
- p->metadata->source.assign(new PackageDatabaseEntry(p->name, p->version,
+ p->metadata->source.reset(new PackageDatabaseEntry(p->name, p->version,
RepositoryName(repo)));
std::string raw_use(file_contents(location, p->name, p->version, "USE"));
@@ -508,7 +505,7 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
"vdb"),
PrivateImplementationPattern<VDBRepository>(new Implementation<VDBRepository>(this, p))
{
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("location", stringify(_imp->location));
config_info->add_kv("root", stringify(_imp->root));
@@ -555,7 +552,7 @@ VDBRepository::do_has_package_named(const QualifiedPackageName & q) const
return r.first != r.second;
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
VDBRepository::do_category_names() const
{
Context context("When fetching category names in " + stringify(name()) + ":");
@@ -563,7 +560,7 @@ VDBRepository::do_category_names() const
if (! _imp->entries_valid)
_imp->load_entries();
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
#if 0
for (std::vector<VDBEntry>::const_iterator c(_imp->entries.begin()), c_end(_imp->entries.end()) ;
@@ -578,7 +575,7 @@ VDBRepository::do_category_names() const
return result;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
VDBRepository::do_package_names(const CategoryNamePart & c) const
{
/* this isn't particularly fast because it isn't called very often. avoid
@@ -588,7 +585,7 @@ VDBRepository::do_package_names(const CategoryNamePart & c) const
Context context("When fetching package names in category '" + stringify(c)
+ "' in " + stringify(name()) + ":");
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
std::pair<std::vector<VDBEntry>::const_iterator, std::vector<VDBEntry>::const_iterator>
r(std::equal_range(_imp->entries.begin(), _imp->entries.end(), c,
@@ -604,7 +601,7 @@ VDBRepository::do_package_names(const CategoryNamePart & c) const
return result;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
VDBRepository::do_version_specs(const QualifiedPackageName & n) const
{
Context context("When fetching versions of '" + stringify(n) + "' in "
@@ -613,7 +610,7 @@ VDBRepository::do_version_specs(const QualifiedPackageName & n) const
if (! _imp->entries_valid)
_imp->load_entries_for(n.category);
- VersionSpecCollection::Pointer result(new VersionSpecCollection::Concrete);
+ std::tr1::shared_ptr<VersionSpecCollection> result(new VersionSpecCollection::Concrete);
std::pair<std::vector<VDBEntry>::const_iterator, std::vector<VDBEntry>::const_iterator>
r(std::equal_range(_imp->entries.begin(), _imp->entries.end(), n,
@@ -632,11 +629,11 @@ VDBRepository::do_has_version(const QualifiedPackageName & q,
Context context("When checking for version '" + stringify(v) + "' in '"
+ stringify(q) + "' in " + stringify(name()) + ":");
- VersionSpecCollection::ConstPointer versions(do_version_specs(q));
+ std::tr1::shared_ptr<const VersionSpecCollection> versions(do_version_specs(q));
return versions->end() != versions->find(v);
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
VDBRepository::do_version_metadata(
const QualifiedPackageName & q, const VersionSpec & v) const
{
@@ -660,7 +657,7 @@ VDBRepository::do_version_metadata(
}
}
-Contents::ConstPointer
+std::tr1::shared_ptr<const Contents>
VDBRepository::do_contents(
const QualifiedPackageName & q, const VersionSpec & v) const
{
@@ -680,10 +677,10 @@ VDBRepository::do_contents(
"version lookup failed for request for '" +
stringify(q) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "'");
- return Contents::ConstPointer(new Contents);
+ return std::tr1::shared_ptr<const Contents>(new Contents);
}
- Contents::Pointer result(new Contents);
+ std::tr1::shared_ptr<Contents> result(new Contents);
FSEntry f(_imp->location / stringify(q.category) /
(stringify(q.package) + "-" + stringify(v)));
@@ -721,15 +718,15 @@ VDBRepository::do_contents(
}
if ("obj" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsFileEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsFileEntry(tokens.at(1))));
else if ("dir" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsDirEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsDirEntry(tokens.at(1))));
else if ("misc" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsMiscEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsMiscEntry(tokens.at(1))));
else if ("fif" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsFifoEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsFifoEntry(tokens.at(1))));
else if ("dev" == tokens.at(0))
- result->add(ContentsEntry::Pointer(new ContentsDevEntry(tokens.at(1))));
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsDevEntry(tokens.at(1))));
else if ("sym" == tokens.at(0))
{
if (tokens.size() < 4)
@@ -741,7 +738,7 @@ VDBRepository::do_contents(
continue;
}
- result->add(ContentsEntry::Pointer(new ContentsSymEntry(
+ result->add(std::tr1::shared_ptr<ContentsEntry>(new ContentsSymEntry(
tokens.at(1), tokens.at(3))));
}
}
@@ -827,10 +824,10 @@ VDBRepository::do_query_use_force(const UseFlagName & u, const PackageDatabaseEn
return use_enabled == do_query_use(u, e);
}
-CountedPtr<Repository>
+std::tr1::shared_ptr<Repository>
VDBRepository::make_vdb_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
{
std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") : m->find("repo_file")->second);
Context context("When making VDB repository from repo_file '" + repo_file + "':");
@@ -869,7 +866,7 @@ VDBRepository::make_vdb_repository(
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
buildroot = "/var/tmp/paludis";
- return CountedPtr<Repository>(new VDBRepository(VDBRepositoryParams::create()
+ return std::tr1::shared_ptr<Repository>(new VDBRepository(VDBRepositoryParams::create()
.environment(env)
.location(location)
.root(root)
@@ -907,7 +904,7 @@ VDBRepository::do_uninstall(const QualifiedPackageName & q, const VersionSpec &
throw PackageInstallActionError("Couldn't uninstall '" + stringify(q) + "-" +
stringify(v) + "' because root ('" + stringify(_imp->root) + "') is not a directory");
- VersionMetadata::ConstPointer metadata(0);
+ std::tr1::shared_ptr<const VersionMetadata> metadata;
if (! has_version(q, v))
throw PackageInstallActionError("Couldn't uninstall '" + stringify(q) + "-" +
stringify(v) + "' because has_version failed");
@@ -916,16 +913,16 @@ VDBRepository::do_uninstall(const QualifiedPackageName & q, const VersionSpec &
PackageDatabaseEntry e(q, v, name());
- FSEntryCollection::Pointer eclassdirs(new FSEntryCollection::Concrete);
+ std::tr1::shared_ptr<FSEntryCollection> eclassdirs(new FSEntryCollection::Concrete);
eclassdirs->append(FSEntry(_imp->location / stringify(q.category) /
(stringify(q.package) + "-" + stringify(v))));
FSEntry pkg_dir(_imp->location / stringify(q.category) /
(stringify(q.package) + "-" + stringify(v)));
- CountedPtr<FSEntry, count_policy::ExternalCountTag> load_env(0);
+ std::tr1::shared_ptr<FSEntry> load_env;
if (is_full_env(pkg_dir))
- load_env.assign(new FSEntry(pkg_dir / "environment.bz2"));
+ load_env.reset(new FSEntry(pkg_dir / "environment.bz2"));
EbuildUninstallCommand uninstall_cmd(EbuildCommandParams::create()
.environment(_imp->env)
@@ -941,12 +938,12 @@ VDBRepository::do_uninstall(const QualifiedPackageName & q, const VersionSpec &
.root(stringify(_imp->root) + "/")
.disable_cfgpro(o.no_config_protect)
.unmerge_only(is_ebuilded(pkg_dir))
- .load_environment(load_env.raw_pointer()));
+ .load_environment(load_env.get()));
uninstall_cmd();
}
-DepAtom::Pointer
+std::tr1::shared_ptr<DepAtom>
VDBRepository::do_package_set(const SetName & s) const
{
Context context("When fetching package set '" + stringify(s) + "' from '" +
@@ -954,8 +951,8 @@ VDBRepository::do_package_set(const SetName & s) const
if ("everything" == s.data())
{
- AllDepAtom::Pointer result(new AllDepAtom);
- GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(SetName("everything"), stringify(name())));
+ std::tr1::shared_ptr<AllDepAtom> result(new AllDepAtom);
+ std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(SetName("everything"), stringify(name())));
if (! _imp->entries_valid)
_imp->load_entries();
@@ -963,7 +960,7 @@ VDBRepository::do_package_set(const SetName & s) const
for (std::vector<VDBEntry>::const_iterator p(_imp->entries.begin()),
p_end(_imp->entries.end()) ; p != p_end ; ++p)
{
- PackageDepAtom::Pointer atom(new PackageDepAtom(p->name));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(p->name));
atom->set_tag(tag);
result->add_child(atom);
}
@@ -972,8 +969,8 @@ VDBRepository::do_package_set(const SetName & s) const
}
else if ("world" == s.data())
{
- AllDepAtom::Pointer result(new AllDepAtom);
- GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(SetName("world"), stringify(name())));
+ std::tr1::shared_ptr<AllDepAtom> result(new AllDepAtom);
+ std::tr1::shared_ptr<GeneralSetDepTag> tag(new GeneralSetDepTag(SetName("world"), stringify(name())));
if (_imp->world_file.exists())
{
@@ -982,7 +979,7 @@ VDBRepository::do_package_set(const SetName & s) const
for (LineConfigFile::Iterator line(world.begin()), line_end(world.end()) ;
line != line_end ; ++line)
{
- PackageDepAtom::Pointer atom(new PackageDepAtom(QualifiedPackageName(*line)));
+ std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(QualifiedPackageName(*line)));
atom->set_tag(tag);
result->add_child(atom);
}
@@ -995,15 +992,15 @@ VDBRepository::do_package_set(const SetName & s) const
return result;
}
else
- return DepAtom::Pointer(0);
+ return std::tr1::shared_ptr<DepAtom>();
}
-SetsCollection::ConstPointer
+std::tr1::shared_ptr<const SetsCollection>
VDBRepository::sets_list() const
{
Context context("While generating the list of sets:");
- SetsCollection::Pointer result(new SetsCollection::Concrete);
+ std::tr1::shared_ptr<SetsCollection> result(new SetsCollection::Concrete);
result->insert(SetName("everything"));
result->insert(SetName("world"));
return result;
@@ -1012,7 +1009,7 @@ VDBRepository::sets_list() const
void
VDBRepository::invalidate()
{
- _imp.assign(new Implementation<VDBRepository>(this, _imp->params));
+ _imp.reset(new Implementation<VDBRepository>(this, _imp->params));
}
void
@@ -1168,7 +1165,7 @@ VDBRepository::get_environment_variable(
+ stringify(for_package) + "'");
}
-RepositoryProvidesInterface::ProvidesCollection::ConstPointer
+std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesCollection>
VDBRepository::provided_packages() const
{
if (_imp->provides)
@@ -1180,14 +1177,15 @@ VDBRepository::provided_packages() const
return _imp->provides;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
VDBRepository::provided_package_version_metadata(const RepositoryProvidesEntry & p) const
{
- VDBVersionMetadata::ConstPointer m(version_metadata(p.provided_by_name, p.version));
- VDBVirtualVersionMetadata::Pointer result(new VDBVirtualVersionMetadata(
+ std::tr1::shared_ptr<const VersionMetadata> m(version_metadata(p.provided_by_name, p.version));
+ std::tr1::shared_ptr<VDBVirtualVersionMetadata> result(new VDBVirtualVersionMetadata(
m->slot, PackageDatabaseEntry(p.provided_by_name, p.version, name())));
- result->license_string = m->license_string;
+ if (m->license_interface)
+ result->license_string = m->license_interface->license_string;
result->eapi = m->eapi;
result->build_depend_string = stringify(p.provided_by_name);
result->run_depend_string = stringify(p.provided_by_name);
@@ -1195,28 +1193,28 @@ VDBRepository::provided_package_version_metadata(const RepositoryProvidesEntry &
return result;
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
VDBRepository::do_arch_flags() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
VDBRepository::do_use_expand_flags() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
VDBRepository::do_use_expand_prefixes() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
-UseFlagNameCollection::ConstPointer
+std::tr1::shared_ptr<const UseFlagNameCollection>
VDBRepository::do_use_expand_hidden_prefixes() const
{
- return UseFlagNameCollection::ConstPointer(new UseFlagNameCollection::Concrete);
+ return std::tr1::shared_ptr<const UseFlagNameCollection>(new UseFlagNameCollection::Concrete);
}
UseFlagName
@@ -1239,7 +1237,7 @@ VDBRepository::load_provided_using_cache() const
Context context("When loading VDB PROVIDEs map using '" + stringify(_imp->provides_cache) + "':");
- ProvidesCollection::Pointer result(new ProvidesCollection::Concrete);
+ std::tr1::shared_ptr<ProvidesCollection> result(new ProvidesCollection::Concrete);
if (! _imp->provides_cache.is_regular_file())
{
@@ -1301,7 +1299,7 @@ VDBRepository::load_provided_the_slow_way() const
Log::get_instance()->message(ll_debug, lc_no_context, "Starting VDB PROVIDEs map creation");
- ProvidesCollection::Pointer result(new ProvidesCollection::Concrete);
+ std::tr1::shared_ptr<ProvidesCollection> result(new ProvidesCollection::Concrete);
if (! _imp->entries_valid)
_imp->load_entries();
@@ -1325,7 +1323,7 @@ VDBRepository::load_provided_the_slow_way() const
if (provide_str.empty())
continue;
- DepAtom::ConstPointer provide(PortageDepParser::parse(provide_str,
+ std::tr1::shared_ptr<const DepAtom> provide(PortageDepParser::parse(provide_str,
PortageDepParserPolicy<PackageDepAtom, false>::get_instance()));
PackageDatabaseEntry dbe(e->name, e->version, name());
DepAtomFlattener f(_imp->env, &dbe, provide);
@@ -1413,13 +1411,13 @@ VDBRepository::regenerate_provides_cache() const
}
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
VDBRepository::do_category_names_containing_package(const PackageNamePart & p) const
{
if (! _imp->names_cache->usable())
return Repository::do_category_names_containing_package(p);
- CategoryNamePartCollection::ConstPointer result(
+ std::tr1::shared_ptr<const CategoryNamePartCollection> result(
_imp->names_cache->category_names_containing_package(p));
return result ? result : Repository::do_category_names_containing_package(p);
diff --git a/paludis/repositories/vdb/vdb_repository.hh b/paludis/repositories/vdb/vdb_repository.hh
index 6802f0d..df05438 100644
--- a/paludis/repositories/vdb/vdb_repository.hh
+++ b/paludis/repositories/vdb/vdb_repository.hh
@@ -68,21 +68,21 @@ namespace paludis
virtual bool do_has_package_named(const QualifiedPackageName &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
virtual bool do_has_version(const QualifiedPackageName &, const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
- virtual Contents::ConstPointer do_contents(
+ virtual std::tr1::shared_ptr<const Contents> do_contents(
const QualifiedPackageName &,
const VersionSpec &) const;
@@ -95,23 +95,23 @@ namespace paludis
virtual void do_uninstall(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &) const;
- virtual DepAtom::Pointer do_package_set(const SetName &) const;
+ virtual std::tr1::shared_ptr<DepAtom> do_package_set(const SetName &) const;
/* RepositoryUseInterface */
virtual UseFlagState do_query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
virtual bool do_query_use_mask(const UseFlagName &, const PackageDatabaseEntry *) const;
virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const;
- virtual UseFlagNameCollection::ConstPointer do_arch_flags() const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_flags() const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_hidden_prefixes() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_arch_flags() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_flags() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_hidden_prefixes() const;
virtual UseFlagName do_use_expand_name(const UseFlagName & u) const;
virtual UseFlagName do_use_expand_value(const UseFlagName & u) const;
- virtual UseFlagNameCollection::ConstPointer do_use_expand_prefixes() const;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_prefixes() const;
/* end of RepositoryUseInterface */
- virtual CategoryNamePartCollection::ConstPointer do_category_names_containing_package(
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names_containing_package(
const PackageNamePart &) const;
public:
@@ -123,9 +123,9 @@ namespace paludis
/**
* Virtual constructor.
*/
- static CountedPtr<Repository> make_vdb_repository(
+ static std::tr1::shared_ptr<Repository> make_vdb_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer m);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m);
/**
* Destructor.
@@ -144,20 +144,17 @@ namespace paludis
const PackageDatabaseEntry & for_package,
const std::string & var) const;
- virtual ProvidesCollection::ConstPointer provided_packages() const;
+ virtual std::tr1::shared_ptr<const ProvidesCollection> provided_packages() const;
- virtual VersionMetadata::ConstPointer provided_package_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> provided_package_version_metadata(
const RepositoryProvidesEntry &) const;
- virtual SetsCollection::ConstPointer sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
virtual bool is_suitable_destination_for(const PackageDatabaseEntry &) const;
virtual std::string do_describe_use_flag(const UseFlagName &,
const PackageDatabaseEntry * const) const;
-
- typedef CountedPtr<VDBRepository, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const VDBRepository, count_policy::InternalCountTag> ConstPointer;
};
/**
diff --git a/paludis/repositories/vdb/vdb_repository_TEST.cc b/paludis/repositories/vdb/vdb_repository_TEST.cc
index b4f41a5..c684ee0 100644
--- a/paludis/repositories/vdb/vdb_repository_TEST.cc
+++ b/paludis/repositories/vdb/vdb_repository_TEST.cc
@@ -46,14 +46,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
- &env, keys));
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(&env, keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "installed");
}
} test_vdb_repository_repo_name;
@@ -69,13 +68,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
&env, keys));
TEST_CHECK(repo->has_category_named(CategoryNamePart("cat-one")));
@@ -95,13 +94,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
&env, keys));
PackageDatabaseEntry e1(CategoryNamePart("cat-one") + PackageNamePart("pkg-one"),
@@ -109,11 +108,11 @@ namespace test_cases
PackageDatabaseEntry e2(CategoryNamePart("cat-one") + PackageNamePart("pkg-neither"),
VersionSpec("1"), RepositoryName("installed"));
- TEST_CHECK(repo->query_use(UseFlagName("flag1"), &e1) == use_enabled);
- TEST_CHECK(repo->query_use(UseFlagName("flag2"), &e1) == use_enabled);
- TEST_CHECK(repo->query_use(UseFlagName("flag3"), &e1) == use_disabled);
+ TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag1"), &e1) == use_enabled);
+ TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag2"), &e1) == use_enabled);
+ TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag3"), &e1) == use_disabled);
- TEST_CHECK(repo->query_use(UseFlagName("flag4"), &e2) == use_unspecified);
+ TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag4"), &e2) == use_unspecified);
}
} test_vdb_repository_query_use;
@@ -127,16 +126,16 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
keys->insert("world", "vdb_repository_TEST_dir/world-new-file");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
&env, keys));
- repo->add_to_world(QualifiedPackageName("cat-one/foofoo"));
+ repo->world_interface->add_to_world(QualifiedPackageName("cat-one/foofoo"));
std::ifstream world("vdb_repository_TEST_dir/world-new-file");
std::string world_content((std::istreambuf_iterator<char>(world)), std::istreambuf_iterator<char>());
TEST_CHECK_EQUAL(world_content, "cat-one/foofoo\n");
@@ -153,16 +152,16 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
keys->insert("world", "vdb_repository_TEST_dir/world-empty");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
&env, keys));
- repo->add_to_world(QualifiedPackageName("cat-one/foofoo"));
+ repo->world_interface->add_to_world(QualifiedPackageName("cat-one/foofoo"));
std::ifstream world("vdb_repository_TEST_dir/world-empty");
std::string world_content((std::istreambuf_iterator<char>(world)), std::istreambuf_iterator<char>());
TEST_CHECK_EQUAL(world_content, "cat-one/foofoo\n");
@@ -179,16 +178,16 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
keys->insert("world", "vdb_repository_TEST_dir/world-no-match");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
&env, keys));
- repo->add_to_world(QualifiedPackageName("cat-one/foofoo"));
+ repo->world_interface->add_to_world(QualifiedPackageName("cat-one/foofoo"));
std::ifstream world("vdb_repository_TEST_dir/world-no-match");
std::string world_content((std::istreambuf_iterator<char>(world)), std::istreambuf_iterator<char>());
TEST_CHECK_EQUAL(world_content, "cat-one/foo\ncat-one/bar\ncat-one/oink\ncat-one/foofoo\n");
@@ -205,16 +204,16 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
keys->insert("world", "vdb_repository_TEST_dir/world-match");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
&env, keys));
- repo->add_to_world(QualifiedPackageName("cat-one/foofoo"));
+ repo->world_interface->add_to_world(QualifiedPackageName("cat-one/foofoo"));
std::ifstream world("vdb_repository_TEST_dir/world-match");
std::string world_content((std::istreambuf_iterator<char>(world)), std::istreambuf_iterator<char>());
TEST_CHECK_EQUAL(world_content, "cat-one/foo\ncat-one/foofoo\ncat-one/bar\n");
@@ -231,16 +230,16 @@ namespace test_cases
void run()
{
TestEnvironment env;
- AssociativeCollection<std::string, std::string>::Pointer keys(
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
new AssociativeCollection<std::string, std::string>::Concrete);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
keys->insert("world", "vdb_repository_TEST_dir/world-no-match-no-eol");
- VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ std::tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
&env, keys));
- repo->add_to_world(QualifiedPackageName("cat-one/foofoo"));
+ repo->world_interface->add_to_world(QualifiedPackageName("cat-one/foofoo"));
std::ifstream world("vdb_repository_TEST_dir/world-no-match-no-eol");
std::string world_content((std::istreambuf_iterator<char>(world)), std::istreambuf_iterator<char>());
TEST_CHECK_EQUAL(world_content, "cat-one/foo\ncat-one/bar\ncat-one/oink\ncat-one/foofoo\n");
diff --git a/paludis/repositories/vdb/vdb_version_metadata.hh b/paludis/repositories/vdb/vdb_version_metadata.hh
index 88fa02e..d3b6036 100644
--- a/paludis/repositories/vdb/vdb_version_metadata.hh
+++ b/paludis/repositories/vdb/vdb_version_metadata.hh
@@ -34,9 +34,6 @@ namespace paludis
public:
VDBVersionMetadata();
virtual ~VDBVersionMetadata();
-
- typedef CountedPtr<const VDBVersionMetadata, count_policy::InternalCountTag> ConstPointer;
- typedef CountedPtr<VDBVersionMetadata, count_policy::InternalCountTag> Pointer;
};
class VDBVirtualVersionMetadata :
@@ -50,9 +47,6 @@ namespace paludis
public:
VDBVirtualVersionMetadata(const SlotName &, const PackageDatabaseEntry &);
virtual ~VDBVirtualVersionMetadata();
-
- typedef CountedPtr<const VDBVirtualVersionMetadata, count_policy::InternalCountTag> ConstPointer;
- typedef CountedPtr<VDBVirtualVersionMetadata, count_policy::InternalCountTag> Pointer;
};
}
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 1c5f576..a0e9ce2 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -31,8 +31,7 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<InstalledVirtualsRepository> :
- InternalCounted<Implementation<InstalledVirtualsRepository> >
+ struct Implementation<InstalledVirtualsRepository>
{
const Environment * const env;
@@ -69,7 +68,7 @@ InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * con
PrivateImplementationPattern<InstalledVirtualsRepository>(
new Implementation<InstalledVirtualsRepository>(env))
{
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("format", "installed_virtuals");
_info->add_section(config_info);
}
@@ -93,7 +92,7 @@ InstalledVirtualsRepository::need_entries() const
if (! (*r)->provides_interface)
continue;
- RepositoryProvidesInterface::ProvidesCollection::ConstPointer pp(
+ std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesCollection> pp(
(*r)->provides_interface->provided_packages());
for (RepositoryProvidesInterface::ProvidesCollection::Iterator p(
@@ -120,12 +119,12 @@ InstalledVirtualsRepository::need_entries() const
_imp->has_entries = true;
}
-CountedPtr<Repository>
+std::tr1::shared_ptr<Repository>
InstalledVirtualsRepository::make_installed_virtuals_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >)
{
- return CountedPtr<Repository>(new InstalledVirtualsRepository(env));
+ return std::tr1::shared_ptr<Repository>(new InstalledVirtualsRepository(env));
}
bool
@@ -142,7 +141,7 @@ InstalledVirtualsRepository::do_query_profile_masks(const QualifiedPackageName &
return false;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
InstalledVirtualsRepository::do_version_metadata(
const QualifiedPackageName & q,
const VersionSpec & v) const
@@ -180,11 +179,11 @@ InstalledVirtualsRepository::do_has_version(const QualifiedPackageName & q,
return p.first != p.second;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
InstalledVirtualsRepository::do_version_specs(const QualifiedPackageName & q) const
{
if (q.category.data() != "virtual")
- return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
+ return std::tr1::shared_ptr<VersionSpecCollection>(new VersionSpecCollection::Concrete);
need_entries();
@@ -193,18 +192,18 @@ InstalledVirtualsRepository::do_version_specs(const QualifiedPackageName & q) co
VREntry(q, VersionSpec("0"), QualifiedPackageName("dummy/package"),
RepositoryName("dummy_repository")), EntriesNameComparator()));
- VersionSpecCollection::Pointer result(new VersionSpecCollection::Concrete);
+ std::tr1::shared_ptr<VersionSpecCollection> result(new VersionSpecCollection::Concrete);
for ( ; p.first != p.second ; ++p.first)
result->insert(p.first->version);
return result;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
InstalledVirtualsRepository::do_package_names(const CategoryNamePart & c) const
{
if (c.data() != "virtual")
- return QualifiedPackageNameCollection::Pointer(new QualifiedPackageNameCollection::Concrete);
+ return std::tr1::shared_ptr<QualifiedPackageNameCollection>(new QualifiedPackageNameCollection::Concrete);
need_entries();
@@ -214,7 +213,7 @@ InstalledVirtualsRepository::do_package_names(const CategoryNamePart & c) const
RepositoryName("dummy_repository")), EntriesCategoryComparator()));
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
#if 0
/// \todo: in theory, this can be a lot faster
for ( ; p.first != p.second ; ++p.first)
@@ -228,10 +227,10 @@ InstalledVirtualsRepository::do_package_names(const CategoryNamePart & c) const
return result;
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
InstalledVirtualsRepository::do_category_names() const
{
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
result->insert(CategoryNamePart("virtual"));
#if 0
@@ -286,7 +285,7 @@ InstalledVirtualsRepository::do_is_licence(const std::string &) const
void
InstalledVirtualsRepository::invalidate()
{
- _imp.assign(new Implementation<InstalledVirtualsRepository>(_imp->env));
+ _imp.reset(new Implementation<InstalledVirtualsRepository>(_imp->env));
}
void
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.hh b/paludis/repositories/virtuals/installed_virtuals_repository.hh
index cb89f78..75a5fa0 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.hh
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.hh
@@ -46,20 +46,20 @@ namespace paludis
virtual bool do_query_profile_masks(const QualifiedPackageName &,
const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
virtual bool do_has_version(const QualifiedPackageName &,
const VersionSpec &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
virtual bool do_has_package_named(const QualifiedPackageName &) const;
@@ -83,9 +83,9 @@ namespace paludis
/**
* Create an InstalledVirtualsRepository instance.
*/
- static CountedPtr<Repository> make_installed_virtuals_repository(
+ static std::tr1::shared_ptr<Repository> make_installed_virtuals_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >);
virtual void invalidate();
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index cb61dca..7023722 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -31,12 +31,11 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<VirtualsRepository> :
- InternalCounted<Implementation<VirtualsRepository> >
+ struct Implementation<VirtualsRepository>
{
const Environment * const env;
- mutable std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> > names;
+ mutable std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > > names;
mutable bool has_names;
mutable std::vector<VREntry> entries;
@@ -56,8 +55,8 @@ namespace
struct NamesCategoryComparator
{
bool
- operator() (const std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> & a,
- const std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> & b) const
+ operator() (const std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > & a,
+ const std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > & b) const
{
return a.first.category < b.first.category;
}
@@ -66,8 +65,8 @@ namespace
struct NamesNameComparator
{
bool
- operator() (const std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> & a,
- const std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> & b) const
+ operator() (const std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > & a,
+ const std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > & b) const
{
return a.first < b.first;
}
@@ -95,7 +94,7 @@ VirtualsRepository::VirtualsRepository(const Environment * const env) :
PrivateImplementationPattern<VirtualsRepository>(
new Implementation<VirtualsRepository>(env))
{
- RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ std::tr1::shared_ptr<RepositoryInfoSection> config_info(new RepositoryInfoSection("Configuration information"));
config_info->add_kv("format", "virtuals");
_info->add_section(config_info);
}
@@ -121,17 +120,17 @@ VirtualsRepository::need_names() const
if (! (*r)->provides_interface)
continue;
- RepositoryProvidesInterface::ProvidesCollection::ConstPointer provides(
+ std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesCollection> provides(
(*r)->provides_interface->provided_packages());
for (RepositoryProvidesInterface::ProvidesCollection::Iterator p(provides->begin()),
p_end(provides->end()) ; p != p_end ; ++p)
- _imp->names.push_back(std::make_pair(p->virtual_name, PackageDepAtom::ConstPointer(
+ _imp->names.push_back(std::make_pair(p->virtual_name, std::tr1::shared_ptr<const PackageDepAtom>(
new PackageDepAtom(stringify(p->provided_by_name)))));
}
std::sort(_imp->names.begin(), _imp->names.end(), NamesNameComparator());
- std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> > new_names;
+ std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > > new_names;
for (PackageDatabase::RepositoryIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
@@ -139,16 +138,16 @@ VirtualsRepository::need_names() const
if (! (*r)->virtuals_interface)
continue;
- RepositoryVirtualsInterface::VirtualsCollection::ConstPointer virtuals(
+ std::tr1::shared_ptr<const RepositoryVirtualsInterface::VirtualsCollection> virtuals(
(*r)->virtuals_interface->virtual_packages());
for (RepositoryVirtualsInterface::VirtualsCollection::Iterator v(virtuals->begin()),
v_end(virtuals->end()) ; v != v_end ; ++v)
{
std::pair<
- std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator,
- std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator> p(
+ std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator,
+ std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator> p(
std::equal_range(_imp->names.begin(), _imp->names.end(),
- std::make_pair(v->virtual_name, PackageDepAtom::ConstPointer(0)),
+ std::make_pair(v->virtual_name, std::tr1::shared_ptr<const PackageDepAtom>()),
NamesNameComparator()));
if (p.first == p.second)
@@ -174,10 +173,10 @@ VirtualsRepository::need_entries() const
Log::get_instance()->message(ll_debug, lc_context, "VirtualsRepository need_entries");
/* Populate our _imp->entries. */
- for (std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator
+ for (std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator
v(_imp->names.begin()), v_end(_imp->names.end()) ; v != v_end ; ++v)
{
- PackageDatabaseEntryCollection::ConstPointer matches(_imp->env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> matches(_imp->env->package_database()->query(
*v->second, is_installable_only, qo_order_by_version));
if (matches->empty())
@@ -201,12 +200,12 @@ VirtualsRepository::need_entries() const
_imp->has_entries = true;
}
-CountedPtr<Repository>
+std::tr1::shared_ptr<Repository>
VirtualsRepository::make_virtuals_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer)
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >)
{
- return CountedPtr<Repository>(new VirtualsRepository(env));
+ return std::tr1::shared_ptr<Repository>(new VirtualsRepository(env));
}
bool
@@ -223,7 +222,7 @@ VirtualsRepository::do_query_profile_masks(const QualifiedPackageName &,
return false;
}
-VersionMetadata::ConstPointer
+std::tr1::shared_ptr<const VersionMetadata>
VirtualsRepository::do_version_metadata(
const QualifiedPackageName & q,
const VersionSpec & v) const
@@ -252,7 +251,7 @@ VirtualsRepository::do_version_metadata(
return vif->virtual_package_version_metadata(
RepositoryVirtualsEntry::create()
.virtual_name(p.first->virtual_name)
- .provided_by_atom(PackageDepAtom::Pointer(new PackageDepAtom(p.first->provided_by_name))), v);
+ .provided_by_atom(std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom(p.first->provided_by_name))), v);
}
bool
@@ -271,11 +270,11 @@ VirtualsRepository::do_has_version(const QualifiedPackageName & q,
return p.first != p.second;
}
-VersionSpecCollection::ConstPointer
+std::tr1::shared_ptr<const VersionSpecCollection>
VirtualsRepository::do_version_specs(const QualifiedPackageName & q) const
{
if (q.category.data() != "virtual")
- return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
+ return std::tr1::shared_ptr<VersionSpecCollection>(new VersionSpecCollection::Concrete);
need_entries();
@@ -284,39 +283,39 @@ VirtualsRepository::do_version_specs(const QualifiedPackageName & q) const
VREntry(q, VersionSpec("0"), QualifiedPackageName("dummy/package"),
RepositoryName("dummy_repository")), EntriesNameComparator()));
- VersionSpecCollection::Pointer result(new VersionSpecCollection::Concrete);
+ std::tr1::shared_ptr<VersionSpecCollection> result(new VersionSpecCollection::Concrete);
for ( ; p.first != p.second ; ++p.first)
result->insert(p.first->version);
return result;
}
-QualifiedPackageNameCollection::ConstPointer
+std::tr1::shared_ptr<const QualifiedPackageNameCollection>
VirtualsRepository::do_package_names(const CategoryNamePart & c) const
{
if (c.data() != "virtual")
- return QualifiedPackageNameCollection::Pointer(new QualifiedPackageNameCollection::Concrete);
+ return std::tr1::shared_ptr<QualifiedPackageNameCollection>(new QualifiedPackageNameCollection::Concrete);
need_names();
std::pair<
- std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator,
- std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator> p(
+ std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator,
+ std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator> p(
std::equal_range(_imp->names.begin(), _imp->names.end(),
- std::make_pair(c + PackageNamePart("dummy"), PackageDepAtom::ConstPointer(0)),
+ std::make_pair(c + PackageNamePart("dummy"), std::tr1::shared_ptr<const PackageDepAtom>()),
NamesCategoryComparator()));
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
+ std::tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
std::copy(p.first, p.second, transform_inserter(result->inserter(),
- SelectFirst<QualifiedPackageName, PackageDepAtom::ConstPointer>()));
+ SelectFirst<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> >()));
return result;
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
VirtualsRepository::do_category_names() const
{
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
result->insert(CategoryNamePart("virtual"));
#if 0
need_entries();
@@ -338,10 +337,10 @@ VirtualsRepository::do_has_package_named(const QualifiedPackageName & q) const
need_names();
std::pair<
- std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator,
- std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator> p(
+ std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator,
+ std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepAtom> > >::const_iterator> p(
std::equal_range(_imp->names.begin(), _imp->names.end(),
- std::make_pair(q, PackageDepAtom::ConstPointer(0)),
+ std::make_pair(q, std::tr1::shared_ptr<const PackageDepAtom>()),
NamesNameComparator()));
return p.first != p.second;
@@ -372,7 +371,7 @@ VirtualsRepository::do_is_licence(const std::string &) const
void
VirtualsRepository::invalidate()
{
- _imp.assign(new Implementation<VirtualsRepository>(_imp->env));
+ _imp.reset(new Implementation<VirtualsRepository>(_imp->env));
}
void
diff --git a/paludis/repositories/virtuals/virtuals_repository.hh b/paludis/repositories/virtuals/virtuals_repository.hh
index 24ded21..03c2e3c 100644
--- a/paludis/repositories/virtuals/virtuals_repository.hh
+++ b/paludis/repositories/virtuals/virtuals_repository.hh
@@ -46,20 +46,20 @@ namespace paludis
virtual bool do_query_profile_masks(const QualifiedPackageName &,
const VersionSpec &) const;
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const;
virtual bool do_has_version(const QualifiedPackageName &,
const VersionSpec &) const;
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const;
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const;
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
virtual bool do_has_package_named(const QualifiedPackageName &) const;
@@ -83,9 +83,9 @@ namespace paludis
/**
* Create a VirtualsRepository instance.
*/
- static CountedPtr<Repository> make_virtuals_repository(
+ static std::tr1::shared_ptr<Repository> make_virtuals_repository(
Environment * const env,
- AssociativeCollection<std::string, std::string>::ConstPointer);
+ std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >);
virtual void invalidate();
diff --git a/paludis/repositories/virtuals/vr_entry.hh b/paludis/repositories/virtuals/vr_entry.hh
index 1e08837..258f5d3 100644
--- a/paludis/repositories/virtuals/vr_entry.hh
+++ b/paludis/repositories/virtuals/vr_entry.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -39,12 +39,12 @@ namespace paludis
struct EntriesComparator
{
/// Our PackageDatabase instance.
- PackageDatabase::ConstPointer const db;
+ std::tr1::shared_ptr<const PackageDatabase> const db;
///\name Basic operations
///\{
- EntriesComparator(PackageDatabase::ConstPointer const d) :
+ EntriesComparator(std::tr1::shared_ptr<const PackageDatabase> const d) :
db(d)
{
}
diff --git a/paludis/repository.cc b/paludis/repository.cc
index ebb4edd..a8de0d6 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -93,8 +93,7 @@ namespace paludis
* \ingroup grprepository
*/
template<>
- struct Implementation<RepositoryInfoSection> :
- InternalCounted<Implementation<RepositoryInfoSection> >
+ struct Implementation<RepositoryInfoSection>
{
std::string heading;
std::map<std::string, std::string> kvs;
@@ -106,15 +105,14 @@ namespace paludis
* \ingroup grprepository
*/
template<>
- struct Implementation<RepositoryInfo> :
- InternalCounted<Implementation<RepositoryInfo> >
+ struct Implementation<RepositoryInfo>
{
- std::list<RepositoryInfoSection::ConstPointer> sections;
+ std::list<std::tr1::shared_ptr<const RepositoryInfoSection> > sections;
};
}
RepositoryInfo &
-RepositoryInfo::add_section(RepositoryInfoSection::ConstPointer s)
+RepositoryInfo::add_section(std::tr1::shared_ptr<const RepositoryInfoSection> s)
{
_imp->sections.push_back(s);
return *this;
@@ -155,7 +153,7 @@ RepositoryInfoSection::add_kv(const std::string & k, const std::string & v)
return *this;
}
-RepositoryInfo::ConstPointer
+std::tr1::shared_ptr<const RepositoryInfo>
Repository::info(bool) const
{
return _info;
@@ -182,13 +180,13 @@ RepositoryInfo::end_sections() const
return SectionIterator(_imp->sections.end());
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
Repository::do_category_names_containing_package(const PackageNamePart & p) const
{
Context context("When finding category names containing package '" + stringify(p) + "':");
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
- CategoryNamePartCollection::ConstPointer cats(category_names());
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<const CategoryNamePartCollection> cats(category_names());
for (CategoryNamePartCollection::Iterator c(cats->begin()), c_end(cats->end()) ;
c != c_end ; ++c)
if (has_package_named(*c + p))
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 3e272ed..1f9dc46 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -23,7 +23,6 @@
#include <paludis/dep_atom.hh>
#include <paludis/name.hh>
#include <paludis/util/attributes.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/sr.hh>
#include <paludis/util/virtual_constructor.hh>
@@ -86,7 +85,6 @@ namespace paludis
* \nosubgrouping
*/
class RepositoryInfoSection :
- public InternalCounted<RepositoryInfoSection>,
private PrivateImplementationPattern<RepositoryInfoSection>
{
public:
@@ -125,7 +123,6 @@ namespace paludis
* \nosubgrouping
*/
class RepositoryInfo :
- public InternalCounted<RepositoryInfo>,
private PrivateImplementationPattern<RepositoryInfo>
{
public:
@@ -141,7 +138,7 @@ namespace paludis
///\{
typedef libwrapiter::ForwardIterator<RepositoryInfo,
- const RepositoryInfoSection::ConstPointer> SectionIterator;
+ const std::tr1::shared_ptr<const RepositoryInfoSection> > SectionIterator;
SectionIterator begin_sections() const;
@@ -150,7 +147,7 @@ namespace paludis
///\}
/// Add a section.
- RepositoryInfo & add_section(RepositoryInfoSection::ConstPointer);
+ RepositoryInfo & add_section(std::tr1::shared_ptr<const RepositoryInfoSection>);
};
/**
@@ -167,7 +164,6 @@ namespace paludis
*/
class Repository :
private InstantiationPolicy<Repository, instantiation_method::NonCopyableTag>,
- public InternalCounted<Repository>,
public RepositoryCapabilities
{
private:
@@ -181,7 +177,7 @@ namespace paludis
/**
* Our information.
*/
- mutable RepositoryInfo::Pointer _info;
+ mutable std::tr1::shared_ptr<RepositoryInfo> _info;
///\}
@@ -203,7 +199,7 @@ namespace paludis
/**
* Override in descendents: fetch the metadata.
*/
- virtual VersionMetadata::ConstPointer do_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
const VersionSpec &) const = 0;
@@ -216,25 +212,25 @@ namespace paludis
/**
* Override in descendents: fetch version specs.
*/
- virtual VersionSpecCollection::ConstPointer do_version_specs(
+ virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
const QualifiedPackageName &) const = 0;
/**
* Override in descendents: fetch package names.
*/
- virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
const CategoryNamePart &) const = 0;
/**
* Override in descendents: fetch category names.
*/
- virtual CategoryNamePartCollection::ConstPointer do_category_names() const = 0;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const = 0;
/**
* Override in descendents if a fast implementation is available: fetch category names
* that contain a particular package.
*/
- virtual CategoryNamePartCollection::ConstPointer do_category_names_containing_package(
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names_containing_package(
const PackageNamePart &) const;
/**
@@ -277,7 +273,7 @@ namespace paludis
/**
* Fetch information about the repository.
*/
- virtual RepositoryInfo::ConstPointer info(bool verbose) const;
+ virtual std::tr1::shared_ptr<const RepositoryInfo> info(bool verbose) const;
/**
* Return our name.
@@ -321,7 +317,7 @@ namespace paludis
/**
* Fetch our category names.
*/
- CategoryNamePartCollection::ConstPointer category_names() const
+ std::tr1::shared_ptr<const CategoryNamePartCollection> category_names() const
{
return do_category_names();
}
@@ -329,7 +325,7 @@ namespace paludis
/**
* Fetch categories that contain a named package.
*/
- CategoryNamePartCollection::ConstPointer category_names_containing_package(
+ std::tr1::shared_ptr<const CategoryNamePartCollection> category_names_containing_package(
const PackageNamePart & p) const
{
return do_category_names_containing_package(p);
@@ -338,7 +334,7 @@ namespace paludis
/**
* Fetch our package names.
*/
- QualifiedPackageNameCollection::ConstPointer package_names(
+ std::tr1::shared_ptr<const QualifiedPackageNameCollection> package_names(
const CategoryNamePart & c) const
{
return do_package_names(c);
@@ -347,7 +343,7 @@ namespace paludis
/**
* Fetch our versions.
*/
- VersionSpecCollection::ConstPointer version_specs(
+ std::tr1::shared_ptr<const VersionSpecCollection> version_specs(
const QualifiedPackageName & p) const
{
return do_version_specs(p);
@@ -364,7 +360,7 @@ namespace paludis
/**
* Fetch metadata.
*/
- VersionMetadata::ConstPointer version_metadata(
+ std::tr1::shared_ptr<const VersionMetadata> version_metadata(
const QualifiedPackageName & q,
const VersionSpec & v) const
{
@@ -481,22 +477,22 @@ namespace paludis
/**
* Override in descendents: fetch all arch flags.
*/
- virtual UseFlagNameCollection::ConstPointer do_arch_flags() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_arch_flags() const = 0;
/**
* Override in descendents: fetch all use expand flags.
*/
- virtual UseFlagNameCollection::ConstPointer do_use_expand_flags() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_flags() const = 0;
/**
* Override in descendents: fetch all use expand hidden prefixes.
*/
- virtual UseFlagNameCollection::ConstPointer do_use_expand_hidden_prefixes() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_hidden_prefixes() const = 0;
/**
* Override in descendents: fetch all use expand prefixes.
*/
- virtual UseFlagNameCollection::ConstPointer do_use_expand_prefixes() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_prefixes() const = 0;
/**
* Override in descendents: describe a use flag.
@@ -542,7 +538,7 @@ namespace paludis
/**
* Fetch all arch flags.
*/
- UseFlagNameCollection::ConstPointer arch_flags() const
+ std::tr1::shared_ptr<const UseFlagNameCollection> arch_flags() const
{
return do_arch_flags();
}
@@ -550,7 +546,7 @@ namespace paludis
/**
* Fetch all expand flags.
*/
- UseFlagNameCollection::ConstPointer use_expand_flags() const
+ std::tr1::shared_ptr<const UseFlagNameCollection> use_expand_flags() const
{
return do_use_expand_flags();
}
@@ -558,7 +554,7 @@ namespace paludis
/**
* Fetch all expand hidden flags.
*/
- UseFlagNameCollection::ConstPointer use_expand_hidden_prefixes() const
+ std::tr1::shared_ptr<const UseFlagNameCollection> use_expand_hidden_prefixes() const
{
return do_use_expand_hidden_prefixes();
}
@@ -566,7 +562,7 @@ namespace paludis
/**
* Fetch all use expand prefixes.
*/
- UseFlagNameCollection::ConstPointer use_expand_prefixes() const
+ std::tr1::shared_ptr<const UseFlagNameCollection> use_expand_prefixes() const
{
return do_use_expand_prefixes();
}
@@ -730,7 +726,7 @@ namespace paludis
/**
* Override in descendents: package list.
*/
- virtual DepAtom::Pointer do_package_set(const SetName & id) const = 0;
+ virtual std::tr1::shared_ptr<DepAtom> do_package_set(const SetName & id) const = 0;
///\}
@@ -741,7 +737,7 @@ namespace paludis
/**
* Fetch a package set.
*/
- DepAtom::Pointer package_set(const SetName & s) const
+ std::tr1::shared_ptr<DepAtom> package_set(const SetName & s) const
{
return do_package_set(s);
}
@@ -749,7 +745,7 @@ namespace paludis
/**
* Gives a list of the names of all the sets provided by this repo.
*/
- virtual SetsCollection::ConstPointer sets_list() const = 0;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const = 0;
///\}
@@ -926,12 +922,12 @@ namespace paludis
/**
* Fetch our virtual packages.
*/
- virtual VirtualsCollection::ConstPointer virtual_packages() const = 0;
+ virtual std::tr1::shared_ptr<const VirtualsCollection> virtual_packages() const = 0;
/**
* Fetch version metadata for a virtual
*/
- virtual VersionMetadata::ConstPointer virtual_package_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> virtual_package_version_metadata(
const RepositoryVirtualsEntry &, const VersionSpec & v) const = 0;
///\}
@@ -962,12 +958,12 @@ namespace paludis
/**
* Fetch our provided packages.
*/
- virtual ProvidesCollection::ConstPointer provided_packages() const = 0;
+ virtual std::tr1::shared_ptr<const ProvidesCollection> provided_packages() const = 0;
/**
* Fetch version metadata for a provided package.
*/
- virtual VersionMetadata::ConstPointer provided_package_version_metadata(
+ virtual std::tr1::shared_ptr<const VersionMetadata> provided_package_version_metadata(
const RepositoryProvidesEntry &) const = 0;
///\}
@@ -1011,7 +1007,7 @@ namespace paludis
/**
* Override in descendents: fetch the contents.
*/
- virtual Contents::ConstPointer do_contents(
+ virtual std::tr1::shared_ptr<const Contents> do_contents(
const QualifiedPackageName &,
const VersionSpec &) const = 0;
@@ -1024,7 +1020,7 @@ namespace paludis
/**
* Fetch contents.
*/
- Contents::ConstPointer contents(
+ std::tr1::shared_ptr<const Contents> contents(
const QualifiedPackageName & q,
const VersionSpec & v) const
{
diff --git a/paludis/repository.sr b/paludis/repository.sr
index 36e2f0e..a1b5fe7 100644
--- a/paludis/repository.sr
+++ b/paludis/repository.sr
@@ -62,9 +62,9 @@ make_class_RepositoryProvidesEntry()
make_class_RepositoryVirtualsEntry()
{
key virtual_name QualifiedPackageName
- key provided_by_atom PackageDepAtom::ConstPointer
+ key provided_by_atom "std::tr1::shared_ptr<const PackageDepAtom>"
allow_named_args
- comparison_operators all all
+ comparison_operators all virtual_name
}
diff --git a/paludis/repository_name_cache.cc b/paludis/repository_name_cache.cc
index 02a3acb..4883e03 100644
--- a/paludis/repository_name_cache.cc
+++ b/paludis/repository_name_cache.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -34,8 +34,7 @@ namespace paludis
typedef MakeHashedMap<PackageNamePart, std::list<CategoryNamePart> >::Type NameCacheMap;
template<>
- struct Implementation<RepositoryNameCache> :
- InternalCounted<Implementation<RepositoryNameCache> >
+ struct Implementation<RepositoryNameCache>
{
const FSEntry location;
const Repository * const repo;
@@ -65,13 +64,13 @@ RepositoryNameCache::~RepositoryNameCache()
{
}
-CategoryNamePartCollection::ConstPointer
+std::tr1::shared_ptr<const CategoryNamePartCollection>
RepositoryNameCache::category_names_containing_package(const PackageNamePart & p) const
{
if (! usable())
- return CategoryNamePartCollection::ConstPointer(0);
+ return std::tr1::shared_ptr<const CategoryNamePartCollection>();
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
+ std::tr1::shared_ptr<CategoryNamePartCollection> result(new CategoryNamePartCollection::Concrete);
NameCacheMap::iterator r(_imp->name_cache_map.find(p));
if (_imp->name_cache_map.end() == r)
@@ -92,7 +91,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
+ "' has version string '" + line + "', which is not supported. Was it generated using "
"a different Paludis version?");
_usable = false;
- return CategoryNamePartCollection::ConstPointer(0);
+ return std::tr1::shared_ptr<const CategoryNamePartCollection>();
}
std::getline(vvf, line);
if (line != stringify(_imp->repo->name()))
@@ -101,7 +100,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
+ "' was generated for repository '" + line + "', so it cannot be used. You must not "
"have multiple name caches at the same location.");
_usable = false;
- return CategoryNamePartCollection::ConstPointer(0);
+ return std::tr1::shared_ptr<const CategoryNamePartCollection>();
}
_imp->checked_name_cache_map = true;
}
@@ -111,7 +110,7 @@ RepositoryNameCache::category_names_containing_package(const PackageNamePart & p
+ "' has no version information, so cannot be used. Either it was generated using "
"an older Paludis version or it has not yet been generated.");
_usable = false;
- return CategoryNamePartCollection::ConstPointer(0);
+ return std::tr1::shared_ptr<const CategoryNamePartCollection>();
}
}
@@ -150,11 +149,11 @@ RepositoryNameCache::regenerate_cache() const
MakeHashedMap<std::string, std::string>::Type m;
- CategoryNamePartCollection::ConstPointer cats(_imp->repo->category_names());
+ std::tr1::shared_ptr<const CategoryNamePartCollection> cats(_imp->repo->category_names());
for (CategoryNamePartCollection::Iterator c(cats->begin()), c_end(cats->end()) ;
c != c_end ; ++c)
{
- QualifiedPackageNameCollection::ConstPointer pkgs(_imp->repo->package_names(*c));
+ std::tr1::shared_ptr<const QualifiedPackageNameCollection> pkgs(_imp->repo->package_names(*c));
for (QualifiedPackageNameCollection::Iterator p(pkgs->begin()), p_end(pkgs->end()) ;
p != p_end ; ++p)
m[stringify(p->package)].append(stringify(*c) + "\n");
diff --git a/paludis/repository_name_cache.hh b/paludis/repository_name_cache.hh
index eb846ac..6ef08ef 100644
--- a/paludis/repository_name_cache.hh
+++ b/paludis/repository_name_cache.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -36,7 +36,6 @@ namespace paludis
* \nosubgrouping
*/
class RepositoryNameCache :
- public InternalCounted<RepositoryNameCache>,
private PrivateImplementationPattern<RepositoryNameCache>
{
private:
@@ -65,7 +64,7 @@ namespace paludis
* fall back to Repository::do_category_names_containing_package or
* its own implementation.
*/
- CategoryNamePartCollection::ConstPointer category_names_containing_package(
+ std::tr1::shared_ptr<const CategoryNamePartCollection> category_names_containing_package(
const PackageNamePart & p) const;
/**
diff --git a/paludis/repository_name_cache_TEST.cc b/paludis/repository_name_cache_TEST.cc
index f3cd89a..a3a49b6 100644
--- a/paludis/repository_name_cache_TEST.cc
+++ b/paludis/repository_name_cache_TEST.cc
@@ -37,10 +37,10 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
- RepositoryNameCache cache(FSEntry("/var/empty"), repo.raw_pointer());
+ RepositoryNameCache cache(FSEntry("/var/empty"), repo.get());
TEST_CHECK(! cache.usable());
}
} test_names_cache_empty;
@@ -52,10 +52,10 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
- RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/not_generated"), repo.raw_pointer());
+ RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/not_generated"), repo.get());
TEST_CHECK(cache.usable());
TEST_CHECK(! cache.category_names_containing_package(PackageNamePart("foo")));
TEST_CHECK(! cache.usable());
@@ -69,10 +69,10 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
- RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/not_existing"), repo.raw_pointer());
+ RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/not_existing"), repo.get());
TEST_CHECK(cache.usable());
TEST_CHECK(! cache.category_names_containing_package(PackageNamePart("foo")));
TEST_CHECK(! cache.usable());
@@ -86,10 +86,10 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
- RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/old_format"), repo.raw_pointer());
+ RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/old_format"), repo.get());
TEST_CHECK(cache.usable());
TEST_CHECK(! cache.category_names_containing_package(PackageNamePart("foo")));
TEST_CHECK(! cache.usable());
@@ -103,10 +103,10 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
- RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/bad_repo"), repo.raw_pointer());
+ RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/bad_repo"), repo.get());
TEST_CHECK(cache.usable());
TEST_CHECK(! cache.category_names_containing_package(PackageNamePart("foo")));
TEST_CHECK(! cache.usable());
@@ -120,18 +120,18 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
- RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/good_repo"), repo.raw_pointer());
+ RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/good_repo"), repo.get());
TEST_CHECK(cache.usable());
- CategoryNamePartCollection::ConstPointer foo(cache.category_names_containing_package(PackageNamePart("foo")));
+ std::tr1::shared_ptr<const CategoryNamePartCollection> foo(cache.category_names_containing_package(PackageNamePart("foo")));
TEST_CHECK(cache.usable());
TEST_CHECK(foo);
TEST_CHECK_EQUAL(join(foo->begin(), foo->end(), " "), "bar baz");
- CategoryNamePartCollection::ConstPointer moo(cache.category_names_containing_package(PackageNamePart("moo")));
+ std::tr1::shared_ptr<const CategoryNamePartCollection> moo(cache.category_names_containing_package(PackageNamePart("moo")));
TEST_CHECK(cache.usable());
TEST_CHECK(moo);
TEST_CHECK(moo->empty());
@@ -145,10 +145,10 @@ namespace test_cases
void run()
{
TestEnvironment env;
- FakeRepository::Pointer repo(new FakeRepository(&env, RepositoryName("repo")));
+ std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(repo);
- RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/generated"), repo.raw_pointer());
+ RepositoryNameCache cache(FSEntry("repository_name_cache_TEST_dir/generated"), repo.get());
repo->add_package(QualifiedPackageName("bar/foo"));
repo->add_package(QualifiedPackageName("baz/foo"));
@@ -156,12 +156,12 @@ namespace test_cases
cache.regenerate_cache();
TEST_CHECK(cache.usable());
- CategoryNamePartCollection::ConstPointer foo(cache.category_names_containing_package(PackageNamePart("foo")));
+ std::tr1::shared_ptr<const CategoryNamePartCollection> foo(cache.category_names_containing_package(PackageNamePart("foo")));
TEST_CHECK(cache.usable());
TEST_CHECK(foo);
TEST_CHECK_EQUAL(join(foo->begin(), foo->end(), " "), "bar baz");
- CategoryNamePartCollection::ConstPointer moo(cache.category_names_containing_package(PackageNamePart("moo")));
+ std::tr1::shared_ptr<const CategoryNamePartCollection> moo(cache.category_names_containing_package(PackageNamePart("moo")));
TEST_CHECK(cache.usable());
TEST_CHECK(moo);
TEST_CHECK(moo->empty());
diff --git a/paludis/selinux/security_context.cc b/paludis/selinux/security_context.cc
index a11c3fc..c0cd246 100644
--- a/paludis/selinux/security_context.cc
+++ b/paludis/selinux/security_context.cc
@@ -162,9 +162,9 @@ SecurityContext::~SecurityContext()
{
}
-SecurityContext::ConstPointer SecurityContext::current_context()
+std::tr1::shared_ptr<const SecurityContext> SecurityContext::current_context()
{
- SecurityContext::Pointer p(new SecurityContext);
+ std::tr1::shared_ptr<SecurityContext> p(new SecurityContext);
security_context_t con;
if (0 != libselinux.getcon(&con))
throw SELinuxException("Couldn't get current security context.");
@@ -172,9 +172,9 @@ SecurityContext::ConstPointer SecurityContext::current_context()
return p;
}
-SecurityContext::ConstPointer SecurityContext::fs_create_context()
+std::tr1::shared_ptr<const SecurityContext> SecurityContext::fs_create_context()
{
- SecurityContext::Pointer p(new SecurityContext);
+ std::tr1::shared_ptr<SecurityContext> p(new SecurityContext);
security_context_t con;
if (0 != libselinux.getfscreatecon(&con))
throw SELinuxException("Couldn't get current filesystem creation context.");
@@ -188,7 +188,7 @@ std::ostream & paludis::operator<<(std::ostream & os, const SecurityContext & co
return os;
}
-FSCreateCon::FSCreateCon(SecurityContext::ConstPointer newfscreatecon)
+FSCreateCon::FSCreateCon(std::tr1::shared_ptr<const SecurityContext> newfscreatecon)
: _context(newfscreatecon), _prev_context(SecurityContext::fs_create_context())
{
if (0 != libselinux.setfscreatecon(_context->_imp->_context))
@@ -221,9 +221,9 @@ bool MatchPathCon::good() const
return _good;
}
-SecurityContext::ConstPointer MatchPathCon::match(const std::string & path, mode_t mode) const
+std::tr1::shared_ptr<const SecurityContext> MatchPathCon::match(const std::string & path, mode_t mode) const
{
- SecurityContext::Pointer p(new SecurityContext);
+ std::tr1::shared_ptr<SecurityContext> p(new SecurityContext);
security_context_t context;
if (0 != libselinux.matchpathcon(path.c_str(), mode, &context))
{
diff --git a/paludis/selinux/security_context.hh b/paludis/selinux/security_context.hh
index f3170a2..ba87556 100644
--- a/paludis/selinux/security_context.hh
+++ b/paludis/selinux/security_context.hh
@@ -22,7 +22,6 @@
#include <string>
#include <paludis/util/exception.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
@@ -61,8 +60,7 @@ namespace paludis
*/
class PALUDIS_VISIBLE SecurityContext :
private PrivateImplementationPattern<SecurityContext>,
- private InstantiationPolicy<SecurityContext, instantiation_method::NonCopyableTag>,
- public InternalCounted<SecurityContext>
+ private InstantiationPolicy<SecurityContext, instantiation_method::NonCopyableTag>
{
public:
/**
@@ -87,12 +85,12 @@ namespace paludis
/**
* Returns a SecurityContext referring to the current process's context
*/
- static SecurityContext::ConstPointer current_context();
+ static std::tr1::shared_ptr<const SecurityContext> current_context();
/**
* Returns a SecurityContext referring to the current filesystem creation context
*/
- static SecurityContext::ConstPointer fs_create_context();
+ static std::tr1::shared_ptr<const SecurityContext> fs_create_context();
};
/**
@@ -116,14 +114,14 @@ namespace paludis
class PALUDIS_VISIBLE FSCreateCon
{
private:
- SecurityContext::ConstPointer _context;
- SecurityContext::ConstPointer _prev_context;
+ std::tr1::shared_ptr<const SecurityContext> _context;
+ std::tr1::shared_ptr<const SecurityContext> _prev_context;
public:
/**
* Constructor
*/
- FSCreateCon(SecurityContext::ConstPointer);
+ FSCreateCon(std::tr1::shared_ptr<const SecurityContext>);
/**
* Destructor
@@ -137,7 +135,7 @@ namespace paludis
* \ingroup grplibpaludisselinux
*/
class PALUDIS_VISIBLE MatchPathCon :
- public InstantiationPolicy<MatchPathCon, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<MatchPathCon, instantiation_method::SingletonTag>
{
private:
bool _good;
@@ -156,7 +154,7 @@ namespace paludis
/**
* Retrieve the default context for a given pathname
*/
- SecurityContext::ConstPointer match(const std::string &, mode_t = 0) const;
+ std::tr1::shared_ptr<const SecurityContext> match(const std::string &, mode_t = 0) const;
/**
* Did the initialisation succeed?
diff --git a/paludis/syncer.hh b/paludis/syncer.hh
index 167eeea..ae42521 100644
--- a/paludis/syncer.hh
+++ b/paludis/syncer.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -41,8 +41,7 @@ namespace paludis
* \ingroup grpsyncer
*/
class Syncer :
- private InstantiationPolicy<Syncer, instantiation_method::NonCopyableTag>,
- public InternalCounted<Syncer>
+ private InstantiationPolicy<Syncer, instantiation_method::NonCopyableTag>
{
protected:
/**
diff --git a/paludis/tasks/find_unused_packages_task.cc b/paludis/tasks/find_unused_packages_task.cc
index 2d79d28..ec2b4c6 100644
--- a/paludis/tasks/find_unused_packages_task.cc
+++ b/paludis/tasks/find_unused_packages_task.cc
@@ -33,11 +33,11 @@ FindUnusedPackagesTask::~FindUnusedPackagesTask()
{
}
-PackageDatabaseEntryCollection::ConstPointer
+std::tr1::shared_ptr<const PackageDatabaseEntryCollection>
FindUnusedPackagesTask::execute(const QualifiedPackageName & package)
{
- PackageDatabaseEntryCollection::Pointer result(new PackageDatabaseEntryCollection::Concrete);
- PackageDatabaseEntryCollection::ConstPointer packages(_env->package_database()->query(
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> result(new PackageDatabaseEntryCollection::Concrete);
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> packages(_env->package_database()->query(
PackageDepAtom(stringify(package) + "::" + stringify(_repo->name())),
is_installable_only,
qo_group_by_slot));
@@ -47,7 +47,7 @@ FindUnusedPackagesTask::execute(const QualifiedPackageName & package)
for (PackageDatabaseEntryCollection::ReverseIterator p(packages->rbegin()), p_end(packages->rend()) ;
p != p_end ; ++p)
{
- VersionMetadata::ConstPointer metadata(_repo->version_metadata(package, p->version));
+ std::tr1::shared_ptr<const VersionMetadata> metadata(_repo->version_metadata(package, p->version));
if (! metadata->ebuild_interface)
continue;
diff --git a/paludis/tasks/find_unused_packages_task.hh b/paludis/tasks/find_unused_packages_task.hh
index baa5d92..f150d70 100644
--- a/paludis/tasks/find_unused_packages_task.hh
+++ b/paludis/tasks/find_unused_packages_task.hh
@@ -62,7 +62,7 @@ namespace paludis
/**
* Run the task.
*/
- PackageDatabaseEntryCollection::ConstPointer execute(const QualifiedPackageName &);
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> execute(const QualifiedPackageName &);
};
}
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 4d5de21..ffd9339 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -28,8 +28,7 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<InstallTask> :
- InternalCounted<Implementation<InstallTask> >
+ struct Implementation<InstallTask>
{
Environment * const env;
DepList dep_list;
@@ -37,8 +36,8 @@ namespace paludis
InstallOptions install_options;
std::list<std::string> raw_targets;
- AllDepAtom::Pointer targets;
- DepAtom::ConstPointer add_to_world_atom;
+ std::tr1::shared_ptr<AllDepAtom> targets;
+ std::tr1::shared_ptr<const DepAtom> add_to_world_atom;
bool pretend;
bool preserve_world;
@@ -52,7 +51,6 @@ namespace paludis
current_dep_list_entry(dep_list.begin()),
install_options(false, false, ido_none, false),
targets(new AllDepAtom),
- add_to_world_atom(0),
pretend(false),
preserve_world(false),
had_set_targets(false),
@@ -84,7 +82,7 @@ InstallTask::~InstallTask()
void
InstallTask::clear()
{
- _imp->targets.assign(new AllDepAtom);
+ _imp->targets.reset(new AllDepAtom);
_imp->had_set_targets = false;
_imp->had_package_targets = false;
_imp->dep_list.clear();
@@ -96,7 +94,7 @@ InstallTask::add_target(const std::string & target)
{
Context context("When adding install target '" + target + "':");
- DepAtom::Pointer s(0);
+ std::tr1::shared_ptr<DepAtom> s;
std::string modified_target(target);
bool done(false);
@@ -135,7 +133,7 @@ InstallTask::add_target(const std::string & target)
QualifiedPackageName q(_imp->env->package_database()->fetch_unique_qualified_package_name(
PackageNamePart(target)));
modified_target = stringify(q);
- _imp->targets->add_child(DepAtom::Pointer(new PackageDepAtom(q)));
+ _imp->targets->add_child(std::tr1::shared_ptr<DepAtom>(new PackageDepAtom(q)));
}
}
@@ -299,10 +297,10 @@ InstallTask::execute()
for (PackageDatabase::RepositoryIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
if ((*r)->installed_interface)
- ((*r).raw_pointer())->invalidate();
+ ((*r).get())->invalidate();
// look for packages with the same name in the same slot
- PackageDatabaseEntryCollection::Pointer collision_list(_imp->env->package_database()->query(
+ std::tr1::shared_ptr<PackageDatabaseEntryCollection> collision_list(_imp->env->package_database()->query(
PackageDepAtom(stringify(dep->package.name) + ":" + stringify(dep->metadata->slot)),
is_installed_only, qo_order_by_version));
diff --git a/paludis/tasks/report_task.cc b/paludis/tasks/report_task.cc
index 01f3607..eef5797 100644
--- a/paludis/tasks/report_task.cc
+++ b/paludis/tasks/report_task.cc
@@ -34,12 +34,12 @@ namespace
public DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, UseDepAtom>
{
private:
- std::multimap<PackageDatabaseEntry, DepTag::ConstPointer,
+ std::multimap<PackageDatabaseEntry, std::tr1::shared_ptr<const DepTag>,
ArbitrarilyOrderedPackageDatabaseEntryCollectionComparator> _found;
const Environment & _env;
public:
- typedef std::multimap<PackageDatabaseEntry, DepTag::ConstPointer>::const_iterator ConstIterator;
+ typedef std::multimap<PackageDatabaseEntry, std::tr1::shared_ptr<const DepTag> >::const_iterator ConstIterator;
using DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, AllDepAtom>::visit;
using DepAtomVisitorTypes::ConstVisitor::VisitChildren<VulnerableChecker, UseDepAtom>::visit;
@@ -79,7 +79,7 @@ namespace
void
VulnerableChecker::visit(const PackageDepAtom * const a)
{
- PackageDatabaseEntryCollection::ConstPointer insecure(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> insecure(
_env.package_database()->query(*a, is_any, qo_order_by_version));
for (PackageDatabaseEntryCollection::Iterator i(insecure->begin()),
i_end(insecure->end()) ; i != i_end ; ++i)
@@ -93,8 +93,7 @@ namespace
namespace paludis
{
template<>
- struct Implementation<ReportTask> :
- InternalCounted<Implementation<ReportTask> >
+ struct Implementation<ReportTask>
{
Environment * const env;
@@ -128,13 +127,13 @@ ReportTask::execute()
for (PackageDatabase::RepositoryIterator r(e->package_database()->begin_repositories()),
r_end(e->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- Repository::ConstPointer rr(e->package_database()->fetch_repository((*r)->name()));
+ std::tr1::shared_ptr<const Repository> rr(e->package_database()->fetch_repository((*r)->name()));
if (! rr->sets_interface)
continue;
try
{
- DepAtom::ConstPointer insecure(rr->sets_interface->package_set(SetName("insecurity")));
+ std::tr1::shared_ptr<const DepAtom> insecure(rr->sets_interface->package_set(SetName("insecurity")));
if (! insecure)
continue;
insecure->accept(&vuln);
@@ -161,21 +160,21 @@ ReportTask::execute()
for (PackageDatabase::RepositoryIterator r(e->package_database()->begin_repositories()),
r_end(e->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- Repository::ConstPointer rr(e->package_database()->fetch_repository((*r)->name()));
+ std::tr1::shared_ptr<const Repository> rr(e->package_database()->fetch_repository((*r)->name()));
if (! rr->installed_interface)
continue;
- CategoryNamePartCollection::ConstPointer cat_names(rr->category_names());
+ std::tr1::shared_ptr<const CategoryNamePartCollection> cat_names(rr->category_names());
for (CategoryNamePartCollection::Iterator c(cat_names->begin()), c_end(cat_names->end()) ;
c != c_end ; ++c)
{
- QualifiedPackageNameCollection::ConstPointer packages(rr->package_names(*c));
+ std::tr1::shared_ptr<const QualifiedPackageNameCollection> packages(rr->package_names(*c));
for (QualifiedPackageNameCollection::Iterator p(packages->begin()), p_end(packages->end()) ;
p != p_end ; ++p)
{
on_report_check_package_pre(*p);
- VersionSpecCollection::ConstPointer vers(rr->version_specs(*p));
+ std::tr1::shared_ptr<const VersionSpecCollection> vers(rr->version_specs(*p));
for (VersionSpecCollection::Iterator v(vers->begin()), v_end(vers->end()) ;
v != v_end ; ++v)
{
@@ -188,7 +187,7 @@ ReportTask::execute()
MaskReasons mr;
try
{
- VersionMetadata::ConstPointer m(rr->version_metadata(pde.name, pde.version));
+ std::tr1::shared_ptr<const VersionMetadata> m(rr->version_metadata(pde.name, pde.version));
if (m->origins_interface && m->origins_interface->source)
{
diff --git a/paludis/tasks/stage_builder_task.cc b/paludis/tasks/stage_builder_task.cc
index 4e19408..52f3b9c 100644
--- a/paludis/tasks/stage_builder_task.cc
+++ b/paludis/tasks/stage_builder_task.cc
@@ -27,10 +27,9 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<StageBuilderTask> :
- InternalCounted<Implementation<StageBuilderTask> >
+ struct Implementation<StageBuilderTask>
{
- std::list<StageBase::ConstPointer> stages;
+ std::list<std::tr1::shared_ptr<const StageBase> > stages;
const StageOptions options;
@@ -62,7 +61,7 @@ StageBuilderTask::~StageBuilderTask()
}
void
-StageBuilderTask::queue_stage(StageBase::ConstPointer p)
+StageBuilderTask::queue_stage(std::tr1::shared_ptr<const StageBase> p)
{
Context context("When queuing stage in build list:");
_imp->stages.push_back(p);
@@ -87,7 +86,7 @@ StageBuilderTask::execute()
on_build_all_pre();
- for (std::list<StageBase::ConstPointer>::const_iterator
+ for (std::list<std::tr1::shared_ptr<const StageBase> >::const_iterator
s(_imp->stages.begin()), s_end(_imp->stages.end()) ;
s != s_end ; ++s)
{
diff --git a/paludis/tasks/stage_builder_task.hh b/paludis/tasks/stage_builder_task.hh
index 6779e16..989374c 100644
--- a/paludis/tasks/stage_builder_task.hh
+++ b/paludis/tasks/stage_builder_task.hh
@@ -26,6 +26,8 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/exception.hh>
+#include <tr1/memory>
+
namespace paludis
{
/**
@@ -56,8 +58,7 @@ namespace paludis
* \ingroup grpstagebuildertask
* \nosubgrouping
*/
- class StageBase :
- public InternalCounted<StageBase>
+ class StageBase
{
public:
virtual ~StageBase();
@@ -105,14 +106,14 @@ namespace paludis
///\name Queue stage in build list
///\{
- void queue_stage(StageBase::ConstPointer);
+ void queue_stage(std::tr1::shared_ptr<const StageBase>);
///\}
///\name Iterate over our stages
///\{
- typedef libwrapiter::ForwardIterator<StageBuilderTask, const StageBase::ConstPointer> StageIterator;
+ typedef libwrapiter::ForwardIterator<StageBuilderTask, const std::tr1::shared_ptr<const StageBase> > StageIterator;
StageIterator begin_stages() const;
StageIterator end_stages() const;
@@ -122,11 +123,11 @@ namespace paludis
///\{
virtual void on_build_all_pre() = 0;
- virtual void on_build_pre(StageBase::ConstPointer) = 0;
- virtual void on_build_post(StageBase::ConstPointer) = 0;
- virtual void on_build_fail(StageBase::ConstPointer, const StageBuildError &) = 0;
- virtual void on_build_skipped(StageBase::ConstPointer) = 0;
- virtual void on_build_succeed(StageBase::ConstPointer) = 0;
+ virtual void on_build_pre(std::tr1::shared_ptr<const StageBase>) = 0;
+ virtual void on_build_post(std::tr1::shared_ptr<const StageBase>) = 0;
+ virtual void on_build_fail(std::tr1::shared_ptr<const StageBase>, const StageBuildError &) = 0;
+ virtual void on_build_skipped(std::tr1::shared_ptr<const StageBase>) = 0;
+ virtual void on_build_succeed(std::tr1::shared_ptr<const StageBase>) = 0;
virtual void on_build_all_post() = 0;
///\}
diff --git a/paludis/tasks/sync_task.cc b/paludis/tasks/sync_task.cc
index 30d1581..632ebfb 100644
--- a/paludis/tasks/sync_task.cc
+++ b/paludis/tasks/sync_task.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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,8 +27,7 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<SyncTask> :
- InternalCounted<Implementation<SyncTask> >
+ struct Implementation<SyncTask>
{
Environment * const env;
std::list<RepositoryName> targets;
@@ -83,7 +82,7 @@ SyncTask::execute()
try
{
- Repository::ConstPointer rr(_imp->env->package_database()->fetch_repository(*r));
+ std::tr1::shared_ptr<const Repository> rr(_imp->env->package_database()->fetch_repository(*r));
if (rr->syncable_interface && rr->syncable_interface->sync())
on_sync_succeed(*r);
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index 3f623dd..6e2fbae 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -28,14 +28,13 @@ using namespace paludis;
namespace paludis
{
template<>
- struct Implementation<UninstallTask> :
- InternalCounted<Implementation<UninstallTask> >
+ struct Implementation<UninstallTask>
{
Environment * const env;
InstallOptions install_options;
std::list<std::string> raw_targets;
- std::list<PackageDepAtom::Pointer> targets;
+ std::list<std::tr1::shared_ptr<PackageDepAtom> > targets;
bool pretend;
bool preserve_world;
@@ -93,9 +92,9 @@ UninstallTask::add_target(const std::string & target)
/* we might have a dep atom, but we might just have a simple package name
* without a category. either should work. */
if (std::string::npos != target.find('/'))
- _imp->targets.push_back(PackageDepAtom::Pointer(new PackageDepAtom(target)));
+ _imp->targets.push_back(std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom(target)));
else
- _imp->targets.push_back(PackageDepAtom::Pointer(new PackageDepAtom(
+ _imp->targets.push_back(std::tr1::shared_ptr<PackageDepAtom>(new PackageDepAtom(
_imp->env->package_database()->fetch_unique_qualified_package_name(
PackageNamePart(target)))));
@@ -148,12 +147,12 @@ UninstallTask::execute()
if (_imp->unused)
list.add_unused();
else
- for (std::list<PackageDepAtom::Pointer>::const_iterator t(_imp->targets.begin()),
+ for (std::list<std::tr1::shared_ptr<PackageDepAtom> >::const_iterator t(_imp->targets.begin()),
t_end(_imp->targets.end()) ; t != t_end ; ++t)
{
Context local_context("When looking for target '" + stringify(**t) + "':");
- PackageDatabaseEntryCollection::ConstPointer r(_imp->env->package_database()->query(
+ std::tr1::shared_ptr<const PackageDatabaseEntryCollection> r(_imp->env->package_database()->query(
**t, is_installed_only, qo_order_by_version));
if (r->empty())
throw NoSuchPackageError(stringify(**t));
@@ -196,8 +195,8 @@ UninstallTask::execute()
{
on_update_world_pre();
- AllDepAtom::Pointer all(new AllDepAtom);
- for (std::list<PackageDepAtom::Pointer>::const_iterator t(_imp->targets.begin()),
+ std::tr1::shared_ptr<AllDepAtom> all(new AllDepAtom);
+ for (std::list<std::tr1::shared_ptr<PackageDepAtom> >::const_iterator t(_imp->targets.begin()),
t_end(_imp->targets.end()) ; t != t_end ; ++t)
all->add_child(*t);
diff --git a/paludis/tasks/uninstall_task.hh b/paludis/tasks/uninstall_task.hh
index 02e0d7d..e530462 100644
--- a/paludis/tasks/uninstall_task.hh
+++ b/paludis/tasks/uninstall_task.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -40,14 +40,14 @@ namespace paludis
{
private:
const std::string _t;
- const PackageDatabaseEntryCollection::ConstPointer _p;
+ const std::tr1::shared_ptr<const PackageDatabaseEntryCollection> _p;
public:
///\name Basic operations
///\{
AmbiguousUnmergeTargetError(const std::string & our_target,
- const PackageDatabaseEntryCollection::ConstPointer matches) throw () :
+ const std::tr1::shared_ptr<const PackageDatabaseEntryCollection> matches) throw () :
Exception("Ambiguous unmerge target '" + our_target + "'"),
_t(our_target),
_p(matches)
diff --git a/paludis/util/collection.hh b/paludis/util/collection.hh
index db32678..70c27f7 100644
--- a/paludis/util/collection.hh
+++ b/paludis/util/collection.hh
@@ -20,11 +20,11 @@
#ifndef PALUDIS_GUARD_PALUDIS_SEQUENTIAL_COLLECTION_HH
#define PALUDIS_GUARD_PALUDIS_SEQUENTIAL_COLLECTION_HH 1
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
#include <libwrapiter/libwrapiter.hh>
#include <iterator>
#include <functional>
+#include <tr1/memory>
/** \file
* Various wrappers around collections of items, for convenience and
@@ -48,7 +48,6 @@ namespace paludis
template <typename T_>
class PALUDIS_VISIBLE SequentialCollection :
private InstantiationPolicy<SequentialCollection<T_>, instantiation_method::NonCopyableTag>,
- public InternalCounted<SequentialCollection<T_> >,
public std::iterator<typename std::iterator_traits<
typename libwrapiter::ForwardIterator<SequentialCollection<T_>, const T_> >::iterator_category, T_>
{
@@ -158,7 +157,6 @@ namespace paludis
template <typename T_, typename C_ = std::less<T_> >
class PALUDIS_VISIBLE SortedCollection :
private InstantiationPolicy<SortedCollection<T_, C_>, instantiation_method::NonCopyableTag>,
- public InternalCounted<SortedCollection<T_, C_> >,
public std::iterator<typename std::iterator_traits<
typename libwrapiter::ForwardIterator<SortedCollection<T_, C_>, const T_> >::iterator_category, T_>
{
@@ -241,7 +239,7 @@ namespace paludis
/**
* Insert all items from another container.
*/
- virtual bool merge(typename SortedCollection<T_, C_>::ConstPointer o) = 0;
+ virtual bool merge(typename std::tr1::shared_ptr<const SortedCollection<T_, C_> > o) = 0;
/**
* Our insert iterator type.
@@ -283,7 +281,6 @@ namespace paludis
template <typename K_, typename V_>
class PALUDIS_VISIBLE AssociativeCollection :
private InstantiationPolicy<AssociativeCollection<K_, V_>, instantiation_method::NonCopyableTag>,
- public InternalCounted<AssociativeCollection<K_, V_> >,
public std::iterator<typename std::iterator_traits<
typename libwrapiter::ForwardIterator<AssociativeCollection<K_, V_>,
const std::pair<const K_, V_> > >::iterator_category, const std::pair<const K_, V_> >
diff --git a/paludis/util/collection_concrete.hh b/paludis/util/collection_concrete.hh
index 07ad487..a478de4 100644
--- a/paludis/util/collection_concrete.hh
+++ b/paludis/util/collection_concrete.hh
@@ -133,16 +133,6 @@ namespace paludis
{
_items.sort(t);
}
-
- //\}
-
- ///\name Pointer types
- ///\{
-
- typedef CountedPtr<Concrete, count_policy::InternalCountTag> ConstPointer;
- typedef CountedPtr<Concrete, count_policy::InternalCountTag> Pointer;
-
- ///\}
};
/**
@@ -221,7 +211,7 @@ namespace paludis
return 0 != _items.erase(v);
}
- virtual bool merge(typename SortedCollection<T_, C_>::ConstPointer o)
+ virtual bool merge(typename std::tr1::shared_ptr<const SortedCollection<T_, C_> > o)
{
bool result(true);
Iterator o_begin(o->begin()), o_end(o->end());
diff --git a/paludis/util/counted_ptr.hh b/paludis/util/counted_ptr.hh
deleted file mode 100644
index 5b87e50..0000000
--- a/paludis/util/counted_ptr.hh
+++ /dev/null
@@ -1,451 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_COUNTED_PTR_HH
-#define PALUDIS_GUARD_PALUDIS_COUNTED_PTR_HH 1
-
-#include <paludis/util/attributes.hh>
-#include <paludis/util/comparison_policy.hh>
-#include <paludis/util/exception.hh>
-
-/** \file
- * Declaration for the CountedPtr template class.
- *
- * \ingroup grppointers
- */
-
-namespace paludis
-{
- /**
- * Contains CountedPtr count policies.
- *
- * \ingroup grppointers
- */
- namespace count_policy
- {
- /**
- * CountedPtr policy: reference counts are stored separately.
- *
- * \ingroup grppointers
- */
- struct ExternalCountTag
- {
- };
-
- /**
- * CountedPtr policy: reference counts are stored by the class via the
- * Counted subclass.
- *
- * \ingroup grppointers
- */
- struct InternalCountTag
- {
- };
- }
-
- /**
- * CountedPtr internals.
- *
- * \ingroup grppointers
- */
- namespace counted_ptr_internals
- {
- /**
- * Base class for CountedPtr.
- *
- * \ingroup grppointers
- * \nosubgrouping
- */
- template <typename T_>
- class CountedPtrBase :
- public ComparisonPolicy<CountedPtrBase<T_>,
- comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberTag<T_ *> >
- {
- private:
- CountedPtrBase(const CountedPtrBase & other);
-
- const CountedPtrBase & operator= (const CountedPtrBase & other);
-
- protected:
- /**
- * Pointer to our data.
- */
- T_ * _ptr;
-
- ///\name Basic operations
- ///\{
-
- CountedPtrBase(T_ * ptr) :
- ComparisonPolicy<CountedPtrBase<T_>,
- comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberTag<T_ *> >(
- &CountedPtrBase::_ptr),
- _ptr(ptr)
- {
- }
-
- virtual ~CountedPtrBase()
- {
- }
-
- ///\}
-
- public:
- ///\name Dereference operators
- ///\{
-
- inline const T_ & operator* () const;
- inline const T_ * operator-> () const;
- T_ & operator* ();
- T_ * operator-> ();
-
- /**
- * Fetch our raw pointer.
- */
- T_ * raw_pointer() const
- {
- return _ptr;
- }
-
- ///\}
-
- /**
- * Return whether we are null. We use const void * rather than bool
- * here to avoid bool -> int conversion weirdness. See \ref
- * TCppPL 21.3.3.
- */
- operator const void * () const
- {
- return _ptr;
- }
- };
-
- template <typename T_>
- const T_ & CountedPtrBase<T_>::operator* () const
- {
- return *_ptr;
- }
-
- template <typename T_>
- const T_ * CountedPtrBase<T_>::operator-> () const
- {
- return _ptr;
- }
-
- template <typename T_>
- T_ & CountedPtrBase<T_>::operator* ()
- {
- return *_ptr;
- }
-
- template <typename T_>
- T_ * CountedPtrBase<T_>::operator-> ()
- {
- return _ptr;
- }
- }
-
- /**
- * Reference counted pointer class.
- *
- * \ingroup grppointers
- */
- template <typename T_, typename CountPolicy_ = count_policy::InternalCountTag>
- class CountedPtr;
-
- /**
- * Base for an internal counted class.
- *
- * \ingroup grppointers
- */
- template <typename T_>
- class InternalCounted;
-
- /**
- * Reference counted pointer class (specialisation for ExternalCountTag).
- *
- * \ingroup grppointers
- * \nosubgrouping
- */
- template <typename T_>
- class CountedPtr<T_, count_policy::ExternalCountTag> :
- public counted_ptr_internals::CountedPtrBase<T_>
- {
- private:
- unsigned * _ref_count;
-
- public:
- ///\name Basic operations
- ///\{
-
- explicit CountedPtr(T_ * const ptr) :
- counted_ptr_internals::CountedPtrBase<T_>(ptr),
- _ref_count(new unsigned(1))
- {
- }
-
- CountedPtr(const CountedPtr & other) :
- counted_ptr_internals::CountedPtrBase<T_>(other.raw_pointer()),
- _ref_count(other._ref_count)
- {
- ++*_ref_count;
- }
-
- /**
- * Constructor, from another CountedPtr of a descendent of our
- * data's class.
- */
- template <typename O_>
- CountedPtr(const CountedPtr<O_, count_policy::ExternalCountTag> & other) :
- counted_ptr_internals::CountedPtrBase<T_>(other._ptr),
- _ref_count(other.reference_count_pointer())
- {
- ++*_ref_count;
- }
-
- ~CountedPtr()
- {
- if (0 == --(*_ref_count))
- {
- delete this->_ptr;
- delete _ref_count;
- }
- }
-
- /**
- * Assignment, from another CountedPtr.
- */
- const CountedPtr & operator= (const CountedPtr & other)
- {
- if (other._ptr != this->_ptr)
- {
- if (0 == --*_ref_count)
- {
- delete this->_ptr;
- delete _ref_count;
- }
-
- this->_ptr = other._ptr;
- _ref_count = other._ref_count;
- ++*_ref_count;
- }
- return *this;
- }
-
- /**
- * Explicit assignment, from a raw pointer.
- */
- const CountedPtr & assign(T_ * const other)
- {
- return operator= (CountedPtr<T_, count_policy::ExternalCountTag>(other));
- }
-
- /**
- * Explicit assignment to zero.
- */
- const CountedPtr & zero()
- {
- return operator= (CountedPtr<T_, count_policy::ExternalCountTag>(0));
- }
-
- ///\}
-
- ///\name Pointer operations
- ///\{
-
- /**
- * Fetch our reference count pointer.
- */
- unsigned * reference_count_pointer() const
- {
- return _ref_count;
- }
-
- ///\}
- };
-
- /**
- * Reference counted pointer class (specialisation for InternalCountTag).
- *
- * \ingroup grppointers
- * \nosubgrouping
- */
- template <typename T_>
- class CountedPtr<T_, count_policy::InternalCountTag> :
- public counted_ptr_internals::CountedPtrBase<T_>
- {
- public:
- ///\name Basic operations
- ///\{
-
- explicit CountedPtr(T_ * const ptr) :
- counted_ptr_internals::CountedPtrBase<T_>(ptr)
- {
- if (0 != this->_ptr)
- ++*this->_ptr->reference_count_pointer();
- }
-
- CountedPtr(const CountedPtr & other) :
- counted_ptr_internals::CountedPtrBase<T_>(other._ptr)
- {
- if (0 != this->_ptr)
- ++*this->_ptr->reference_count_pointer();
- }
-
- /**
- * Constructor, from another CountedPtr of a descendent of our
- * data's class.
- */
- template <typename O_>
- CountedPtr(const CountedPtr<O_, count_policy::InternalCountTag> & other) :
- counted_ptr_internals::CountedPtrBase<T_>(
- static_cast<T_ *>(other.raw_pointer()))
- {
- if (0 != this->_ptr)
- ++*this->_ptr->reference_count_pointer();
- }
-
- ~CountedPtr();
-
- const CountedPtr & operator= (const CountedPtr & other)
- {
- if (other._ptr != this->_ptr)
- {
- if (0 != this->_ptr)
- if (0 == --(*this->_ptr->reference_count_pointer()))
- delete this->_ptr;
-
- this->_ptr = other._ptr;
- if (0 != this->_ptr)
- ++*this->_ptr->reference_count_pointer();
- }
- return *this;
- }
-
- /**
- * Explicit assignment, from a raw pointer.
- */
- const CountedPtr & assign(T_ * const other)
- {
- return operator= (CountedPtr<T_, count_policy::InternalCountTag>(other));
- }
-
- /**
- * Explicit assignment to zero.
- */
- const CountedPtr & zero()
- {
- return operator= (CountedPtr<T_, count_policy::InternalCountTag>(0));
- }
-
- ///\}
-
- ///\name Pointer operations
- ///\{
-
- /**
- * Fetch our reference count pointer.
- */
- unsigned * reference_count_pointer() const
- {
- if (0 != this->_ptr)
- return this->_ptr->reference_count_pointer();
- else
- return 0;
- }
-
- ///\}
- };
-
- template <typename T_>
- CountedPtr<T_, count_policy::InternalCountTag>::~CountedPtr()
- {
- if (0 != this->_ptr)
- if (0 == --(*this->_ptr->reference_count_pointer()))
- delete this->_ptr;
- }
-}
-
-#include <paludis/util/instantiation_policy.hh>
-
-namespace paludis
-{
- /**
- * Base class for an internally counted class.
- *
- * \ingroup grppointers
- * \nosubgrouping
- */
- template <typename T_>
- class InternalCounted :
- private InstantiationPolicy<InternalCounted<T_>,
- instantiation_method::NonCopyableTag>
- {
- private:
- mutable unsigned _ref_count;
-
- protected:
- ///\name Basic operations
- ///\{
-
- InternalCounted() :
- _ref_count(0)
- {
- }
-
- ~InternalCounted()
- {
- }
-
- ///\}
-
- public:
- ///\name Pointer types
- ///\{
-
- /**
- * A CountedPtr to us.
- */
- typedef CountedPtr<T_, count_policy::InternalCountTag> Pointer;
-
- /**
- * A CountedPtr to us (const).
- */
- typedef CountedPtr<const T_, count_policy::InternalCountTag> ConstPointer;
-
- ///\}
-
- ///\name Pointer operations
- ///\{
-
- /**
- * Fetch a pointer to our reference count (may be zero).
- */
- unsigned * reference_count_pointer() const
- {
- return & _ref_count;
- }
-
- ///\}
- };
-}
-
-#endif
-
diff --git a/paludis/util/counted_ptr_TEST.cc b/paludis/util/counted_ptr_TEST.cc
deleted file mode 100644
index efe0f82..0000000
--- a/paludis/util/counted_ptr_TEST.cc
+++ /dev/null
@@ -1,358 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/util/counted_ptr.hh>
-#include <string>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-
-using namespace test;
-using namespace paludis;
-
-/** \file
- * Test cases for counted_ptr.hh .
- *
- */
-
-namespace
-{
- /**
- * Test InternalCounted class.
- *
- */
- class MyClass :
- public InternalCounted<MyClass>
- {
- private:
- int _v;
-
- public:
- MyClass(const int v) :
- _v(v)
- {
- }
-
- MyClass(const MyClass & other) :
- InternalCounted<MyClass>(),
- _v(other._v)
- {
- }
-
- const MyClass & operator= (const MyClass & other)
- {
- _v = other._v;
- return *this;
- }
-
- bool operator== (const MyClass & other) const
- {
- return _v == other._v;
- }
-
- int value() const
- {
- return _v;
- }
- };
-}
-
-/**
- * Test InternalCounted class is stringifiable.
- *
- */
-std::ostream & operator<< (std::ostream & s, const MyClass & c)
-{
- s << c.value();
- return s;
-}
-
-namespace test_cases
-{
- /**
- * \test CountedPtr creation tests.
- *
- */
- struct CountedPtrCreationTests : TestCase
- {
- CountedPtrCreationTests() : TestCase("CountedPtr creation tests") { }
-
- void run()
- {
- CountedPtr<int, count_policy::ExternalCountTag> i(new int(10));
- CountedPtr<std::string, count_policy::ExternalCountTag> j(new std::string("moo"));
- }
- } test_counted_ptr_creation;
-
- /**
- * \test CountedPtr dereference tests.
- *
- */
- struct CountedPtrDereferenceTests : TestCase
- {
- CountedPtrDereferenceTests() : TestCase("CountedPtr dereference tests") { }
-
- void run()
- {
- CountedPtr<int, count_policy::ExternalCountTag> i(new int(10));
- TEST_CHECK_EQUAL(*i, 10);
-
- CountedPtr<std::string, count_policy::ExternalCountTag> j(new std::string("moo"));
- TEST_CHECK_EQUAL(*j, "moo");
- TEST_CHECK_EQUAL(j->length(), 3);
- }
- } test_counted_ptr_dereference;
-
- /**
- * \test CountedPtr copy tests.
- *
- */
- struct CountedPtrCopyTests : TestCase
- {
- CountedPtrCopyTests() : TestCase("CountedPtr copy tests") { }
-
- void run()
- {
- CountedPtr<int, count_policy::ExternalCountTag> i(new int(10));
- TEST_CHECK_EQUAL(*i, 10);
-
- CountedPtr<int, count_policy::ExternalCountTag> i2(i);
- TEST_CHECK_EQUAL(*i, 10);
- TEST_CHECK_EQUAL(*i2, 10);
- }
- } test_counted_ptr_copy;
-
- /**
- * \test CountedPtr dereference-assign tests.
- *
- */
- struct CountedPtrDereferenceAssignTests : TestCase
- {
- CountedPtrDereferenceAssignTests() : TestCase("CountedPtr dereference assign tests") { }
-
- void run()
- {
- CountedPtr<int, count_policy::ExternalCountTag> i(new int(10));
- TEST_CHECK_EQUAL(*i, 10);
- *i = 20;
- TEST_CHECK_EQUAL(*i, 20);
-
- CountedPtr<int, count_policy::ExternalCountTag> i2(i);
- TEST_CHECK_EQUAL(*i, 20);
- TEST_CHECK_EQUAL(*i2, 20);
-
- *i = 30;
- TEST_CHECK_EQUAL(*i, 30);
- TEST_CHECK_EQUAL(*i2, 30);
-
- *i2 = 40;
- TEST_CHECK_EQUAL(*i, 40);
- TEST_CHECK_EQUAL(*i2, 40);
- }
- } test_counted_ptr_dereference_assign;
-
- /**
- * \test CountedPtr assign value tests.
- *
- */
- struct CountedPtrAssignValueTests : TestCase
- {
- CountedPtrAssignValueTests() : TestCase("CountedPtr assign value tests") { }
-
- void run()
- {
- CountedPtr<int, count_policy::ExternalCountTag> i(new int(10));
- TEST_CHECK_EQUAL(*i, 10);
- CountedPtr<int, count_policy::ExternalCountTag> i2(i);
- TEST_CHECK_EQUAL(*i, 10);
- TEST_CHECK_EQUAL(*i2, 10);
-
- i = CountedPtr<int, count_policy::ExternalCountTag>(new int(20));
- TEST_CHECK_EQUAL(*i, 20);
- TEST_CHECK_EQUAL(*i2, 10);
- }
- } test_counted_ptr_assign_value;
-
- /**
- * \test CountedPtr assign pointer tests.
- *
- */
- struct CountedPtrAssignPointerTests : TestCase
- {
- CountedPtrAssignPointerTests() : TestCase("CountedPtr assign pointer tests") { }
-
- void run()
- {
- CountedPtr<int, count_policy::ExternalCountTag> i(new int(10));
- TEST_CHECK_EQUAL(*i, 10);
- CountedPtr<int, count_policy::ExternalCountTag> i2(i);
- TEST_CHECK_EQUAL(*i, 10);
- TEST_CHECK_EQUAL(*i2, 10);
-
- CountedPtr<int, count_policy::ExternalCountTag> i3(new int(30));
-
- i = i3;
- TEST_CHECK_EQUAL(*i, 30);
- TEST_CHECK_EQUAL(*i2, 10);
- TEST_CHECK_EQUAL(*i3, 30);
-
- i.assign(new int(50));
- TEST_CHECK_EQUAL(*i, 50);
-
- i.zero();
- TEST_CHECK(! i);
- }
- } test_counted_ptr_assign_pointer;
-
- /**
- * \test CountedPtr internal creation tests.
- *
- */
- struct CountedPtrInternalCreationTests : TestCase
- {
- CountedPtrInternalCreationTests() : TestCase("CountedPtr internal creation tests") { }
-
- void run()
- {
- MyClass::Pointer i(new MyClass(10));
- }
- } test_counted_ptr_internal_creation;
-
- /**
- * \test CountedPtr internal dereference tests.
- *
- */
- struct CountedPtrInternalDereferenceTests : TestCase
- {
- CountedPtrInternalDereferenceTests() : TestCase("CountedPtr internal dereference tests") { }
-
- void run()
- {
- MyClass::Pointer i(new MyClass(10));
- TEST_CHECK_EQUAL(*i, 10);
-
- MyClass::Pointer j(new MyClass(20));
- TEST_CHECK_EQUAL(*j, 20);
- }
- } test_counted_ptr_internal_dereference;
-
- /**
- * \test CountedPtr internal copy tests.
- *
- */
- struct CountedPtrInternalCopyTests : TestCase
- {
- CountedPtrInternalCopyTests() : TestCase("CountedPtr internal copy tests") { }
-
- void run()
- {
- MyClass::Pointer i(new MyClass(10));
- TEST_CHECK_EQUAL(*i, 10);
-
- MyClass::Pointer i2(i);
- TEST_CHECK_EQUAL(*i, 10);
- TEST_CHECK_EQUAL(*i2, 10);
- }
- } test_counted_ptr_internal_copy;
-
- /**
- * \test CountedPtr internal dereference-assign tests.
- *
- */
- struct CountedPtrInternalDereferenceAssignTests : TestCase
- {
- CountedPtrInternalDereferenceAssignTests() :
- TestCase("CountedPtr internal dereference assign tests") { }
-
- void run()
- {
- MyClass::Pointer i(new MyClass(10));
- TEST_CHECK_EQUAL(*i, 10);
- *i = 20;
- TEST_CHECK_EQUAL(*i, 20);
-
- MyClass::Pointer i2(i);
- TEST_CHECK_EQUAL(*i, 20);
- TEST_CHECK_EQUAL(*i2, 20);
-
- *i = 30;
- TEST_CHECK_EQUAL(*i, 30);
- TEST_CHECK_EQUAL(*i2, 30);
-
- *i2 = 40;
- TEST_CHECK_EQUAL(*i, 40);
- TEST_CHECK_EQUAL(*i2, 40);
- }
- } test_counted_ptr_internal_dereference_assign;
-
- /**
- * \test CountedPtr internal assign value tests.
- *
- */
- struct CountedPtrInternalAssignValueTests : TestCase
- {
- CountedPtrInternalAssignValueTests() :
- TestCase("CountedPtr internal assign value tests") { }
-
- void run()
- {
- MyClass::Pointer i(new MyClass(10));
- TEST_CHECK_EQUAL(*i, 10);
- MyClass::Pointer i2(i);
- TEST_CHECK_EQUAL(*i, 10);
- TEST_CHECK_EQUAL(*i2, 10);
-
- i = MyClass::Pointer(new MyClass(20));
- TEST_CHECK_EQUAL(*i, 20);
- TEST_CHECK_EQUAL(*i2, 10);
- }
- } test_counted_ptr_internal_assign_value;
-
- /**
- * \test CountedPtr internal assign pointer tests.
- *
- */
- struct CountedPtrInternalAssignPointerTests : TestCase
- {
- CountedPtrInternalAssignPointerTests() :
- TestCase("CountedPtr internal assign pointer tests") { }
-
- void run()
- {
- MyClass::Pointer i(new MyClass(10));
- TEST_CHECK_EQUAL(*i, 10);
- MyClass::Pointer i2(i);
- TEST_CHECK_EQUAL(*i, 10);
- TEST_CHECK_EQUAL(*i2, 10);
-
- MyClass::Pointer i3(new MyClass(30));
-
- i = i3;
- TEST_CHECK_EQUAL(*i, 30);
- TEST_CHECK_EQUAL(*i2, 10);
- TEST_CHECK_EQUAL(*i3, 30);
-
- i.assign(new MyClass(50));
- TEST_CHECK_EQUAL(*i, 50);
-
- i.zero();
- TEST_CHECK(! i);
- }
- } test_counted_ptr_internal_assign_pointer;
-}
-
diff --git a/paludis/util/dir_iterator.cc b/paludis/util/dir_iterator.cc
index 7281f4d..7935533 100644
--- a/paludis/util/dir_iterator.cc
+++ b/paludis/util/dir_iterator.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -40,16 +40,14 @@ namespace paludis
* \ingroup grpfilesystem
*/
template<>
- struct Implementation<DirIterator> :
- InternalCounted<Implementation<DirIterator> >
+ struct Implementation<DirIterator>
{
FSEntry base;
bool ignore_dotfiles;
- CountedPtr<std::set<FSEntry>, count_policy::ExternalCountTag> items;
+ std::tr1::shared_ptr<std::set<FSEntry> > items;
std::set<FSEntry>::iterator iter;
- Implementation(const FSEntry & b, bool i, CountedPtr<std::set<FSEntry>,
- count_policy::ExternalCountTag> ii) :
+ Implementation(const FSEntry & b, bool i, std::tr1::shared_ptr<std::set<FSEntry> > ii) :
base(b),
ignore_dotfiles(i),
items(ii)
@@ -65,8 +63,7 @@ DirOpenError::DirOpenError(const FSEntry & location, const int errno_value) thro
DirIterator::DirIterator(const FSEntry & base, bool ignore_dotfiles) :
PrivateImplementationPattern<DirIterator>(new Implementation<DirIterator>(
- base, ignore_dotfiles, CountedPtr<std::set<FSEntry>,
- count_policy::ExternalCountTag>(new std::set<FSEntry>)))
+ base, ignore_dotfiles, std::tr1::shared_ptr<std::set<FSEntry> >(new std::set<FSEntry>)))
{
DIR * d(opendir(stringify(_imp->base).c_str()));
if (0 == d)
@@ -97,8 +94,7 @@ DirIterator::DirIterator(const DirIterator & other) :
DirIterator::DirIterator() :
PrivateImplementationPattern<DirIterator>(new Implementation<DirIterator>(
- FSEntry(""), true, CountedPtr<std::set<FSEntry>,
- count_policy::ExternalCountTag>(new std::set<FSEntry>)))
+ FSEntry(""), true, std::tr1::shared_ptr<std::set<FSEntry> >(new std::set<FSEntry>)))
{
_imp->iter = _imp->items->end();
}
diff --git a/paludis/util/dir_iterator.hh b/paludis/util/dir_iterator.hh
index e5cd53d..77791d9 100644
--- a/paludis/util/dir_iterator.hh
+++ b/paludis/util/dir_iterator.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_DIR_ITERATOR_HH 1
#include <iterator>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index e8ffdba..942aa75 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -13,7 +13,6 @@ add(`collection', `hh')
add(`collection_concrete', `hhx')
add(`compare', `hh')
add(`comparison_policy', `hh')
-add(`counted_ptr', `hh', `test')
add(`destringify', `hh', `cc', `test')
add(`dir_iterator', `hh', `cc', `test', `testscript')
add(`exception', `hh', `cc')
diff --git a/paludis/util/fs_entry.cc b/paludis/util/fs_entry.cc
index bdd28a8..3de0337 100644
--- a/paludis/util/fs_entry.cc
+++ b/paludis/util/fs_entry.cc
@@ -47,7 +47,6 @@ FSError::FSError(const std::string & our_message) throw () :
FSEntry::FSEntry(const std::string & path) :
ComparisonPolicyType(&FSEntry::_path),
_path(path),
- _stat_info(0),
_exists(false),
_checked(false)
{
@@ -106,7 +105,7 @@ FSEntry::operator/= (const FSEntry & rhs)
_checked = false;
_exists = false;
- _stat_info = CountedPtr<struct ::stat, count_policy::ExternalCountTag>(0);
+ _stat_info.reset();
return *this;
}
@@ -284,15 +283,15 @@ FSEntry::_stat() const
if (_checked)
return;
- _stat_info = CountedPtr<struct stat, count_policy::ExternalCountTag>(new struct stat);
- if (0 != lstat(_path.c_str(), _stat_info.raw_pointer()))
+ _stat_info.reset(new struct stat);
+ if (0 != lstat(_path.c_str(), _stat_info.get()))
{
if (errno != ENOENT)
throw FSError("Error running stat() on '" + stringify(_path) + "': "
+ strerror(errno));
_exists = false;
- _stat_info = CountedPtr<struct stat, count_policy::ExternalCountTag>(0);
+ _stat_info.reset();
}
else
_exists = true;
diff --git a/paludis/util/fs_entry.hh b/paludis/util/fs_entry.hh
index 0b67941..20e4b38 100644
--- a/paludis/util/fs_entry.hh
+++ b/paludis/util/fs_entry.hh
@@ -22,10 +22,10 @@
#define PALUDIS_GUARD_PALUDIS_FS_ENTRY_HH 1
#include <paludis/util/comparison_policy.hh>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
#include <string>
#include <iosfwd>
+#include <tr1/memory>
/** \file
* Declarations for paludis::Filesystem.
@@ -96,7 +96,7 @@ namespace paludis
private:
std::string _path;
- mutable CountedPtr<struct ::stat, count_policy::ExternalCountTag> _stat_info;
+ mutable std::tr1::shared_ptr<struct ::stat> _stat_info;
mutable bool _exists;
diff --git a/paludis/util/instantiation_policy.hh b/paludis/util/instantiation_policy.hh
index 2f5b994..6d5c4ab 100644
--- a/paludis/util/instantiation_policy.hh
+++ b/paludis/util/instantiation_policy.hh
@@ -58,20 +58,11 @@ namespace paludis
};
/**
- * Single instance created at startup.
+ * Single instance.
*
* \ingroup grpinstance
*/
- struct SingletonAtStartupTag
- {
- };
-
- /**
- * Single instance created when needed.
- *
- * \ingroup grpinstance
- */
- struct SingletonAsNeededTag
+ struct SingletonTag
{
};
}
@@ -141,58 +132,6 @@ namespace paludis
///\}
};
-}
-
-#include <paludis/util/counted_ptr.hh>
-
-namespace paludis
-{
- /**
- * InstantiationPolicy: specialisation for singleton classes that are
- * created at startup.
- *
- * \ingroup grpinstance
- * \nosubgrouping
- */
- template<typename OurType_>
- class PALUDIS_VISIBLE InstantiationPolicy<OurType_, instantiation_method::SingletonAtStartupTag>
- {
- private:
- InstantiationPolicy(const InstantiationPolicy &);
-
- const InstantiationPolicy & operator= (const InstantiationPolicy &);
-
- static CountedPtr<OurType_, count_policy::ExternalCountTag> _instance;
-
- protected:
- ///\name Basic operations
- ///\{
-
- InstantiationPolicy()
- {
- }
-
- ///\}
-
- public:
- ///\name Singleton operations
- ///\{
-
- /**
- * Fetch our instance.
- */
- static OurType_ * get_instance()
- {
- return _instance.raw_pointer();
- }
-
- ///\}
- };
-
- template <typename OurType_>
- CountedPtr<OurType_, count_policy::ExternalCountTag>
- InstantiationPolicy<OurType_, instantiation_method::SingletonAtStartupTag>::_instance(
- new OurType_);
/**
* InstantiationPolicy: specialisation for singleton classes that are
@@ -202,7 +141,7 @@ namespace paludis
* \nosubgrouping
*/
template<typename OurType_>
- class PALUDIS_VISIBLE InstantiationPolicy<OurType_, instantiation_method::SingletonAsNeededTag>
+ class PALUDIS_VISIBLE InstantiationPolicy<OurType_, instantiation_method::SingletonTag>
{
private:
InstantiationPolicy(const InstantiationPolicy &);
@@ -232,7 +171,7 @@ namespace paludis
~DeleteOnDestruction()
{
- InstantiationPolicy<OurType_, instantiation_method::SingletonAsNeededTag>::_delete(* _ptr);
+ InstantiationPolicy<OurType_, instantiation_method::SingletonTag>::_delete(* _ptr);
* _ptr = 0;
}
};
@@ -266,7 +205,7 @@ namespace paludis
template<typename OurType_>
OurType_ * *
- InstantiationPolicy<OurType_, instantiation_method::SingletonAsNeededTag>::_get_instance_ptr()
+ InstantiationPolicy<OurType_, instantiation_method::SingletonTag>::_get_instance_ptr()
{
static OurType_ * instance(0);
static DeleteOnDestruction delete_instance(&instance);
@@ -276,7 +215,7 @@ namespace paludis
template<typename OurType_>
OurType_ *
- InstantiationPolicy<OurType_, instantiation_method::SingletonAsNeededTag>::get_instance()
+ InstantiationPolicy<OurType_, instantiation_method::SingletonTag>::get_instance()
{
static bool recursive(false);
OurType_ * * i(_get_instance_ptr());
@@ -295,7 +234,7 @@ namespace paludis
template<typename OurType_>
void
- InstantiationPolicy<OurType_, instantiation_method::SingletonAsNeededTag>::destroy_instance()
+ InstantiationPolicy<OurType_, instantiation_method::SingletonTag>::destroy_instance()
{
OurType_ * * i(_get_instance_ptr());
delete *i;
diff --git a/paludis/util/instantiation_policy_TEST.cc b/paludis/util/instantiation_policy_TEST.cc
index e50767f..3ae1793 100644
--- a/paludis/util/instantiation_policy_TEST.cc
+++ b/paludis/util/instantiation_policy_TEST.cc
@@ -37,9 +37,9 @@ namespace
*
*/
class MyClass :
- public InstantiationPolicy<MyClass, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<MyClass, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<MyClass, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<MyClass, instantiation_method::SingletonTag>;
private:
MyClass()
@@ -56,9 +56,9 @@ namespace
int MyClass::instances = 0;
class MyClassTwo :
- public InstantiationPolicy<MyClassTwo, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<MyClassTwo, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<MyClassTwo, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<MyClassTwo, instantiation_method::SingletonTag>;
private:
MyClassTwo()
@@ -79,29 +79,10 @@ namespace
int MyClassTwo::instances = 0;
- struct MyLoadAtStartupClass :
- public InstantiationPolicy<MyLoadAtStartupClass, instantiation_method::SingletonAtStartupTag>
- {
- friend class InstantiationPolicy<MyLoadAtStartupClass, instantiation_method::SingletonAtStartupTag>;
-
- private:
- MyLoadAtStartupClass()
- {
- ++instances;
- }
-
- public:
- std::string s;
-
- static int instances;
- };
-
- int MyLoadAtStartupClass::instances = 0;
-
class MyRecursiveClass :
- public InstantiationPolicy<MyRecursiveClass, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<MyRecursiveClass, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<MyRecursiveClass, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<MyRecursiveClass, instantiation_method::SingletonTag>;
public:
std::string s;
@@ -180,32 +161,5 @@ namespace test_cases
TEST_CHECK_THROWS(MyRecursiveClass::get_instance(), InternalError);
}
} test_singleton_pattern_recurse;
-
- /**
- * \test Test singleton create at startup behaviour.
- *
- */
- struct SingletonPatternCreateAtStartupTest : TestCase
- {
- SingletonPatternCreateAtStartupTest() : TestCase("singleton create at startup test") { }
-
- bool repeatable() const
- {
- return false;
- }
-
- void run()
- {
- TEST_CHECK_EQUAL(MyLoadAtStartupClass::instances, 1);
- TEST_CHECK(0 != MyLoadAtStartupClass::get_instance());
- TEST_CHECK_EQUAL(MyLoadAtStartupClass::instances, 1);
- TEST_CHECK(MyLoadAtStartupClass::get_instance() == MyLoadAtStartupClass::get_instance());
- TEST_CHECK(MyLoadAtStartupClass::get_instance()->s.empty());
- MyLoadAtStartupClass::get_instance()->s = "foo";
- TEST_CHECK_EQUAL(MyLoadAtStartupClass::get_instance()->s, "foo");
- }
- } test_singleton_pattern_create_at_startup;
}
-
-
diff --git a/paludis/util/iterator_TEST.cc b/paludis/util/iterator_TEST.cc
index 9f5a30e..6003343 100644
--- a/paludis/util/iterator_TEST.cc
+++ b/paludis/util/iterator_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,12 +19,12 @@
#include <algorithm>
#include <list>
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/iterator.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <vector>
#include <set>
+#include <tr1/memory>
using namespace test;
using namespace paludis;
@@ -60,20 +60,19 @@ namespace
namespace test_cases
{
/**
- * \test Test IndirectIterator over a vector of CountedPtr of int.
+ * \test Test IndirectIterator over a vector of shared_ptr of int.
*
*/
struct IndirectIteratorVecCPIntTest : TestCase
{
- IndirectIteratorVecCPIntTest() : TestCase("vector<CountedPtr<int> >") { }
+ IndirectIteratorVecCPIntTest() : TestCase("vector<std::tr1::shared_ptr<int> >") { }
void run()
{
- std::vector<CountedPtr<int, count_policy::ExternalCountTag> > v;
- v.push_back(CountedPtr<int, count_policy::ExternalCountTag>(new int(5)));
- v.push_back(CountedPtr<int, count_policy::ExternalCountTag>(new int(10)));
- IndirectIterator<std::vector<CountedPtr<int,
- count_policy::ExternalCountTag> >::iterator, int> vi(v.begin()), vi_end(v.end());
+ std::vector<std::tr1::shared_ptr<int> > v;
+ v.push_back(std::tr1::shared_ptr<int>(new int(5)));
+ v.push_back(std::tr1::shared_ptr<int>(new int(10)));
+ IndirectIterator<std::vector<std::tr1::shared_ptr<int> >::iterator, int> vi(v.begin()), vi_end(v.end());
TEST_CHECK(vi != vi_end);
TEST_CHECK(vi < vi_end);
TEST_CHECK(! (vi > vi_end));
@@ -87,20 +86,19 @@ namespace test_cases
} test_indirect_iterator_vec_cp_int;
/**
- * \test Test IndirectIterator over a list of CountedPtr of int.
+ * \test Test IndirectIterator over a list of shared_ptr of int.
*
*/
struct IndirectIteratorListCPIntTest : TestCase
{
- IndirectIteratorListCPIntTest() : TestCase("list<CountedPtr<int> >") { }
+ IndirectIteratorListCPIntTest() : TestCase("list<std::tr1::shared_ptr<int> >") { }
void run()
{
- std::list<CountedPtr<int, count_policy::ExternalCountTag> > v;
- v.push_back(CountedPtr<int, count_policy::ExternalCountTag>(new int(5)));
- v.push_back(CountedPtr<int, count_policy::ExternalCountTag>(new int(10)));
- IndirectIterator<std::list<CountedPtr<int,
- count_policy::ExternalCountTag> >::iterator, int> vi(v.begin()), vi_end(v.end());
+ std::list<std::tr1::shared_ptr<int> > v;
+ v.push_back(std::tr1::shared_ptr<int>(new int(5)));
+ v.push_back(std::tr1::shared_ptr<int>(new int(10)));
+ IndirectIterator<std::list<std::tr1::shared_ptr<int> >::iterator, int> vi(v.begin()), vi_end(v.end());
TEST_CHECK(vi != vi_end);
TEST_CHECK_EQUAL(*vi, 5);
TEST_CHECK(++vi != vi_end);
@@ -143,7 +141,7 @@ namespace test_cases
*/
struct IndirectIteratorListPIntTest : TestCase
{
- IndirectIteratorListPIntTest() : TestCase("list<CountedPtr<int *>") { }
+ IndirectIteratorListPIntTest() : TestCase("list<int *>") { }
void run()
{
diff --git a/paludis/util/log.cc b/paludis/util/log.cc
index a27e12b..e7debb7 100644
--- a/paludis/util/log.cc
+++ b/paludis/util/log.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -36,8 +36,7 @@ namespace paludis
* \ingroup grplog
*/
template<>
- struct Implementation<Log> :
- InternalCounted<Implementation<Log> >
+ struct Implementation<Log>
{
/// Current log level
LogLevel log_level;
diff --git a/paludis/util/log.hh b/paludis/util/log.hh
index ff7576d..757c69d 100644
--- a/paludis/util/log.hh
+++ b/paludis/util/log.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -72,10 +72,10 @@ namespace paludis
* \ingroup grplog
*/
class PALUDIS_VISIBLE Log :
- public InstantiationPolicy<Log, instantiation_method::SingletonAsNeededTag>,
+ public InstantiationPolicy<Log, instantiation_method::SingletonTag>,
private PrivateImplementationPattern<Log>
{
- friend class InstantiationPolicy<Log, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<Log, instantiation_method::SingletonTag>;
private:
Log();
diff --git a/paludis/util/private_implementation_pattern.hh b/paludis/util/private_implementation_pattern.hh
index 5546fae..9ffd1a3 100644
--- a/paludis/util/private_implementation_pattern.hh
+++ b/paludis/util/private_implementation_pattern.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -20,7 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_PRIVATE_IMPLEMENTATION_PATTERN_HH
#define PALUDIS_GUARD_PALUDIS_PRIVATE_IMPLEMENTATION_PATTERN_HH 1
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
/** \file
@@ -51,10 +50,45 @@ namespace paludis
private InstantiationPolicy<PrivateImplementationPattern<C_>, instantiation_method::NonCopyableTag>
{
protected:
+ class ImpPtr
+ {
+ private:
+ ImpPtr(const ImpPtr &);
+ void operator= (const ImpPtr &);
+ Implementation<C_> * _ptr;
+
+ public:
+ ImpPtr(Implementation<C_> * p) :
+ _ptr(p)
+ {
+ }
+
+ ~ImpPtr()
+ {
+ delete _ptr;
+ }
+
+ Implementation<C_> * operator-> ()
+ {
+ return _ptr;
+ }
+
+ const Implementation<C_> * operator-> () const
+ {
+ return _ptr;
+ }
+
+ void reset(Implementation<C_> * p)
+ {
+ std::swap(_ptr, p);
+ delete p;
+ }
+ };
+
/**
* Pointer to our implementation data.
*/
- CountedPtr<Implementation<C_>, count_policy::InternalCountTag> _imp;
+ ImpPtr _imp;
public:
/**
@@ -64,6 +98,10 @@ namespace paludis
_imp(i)
{
}
+
+ ~PrivateImplementationPattern()
+ {
+ }
};
}
diff --git a/paludis/util/stringify.hh b/paludis/util/stringify.hh
index 807a0ac..c8ce504 100644
--- a/paludis/util/stringify.hh
+++ b/paludis/util/stringify.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -20,9 +20,10 @@
#ifndef PALUDIS_GUARD_PALUDIS_STRINGIFY_HH
#define PALUDIS_GUARD_PALUDIS_STRINGIFY_HH 1
+#include <paludis/util/attributes.hh>
#include <sstream>
#include <string>
-#include <paludis/util/attributes.hh>
+#include <tr1/memory>
/** \file
* Stringify functions.
@@ -32,9 +33,6 @@
namespace paludis
{
- template <typename T_, typename U_>
- class CountedPtr;
-
/**
* For use by stringify.
*
@@ -71,8 +69,8 @@ namespace paludis
*
* \ingroup grpstringify
*/
- template <typename T_, typename U_>
- struct CheckType<CountedPtr<T_, U_> >
+ template <typename T_>
+ struct CheckType<std::tr1::shared_ptr<T_> >
{
};
diff --git a/paludis/util/tokeniser.hh b/paludis/util/tokeniser.hh
index 546674f..35ac601 100644
--- a/paludis/util/tokeniser.hh
+++ b/paludis/util/tokeniser.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -233,10 +233,10 @@ namespace paludis
* \ingroup grptokenise
*/
class PALUDIS_VISIBLE WhitespaceTokeniser :
- public InstantiationPolicy<WhitespaceTokeniser, instantiation_method::SingletonAtStartupTag>,
+ public InstantiationPolicy<WhitespaceTokeniser, instantiation_method::SingletonTag>,
public Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag>
{
- friend class InstantiationPolicy<WhitespaceTokeniser, instantiation_method::SingletonAtStartupTag>;
+ friend class InstantiationPolicy<WhitespaceTokeniser, instantiation_method::SingletonTag>;
private:
WhitespaceTokeniser();
diff --git a/paludis/util/virtual_constructor_TEST.cc b/paludis/util/virtual_constructor_TEST.cc
index 4075a83..6d7bd59 100644
--- a/paludis/util/virtual_constructor_TEST.cc
+++ b/paludis/util/virtual_constructor_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -17,11 +17,11 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/util/counted_ptr.hh>
#include <paludis/util/virtual_constructor.hh>
-#include <set>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
+#include <set>
+#include <tr1/memory>
/** \file
* Test cases for VirtualConstructor.
@@ -39,8 +39,7 @@ namespace
cs_large
};
- class Cookie :
- public InternalCounted<Cookie>
+ class Cookie
{
private:
CookieSize _size;
@@ -84,9 +83,9 @@ namespace
return "Chocolate Chip";
}
- static CountedPtr<Cookie> make(CookieSize size)
+ static std::tr1::shared_ptr<Cookie> make(CookieSize size)
{
- return CountedPtr<Cookie>(new ChocolateChipCookie(size));
+ return std::tr1::shared_ptr<Cookie>(new ChocolateChipCookie(size));
}
};
@@ -107,24 +106,24 @@ namespace
return _with_crunchy_bits ? "Crunchy Ginger" : "Ginger";
}
- static CountedPtr<Cookie> make(CookieSize size)
+ static std::tr1::shared_ptr<Cookie> make(CookieSize size)
{
- return CountedPtr<Cookie>(new GingerCookie(size, false));
+ return std::tr1::shared_ptr<Cookie>(new GingerCookie(size, false));
}
- static CountedPtr<Cookie> make_crunchy(CookieSize size)
+ static std::tr1::shared_ptr<Cookie> make_crunchy(CookieSize size)
{
- return CountedPtr<Cookie>(new GingerCookie(size, true));
+ return std::tr1::shared_ptr<Cookie>(new GingerCookie(size, true));
}
};
class CookieMaker :
public VirtualConstructor<std::string,
- CountedPtr<Cookie> (*) (CookieSize),
+ std::tr1::shared_ptr<Cookie> (*) (CookieSize),
virtual_constructor_not_found::ThrowException<NoCookie> >,
- public InstantiationPolicy<CookieMaker, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<CookieMaker, instantiation_method::SingletonTag>
{
- friend class InstantiationPolicy<CookieMaker, instantiation_method::SingletonAsNeededTag>;
+ friend class InstantiationPolicy<CookieMaker, instantiation_method::SingletonTag>;
private:
CookieMaker()
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index 5fa093e..43fdd75 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -33,25 +33,25 @@ using namespace paludis;
#include <paludis/version_metadata-sr.cc>
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const DepAtom>
VersionMetadataDepsInterface::build_depend() const
{
return parser(build_depend_string);
}
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const DepAtom>
VersionMetadataDepsInterface::run_depend() const
{
return parser(run_depend_string);
}
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const DepAtom>
VersionMetadataDepsInterface::post_depend() const
{
return parser(post_depend_string);
}
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const DepAtom>
VersionMetadataDepsInterface::suggested_depend() const
{
return parser(suggested_depend_string);
@@ -72,16 +72,14 @@ VersionMetadata::VersionMetadata(const VersionMetadataBase & base, const Version
{
}
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const DepAtom>
VersionMetadataEbuildInterface::provide() const
{
return PortageDepParser::parse(provide_string, PortageDepParserPolicy<PackageDepAtom,
false>::get_instance());
}
-VersionMetadataOriginsInterface::VersionMetadataOriginsInterface() :
- source(0),
- binary(0)
+VersionMetadataOriginsInterface::VersionMetadataOriginsInterface()
{
}
@@ -90,7 +88,7 @@ VersionMetadataLicenseInterface::VersionMetadataLicenseInterface(const ParserFun
{
}
-DepAtom::ConstPointer
+std::tr1::shared_ptr<const DepAtom>
VersionMetadataLicenseInterface::license() const
{
return parser(license_string);
diff --git a/paludis/version_metadata.hh b/paludis/version_metadata.hh
index 7d2a802..59128e5 100644
--- a/paludis/version_metadata.hh
+++ b/paludis/version_metadata.hh
@@ -48,7 +48,7 @@ namespace paludis
*
* \ingroup grpversions
*/
- typedef DepAtom::ConstPointer (* ParserFunction) (const std::string &);
+ typedef std::tr1::shared_ptr<const CompositeDepAtom> (* ParserFunction) (const std::string &);
#include <paludis/version_metadata-sr.hh>
@@ -60,7 +60,6 @@ namespace paludis
class VersionMetadata :
private InstantiationPolicy<VersionMetadata, instantiation_method::NonCopyableTag>,
public VersionMetadataBase,
- public InternalCounted<VersionMetadata>,
public VersionMetadataCapabilities
{
public:
diff --git a/paludis/version_metadata.sr b/paludis/version_metadata.sr
index 7058fe8..98ab04a 100644
--- a/paludis/version_metadata.sr
+++ b/paludis/version_metadata.sr
@@ -40,22 +40,22 @@ END
/**
* Our build depends.
*/
- DepAtom::ConstPointer build_depend() const;
+ std::tr1::shared_ptr<const DepAtom> build_depend() const;
/**
* Our runtime depends.
*/
- DepAtom::ConstPointer run_depend() const;
+ std::tr1::shared_ptr<const DepAtom> run_depend() const;
/**
* Our post depends.
*/
- DepAtom::ConstPointer post_depend() const;
+ std::tr1::shared_ptr<const DepAtom> post_depend() const;
/**
* Our suggested depends.
*/
- DepAtom::ConstPointer suggested_depend() const;
+ std::tr1::shared_ptr<const DepAtom> suggested_depend() const;
END
doxygen_comment << "END"
@@ -82,7 +82,7 @@ END
/**
* Our licences.
*/
- DepAtom::ConstPointer license() const;
+ std::tr1::shared_ptr<const DepAtom> license() const;
END
doxygen_comment << "END"
@@ -97,8 +97,8 @@ END
make_class_VersionMetadataOriginsInterface()
{
- key "source" "CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>"
- key "binary" "CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>"
+ key "source" "std::tr1::shared_ptr<PackageDatabaseEntry>"
+ key "binary" "std::tr1::shared_ptr<PackageDatabaseEntry>"
extra_constructors <<END
VersionMetadataOriginsInterface();
@@ -151,7 +151,7 @@ END
/**
* PROVIDE, as a dep atom.
*/
- DepAtom::ConstPointer provide() const;
+ std::tr1::shared_ptr<const DepAtom> provide() const;
END
allow_named_args
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 1a53c67..370a439 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 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -72,8 +72,7 @@ namespace paludis
* Implementation data for a VersionSpec.
*/
template<>
- struct Implementation<VersionSpec> :
- InternalCounted<Implementation<VersionSpec> >
+ struct Implementation<VersionSpec>
{
/// Our raw string representation.
std::string text;
@@ -427,8 +426,7 @@ VersionSpec::remove_revision() const
std::string
VersionSpec::revision_only() const
{
- std::vector<Part>::const_iterator r(std::find_if(_imp->parts.begin(),
- _imp->parts.end(), IsPart<revision>()));
+ std::vector<Part>::const_iterator r(std::find_if(_imp->parts.begin(), _imp->parts.end(), IsPart<revision>()));
if (r != _imp->parts.end())
{
std::string result;
diff --git a/ruby/check.cc b/ruby/check.cc
index 5445c22..5e60da7 100644
--- a/ruby/check.cc
+++ b/ruby/check.cc
@@ -234,7 +234,7 @@ namespace
{
try
{
- return (check_check <PackageDirCheck::Pointer, FSEntry> (self, FSEntry(StringValuePtr(f))));
+ return (check_check <std::tr1::shared_ptr<PackageDirCheck>, FSEntry> (self, FSEntry(StringValuePtr(f))));
}
catch (const std::exception & e)
{
@@ -253,7 +253,7 @@ namespace
{
try
{
- return (check_check <FileCheck::Pointer, FSEntry> (self, FSEntry(StringValuePtr(f))));
+ return (check_check <std::tr1::shared_ptr<FileCheck>, FSEntry> (self, FSEntry(StringValuePtr(f))));
}
catch (const std::exception & e)
{
@@ -272,7 +272,7 @@ namespace
{
try
{
- return (check_check <EbuildCheck::Pointer, EbuildCheckData> (self, value_to_ebuild_check_data(f)));
+ return (check_check <std::tr1::shared_ptr<EbuildCheck>, EbuildCheckData> (self, value_to_ebuild_check_data(f)));
}
catch (const std::exception & e)
{
@@ -291,7 +291,7 @@ namespace
{
try
{
- return (check_check <PerProfileEbuildCheck::Pointer, PerProfileEbuildCheckData> (self, value_to_per_profile_ebuild_check_data(f)));
+ return (check_check <std::tr1::shared_ptr<PerProfileEbuildCheck>, PerProfileEbuildCheckData> (self, value_to_per_profile_ebuild_check_data(f)));
}
catch (const std::exception & e)
{
@@ -310,7 +310,7 @@ namespace
{
try
{
- return (check_check <ProfilesCheck::Pointer, FSEntry> (self, FSEntry(StringValuePtr(f))));
+ return (check_check <std::tr1::shared_ptr<ProfilesCheck>, FSEntry> (self, FSEntry(StringValuePtr(f))));
}
catch (const std::exception & e)
{
@@ -329,7 +329,7 @@ namespace
{
try
{
- return (check_check <ProfileCheck::Pointer, ProfileCheckData> (self, value_to_profile_check_data(f)));
+ return (check_check <std::tr1::shared_ptr<ProfileCheck>, ProfileCheckData> (self, value_to_profile_check_data(f)));
}
catch (const std::exception & e)
{
@@ -379,7 +379,7 @@ namespace
{
try
{
- PackageDirCheck::Pointer p = (PackageDirCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ std::tr1::shared_ptr<PackageDirCheck> p = (PackageDirCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
return package_dir_check_to_value(p);
}
catch (const std::exception & e)
@@ -398,7 +398,7 @@ namespace
{
try
{
- FileCheck::Pointer p = (FileCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ std::tr1::shared_ptr<FileCheck> p = (FileCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
return file_check_to_value(p);
}
catch (const std::exception & e)
@@ -417,7 +417,7 @@ namespace
{
try
{
- EbuildCheck::Pointer p = (EbuildCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ std::tr1::shared_ptr<EbuildCheck> p = (EbuildCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
return ebuild_check_to_value(p);
}
catch (const std::exception & e)
@@ -436,7 +436,7 @@ namespace
{
try
{
- PerProfileEbuildCheck::Pointer p = (PerProfileEbuildCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ std::tr1::shared_ptr<PerProfileEbuildCheck> p = (PerProfileEbuildCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
return per_profile_ebuild_check_to_value(p);
}
catch (const std::exception & e)
@@ -455,7 +455,7 @@ namespace
{
try
{
- ProfilesCheck::Pointer p = (ProfilesCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ std::tr1::shared_ptr<ProfilesCheck> p = (ProfilesCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
return profiles_check_to_value(p);
}
catch (const std::exception & e)
@@ -474,7 +474,7 @@ namespace
{
try
{
- ProfileCheck::Pointer p = (ProfileCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ std::tr1::shared_ptr<ProfileCheck> p = (ProfileCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
return profile_check_to_value(p);
}
catch (const std::exception & e)
@@ -522,8 +522,8 @@ namespace
c_package_dir_check = rb_define_class_under(paludis_qa_module(), "PackageDirCheck", rb_cObject);
rb_funcall(c_package_dir_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_package_dir_check, "check", RUBY_FUNC_CAST(&package_dir_check_check),1);
- rb_define_method(c_package_dir_check, "describe", RUBY_FUNC_CAST(&CheckStruct<PackageDirCheck::Pointer>::describe),0);
- rb_define_method(c_package_dir_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<PackageDirCheck::Pointer>::is_important),0);
+ rb_define_method(c_package_dir_check, "describe", RUBY_FUNC_CAST(&CheckStruct<std::tr1::shared_ptr<PackageDirCheck> >::describe),0);
+ rb_define_method(c_package_dir_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<std::tr1::shared_ptr<PackageDirCheck> >::is_important),0);
/*
* Document-class: Paludis::QA::FileCheck
@@ -533,8 +533,8 @@ namespace
c_file_check = rb_define_class_under(paludis_qa_module(), "FileCheck", rb_cObject);
rb_funcall(c_file_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_file_check, "check", RUBY_FUNC_CAST(&file_check_check),1);
- rb_define_method(c_file_check, "describe", RUBY_FUNC_CAST(&CheckStruct<FileCheck::Pointer>::describe),0);
- rb_define_method(c_file_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<FileCheck::Pointer>::is_important),0);
+ rb_define_method(c_file_check, "describe", RUBY_FUNC_CAST(&CheckStruct<std::tr1::shared_ptr<FileCheck> >::describe),0);
+ rb_define_method(c_file_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<std::tr1::shared_ptr<FileCheck> >::is_important),0);
/*
* Document-class: Paludis::QA::EbuildCheck
@@ -544,8 +544,8 @@ namespace
c_ebuild_check = rb_define_class_under(paludis_qa_module(), "EbuildCheck", rb_cObject);