aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-17 08:07:10 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-17 08:07:10 +0000
commitd9b68122d4b6a533081c46086a9247fd059d5660 (patch)
tree8fd998687aec7a4eb9d2ff13d2e3075686bdc9d0
parent8cf428ddb83b4ccc3b33dd003ae4942573dfdc1f (diff)
downloadpaludis-d9b68122d4b6a533081c46086a9247fd059d5660.tar.gz
paludis-d9b68122d4b6a533081c46086a9247fd059d5660.tar.xz
Start using libwrapiter and smarter containers to avoid including big scary STL files in our headers
-rw-r--r--configure.ac20
-rw-r--r--paludis/Makefile.am.m42
-rw-r--r--paludis/args/args_handler.cc1
-rw-r--r--paludis/config_file.cc264
-rw-r--r--paludis/config_file.hh157
-rw-r--r--paludis/contents.cc36
-rw-r--r--paludis/contents.hh24
-rw-r--r--paludis/default_config.cc61
-rw-r--r--paludis/default_config.hh34
-rw-r--r--paludis/default_environment.cc3
-rw-r--r--paludis/dep_atom.cc77
-rw-r--r--paludis/dep_atom.hh67
-rw-r--r--paludis/dep_atom_flattener.cc56
-rw-r--r--paludis/dep_atom_flattener.hh49
-rw-r--r--paludis/dep_atom_pretty_printer.hh3
-rw-r--r--paludis/dep_list.cc14
-rw-r--r--paludis/dep_list.hh117
-rw-r--r--paludis/environment.cc2
-rw-r--r--paludis/environment.hh7
-rw-r--r--paludis/package_database.cc5
-rw-r--r--paludis/package_database.hh3
-rw-r--r--paludis/portage_dep_lexer.cc42
-rw-r--r--paludis/portage_dep_lexer.hh46
-rw-r--r--paludis/qa/dep_flags_check.cc3
-rw-r--r--paludis/qa/dep_packages_check.cc1
-rw-r--r--paludis/qa/environment.cc28
-rw-r--r--paludis/qa/environment.hh20
-rw-r--r--paludis/qa/keywords_check.cc1
-rw-r--r--paludis/qa/pdepend_overlap_check.cc1
-rw-r--r--paludis/qa/src_uri_check.cc1
-rw-r--r--paludis/repositories/fake/fake_repository.cc13
-rw-r--r--paludis/repositories/nothing/nothing_repository.cc15
-rw-r--r--paludis/repositories/portage/portage_repository.cc75
-rw-r--r--paludis/repositories/vdb/vdb_repository.cc26
-rw-r--r--paludis/repository.cc72
-rw-r--r--paludis/repository.hh83
-rw-r--r--paludis/test_environment.cc26
-rw-r--r--paludis/test_environment.hh18
-rw-r--r--paludis/util/collection.hh171
-rw-r--r--paludis/util/collection_concrete.hh204
-rw-r--r--paludis/util/dir_iterator.cc1
-rw-r--r--paludis/util/dir_iterator.hh1
-rw-r--r--paludis/util/exception.cc54
-rw-r--r--paludis/util/exception.hh59
-rw-r--r--paludis/util/files.m41
-rw-r--r--src/paludis/applets.cc4
-rw-r--r--src/paludis/install.cc3
-rw-r--r--src/paludis/list.cc6
-rw-r--r--src/paludis/paludis.cc13
-rw-r--r--src/paludis/query.cc3
-rw-r--r--src/paludis/uninstall.cc3
-rw-r--r--src/qualudis/qualudis.cc6
52 files changed, 1329 insertions, 673 deletions
diff --git a/configure.ac b/configure.ac
index 59c8fa0..77f8551 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,6 +213,26 @@ int main(int, char **)
AC_MSG_ERROR([libebt (http://libebt.berlios.de/) is required])])
dnl }}}
+dnl {{{ we need libwrapiter.
+dnl don't use AC_CHECK_HEADER, it does silly things
+AC_MSG_CHECKING([for libwrapiter])
+AC_COMPILE_IFELSE([
+#include <libwrapiter/libwrapiter.hh>
+#include <string>
+struct C {
+ typedef libwrapiter::ForwardIterator<C, int> Iterator;
+ Iterator begin();
+ Iterator end();
+};
+int main(int, char **)
+{
+}
+],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([libwrapiter (http://libwrapiter.berlios.de/) is required])])
+dnl }}}
+
dnl {{{ check for various misc functions.
dnl It's probably possible to make many of these optional rather than
dnl hard requirements. If any of these fail for you, send patches.
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 42fedb3..651c7b3 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -20,10 +20,12 @@ $1_TEST_CXXFLAGS = -I$(top_srcdir)
')dnl
define(`addtestscript', `define(`testscriptlist', testscriptlist `$1_TEST_setup.sh $1_TEST_cleanup.sh')')dnl
define(`addhh', `define(`filelist', filelist `$1.hh')define(`headerlist', headerlist `$1.hh')')dnl
+define(`addhhx', `define(`filelist', filelist `$1.hh')')dnl
define(`addcc', `define(`filelist', filelist `$1.cc')')dnl
define(`addimpl', `define(`filelist', filelist `$1-impl.hh')')dnl
define(`addthis', `dnl
ifelse(`$2', `hh', `addhh(`$1')', `')dnl
+ifelse(`$2', `hhx', `addhhx(`$1')', `')dnl
ifelse(`$2', `cc', `addcc(`$1')', `')dnl
ifelse(`$2', `impl', `addimpl(`$1')', `')dnl
ifelse(`$2', `test', `addtest(`$1')', `')dnl
diff --git a/paludis/args/args_handler.cc b/paludis/args/args_handler.cc
index a681655..3273756 100644
--- a/paludis/args/args_handler.cc
+++ b/paludis/args/args_handler.cc
@@ -20,6 +20,7 @@
#include "args.hh"
#include "args_dumper.hh"
#include <algorithm>
+#include <sstream>
#include <paludis/util/system.hh>
/** \file
diff --git a/paludis/config_file.cc b/paludis/config_file.cc
index 57c7445..22b124a 100644
--- a/paludis/config_file.cc
+++ b/paludis/config_file.cc
@@ -28,6 +28,7 @@
#include <fstream>
#include <istream>
+#include <list>
/** \file
* Implementation for config_file.hh classes.
@@ -147,28 +148,57 @@ ConfigFile::skip_line(const std::string & s) const
return (s.empty() || '#' == s.at(0));
}
+namespace paludis
+{
+ template<>
+ struct Implementation<LineConfigFile> :
+ InternalCounted<Implementation<LineConfigFile> >
+ {
+ mutable std::list<std::string> lines;
+ };
+}
+
LineConfigFile::LineConfigFile(std::istream * const s) :
- ConfigFile(s)
+ ConfigFile(s),
+ PrivateImplementationPattern<LineConfigFile>(new Implementation<LineConfigFile>)
{
need_lines();
}
LineConfigFile::LineConfigFile(const std::string & filename) :
- ConfigFile(filename)
+ ConfigFile(filename),
+ PrivateImplementationPattern<LineConfigFile>(new Implementation<LineConfigFile>)
{
need_lines();
}
LineConfigFile::LineConfigFile(const FSEntry & filename) :
- ConfigFile(filename)
+ ConfigFile(filename),
+ PrivateImplementationPattern<LineConfigFile>(new Implementation<LineConfigFile>)
{
need_lines();
}
+LineConfigFile::~LineConfigFile()
+{
+}
+
void
LineConfigFile::accept_line(const std::string & s) const
{
- _lines.push_back(s);
+ _imp->lines.push_back(s);
+}
+
+LineConfigFile::Iterator
+LineConfigFile::begin() const
+{
+ return Iterator(_imp->lines.begin());
+}
+
+LineConfigFile::Iterator
+LineConfigFile::end() const
+{
+ return Iterator(_imp->lines.end());
}
KeyValueConfigFileError::KeyValueConfigFileError(const std::string & msg,
@@ -178,20 +208,33 @@ KeyValueConfigFileError::KeyValueConfigFileError(const std::string & msg,
{
}
+namespace paludis
+{
+ template <>
+ struct Implementation<KeyValueConfigFile> :
+ InternalCounted<Implementation<KeyValueConfigFile> >
+ {
+ mutable std::map<std::string, std::string> entries;
+ };
+}
+
KeyValueConfigFile::KeyValueConfigFile(std::istream * const s) :
- ConfigFile(s)
+ ConfigFile(s),
+ PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
need_lines();
}
KeyValueConfigFile::KeyValueConfigFile(const std::string & filename) :
- ConfigFile(filename)
+ ConfigFile(filename),
+ PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
need_lines();
}
KeyValueConfigFile::KeyValueConfigFile(const FSEntry & filename) :
- ConfigFile(filename)
+ ConfigFile(filename),
+ PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
need_lines();
}
@@ -199,24 +242,27 @@ KeyValueConfigFile::KeyValueConfigFile(const FSEntry & filename) :
KeyValueConfigFile::KeyValueConfigFile(std::istream * const s,
const std::map<std::string, std::string> & m) :
ConfigFile(s),
- _entries(m.begin(), m.end())
+ PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
+ _imp->entries.insert(m.begin(), m.end());
need_lines();
}
KeyValueConfigFile::KeyValueConfigFile(const std::string & filename,
const std::map<std::string, std::string> & m) :
ConfigFile(filename),
- _entries(m.begin(), m.end())
+ PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
+ _imp->entries.insert(m.begin(), m.end());
need_lines();
}
KeyValueConfigFile::KeyValueConfigFile(const FSEntry & filename,
const std::map<std::string, std::string> & m) :
ConfigFile(filename),
- _entries(m.begin(), m.end())
+ PrivateImplementationPattern<KeyValueConfigFile>(new Implementation<KeyValueConfigFile>)
{
+ _imp->entries.insert(m.begin(), m.end());
need_lines();
}
@@ -229,13 +275,13 @@ KeyValueConfigFile::accept_line(const std::string & line) const
{
std::string::size_type p(line.find('='));
if (std::string::npos == p)
- _entries[line] = "";
+ _imp->entries[line] = "";
else
{
std::string key(line.substr(0, p)), value(line.substr(p + 1));
normalise_line(key);
normalise_line(value);
- _entries[key] = replace_variables(strip_quotes(value));
+ _imp->entries[key] = replace_variables(strip_quotes(value));
}
}
@@ -314,6 +360,18 @@ KeyValueConfigFile::strip_quotes(const std::string & s) const
return s;
}
+KeyValueConfigFile::Iterator
+KeyValueConfigFile::begin() const
+{
+ return Iterator(_imp->entries.begin());
+}
+
+KeyValueConfigFile::Iterator
+KeyValueConfigFile::end() const
+{
+ return Iterator(_imp->entries.end());
+}
+
AdvisoryFileError::AdvisoryFileError(const std::string & msg,
const std::string & filename) throw () :
ConfigurationError("Advisory file error" +
@@ -321,9 +379,27 @@ AdvisoryFileError::AdvisoryFileError(const std::string & msg,
{
}
+namespace paludis
+{
+ template<>
+ struct Implementation<AdvisoryFile> :
+ InternalCounted<Implementation<AdvisoryFile> >
+ {
+ mutable std::map<std::string, std::string> entries;
+ mutable std::list<std::string> affected;
+ mutable std::list<std::string> unaffected;
+ mutable bool end_of_header;
+
+ Implementation() :
+ end_of_header(false)
+ {
+ }
+ };
+}
+
AdvisoryFile::AdvisoryFile(std::istream * const s) :
ConfigFile(s),
- _end_of_header(false)
+ PrivateImplementationPattern<AdvisoryFile>(new Implementation<AdvisoryFile>)
{
need_lines();
sanitise();
@@ -331,7 +407,7 @@ AdvisoryFile::AdvisoryFile(std::istream * const s) :
AdvisoryFile::AdvisoryFile(const std::string & filename) :
ConfigFile(filename),
- _end_of_header(false)
+ PrivateImplementationPattern<AdvisoryFile>(new Implementation<AdvisoryFile>)
{
need_lines();
sanitise();
@@ -339,7 +415,7 @@ AdvisoryFile::AdvisoryFile(const std::string & filename) :
AdvisoryFile::AdvisoryFile(const FSEntry & filename) :
ConfigFile(filename),
- _end_of_header(false)
+ PrivateImplementationPattern<AdvisoryFile>(new Implementation<AdvisoryFile>)
{
need_lines();
sanitise();
@@ -348,9 +424,9 @@ AdvisoryFile::AdvisoryFile(const FSEntry & filename) :
AdvisoryFile::AdvisoryFile(std::istream * const s,
const std::map<std::string, std::string> & m) :
ConfigFile(s),
- _entries(m.begin(), m.end()),
- _end_of_header(false)
+ PrivateImplementationPattern<AdvisoryFile>(new Implementation<AdvisoryFile>)
{
+ _imp->entries.insert(m.begin(), m.end());
need_lines();
sanitise();
}
@@ -358,9 +434,9 @@ AdvisoryFile::AdvisoryFile(std::istream * const s,
AdvisoryFile::AdvisoryFile(const std::string & filename,
const std::map<std::string, std::string> & m) :
ConfigFile(filename),
- _entries(m.begin(), m.end()),
- _end_of_header(false)
+ PrivateImplementationPattern<AdvisoryFile>(new Implementation<AdvisoryFile>)
{
+ _imp->entries.insert(m.begin(), m.end());
need_lines();
sanitise();
}
@@ -368,9 +444,9 @@ AdvisoryFile::AdvisoryFile(const std::string & filename,
AdvisoryFile::AdvisoryFile(const FSEntry & filename,
const std::map<std::string, std::string> & m) :
ConfigFile(filename),
- _entries(m.begin(), m.end()),
- _end_of_header(false)
+ PrivateImplementationPattern<AdvisoryFile>(new Implementation<AdvisoryFile>)
{
+ _imp->entries.insert(m.begin(), m.end());
need_lines();
sanitise();
}
@@ -384,10 +460,10 @@ AdvisoryFile::accept_line(const std::string & line) const
{
std::string::size_type p(line.find(':'));
- if ((std::string::npos == p) || (_end_of_header))
+ if ((std::string::npos == p) || (_imp->end_of_header))
{
- _entries["Description"] += line + "\n";
- _end_of_header = true;
+ _imp->entries["Description"] += line + "\n";
+ _imp->end_of_header = true;
}
else
{
@@ -398,20 +474,20 @@ AdvisoryFile::accept_line(const std::string & line) const
|| (key == "Restart") || (key == "Unaffected"))
{
if (key == "Affected")
- _affected.push_back(value);
+ _imp->affected.push_back(value);
else if (key == "Unaffected")
- _unaffected.push_back(value);
+ _imp->unaffected.push_back(value);
else
{
- if (! _entries[key].empty())
+ if (! _imp->entries[key].empty())
value = "\n" + value;
- _entries[key] += value;
+ _imp->entries[key] += value;
}
}
else
{
- if (_entries[key].empty())
- _entries[key] = value;
+ if (_imp->entries[key].empty())
+ _imp->entries[key] = value;
else
throw AdvisoryFileError("When adding value for key '" + key + "': Duplicate key found.");
}
@@ -421,60 +497,160 @@ AdvisoryFile::accept_line(const std::string & line) const
void
AdvisoryFile::sanitise()
{
- if (_entries["Id"].empty())
+ if (_imp->entries["Id"].empty())
throw AdvisoryFileError("Missing mandatory key: 'Id'.");
- if (_entries["Title"].empty())
+ if (_imp->entries["Title"].empty())
throw AdvisoryFileError("Missing mandatory key: 'Title'.");
- if (_entries["Access"].empty())
+ if (_imp->entries["Access"].empty())
throw AdvisoryFileError("Missing mandatory key: 'Access'.");
- if (_entries["Last-Modified"].empty())
+ if (_imp->entries["Last-Modified"].empty())
throw AdvisoryFileError("Missing mandatory key: 'Last-Modified'.");
- if (_entries["Revision"].empty())
+ if (_imp->entries["Revision"].empty())
throw AdvisoryFileError("Missing mandatory key: 'Revision'.");
- if (_entries["Severity"].empty())
+ if (_imp->entries["Severity"].empty())
throw AdvisoryFileError("Missing mandatory key: 'Severity'.");
- if (_entries["Spec-Version"].empty())
+ if (_imp->entries["Spec-Version"].empty())
throw AdvisoryFileError("Missing mandatory key: 'Spec-Version'.");
}
+AdvisoryFile::EntriesIterator
+AdvisoryFile::begin() const
+{
+ return EntriesIterator(_imp->entries.begin());
+}
+
+AdvisoryFile::EntriesIterator
+AdvisoryFile::end() const
+{
+ return EntriesIterator(_imp->entries.end());
+}
+
+AdvisoryFile::LineIterator
+AdvisoryFile::begin_affected() const
+{
+ return LineIterator(_imp->affected.begin());
+}
+
+AdvisoryFile::LineIterator
+AdvisoryFile::end_affected() const
+{
+ return LineIterator(_imp->affected.end());
+}
+
+AdvisoryFile::LineIterator
+AdvisoryFile::begin_unaffected() const
+{
+ return LineIterator(_imp->unaffected.begin());
+}
+
+AdvisoryFile::LineIterator
+AdvisoryFile::end_unaffected() const
+{
+ return LineIterator(_imp->unaffected.end());
+}
+
+std::string
+AdvisoryFile::get(const std::string & key) const
+{
+ return _imp->entries[key];
+}
+
+namespace paludis
+{
+ template<>
+ struct Implementation<NewsFile> :
+ InternalCounted<Implementation<NewsFile> >
+ {
+ mutable bool in_header;
+ mutable std::list<std::string> display_if_installed;
+ mutable std::list<std::string> display_if_keyword;
+ mutable std::list<std::string> display_if_profile;
+
+ Implementation() :
+ in_header(true)
+ {
+ }
+ };
+}
+
NewsFile::NewsFile(const FSEntry & filename) :
ConfigFile(filename),
- _in_header(true)
+ PrivateImplementationPattern<NewsFile>(new Implementation<NewsFile>)
{
need_lines();
}
+NewsFile::~NewsFile()
+{
+}
+
void
NewsFile::accept_line(const std::string & line) const
{
- if (_in_header)
+ if (_imp->in_header)
{
std::string::size_type p(line.find(':'));
if (std::string::npos == p)
- _in_header = false;
+ _imp->in_header = false;
else
{
std::string k(strip_leading(strip_trailing(line.substr(0, p), " \t\n"), " \t\n"));
std::string v(strip_leading(strip_trailing(line.substr(p + 1), " \t\n"), " \t\n"));
if (k == "Display-If-Installed")
- _display_if_installed.push_back(v);
+ _imp->display_if_installed.push_back(v);
else if (k == "Display-If-Keyword")
- _display_if_keyword.push_back(v);
+ _imp->display_if_keyword.push_back(v);
if (k == "Display-If-Profile")
- _display_if_profile.push_back(v);
+ _imp->display_if_profile.push_back(v);
}
}
}
+NewsFile::DisplayIfInstalledIterator
+NewsFile::begin_display_if_installed() const
+{
+ return DisplayIfInstalledIterator(_imp->display_if_installed.begin());
+}
+
+NewsFile::DisplayIfInstalledIterator
+NewsFile::end_display_if_installed() const
+{
+ return DisplayIfInstalledIterator(_imp->display_if_installed.end());
+}
+
+NewsFile::DisplayIfKeywordIterator
+NewsFile::begin_display_if_keyword() const
+{
+ return DisplayIfKeywordIterator(_imp->display_if_keyword.begin());
+}
+
+NewsFile::DisplayIfKeywordIterator
+NewsFile::end_display_if_keyword() const
+{
+ return DisplayIfKeywordIterator(_imp->display_if_keyword.end());
+}
+
+NewsFile::DisplayIfProfileIterator
+NewsFile::begin_display_if_profile() const
+{
+ return DisplayIfProfileIterator(_imp->display_if_profile.begin());
+}
+
+NewsFile::DisplayIfProfileIterator
+NewsFile::end_display_if_profile() const
+{
+ return DisplayIfProfileIterator(_imp->display_if_profile.end());
+}
+
std::string
KeyValueConfigFile::get(const std::string & key) const
{
- return _entries[key];
+ return _imp->entries[key];
}
diff --git a/paludis/config_file.hh b/paludis/config_file.hh
index d7e1b49..4a95920 100644
--- a/paludis/config_file.hh
+++ b/paludis/config_file.hh
@@ -22,12 +22,13 @@
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+#include <libwrapiter/libwrapiter.hh>
#include <iosfwd>
-#include <list>
-#include <map>
#include <string>
-#include <vector>
+#include <map>
/** \file
* Declarations for the ConfigFile classes.
@@ -145,11 +146,10 @@ namespace paludis
*
* \ingroup grplineconfigfile
*/
- class LineConfigFile : protected ConfigFile
+ class LineConfigFile :
+ protected ConfigFile,
+ private PrivateImplementationPattern<LineConfigFile>
{
- private:
- mutable std::list<std::string> _lines;
-
protected:
void accept_line(const std::string &) const;
@@ -172,22 +172,18 @@ namespace paludis
*/
LineConfigFile(const FSEntry & filename);
+ ~LineConfigFile();
+
///\}
///\name Iterate over our lines
///\{
- typedef std::list<std::string>::const_iterator Iterator;
+ typedef libwrapiter::ForwardIterator<LineConfigFile, const std::string> Iterator;
- Iterator begin() const
- {
- return _lines.begin();
- }
+ Iterator begin() const;
- Iterator end() const
- {
- return _lines.end();
- }
+ Iterator end() const;
///\}
};
@@ -217,11 +213,10 @@ namespace paludis
*
* \ingroup grpkvconfigfile
*/
- class KeyValueConfigFile : protected ConfigFile
+ class KeyValueConfigFile :
+ protected ConfigFile,
+ private PrivateImplementationPattern<KeyValueConfigFile>
{
- private:
- mutable std::map<std::string, std::string> _entries;
-
protected:
void accept_line(const std::string &) const;
@@ -279,17 +274,12 @@ namespace paludis
///\name Iterate over our key/values
///\{
- typedef std::map<std::string, std::string>::const_iterator Iterator;
+ typedef libwrapiter::ForwardIterator<KeyValueConfigFile,
+ std::pair<const std::string, std::string> > Iterator;
- Iterator begin() const
- {
- return _entries.begin();
- }
+ Iterator begin() const;
- Iterator end() const
- {
- return _entries.end();
- }
+ Iterator end() const;
///\}
@@ -331,14 +321,10 @@ namespace paludis
* \ingroup grpadvisoryconfigfile
*/
- class AdvisoryFile : protected ConfigFile
+ class AdvisoryFile :
+ protected ConfigFile,
+ private PrivateImplementationPattern<AdvisoryFile>
{
- private:
- mutable std::map<std::string, std::string> _entries;
- mutable std::list<std::string> _affected;
- mutable std::list<std::string> _unaffected;
- mutable bool _end_of_header;
-
protected:
void accept_line(const std::string &) const;
@@ -391,54 +377,34 @@ namespace paludis
///\name Iterate over our entries
///\{
- typedef std::map<std::string, std::string>::const_iterator EntriesIterator;
+ typedef libwrapiter::ForwardIterator<AdvisoryFile,
+ std::pair<const std::string, std::string> > EntriesIterator;
- EntriesIterator begin() const
- {
- return _entries.begin();
- }
+ EntriesIterator begin() const;
- EntriesIterator end() const
- {
- return _entries.end();
- }
+ EntriesIterator end() const;
///\}
///\name Iterate over our Affected: and Unaffected: lines.
///\{
- typedef std::list<std::string>::const_iterator LineIterator;
+ typedef libwrapiter::ForwardIterator<AdvisoryFile, std::string> LineIterator;
- LineIterator begin_affected() const
- {
- return _affected.begin();
- }
+ LineIterator begin_affected() const;
- LineIterator end_affected() const
- {
- return _affected.end();
- }
+ LineIterator end_affected() const;
- LineIterator begin_unaffected() const
- {
- return _unaffected.begin();
- }
+ LineIterator begin_unaffected() const;
- LineIterator end_unaffected() const
- {
- return _unaffected.end();
- }
+ LineIterator end_unaffected() const;
///\}
/**
* Fetch the specified key, or a blank string.
*/
- std::string get(const std::string & key) const
- {
- return _entries[key];
- }
+ std::string get(const std::string & key) const;
};
@@ -448,14 +414,9 @@ namespace paludis
* \ingroup grpnewconfigfile
*/
class NewsFile :
- protected ConfigFile
+ protected ConfigFile,
+ private PrivateImplementationPattern<NewsFile>
{
- private:
- mutable bool _in_header;
- mutable std::list<std::string> _display_if_installed;
- mutable std::list<std::string> _display_if_keyword;
- mutable std::list<std::string> _display_if_profile;
-
protected:
void accept_line(const std::string &) const;
@@ -468,56 +429,52 @@ namespace paludis
*/
NewsFile(const FSEntry & filename);
+ ~NewsFile();
+
///\}
///\name Iterate over our Display-If-Installed headers
///\{
- typedef std::list<std::string>::const_iterator DisplayIfInstalledIterator;
+ /// Tag for DisplayIfInstalledIterator.
+ struct DisplayIfInstalledIteratorTag;
- DisplayIfInstalledIterator begin_display_if_installed() const
- {
- return _display_if_installed.begin();
- }
+ typedef libwrapiter::ForwardIterator<DisplayIfInstalledIteratorTag,
+ const std::string> DisplayIfInstalledIterator;
- DisplayIfInstalledIterator end_display_if_installed() const
- {
- return _display_if_installed.end();
- }
+ DisplayIfInstalledIterator begin_display_if_installed() const;
+
+ DisplayIfInstalledIterator end_display_if_installed() const;
///\}
///\name Iterate over our Display-If-Keyword headers
///\{
- typedef std::list<std::string>::const_iterator DisplayIfKeywordIterator;
+ /// Tag for DisplayIfKeywordIterator.
+ struct DisplayIfKeywordIteratorTag;
- DisplayIfKeywordIterator begin_display_if_keyword() const
- {
- return _display_if_keyword.begin();
- }
+ typedef libwrapiter::ForwardIterator<DisplayIfKeywordIteratorTag,
+ const std::string> DisplayIfKeywordIterator;
- DisplayIfKeywordIterator end_display_if_keyword() const
- {
- return _display_if_keyword.end();
- }
+ DisplayIfKeywordIterator begin_display_if_keyword() const;
+
+ DisplayIfKeywordIterator end_display_if_keyword() const;
///\}
///\name Iterate over our Display-If-Profile headers
///\{
- typedef std::list<std::string>::const_iterator DisplayIfProfileIterator;
+ /// Tag for DisplayIfProfileIterator.
+ struct DisplayIfProfileIteratorTag;
- DisplayIfProfileIterator begin_display_if_profile() const
- {
- return _display_if_profile.begin();
- }
+ typedef libwrapiter::ForwardIterator<DisplayIfProfileIteratorTag,
+ const std::string> DisplayIfProfileIterator;
- DisplayIfProfileIterator end_display_if_profile() const
- {
- return _display_if_profile.end();
- }
+ DisplayIfProfileIterator begin_display_if_profile() const;
+
+ DisplayIfProfileIterator end_display_if_profile() const;
///\}
};
diff --git a/paludis/contents.cc b/paludis/contents.cc
index ad9acfa..6429624 100644
--- a/paludis/contents.cc
+++ b/paludis/contents.cc
@@ -18,6 +18,7 @@
*/
#include "contents.hh"
+#include <list>
/** \file
* Implementation for Contents classes.
@@ -52,7 +53,40 @@ ContentsSymEntry::ContentsSymEntry(const std::string & name, const std::string &
{
}
-Contents::Contents()
+namespace paludis
{
+ template<>
+ struct Implementation<Contents> :
+ InternalCounted<Implementation<Contents> >
+ {
+ std::list<ContentsEntry::ConstPointer> c;
+ };
+}
+
+Contents::Contents() :
+ PrivateImplementationPattern<Contents>(new Implementation<Contents>())
+{
+}
+
+Contents::~Contents()
+{
+}
+
+void
+Contents::add(ContentsEntry::ConstPointer c)
+{
+ _imp->c.push_back(c);
+}
+
+Contents::Iterator
+Contents::begin() const
+{
+ return Iterator(_imp->c.begin());
+}
+
+Contents::Iterator
+Contents::end() const
+{
+ return Iterator(_imp->c.end());
}
diff --git a/paludis/contents.hh b/paludis/contents.hh
index 8674c9a..f5265b5 100644
--- a/paludis/contents.hh
+++ b/paludis/contents.hh
@@ -26,6 +26,8 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <string>
+#include <libwrapiter/libwrapiter.hh>
+
/** \file
* Declarations for the Contents classes.
*
@@ -175,39 +177,29 @@ namespace paludis
*/
class Contents :
private InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>,
+ private PrivateImplementationPattern<Contents>,
public InternalCounted<Contents>
{
- private:
- std::list<ContentsEntry::ConstPointer> _c;
-
public:
///\name Basic operations
///\{
Contents();
+ ~Contents();
///\}
/// Add a new entry.
- void add(ContentsEntry::ConstPointer c)
- {
- _c.push_back(c);
- }
+ void add(ContentsEntry::ConstPointer c);
///\name Iterate over our entries
///\{
- typedef std::list<ContentsEntry::ConstPointer>::const_iterator Iterator;
+ typedef libwrapiter::ForwardIterator<Contents, const ContentsEntry::ConstPointer> Iterator;
- Iterator begin() const
- {
- return _c.begin();
- }
+ Iterator begin() const;
- Iterator end() const
- {
- return _c.end();
- }
+ Iterator end() const;
///\}
};
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 5581c6a..3d7dd0a 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -32,6 +32,7 @@
#include <fstream>
#include <algorithm>
#include <sstream>
+#include <list>
#include <ctype.h>
@@ -469,13 +470,13 @@ DefaultConfig::config_suffix()
DefaultConfig::RepositoryIterator
DefaultConfig::begin_repositories() const
{
- return _imp->repos.begin();
+ return RepositoryIterator(_imp->repos.begin());
}
DefaultConfig::RepositoryIterator
DefaultConfig::end_repositories() const
{
- return _imp->repos.end();
+ return RepositoryIterator(_imp->repos.end());
}
DefaultConfig::PackageKeywordsIterator
@@ -484,9 +485,9 @@ DefaultConfig::begin_package_keywords(const QualifiedPackageName & d) const
std::map<QualifiedPackageName, std::vector<
std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r;
if (_imp->keywords.end() != ((r = _imp->keywords.find(d))))
- return r->second.begin();
+ return PackageKeywordsIterator(r->second.begin());
else
- return _imp->empty_keywords.begin();
+ return PackageKeywordsIterator(_imp->empty_keywords.begin());
}
DefaultConfig::PackageKeywordsIterator
@@ -495,21 +496,21 @@ DefaultConfig::end_package_keywords(const QualifiedPackageName & d) const
std::map<QualifiedPackageName, std::vector<
std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r;
if (_imp->keywords.end() != ((r = _imp->keywords.find(d))))
- return r->second.end();
+ return PackageKeywordsIterator(r->second.end());
else
- return _imp->empty_keywords.end();
+ return PackageKeywordsIterator(_imp->empty_keywords.end());
}
DefaultConfig::DefaultKeywordsIterator
DefaultConfig::begin_default_keywords() const
{
- return _imp->default_keywords.begin();
+ return DefaultKeywordsIterator(_imp->default_keywords.begin());
}
DefaultConfig::DefaultKeywordsIterator
DefaultConfig::end_default_keywords() const
{
- return _imp->default_keywords.end();
+ return DefaultKeywordsIterator(_imp->default_keywords.end());
}
DefaultConfig::PackageLicensesIterator
@@ -518,9 +519,9 @@ DefaultConfig::begin_package_licenses(const QualifiedPackageName & d) const
std::map<QualifiedPackageName, std::vector<
std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
if (_imp->licenses.end() != ((r = _imp->licenses.find(d))))
- return r->second.begin();
+ return PackageLicensesIterator(r->second.begin());
else
- return _imp->empty_licenses.begin();
+ return PackageLicensesIterator(_imp->empty_licenses.begin());
}
DefaultConfig::PackageLicensesIterator
@@ -529,21 +530,21 @@ DefaultConfig::end_package_licenses(const QualifiedPackageName & d) const
std::map<QualifiedPackageName, std::vector<
std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
if (_imp->licenses.end() != ((r = _imp->licenses.find(d))))
- return r->second.end();
+ return PackageLicensesIterator(r->second.end());
else
- return _imp->empty_licenses.end();
+ return PackageLicensesIterator(_imp->empty_licenses.end());
}
DefaultConfig::DefaultLicensesIterator
DefaultConfig::begin_default_licenses() const
{
- return _imp->default_licenses.begin();
+ return DefaultLicensesIterator(_imp->default_licenses.begin());
}
DefaultConfig::DefaultLicensesIterator
DefaultConfig::end_default_licenses() const
{
- return _imp->default_licenses.end();
+ return DefaultLicensesIterator(_imp->default_licenses.end());
}
DefaultConfig::UserMasksIterator
@@ -551,9 +552,9 @@ DefaultConfig::begin_user_masks(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
if (_imp->user_masks.end() != ((r = _imp->user_masks.find(d))))
- return r->second.begin();
+ return UserMasksIterator(indirect_iterator<const PackageDepAtom>(r->second.begin()));
else
- return _imp->empty_masks.begin();
+ return UserMasksIterator(indirect_iterator<const PackageDepAtom>(_imp->empty_masks.begin()));
}
DefaultConfig::UserMasksIterator
@@ -561,9 +562,9 @@ DefaultConfig::end_user_masks(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
if (_imp->user_masks.end() != ((r = _imp->user_masks.find(d))))
- return r->second.end();
+ return UserMasksIterator(indirect_iterator<const PackageDepAtom>(r->second.end()));
else
- return _imp->empty_masks.end();
+ return UserMasksIterator(indirect_iterator<const PackageDepAtom>(_imp->empty_masks.end()));
}
DefaultConfig::UserUnmasksIterator
@@ -571,9 +572,9 @@ DefaultConfig::begin_user_unmasks(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
if (_imp->user_unmasks.end() != ((r = _imp->user_unmasks.find(d))))
- return r->second.begin();
+ return UserUnmasksIterator(indirect_iterator<const PackageDepAtom>(r->second.begin()));
else
- return _imp->empty_masks.begin();
+ return UserUnmasksIterator(indirect_iterator<const PackageDepAtom>(_imp->empty_masks.begin()));
}
DefaultConfig::UserUnmasksIterator
@@ -581,9 +582,9 @@ DefaultConfig::end_user_unmasks(const QualifiedPackageName & d) const
{
std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
if (_imp->user_unmasks.end() != ((r = _imp->user_unmasks.find(d))))
- return r->second.end();
+ return UserUnmasksIterator(indirect_iterator<const PackageDepAtom>(r->second.end()));
else
- return _imp->empty_masks.end();
+ return UserUnmasksIterator(indirect_iterator<const PackageDepAtom>(_imp->empty_masks.end()));
}
DefaultConfig::UseConfigIterator
@@ -591,9 +592,9 @@ DefaultConfig::begin_use_config(const QualifiedPackageName & q) const
{
std::map<QualifiedPackageName, std::vector<UseConfigEntry> >::const_iterator r;
if (_imp->use.end() != ((r = _imp->use.find(q))))
- return r->second.begin();
+ return UseConfigIterator(r->second.begin());
else
- return _imp->empty_use.begin();
+ return UseConfigIterator(_imp->empty_use.begin());
}
DefaultConfig::UseConfigIterator
@@ -601,21 +602,21 @@ DefaultConfig::end_use_config(const QualifiedPackageName & q) const
{
std::map<QualifiedPackageName, std::vector<UseConfigEntry> >::const_iterator r;
if (_imp->use.end() != ((r = _imp->use.find(q))))
- return r->second.end();
+ return UseConfigIterator(r->second.end());
else
- return _imp->empty_use.end();
+ return UseConfigIterator(_imp->empty_use.end());
}
DefaultConfig::DefaultUseIterator
DefaultConfig::begin_default_use() const
{
- return _imp->default_use.begin();
+ return DefaultUseIterator(_imp->default_use.begin());
}
DefaultConfig::DefaultUseIterator
DefaultConfig::end_default_use() const
{
- return _imp->default_use.end();
+ return DefaultUseIterator(_imp->default_use.end());
}
std::string
@@ -645,12 +646,12 @@ DefaultConfig::config_dir() const
DefaultConfig::MirrorIterator
DefaultConfig::begin_mirrors(const std::string & m) const
{
- return _imp->mirrors.lower_bound(m);
+ return MirrorIterator(_imp->mirrors.lower_bound(m));
}
DefaultConfig::MirrorIterator
DefaultConfig::end_mirrors(const std::string & m) const
{
- return _imp->mirrors.upper_bound(m);
+ return MirrorIterator(_imp->mirrors.upper_bound(m));
}
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index ebe7400..5b82a2e 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -26,8 +26,6 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/smart_record.hh>
-#include <map>
-#include <vector>
#include <string>
/** \file
@@ -38,6 +36,11 @@
namespace paludis
{
+ struct EnvironmentMirrorIteratorTag;
+
+ typedef libwrapiter::ForwardIterator<EnvironmentMirrorIteratorTag,
+ const std::pair<const std::string, std::string> > EnvironmentMirrorIterator;
+
/**
* A DefaultConfigError is thrown if a configuration error is encountered
* by DefaultConfig.
@@ -162,7 +165,7 @@ namespace paludis
///\name Iterate over our repositories
///{
- typedef std::list<RepositoryConfigEntry>::const_iterator RepositoryIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const RepositoryConfigEntry> RepositoryIterator;
RepositoryIterator begin_repositories() const;
@@ -173,14 +176,14 @@ namespace paludis
///\name Iterate over our default and per-package keywords
///{
- typedef std::vector<std::pair<PackageDepAtom::ConstPointer, KeywordName> >::const_iterator
- PackageKeywordsIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig,
+ const std::pair<PackageDepAtom::ConstPointer, KeywordName> > PackageKeywordsIterator;
PackageKeywordsIterator begin_package_keywords(const QualifiedPackageName & d) const;
PackageKeywordsIterator end_package_keywords(const QualifiedPackageName & d) const;
- typedef std::vector<KeywordName>::const_iterator DefaultKeywordsIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const KeywordName> DefaultKeywordsIterator;
DefaultKeywordsIterator begin_default_keywords() const;
@@ -191,14 +194,14 @@ namespace paludis
///\name Iterate over our default and per-package licenses
///{
- typedef std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> >::const_iterator
- PackageLicensesIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig,
+ const std::pair<PackageDepAtom::ConstPointer, std::string> > PackageLicensesIterator;
PackageLicensesIterator begin_package_licenses(const QualifiedPackageName & d) const;
PackageLicensesIterator end_package_licenses(const QualifiedPackageName & d) const;
- typedef std::vector<std::string>::const_iterator DefaultLicensesIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const std::string> DefaultLicensesIterator;
DefaultLicensesIterator begin_default_licenses() const;
@@ -209,15 +212,13 @@ namespace paludis
///\name Iterate over our masks and unmasks
///{
- typedef IndirectIterator<std::vector<PackageDepAtom::ConstPointer>::const_iterator,
- const PackageDepAtom> UserMasksIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const PackageDepAtom> UserMasksIterator;
UserMasksIterator begin_user_masks(const QualifiedPackageName & d) const;
UserMasksIterator end_user_masks(const QualifiedPackageName & d) const;
- typedef IndirectIterator<std::vector<PackageDepAtom::ConstPointer>::const_iterator,
- const PackageDepAtom> UserUnmasksIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const PackageDepAtom> UserUnmasksIterator;
UserUnmasksIterator begin_user_unmasks(const QualifiedPackageName & d) const;
@@ -228,13 +229,14 @@ namespace paludis
///\name Iterate over our default and per-package use flags
///{
- typedef std::vector<UseConfigEntry>::const_iterator UseConfigIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig, const UseConfigEntry> UseConfigIterator;
UseConfigIterator begin_use_config(const QualifiedPackageName & q) const;
UseConfigIterator end_use_config(const QualifiedPackageName & q) const;
- typedef std::vector<std::pair<UseFlagName, UseFlagState> >::const_iterator DefaultUseIterator;
+ typedef libwrapiter::ForwardIterator<DefaultConfig,
+ const std::pair<UseFlagName, UseFlagState> > DefaultUseIterator;
DefaultUseIterator begin_default_use() const;
@@ -270,7 +272,7 @@ namespace paludis
///\name Iterate over our mirrors
///\{
- typedef std::multimap<std::string, std::string>::const_iterator MirrorIterator;
+ typedef EnvironmentMirrorIterator MirrorIterator;
MirrorIterator begin_mirrors(const std::string & m) const;
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 1639990..527d9c9 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -24,6 +24,7 @@
#include <paludis/match_package.hh>
#include <paludis/package_database.hh>
#include <paludis/repository.hh>
+#include <paludis/util/collection_concrete.hh>
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/log.hh>
#include <paludis/util/stringify.hh>
@@ -273,7 +274,7 @@ UseFlagNameCollection::Pointer
DefaultEnvironment::query_enabled_use_matching(const std::string & prefix,
const PackageDatabaseEntry * e) const
{
- UseFlagNameCollection::Pointer result(new UseFlagNameCollection);
+ UseFlagNameCollection::Pointer result(new UseFlagNameCollection::Concrete);
for (DefaultConfig::DefaultUseIterator
u(DefaultConfig::get_instance()->begin_default_use()),
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index 5098176..07d4583 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -20,6 +20,9 @@
#include <paludis/dep_atom.hh>
#include <paludis/util/log.hh>
+#include <list>
+#include <map>
+
/** \file
* Implementation for dep_atom.hh things.
*
@@ -42,14 +45,41 @@ DepAtom::as_use_dep_atom() const
return 0;
}
-CompositeDepAtom::CompositeDepAtom()
+namespace paludis
+{
+ template<>
+ struct Implementation<CompositeDepAtom> :
+ InternalCounted<Implementation<CompositeDepAtom> >
+ {
+ std::list<DepAtom::ConstPointer> children;
+ };
+}
+
+CompositeDepAtom::CompositeDepAtom() :
+ PrivateImplementationPattern<CompositeDepAtom>(new Implementation<CompositeDepAtom>)
+{
+}
+
+CompositeDepAtom::~CompositeDepAtom()
{
}
void
CompositeDepAtom::add_child(DepAtom::ConstPointer c)
{
- _children.push_back(c);
+ _imp->children.push_back(c);
+}
+
+CompositeDepAtom::Iterator
+CompositeDepAtom::begin() const
+{
+ return Iterator(_imp->children.begin());
+}
+
+CompositeDepAtom::Iterator
+CompositeDepAtom::end() const
+{
+ return Iterator(_imp->children.end());
}
AnyDepAtom::AnyDepAtom()
@@ -274,6 +304,49 @@ PlainTextDepAtom::PlainTextDepAtom(const std::string & s) :
{
}
+namespace paludis
+{
+ template<>
+ struct Implementation<UseRequirements> :
+ InternalCounted<Implementation<UseRequirements> >
+ {
+ std::map<UseFlagName, UseFlagState> reqs;
+ };
+}
+
+UseRequirements::UseRequirements() :
+ PrivateImplementationPattern<UseRequirements>(new Implementation<UseRequirements>)
+{
+}
+
+UseRequirements::~UseRequirements()
+{
+}
+
+UseRequirements::Iterator
+UseRequirements::begin() const
+{
+ return Iterator(_imp->reqs.begin());
+}
+
+UseRequirements::Iterator
+UseRequirements::end() const
+{
+ return Iterator(_imp->reqs.end());
+}
+
+UseRequirements::Iterator
+UseRequirements::find(const UseFlagName & u) const
+{
+ return Iterator(_imp->reqs.find(u));
+}
+
+bool
+UseRequirements::insert(const UseFlagName & u, UseFlagState s)
+{
+ return _imp->reqs.insert(std::make_pair(u, s)).second;
+}
+
UseFlagState
UseRequirements::state(const UseFlagName & u) const
{
diff --git a/paludis/dep_atom.hh b/paludis/dep_atom.hh
index 9f44f46..96a5480 100644
--- a/paludis/dep_atom.hh
+++ b/paludis/dep_atom.hh
@@ -20,7 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_HH
#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_HH 1
-#include <list>
#include <paludis/dep_tag.hh>
#include <paludis/name.hh>
#include <paludis/util/attributes.hh>
@@ -29,7 +28,8 @@
#include <paludis/util/visitor.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
-#include <map>
+
+#include <libwrapiter/libwrapiter.hh>
/** \file
* Declarations for the DepAtom classes.
@@ -96,11 +96,9 @@ namespace paludis
* \ingroup grpdepatoms
*/
class CompositeDepAtom :
- public DepAtom
+ public DepAtom,
+ private PrivateImplementationPattern<CompositeDepAtom>
{
- private:
- std::list<DepAtom::ConstPointer> _children;
-
protected:
///\name Basic operations
///\{
@@ -110,6 +108,13 @@ namespace paludis
///\}
public:
+ ///\name Basic operations
+ ///\{
+
+ ~CompositeDepAtom();
+
+ ///\}
+
///\name Modify our children
///\{
@@ -123,17 +128,11 @@ namespace paludis
///\name Iterate over our children
///\{
- typedef std::list<DepAtom::ConstPointer>::const_iterator Iterator;
+ typedef libwrapiter::ForwardIterator<CompositeDepAtom, const DepAtom::ConstPointer> Iterator;
- Iterator begin() const
- {
- return _children.begin();
- }
+ Iterator begin() const;
- Iterator end() const
- {
- return _children.end();
- }
+ Iterator end() const;
///\name Pointer types
///\{
@@ -258,40 +257,34 @@ namespace paludis
* \ingroup grpdepatoms
*/
class UseRequirements :
- public InternalCounted<UseRequirements>
+ public InternalCounted<UseRequirements>,
+ private PrivateImplementationPattern<UseRequirements>
{
- private:
- std::map<UseFlagName, UseFlagState> _reqs;
-
public:
- ///\name Iterate over our USE requirements
+ ///\name Basic operations
///\{
- typedef std::map<UseFlagName, UseFlagState>::const_iterator Iterator;
+ UseRequirements();
+ ~UseRequirements();
- Iterator begin() const
- {
- return _reqs.begin();
- }
+ ///\}
- Iterator end() const
- {
- return _reqs.end();
- }
+ ///\name Iterate over our USE requirements
+ ///\{
+
+ typedef libwrapiter::ForwardIterator<UseRequirements,
+ const std::pair<const UseFlagName, UseFlagState> > Iterator;
+
+ Iterator begin() const;
+ Iterator end() const;
///\}
/// Find the requirement for a particular USE flag.
- Iterator find(const UseFlagName & u) const
- {
- return _reqs.find(u);
- }
+ Iterator find(const UseFlagName & u) const;
/// Insert a new requirement.
- bool insert(const UseFlagName & u, UseFlagState s)
- {
- return _reqs.insert(std::make_pair(u, s)).second;
- }
+ bool insert(const UseFlagName & u, UseFlagState s);
/// What state is desired for a particular use flag?
UseFlagState state(const UseFlagName &) const;
diff --git a/paludis/dep_atom_flattener.cc b/paludis/dep_atom_flattener.cc
index 77c29ae..71f38f7 100644
--- a/paludis/dep_atom_flattener.cc
+++ b/paludis/dep_atom_flattener.cc
@@ -28,14 +28,40 @@
using namespace paludis;
+namespace paludis
+{
+ template<>
+ struct Implementation<DepAtomFlattener> :
+ InternalCounted<Implementation<DepAtomFlattener> >
+ {
+ const Environment * const env;
+
+ const PackageDatabaseEntry * const pkg;
+
+ DepAtom::ConstPointer a;
+
+ mutable std::list<const StringDepAtom *> atoms;
+
+ mutable bool done;
+
+ Implementation(const Environment * const e,
+ const PackageDatabaseEntry * const p,
+ DepAtom::ConstPointer aa) :
+ env(e),
+ pkg(p),
+ a(aa),
+ done(false)
+ {
+ }
+ };
+}
+
DepAtomFlattener::DepAtomFlattener(
const Environment * const env,
const PackageDatabaseEntry * const pkg,
DepAtom::ConstPointer a) :
- _env(env),
- _pkg(pkg),
- _a(a),
- _done(false)
+ PrivateImplementationPattern<DepAtomFlattener>(new Implementation<DepAtomFlattener>(
+ env, pkg, a))
{
}
@@ -46,13 +72,19 @@ DepAtomFlattener::~DepAtomFlattener()
DepAtomFlattener::Iterator
DepAtomFlattener::begin()
{
- if (! _done)
+ if (! _imp->done)
{
- _a->accept(static_cast<DepAtomVisitorTypes::ConstVisitor *>(this));
- _done = true;
+ _imp->a->accept(static_cast<DepAtomVisitorTypes::ConstVisitor *>(this));
+ _imp->done = true;
}
- return _atoms.begin();
+ return Iterator(_imp->atoms.begin());
+}
+
+DepAtomFlattener::Iterator
+DepAtomFlattener::end() const
+{
+ return Iterator(_imp->atoms.end());
}
void DepAtomFlattener::visit(const AllDepAtom * a)
@@ -68,23 +100,23 @@ void DepAtomFlattener::visit(const AnyDepAtom *)
void DepAtomFlattener::visit(const UseDepAtom * u)
{
- if (_env->query_use(u->flag(), _pkg) ^ u->inverse())
+ if (_imp->env->query_use(u->flag(), _imp->pkg) ^ u->inverse())
std::for_each(u->begin(), u->end(), accept_visitor(
static_cast<DepAtomVisitorTypes::ConstVisitor *>(this)));
}
void DepAtomFlattener::visit(const PlainTextDepAtom * p)
{
- _atoms.push_back(p);
+ _imp->atoms.push_back(p);
}
void DepAtomFlattener::visit(const PackageDepAtom * p)
{
- _atoms.push_back(p);
+ _imp->atoms.push_back(p);
}
void DepAtomFlattener::visit(const BlockDepAtom * p)
{
- _atoms.push_back(p);
+ _imp->atoms.push_back(p);
}
diff --git a/paludis/dep_atom_flattener.hh b/paludis/dep_atom_flattener.hh
index ee2ab51..609178e 100644
--- a/paludis/dep_atom_flattener.hh
+++ b/paludis/dep_atom_flattener.hh
@@ -20,13 +20,14 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_FLATTENER_HH
#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_FLATTENER_HH 1
-#include <list>
#include <paludis/dep_atom.hh>
#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <libwrapiter/libwrapiter.hh>
+
/** \file
* Declarations for DepAtomFlattener.
*
@@ -46,19 +47,9 @@ namespace paludis
*/
class DepAtomFlattener :
private InstantiationPolicy<DepAtomFlattener, instantiation_method::NonCopyableTag>,
- protected DepAtomVisitorTypes::ConstVisitor
+ protected DepAtomVisitorTypes::ConstVisitor,
+ private PrivateImplementationPattern<DepAtomFlattener>
{
- private:
- const Environment * const _env;
-
- const PackageDatabaseEntry * const _pkg;
-
- DepAtom::ConstPointer _a;
-
- mutable std::list<const StringDepAtom *> _atoms;
-
- mutable bool _done;
-
protected:
///\name Visit methods
///{
@@ -71,35 +62,27 @@ namespace paludis
///}
public:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
DepAtomFlattener(const Environment * const,
const PackageDatabaseEntry * const,
const DepAtom::ConstPointer);
- /**
- * Destructor.
- */
~DepAtomFlattener();
- /**
- * Iterate over our dep atoms.
- */
- typedef std::list<const StringDepAtom *>::const_iterator Iterator;
+ ///\}
+
+ ///\name Iterate over our dep atoms
+ ///{
+
+ typedef libwrapiter::ForwardIterator<DepAtomFlattener, const StringDepAtom *> Iterator;
- /**
- * Iterator to the start of our dep atoms.
- */
Iterator begin();
- /**
- * Iterator to past the end of our dep atoms.
- */
- Iterator end() const
- {
- return _atoms.end();
- }
+ Iterator end() const;
+
+ ///\}
};
}
diff --git a/paludis/dep_atom_pretty_printer.hh b/paludis/dep_atom_pretty_printer.hh
index 59ac6be..9f37f51 100644
--- a/paludis/dep_atom_pretty_printer.hh
+++ b/paludis/dep_atom_pretty_printer.hh
@@ -20,9 +20,8 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_PRETTY_PRINTER_HH
#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_PRETTY_PRINTER_HH 1
-#include <ostream>
+#include <iosfwd>
#include <paludis/dep_atom.hh>
-#include <sstream>
/** \file
* Declarations for the DepAtomPrettyPrinter class.
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 56de0bb..028b44b 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -81,6 +81,13 @@ BlockError::BlockError(const std::string & msg) throw () :
{
}
+template <typename I_>
+CircularDependencyError::CircularDependencyError(I_ begin, const I_ end) throw () :
+ DepListError("Circular dependency: " + join(begin, end, " -> ")),
+ _cycle_size(std::distance(begin, end))
+{
+}
+
namespace paludis
{
/**
@@ -295,13 +302,13 @@ DepList::_add_in_role_raw(const DepAtom * const atom, const std::string & role)
DepList::Iterator
DepList::begin() const
{
- return _imp->merge_list.begin();
+ return Iterator(_imp->merge_list.begin());
}
DepList::Iterator
DepList::end() const
{
- return _imp->merge_list.end();
+ return Iterator(_imp->merge_list.end());
}
void
@@ -509,8 +516,7 @@ DepList::visit(const PackageDepAtom * const p)
Save<std::list<DepListEntry>::iterator> old_merge_list_insert_pos(
&_imp->merge_list_insert_pos, merge_entry);
- context.change_context("When resolving package dependency '" + stringify(*p) +
- "' -> '" + stringify(*merge_entry) + "':");
+ Context resolved_context("Dependency resolution is '" + stringify(*merge_entry) + "':");
/* new current package */
Save<const DepListEntry *> old_current_package(&_imp->current_package,
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 8855924..8793ff5 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -20,13 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_LIST_HH
#define PALUDIS_GUARD_PALUDIS_DEP_LIST_HH 1
-#include <algorithm>
-#include <bitset>
-#include <deque>
-#include <iterator>
-#include <list>
-#include <ostream>
-#include <set>
#include <paludis/dep_atom.hh>
#include <paludis/dep_tag.hh>
#include <paludis/name.hh>
@@ -36,6 +29,12 @@
#include <paludis/util/smart_record.hh>
#include <paludis/version_spec.hh>
+#include <iosfwd>
+#include <bitset>
+#include <set>
+
+#include <libwrapiter/libwrapiter.hh>
+
namespace paludis
{
/**
@@ -117,10 +116,12 @@ namespace paludis
class DepListError : public Exception
{
protected:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
DepListError(const std::string &) throw ();
+
+ ///\}
};
/**
@@ -132,10 +133,12 @@ namespace paludis
class DepListStackTooDeepError : public DepListError
{
public:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
DepListStackTooDeepError(int level) throw ();
+
+ ///\}
};
/**
@@ -147,16 +150,15 @@ namespace paludis
class NoResolvableOptionError : public DepListError
{
public:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
NoResolvableOptionError() throw ();
- /**
- * Constructor with failure reasons.
- */
template <typename I_>
NoResolvableOptionError(I_ i, I_ end) throw ();
+
+ ///\}
};
/**
@@ -171,18 +173,17 @@ namespace paludis
std::string _query;
public:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
AllMaskedError(const std::string & query) throw ();
- /**
- * Destructor.
- */
virtual ~AllMaskedError() throw ()
{
}
+ ///\}
+
/**
* Our query.
*/
@@ -205,18 +206,17 @@ namespace paludis
std::string _query;
public:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
UseRequirementsNotMetError(const std::string & query) throw ();
- /**
- * Destructor.
- */
virtual ~UseRequirementsNotMetError() throw ()
{
}
+ ///\}
+
/**
* Our query.
*/
@@ -235,10 +235,12 @@ namespace paludis
class BlockError : public DepListError
{
public:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
BlockError(const std::string & msg) throw ();
+
+ ///\}
};
/**
@@ -253,16 +255,13 @@ namespace paludis
unsigned _cycle_size;
public:
- /**
- * Constructor, from a sequence of the items causing the circular
- * dependency.
- */
+ ///\name Basic operations
+ ///\{
+
template <typename I_>
- CircularDependencyError(I_ begin, const I_ end) throw () :
- DepListError("Circular dependency: " + join(begin, end, " -> ")),
- _cycle_size(std::distance(begin, end))
- {
- }
+ CircularDependencyError(I_ begin, const I_ end) throw ();
+
+ ///\}
/**
* How large is our circular dependency cycle?
@@ -334,37 +333,35 @@ namespace paludis
///}
public:
- /**
- * Iterator for our children.
- */
- typedef std::list<DepListEntry>::const_iterator Iterator;
+ ///\name Basic operations
+ ///\{
- /**
- * Constructor.
- */
DepList(const Environment * const);
- /**
- * Destructor.
- */
virtual ~DepList();
+ ///\}
+
/**
* Add the packages required to resolve an additional dependency
* atom.
*/
void add(DepAtom::ConstPointer);
- /**
- * Start of our dependency list.
- */
+ ///\name Iterate over our dependency list entries.
+ ///\{
+
+ typedef libwrapiter::ForwardIterator<DepList, const DepListEntry> Iterator;
+
Iterator begin() const;
- /**
- * One past the end of our dependency list.
- */
Iterator end() const;
+ ///\}
+
+ ///\name Behaviour options
+ ///\{
+
/**
* Behaviour: determines when RDEPEND entries can be treated as PDEPEND.
*/
@@ -413,6 +410,8 @@ namespace paludis
* Behaviour: set whether we upgrade unnecessarily.
*/
void set_no_unnecessary_upgrades(const bool value);
+
+ ///\}
};
}
diff --git a/paludis/environment.cc b/paludis/environment.cc
index 1013144..03859ac 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -24,6 +24,8 @@
#include <paludis/util/save.hh>
#include <paludis/util/tokeniser.hh>
+#include <set>
+
/** \file
* Implementation of Environment.
*
diff --git a/paludis/environment.hh b/paludis/environment.hh
index a2ac1c3..95bf844 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -34,6 +34,11 @@
namespace paludis
{
+ struct EnvironmentMirrorIteratorTag;
+
+ typedef libwrapiter::ForwardIterator<EnvironmentMirrorIteratorTag,
+ const std::pair<const std::string, std::string> > EnvironmentMirrorIterator;
+
/**
* Represents the data for an Environment hook call.
*
@@ -192,7 +197,7 @@ namespace paludis
/**
* Iterator over named mirror entries.
*/
- typedef std::multimap<std::string, std::string>::const_iterator MirrorIterator;
+ typedef EnvironmentMirrorIterator MirrorIterator;
/**
* Iterator to the start of our mirrors.
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index ff74a65..bbaa8b7 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -22,6 +22,7 @@
#include <paludis/package_database.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/collection_concrete.hh>
#include <list>
#include <map>
@@ -121,7 +122,7 @@ QualifiedPackageName
PackageDatabase::fetch_unique_qualified_package_name(
const PackageNamePart & p) const
{
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection);
+ QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
IndirectIterator<std::list<Repository::ConstPointer>::const_iterator, const Repository>
r(_imp->repositories.begin()),
@@ -146,7 +147,7 @@ PackageDatabase::fetch_unique_qualified_package_name(
PackageDatabaseEntryCollection::Pointer
PackageDatabase::_do_query(const PackageDepAtom & a, const InstallState installed_state) const
{
- PackageDatabaseEntryCollection::Pointer result(new PackageDatabaseEntryCollection);
+ PackageDatabaseEntryCollection::Pointer result(new PackageDatabaseEntryCollection::Concrete);
IndirectIterator<std::list<Repository::ConstPointer>::const_iterator, const Repository>
r(_imp->repositories.begin()),
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 00faf84..76d269d 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -37,10 +37,11 @@
#include <paludis/package_database_entry.hh>
#include <paludis/contents.hh>
-#include <ostream>
+#include <iosfwd>
#include <algorithm>
#include <functional>
#include <iterator>
+#include <list>
/** \file
* Declarations for the PackageDatabase class and related utilities.
diff --git a/paludis/portage_dep_lexer.cc b/paludis/portage_dep_lexer.cc
index 4327498..da5a19a 100644
--- a/paludis/portage_dep_lexer.cc
+++ b/paludis/portage_dep_lexer.cc
@@ -22,6 +22,7 @@
#include <paludis/util/exception.hh>
#include <paludis/util/tokeniser.hh>
#include <vector>
+#include <list>
/** \file
* Implementation of dep_lexer.hh things.
@@ -31,6 +32,16 @@
using namespace paludis;
+namespace paludis
+{
+ template<>
+ struct Implementation<PortageDepLexer> :
+ InternalCounted<Implementation<PortageDepLexer> >
+ {
+ std::list<std::pair<PortageDepLexerLexeme, std::string> > tokens;
+ };
+}
+
DepStringLexError::DepStringLexError(const std::string & dep_string,
const std::string & message) throw () :
DepStringError(dep_string, "in lex phase: " + message)
@@ -42,7 +53,8 @@ DepStringError::DepStringError(const std::string & d, const std::string & m) thr
{
}
-PortageDepLexer::PortageDepLexer(const std::string & s)
+PortageDepLexer::PortageDepLexer(const std::string & s) :
+ PrivateImplementationPattern<PortageDepLexer>(new Implementation<PortageDepLexer>)
{
Context context("When lexing dependency string '" + s + "':");
@@ -57,23 +69,39 @@ PortageDepLexer::PortageDepLexer(const std::string & s)
continue;
if (*t == "||")
- _tokens.push_back(std::make_pair(dpl_double_bar, *t));
+ _imp->tokens.push_back(std::make_pair(dpl_double_bar, *t));
else if ('|' == (*t)[0])
throw DepStringLexError(s, "'|' should be followed by '|'");
else if (*t == "(")
- _tokens.push_back(std::make_pair(dpl_open_paren, *t));
+ _imp->tokens.push_back(std::make_pair(dpl_open_paren, *t));
else if ('(' == (*t)[0])
throw DepStringLexError(s, "'(' should be followed by whitespace");
else if (*t == ")")
- _tokens.push_back(std::make_pair(dpl_close_paren, *t));
+ _imp->tokens.push_back(std::make_pair(dpl_close_paren, *t));
else if (')' == (*t)[0])
throw DepStringLexError(s, "')' should be followed by whitespace");
else if (std::string::npos == t->find_first_not_of(" \t\n"))
- _tokens.push_back(std::make_pair(dpl_whitespace, *t));
+ _imp->tokens.push_back(std::make_pair(dpl_whitespace, *t));
else if ('?' == (*t)[t->length() - 1])
- _tokens.push_back(std::make_pair(dpl_use_flag, *t));
+ _imp->tokens.push_back(std::make_pair(dpl_use_flag, *t));
else
- _tokens.push_back(std::make_pair(dpl_text, *t));
+ _imp->tokens.push_back(std::make_pair(dpl_text, *t));
}
}
+PortageDepLexer::~PortageDepLexer()
+{
+}
+
+PortageDepLexer::Iterator
+PortageDepLexer::begin() const
+{
+ return Iterator(_imp->tokens.begin());
+}
+
+PortageDepLexer::Iterator
+PortageDepLexer::end() const
+{
+ return Iterator(_imp->tokens.end());
+}
+
diff --git a/paludis/portage_dep_lexer.hh b/paludis/portage_dep_lexer.hh
index 9c56425..8aa3c78 100644
--- a/paludis/portage_dep_lexer.hh
+++ b/paludis/portage_dep_lexer.hh
@@ -20,11 +20,13 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_PARSER_LEXER_HH
#define PALUDIS_GUARD_PALUDIS_DEP_PARSER_LEXER_HH 1
-#include <list>
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
#include <string>
+#include <libwrapiter/libwrapiter.hh>
+
/** \file
* Declarations for the PortageDepLexer class.
*
@@ -93,37 +95,29 @@ namespace paludis
* \ingroup grpdeplexer
*/
class PortageDepLexer :
- private InstantiationPolicy<PortageDepLexer, instantiation_method::NonCopyableTag>
+ private InstantiationPolicy<PortageDepLexer, instantiation_method::NonCopyableTag>,
+ private PrivateImplementationPattern<PortageDepLexer>
{
- private:
- std::list<std::pair<PortageDepLexerLexeme, std::string> > _tokens;
-
public:
- /**
- * Iterator for our tokens.
- */
- typedef std::list<std::pair<PortageDepLexerLexeme, std::string> >::const_iterator Iterator;
+ ///\name Iterate over our items
+ ///\{
- /**
- * Iterator to the start of our tokens.
- */
- Iterator begin() const
- {
- return _tokens.begin();
- }
+ typedef libwrapiter::ForwardIterator<PortageDepLexer,
+ const std::pair<PortageDepLexerLexeme, std::string> > Iterator;
- /**
- * Iterator to the end of our tokens.
- */
- Iterator end() const
- {
- return _tokens.end();
- }
+ Iterator begin() const;
+
+ Iterator end() const;
+
+ ///\}
+
+ ///\name Basic operations
+ ///\{
- /**
- * Constructor.
- */
PortageDepLexer(const std::string &);
+ ~PortageDepLexer();
+
+ ///\}
};
}
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index 4061407..78721be 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -21,6 +21,7 @@
#include <paludis/portage_dep_parser.hh>
#include <paludis/qa/dep_flags_check.hh>
#include <paludis/util/tokeniser.hh>
+#include <set>
using namespace paludis;
using namespace paludis::qa;
@@ -64,7 +65,7 @@ namespace
favourite_repository()));
if (! r->get_interface<repo_use>())
- throw InternalError("Confused: Repository does not have a UseInterface.");
+ throw InternalError(PALUDIS_HERE, "Confused: Repository does not have a UseInterface.");
if (r->get_interface<repo_use>()->is_arch_flag(u->flag()))
{
diff --git a/paludis/qa/dep_packages_check.cc b/paludis/qa/dep_packages_check.cc
index e5050c3..7fab3de 100644
--- a/paludis/qa/dep_packages_check.cc
+++ b/paludis/qa/dep_packages_check.cc
@@ -20,6 +20,7 @@
#include <paludis/dep_atom.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/qa/dep_packages_check.hh>
+#include <set>
using namespace paludis;
using namespace paludis::qa;
diff --git a/paludis/qa/environment.cc b/paludis/qa/environment.cc
index 338153f..e19ff8c 100644
--- a/paludis/qa/environment.cc
+++ b/paludis/qa/environment.cc
@@ -18,8 +18,9 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <map>
#include <paludis/qa/environment.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <map>
using namespace paludis;
using namespace paludis::qa;
@@ -27,7 +28,6 @@ using namespace paludis::qa;
QAEnvironment::QAEnvironment(const FSEntry & base) :
Environment(PackageDatabase::Pointer(new PackageDatabase(this)))
{
- MirrorIterator _mirrors;
std::map<std::string, std::string> keys;
keys.insert(std::make_pair(std::string("format"), std::string("portage")));
@@ -74,3 +74,27 @@ QAEnvironment::query_user_unmasks(const PackageDatabaseEntry &) const
{
return false;
}
+
+namespace
+{
+ static const std::multimap<std::string, std::string> qa_environment_mirrors;
+}
+
+QAEnvironment::MirrorIterator
+QAEnvironment::begin_mirrors(const std::string &) const
+{
+ return MirrorIterator(qa_environment_mirrors.begin());
+}
+
+QAEnvironment::MirrorIterator
+QAEnvironment::end_mirrors(const std::string &) const
+{
+ return MirrorIterator(qa_environment_mirrors.end());
+}
+
+UseFlagNameCollection::Pointer
+QAEnvironment::query_enabled_use_matching(const std::string &, const PackageDatabaseEntry *) const
+{
+ return UseFlagNameCollection::Pointer(new UseFlagNameCollection::Concrete);
+}
+
diff --git a/paludis/qa/environment.hh b/paludis/qa/environment.hh
index e00c046..f5fdbe9 100644
--- a/paludis/qa/environment.hh
+++ b/paludis/qa/environment.hh
@@ -46,9 +46,6 @@ namespace paludis
class QAEnvironment :
public Environment
{
- private:
- std::multimap<std::string, std::string> _mirrors;
-
public:
QAEnvironment(const FSEntry & base);
@@ -80,22 +77,13 @@ namespace paludis
}
virtual UseFlagNameCollection::Pointer query_enabled_use_matching(
- const std::string &, const PackageDatabaseEntry *) const
- {
- return UseFlagNameCollection::Pointer(new UseFlagNameCollection);
- }
+ const std::string &, const PackageDatabaseEntry *) const;
- virtual MirrorIterator begin_mirrors(const std::string & mirror) const
- {
- return _mirrors.end();
- }
+ virtual MirrorIterator begin_mirrors(const std::string & mirror) const;
- virtual MirrorIterator end_mirrors(const std::string & mirror) const
- {
- return _mirrors.end();
- }
+ virtual MirrorIterator end_mirrors(const std::string & mirror) const;
- virtual void perform_hook (const Hook & hook) const
+ virtual void perform_hook (const Hook &) const
{
}
};
diff --git a/paludis/qa/keywords_check.cc b/paludis/qa/keywords_check.cc
index 0d8c220..b089d18 100644
--- a/paludis/qa/keywords_check.cc
+++ b/paludis/qa/keywords_check.cc
@@ -19,6 +19,7 @@
#include <paludis/qa/keywords_check.hh>
#include <paludis/util/tokeniser.hh>
+#include <set>
using namespace paludis;
using namespace paludis::qa;
diff --git a/paludis/qa/pdepend_overlap_check.cc b/paludis/qa/pdepend_overlap_check.cc
index 34c00dd..efc0446 100644
--- a/paludis/qa/pdepend_overlap_check.cc
+++ b/paludis/qa/pdepend_overlap_check.cc
@@ -21,6 +21,7 @@
#include <paludis/portage_dep_parser.hh>
#include <paludis/qa/pdepend_overlap_check.hh>
#include <paludis/util/join.hh>
+#include <set>
using namespace paludis;
using namespace paludis::qa;
diff --git a/paludis/qa/src_uri_check.cc b/paludis/qa/src_uri_check.cc
index 356a1d7..3fdf4c0 100644
--- a/paludis/qa/src_uri_check.cc
+++ b/paludis/qa/src_uri_check.cc
@@ -21,6 +21,7 @@
#include <paludis/portage_dep_parser.hh>
#include <paludis/qa/src_uri_check.hh>
#include <paludis/util/tokeniser.hh>
+#include <set>
using namespace paludis;
using namespace paludis::qa;
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index b3040f4..8cf0d53 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -20,6 +20,7 @@
#include <map>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/collection_concrete.hh>
#include <paludis/version_metadata.hh>
#include <paludis/portage_dep_parser.hh>
@@ -63,7 +64,7 @@ namespace paludis
};
Implementation<FakeRepository>::Implementation() :
- category_names(new CategoryNamePartCollection)
+ category_names(new CategoryNamePartCollection::Concrete)
{
}
}
@@ -85,8 +86,8 @@ FakeRepository::FakeRepository(const RepositoryName & name) :
Repository::UseInterface(),
PrivateImplementationPattern<FakeRepository>(new Implementation<FakeRepository>)
{
- RepositoryInfoSection config_info("Configuration information");
- config_info.add_kv("format", "fake");
+ RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ config_info->add_kv("format", "fake");
_info->add_section(config_info);
}
@@ -120,7 +121,7 @@ FakeRepository::do_package_names(const CategoryNamePart & c) const
{
if (! has_category_named(c))
throw InternalError(PALUDIS_HERE, "no category named " + stringify(c));
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection);
+ QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
PackageNamePartCollection::Iterator p(_imp->package_names.find(c)->second->begin()),
p_end(_imp->package_names.find(c)->second->end());
for ( ; p != p_end ; ++p)
@@ -153,7 +154,7 @@ void
FakeRepository::add_category(const CategoryNamePart & c)
{
_imp->category_names->insert(c);
- _imp->package_names.insert(std::make_pair(c, new PackageNamePartCollection));
+ _imp->package_names.insert(std::make_pair(c, new PackageNamePartCollection::Concrete));
}
void
@@ -161,7 +162,7 @@ FakeRepository::add_package(const QualifiedPackageName & q)
{
add_category(q.get<qpn_category>());
_imp->package_names.find(q.get<qpn_category>())->second->insert(q.get<qpn_package>());
- _imp->versions.insert(std::make_pair(q, new VersionSpecCollection));
+ _imp->versions.insert(std::make_pair(q, new VersionSpecCollection::Concrete));
}
VersionMetadata::Pointer
diff --git a/paludis/repositories/nothing/nothing_repository.cc b/paludis/repositories/nothing/nothing_repository.cc
index 080988c..a1ec4e5 100644
--- a/paludis/repositories/nothing/nothing_repository.cc
+++ b/paludis/repositories/nothing/nothing_repository.cc
@@ -20,6 +20,7 @@
#include "config.h"
#include <paludis/repositories/nothing/nothing_repository.hh>
+#include <paludis/util/collection_concrete.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/syncer.hh>
#include <paludis/util/dir_iterator.hh>
@@ -98,10 +99,10 @@ NothingRepository::NothingRepository(const NothingRepositoryParams & p) try :
))),
PrivateImplementationPattern<NothingRepository>(new Implementation<NothingRepository>(p))
{
- RepositoryInfoSection config_info("Configuration information");
- config_info.add_kv("sync", _imp->sync);
- config_info.add_kv("sync_exclude", _imp->sync_exclude);
- config_info.add_kv("location", stringify(_imp->location));
+ RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
+ config_info->add_kv("sync", _imp->sync);
+ config_info->add_kv("sync_exclude", _imp->sync_exclude);
+ config_info->add_kv("location", stringify(_imp->location));
_info->add_section(config_info);
}
@@ -130,21 +131,21 @@ NothingRepository::do_has_package_named(const QualifiedPackageName &) const
CategoryNamePartCollection::ConstPointer
NothingRepository::do_category_names() const
{
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection);
+ CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
return result;
}
QualifiedPackageNameCollection::ConstPointer
NothingRepository::do_package_names(const CategoryNamePart &) const
{
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection);
+ QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
return result;
}
VersionSpecCollection::ConstPointer
NothingRepository::do_version_specs(const QualifiedPackageName &) const
{
- return VersionSpecCollection::Pointer(new VersionSpecCollection);
+ return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
}
bool
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index a235b35..5d4997c 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -32,6 +32,7 @@
#include <paludis/portage_dep_parser.hh>
#include <paludis/repositories/portage/portage_repository.hh>
#include <paludis/syncer.hh>
+#include <paludis/util/collection_concrete.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/is_file_with_extension.hh>
@@ -569,23 +570,23 @@ 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 config_info("Configuration information");
+ RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
- config_info.add_kv("location", stringify(_imp->location));
- config_info.add_kv("profiles", join(_imp->profiles->begin(),
+ config_info->add_kv("location", stringify(_imp->location));
+ config_info->add_kv("profiles", join(_imp->profiles->begin(),
_imp->profiles->end(), " "));
- config_info.add_kv("eclassdirs", join(_imp->eclassdirs->begin(),
+ config_info->add_kv("eclassdirs", join(_imp->eclassdirs->begin(),
_imp->eclassdirs->end(), " "));
- config_info.add_kv("cache", stringify(_imp->cache));
- config_info.add_kv("distdir", stringify(_imp->distdir));
- config_info.add_kv("securitydir", stringify(_imp->securitydir));
- config_info.add_kv("setsdir", stringify(_imp->setsdir));
- config_info.add_kv("newsdir", stringify(_imp->newsdir));
- config_info.add_kv("format", "portage");
- config_info.add_kv("root", stringify(_imp->root));
- config_info.add_kv("buildroot", stringify(_imp->buildroot));
- config_info.add_kv("sync", _imp->sync);
- config_info.add_kv("sync_exclude", _imp->sync_exclude);
+ config_info->add_kv("cache", stringify(_imp->cache));
+ config_info->add_kv("distdir", stringify(_imp->distdir));
+ config_info->add_kv("securitydir", stringify(_imp->securitydir));
+ config_info->add_kv("setsdir", stringify(_imp->setsdir));
+ config_info->add_kv("newsdir", stringify(_imp->newsdir));
+ config_info->add_kv("format", "portage");
+ config_info->add_kv("root", stringify(_imp->root));
+ config_info->add_kv("buildroot", stringify(_imp->buildroot));
+ config_info->add_kv("sync", _imp->sync);
+ config_info->add_kv("sync_exclude", _imp->sync_exclude);
_info->add_section(config_info);
}
@@ -674,7 +675,7 @@ PortageRepository::do_category_names() const
need_category_names();
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection);
+ CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
CategoryMap::const_iterator i(_imp->category_names.begin()),
i_end(_imp->category_names.end());
for ( ; i != i_end ; ++i)
@@ -697,7 +698,7 @@ PortageRepository::do_package_names(const CategoryNamePart & c) const
need_virtual_names();
if (_imp->category_names.end() == _imp->category_names.find(c))
- return QualifiedPackageNameCollection::Pointer(new QualifiedPackageNameCollection);
+ return QualifiedPackageNameCollection::Pointer(new QualifiedPackageNameCollection::Concrete);
if ((_imp->location / stringify(c)).is_directory())
for (DirIterator d(_imp->location / stringify(c)), d_end ; d != d_end ; ++d)
@@ -722,11 +723,11 @@ PortageRepository::do_package_names(const CategoryNamePart & c) const
_imp->category_names[c] = true;
- QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection);
+ QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
std::copy(_imp->package_names.begin(), _imp->package_names.end(),
transform_inserter(filter_inserter(result->inserter(), CategoryFilter(c)),
- SelectFirst<QualifiedPackageName, bool>()));
+ SelectFirst<const QualifiedPackageName, bool>()));
return result;
}
@@ -743,7 +744,7 @@ PortageRepository::do_version_specs(const QualifiedPackageName & n) const
return _imp->version_specs.find(n)->second;
}
else
- return VersionSpecCollection::Pointer(new VersionSpecCollection);
+ return VersionSpecCollection::Pointer(new VersionSpecCollection::Concrete);
}
bool
@@ -792,7 +793,7 @@ PortageRepository::need_version_names(const QualifiedPackageName & n) const
Context context("When loading versions for '" + stringify(n) + "' in "
+ stringify(name()) + ":");
- VersionSpecCollection::Pointer v(new VersionSpecCollection);
+ VersionSpecCollection::Pointer v(new VersionSpecCollection::Concrete);
FSEntry path(_imp->location / stringify(n.get<qpn_category>()) /
stringify(n.get<qpn_package>()));
@@ -1190,7 +1191,7 @@ PortageRepository::make_portage_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);
+ FSEntryCollection::Pointer 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)));
@@ -1207,7 +1208,7 @@ PortageRepository::make_portage_repository(
if (profiles->empty())
throw PortageRepositoryConfigurationError("No profiles have been specified");
- FSEntryCollection::Pointer eclassdirs(new FSEntryCollection);
+ FSEntryCollection::Pointer 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)));
@@ -1845,7 +1846,7 @@ PortageRepository::do_security_set(const PackageSetOptions & o) const
f_end(advisories.end());
std::set<std::pair<PackageDatabaseEntry, std::string> > affected;
- PackageDatabaseEntryCollection unaffected;
+ PackageDatabaseEntryCollection::Concrete unaffected;
std::map<std::string, std::string> advisory_map;
for ( ; f != f_end; ++f)
@@ -1874,9 +1875,12 @@ PortageRepository::do_security_set(const PackageSetOptions & o) const
bool is_range(2 == atoms.size());
- PackageDatabaseEntryCollection::ConstPointer affected_collection1(_imp->db->query(*atoms.at(0), affected_state));
- PackageDatabaseEntryCollection::ConstPointer affected_collection2(new PackageDatabaseEntryCollection);
- PackageDatabaseEntryCollection::Iterator p(affected_collection1->begin()), p_end(affected_collection1->end());
+ PackageDatabaseEntryCollection::ConstPointer affected_collection1(
+ _imp->db->query(*atoms.at(0), affected_state));
+ PackageDatabaseEntryCollection::ConstPointer affected_collection2(
+ new PackageDatabaseEntryCollection::Concrete);
+ PackageDatabaseEntryCollection::Iterator p(affected_collection1->begin()),
+ p_end(affected_collection1->end());
if (is_range)
affected_collection2 = _imp->db->query(*atoms.at(1), affected_state);
@@ -1905,9 +1909,12 @@ PortageRepository::do_security_set(const PackageSetOptions & o) const
bool is_range(2 == atoms.size());
- PackageDatabaseEntryCollection::ConstPointer unaffected_collection1(_imp->db->query(*atoms.at(0), is_either));
- PackageDatabaseEntryCollection::ConstPointer unaffected_collection2(new PackageDatabaseEntryCollection);
- PackageDatabaseEntryCollection::Iterator p(unaffected_collection1->begin()), p_end(unaffected_collection1->end());
+ PackageDatabaseEntryCollection::ConstPointer unaffected_collection1(_imp->db->query(
+ *atoms.at(0), is_either));
+ PackageDatabaseEntryCollection::ConstPointer unaffected_collection2(
+ new PackageDatabaseEntryCollection::Concrete);
+ PackageDatabaseEntryCollection::Iterator p(unaffected_collection1->begin()),
+ p_end(unaffected_collection1->end());
if (is_range)
unaffected_collection2 = _imp->db->query(*atoms.at(1), is_either);
@@ -2246,14 +2253,14 @@ PortageRepository::info(bool verbose) const
if (! info_pkgs.empty())
{
- RepositoryInfoSection package_info("Package information");
+ RepositoryInfoSection::Pointer 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(_imp->env->package_database()->query(
PackageDepAtom::ConstPointer(new PackageDepAtom(*i)), is_installed_only));
if (q->empty())
- package_info.add_kv(*i, "(none)");
+ package_info->add_kv(*i, "(none)");
else
{
std::set<VersionSpec> versions;
@@ -2264,7 +2271,7 @@ PortageRepository::info(bool verbose) const
for (PackageDatabaseEntryCollection::Iterator qq(q->begin()), qq_end(q->end()) ;
qq != qq_end ; ++qq)
versions.insert(qq->get<pde_version>());
- package_info.add_kv(*i, join(versions.begin(), versions.end(), ", "));
+ package_info->add_kv(*i, join(versions.begin(), versions.end(), ", "));
}
}
@@ -2284,10 +2291,10 @@ PortageRepository::info(bool verbose) const
PackageDatabaseEntry e(QualifiedPackageName(*info_pkgs.begin()),
*version_specs(QualifiedPackageName(*info_pkgs.begin()))->last(),
name());
- RepositoryInfoSection variable_info("Variable information");
+ RepositoryInfoSection::Pointer 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));
+ variable_info->add_kv(*i, get_environment_variable(e, *i));
result->add_section(variable_info);
}
diff --git a/paludis/repositories/vdb/vdb_repository.cc b/paludis/repositories/vdb/vdb_repository.cc
index 2e4a383..79c67ad 100644
--- a/paludis/repositories/vdb/vdb_repository.cc
+++ b/paludis/repositories/vdb/vdb_repository.cc
@@ -27,14 +27,16 @@
#include <paludis/config_file.hh>
#include <paludis/match_package.hh>
#include <paludis/package_database.hh>
-#include <paludis/util/iterator.hh>
+
+#include <paludis/util/collection_concrete.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/fs_entry.hh>
-#include <paludis/util/system.hh>
+#include <paludis/util/iterator.hh>
#include <paludis/util/log.hh>
#include <paludis/util/pstream.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/system.hh>
#include <paludis/util/tokeniser.hh>
#include <fstream>
@@ -403,13 +405,13 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
))),
PrivateImplementationPattern<VDBRepository>(new Implementation<VDBRepository>(p))
{
- RepositoryInfoSection config_info("Configuration information");
+ RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
- config_info.add_kv("location", stringify(_imp->location));
- config_info.add_kv("root", stringify(_imp->root));
- config_info.add_kv("format", "vdb");
- config_info.add_kv("world", stringify(_imp->world_file));
- config_info.add_kv("buildroot", stringify(_imp->buildroot));
+ config_info->add_kv("location", stringify(_imp->location));
+ config_info->add_kv("root", stringify(_imp->root));
+ config_info->add_kv("format", "vdb");
+ config_info->add_kv("world", stringify(_imp->world_file));
+ config_info->add_kv("buildroot", stringify(_imp->buildroot));
_info->add_section(config_info);
}
@@ -456,7 +458,7 @@ VDBRepository::do_category_names() const
if (! _imp->entries_valid)
_imp->load_entries();
- CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection);
+ CategoryNamePartCollection::Pointer result(new CategoryNamePartCollection::Concrete);
for (std::vector<VDBEntry>::const_iterator c(_imp->entries.begin()), c_end(_imp->entries.end()) ;
c != c_end ; ++c)
@@ -475,7 +477,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);
+ QualifiedPackageNameCollection::Pointer 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,
@@ -493,7 +495,7 @@ VDBRepository::do_version_specs(const QualifiedPackageName & n) const
Context context("When fetching versions of '" + stringify(n) + "' in "
+ stringify(name()) + ":");
- VersionSpecCollection::Pointer result(new VersionSpecCollection);
+ VersionSpecCollection::Pointer 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,
@@ -772,7 +774,7 @@ VDBRepository::do_uninstall(const QualifiedPackageName & q, const VersionSpec &
PackageDatabaseEntry e(q, v, name());
- FSEntryCollection::Pointer eclassdirs(new FSEntryCollection);
+ FSEntryCollection::Pointer eclassdirs(new FSEntryCollection::Concrete);
eclassdirs->append(FSEntry(_imp->location / stringify(q.get<qpn_category>()) /
(stringify(q.get<qpn_package>()) + "-" + stringify(v))));
diff --git a/paludis/repository.cc b/paludis/repository.cc
index abd8e66..bf46202 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -18,6 +18,8 @@
*/
#include <paludis/repository.hh>
+#include <map>
+#include <list>
#include <ctype.h>
/** \file
@@ -77,22 +79,63 @@ PackageUninstallActionError::PackageUninstallActionError(const std::string & msg
{
}
+namespace paludis
+{
+ template<>
+ struct Implementation<RepositoryInfoSection> :
+ InternalCounted<Implementation<RepositoryInfoSection> >
+ {
+ std::string heading;
+ std::map<std::string, std::string> kvs;
+ };
+
+ template<>
+ struct Implementation<RepositoryInfo> :
+ InternalCounted<Implementation<RepositoryInfo> >
+ {
+ std::list<RepositoryInfoSection::ConstPointer> sections;
+ };
+}
+
RepositoryInfo &
-RepositoryInfo::add_section(const RepositoryInfoSection & s)
+RepositoryInfo::add_section(RepositoryInfoSection::ConstPointer s)
{
- _sections.push_back(s);
+ _imp->sections.push_back(s);
return *this;
}
RepositoryInfoSection::RepositoryInfoSection(const std::string & heading) :
- _heading(heading)
+ PrivateImplementationPattern<RepositoryInfoSection>(new Implementation<RepositoryInfoSection>)
+{
+ _imp->heading = heading;
+}
+
+RepositoryInfoSection::~RepositoryInfoSection()
+{
+}
+
+std::string
+RepositoryInfoSection::heading() const
{
+ return _imp->heading;
+}
+
+RepositoryInfoSection::KeyValueIterator
+RepositoryInfoSection::begin_kvs() const
+{
+ return KeyValueIterator(_imp->kvs.begin());
+}
+
+RepositoryInfoSection::KeyValueIterator
+RepositoryInfoSection::end_kvs() const
+{
+ return KeyValueIterator(_imp->kvs.end());
}
RepositoryInfoSection &
RepositoryInfoSection::add_kv(const std::string & k, const std::string & v)
{
- _kvs.insert(std::make_pair(k, v));
+ _imp->kvs.insert(std::make_pair(k, v));
return *this;
}
@@ -102,6 +145,27 @@ Repository::info(bool) const
return _info;
}
+RepositoryInfo::RepositoryInfo() :
+ PrivateImplementationPattern<RepositoryInfo>(new Implementation<RepositoryInfo>)
+{
+}
+
+RepositoryInfo::~RepositoryInfo()
+{
+}
+
+RepositoryInfo::SectionIterator
+RepositoryInfo::begin_sections() const
+{
+ return SectionIterator(_imp->sections.begin());
+}
+
+RepositoryInfo::SectionIterator
+RepositoryInfo::end_sections() const
+{
+ return SectionIterator(_imp->sections.end());
+}
+
UseFlagName
Repository::UseInterface::expand_flag_name(const UseFlagName & u) const
{
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 48ccfb5..32bf972 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -31,8 +31,10 @@
#include <paludis/package_database_entry.hh>
#include <paludis/contents.hh>
-#include <map>
#include <string>
+#include <map>
+
+#include <libwrapiter/libwrapiter.hh>
/** \file
* Declarations for the Repository class.
@@ -134,36 +136,34 @@ namespace paludis
* \see RepositoryInfo
* \ingroup grprepository
*/
- class RepositoryInfoSection
+ class RepositoryInfoSection :
+ public InternalCounted<RepositoryInfoSection>,
+ private PrivateImplementationPattern<RepositoryInfoSection>
{
- private:
- std::string _heading;
- std::map<std::string, std::string> _kvs;
-
public:
- /// Constructor.
+ ///\name Basic operations
+ ///\{
+
RepositoryInfoSection(const std::string & heading);
+ ~RepositoryInfoSection();
+
+ ///\}
+
/// Our heading.
- std::string heading() const
- {
- return _heading;
- }
+ std::string heading() const;
- /// Iterate over our key/values.
- typedef std::map<std::string, std::string>::const_iterator KeyValueIterator;
+ ///\name Iterate over our key/values
+ ///\{
- /// Start of our key/values.
- KeyValueIterator begin_kvs() const
- {
- return _kvs.begin();
- }
+ typedef libwrapiter::ForwardIterator<RepositoryInfoSection,
+ const std::pair<const std::string, std::string> > KeyValueIterator;
- /// End of our key/values.
- KeyValueIterator end_kvs() const
- {
- return _kvs.end();
- }
+ KeyValueIterator begin_kvs() const;
+
+ KeyValueIterator end_kvs() const;
+
+ ///\}
/// Add a key/value pair.
RepositoryInfoSection & add_kv(const std::string &, const std::string &);
@@ -175,29 +175,32 @@ namespace paludis
* \ingroup grprepository
*/
class RepositoryInfo :
- public InternalCounted<RepositoryInfo>
+ public InternalCounted<RepositoryInfo>,
+ private PrivateImplementationPattern<RepositoryInfo>
{
- private:
- std::list<RepositoryInfoSection> _sections;
-
public:
- /// Iterator over our sections.
- typedef std::list<RepositoryInfoSection>::const_iterator SectionIterator;
+ ///\name Basic operations
+ ///\{
- /// Start of our sections.
- SectionIterator begin_sections() const
- {
- return _sections.begin();
- }
+ RepositoryInfo();
+ ~RepositoryInfo();
- /// End of our sections.
- SectionIterator end_sections() const
- {
- return _sections.end();
- }
+ ///\}
+
+ ///\name Iterator over our sections
+ ///\{
+
+ typedef libwrapiter::ForwardIterator<RepositoryInfo,
+ const RepositoryInfoSection::ConstPointer> SectionIterator;
+
+ SectionIterator begin_sections() const;
+
+ SectionIterator end_sections() const;
+
+ ///\}
/// Add a section.
- RepositoryInfo & add_section(const RepositoryInfoSection &);
+ RepositoryInfo & add_section(RepositoryInfoSection::ConstPointer);
};
/**
diff --git a/paludis/test_environment.cc b/paludis/test_environment.cc
index 402af9b..c0a1b16 100644
--- a/paludis/test_environment.cc
+++ b/paludis/test_environment.cc
@@ -18,6 +18,9 @@
*/
#include <paludis/test_environment.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <map>
+#include <string>
/** \file
* Implementation of TestEnvironment.
@@ -62,3 +65,26 @@ TestEnvironment::query_user_unmasks(const PackageDatabaseEntry &) const
return false;
}
+namespace
+{
+ static const std::multimap<std::string, std::string> test_environment_mirrors;
+}
+
+TestEnvironment::MirrorIterator
+TestEnvironment::begin_mirrors(const std::string &) const
+{
+ return MirrorIterator(test_environment_mirrors.begin());
+}
+
+TestEnvironment::MirrorIterator
+TestEnvironment::end_mirrors(const std::string &) const
+{
+ return MirrorIterator(test_environment_mirrors.end());
+}
+
+UseFlagNameCollection::Pointer
+TestEnvironment::query_enabled_use_matching(const std::string &, const PackageDatabaseEntry *) const
+{
+ return UseFlagNameCollection::Pointer(new UseFlagNameCollection::Concrete);
+}
+
diff --git a/paludis/test_environment.hh b/paludis/test_environment.hh
index 1051fb5..9f66d82 100644
--- a/paludis/test_environment.hh
+++ b/paludis/test_environment.hh
@@ -40,9 +40,6 @@ namespace paludis
*/
class TestEnvironment : public Environment
{
- private:
- std::multimap<std::string, std::string> _mirrors;
-
public:
/**
* Constructor.
@@ -75,24 +72,15 @@ namespace paludis
}
virtual UseFlagNameCollection::Pointer query_enabled_use_matching(
- const std::string &, const PackageDatabaseEntry *) const
- {
- return UseFlagNameCollection::Pointer(new UseFlagNameCollection);
- }
+ const std::string &, const PackageDatabaseEntry *) const;
virtual void perform_hook(const Hook &) const
{
}
- virtual MirrorIterator begin_mirrors(const std::string &) const
- {
- return _mirrors.end();
- }
+ virtual MirrorIterator begin_mirrors(const std::string &) const;
- virtual MirrorIterator end_mirrors(const std::string &) const
- {
- return _mirrors.end();
- }
+ virtual MirrorIterator end_mirrors(const std::string &) const;
};
}
diff --git a/paludis/util/collection.hh b/paludis/util/collection.hh
index 45ab70e..84a05b3 100644
--- a/paludis/util/collection.hh
+++ b/paludis/util/collection.hh
@@ -20,12 +20,10 @@
#ifndef PALUDIS_GUARD_PALUDIS_SEQUENTIAL_COLLECTION_HH
#define PALUDIS_GUARD_PALUDIS_SEQUENTIAL_COLLECTION_HH 1
-#include <algorithm>
-#include <list>
-#include <set>
-#include <iterator>
#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <iterator>
+#include <libwrapiter/libwrapiter.hh>
/** \file
* Various wrappers around collections of items, for convenience and
@@ -40,6 +38,9 @@ namespace paludis
* Wrapper around a std::list of a particular item. Multiple items
* with the same value are disallowed.
*
+ * This item cannot be constructed. Use SequentialCollection::Concrete,
+ * which requires including paludis/util/collection_concrete.hh .
+ *
* \ingroup grpcollections
*/
template <typename T_>
@@ -47,12 +48,21 @@ namespace paludis
private InstantiationPolicy<SequentialCollection<T_>, instantiation_method::NonCopyableTag>,
public InternalCounted<SequentialCollection<T_> >,
public std::iterator<typename std::iterator_traits<
- typename std::list<T_>::const_iterator>::iterator_category, T_>
+ typename libwrapiter::ForwardIterator<SequentialCollection<T_>, const T_> >::iterator_category, T_>
{
- private:
- std::list<T_> _items;
+ protected:
+ ///\name Basic operations
+ ///\{
+
+ SequentialCollection()
+ {
+ }
+
+ ///\}
public:
+ class Concrete;
+
/**
* Issue with g++ 3.4.6: const_reference isn't defined via our std::iterator
* inherit, but it is needed by many standard algorithms.
@@ -62,16 +72,6 @@ namespace paludis
///\name Basic operations
///\{
- /**
- * Constructor.
- */
- SequentialCollection()
- {
- }
-
- /**
- * Destructor.
- */
virtual ~SequentialCollection()
{
}
@@ -81,22 +81,13 @@ namespace paludis
///\name Iterate over our items
///\{
- typedef typename std::list<T_>::const_iterator Iterator;
+ typedef libwrapiter::ForwardIterator<SequentialCollection<T_>, const T_> Iterator;
- Iterator begin() const
- {
- return _items.begin();
- }
+ virtual Iterator begin() const = 0;
- Iterator end() const
- {
- return _items.end();
- }
+ virtual Iterator end() const = 0;
- Iterator last() const
- {
- return _items.begin() == _items.end() ? _items.end() : --(_items.end());
- }
+ virtual Iterator last() const = 0;
///\}
@@ -106,10 +97,7 @@ namespace paludis
/**
* Return an Iterator to an item, or end() if there's no match.
*/
- Iterator find(const T_ & v) const
- {
- return std::find(_items.begin(), _items.end(), v);
- }
+ virtual Iterator find(const T_ & v) const = 0;
///\}
@@ -119,23 +107,12 @@ namespace paludis
/**
* Append an item, return whether we succeeded.
*/
- bool append(T_ v)
- {
- if (end() != find(v))
- return false;
-
- _items.push_back(v);
- return true;
- }
+ virtual bool append(T_ v) = 0;
/**
* Append an item.
*/
- void push_back(const T_ & v)
- {
- if (end() == find(v))
- _items.push_back(v);
- }
+ virtual void push_back(const T_ & v) = 0;
///\}
@@ -145,17 +122,16 @@ namespace paludis
/**
* Are we empty?
*/
- bool empty() const
- {
- return _items.empty();
- }
+ virtual bool empty() const = 0;
///\}
};
/**
- * Wrapper around a std::set of a particular item. May be changed at some
- * point to support template find.
+ * Wrapper around a std::set of a particular item.
+ *
+ * This item cannot be constructed. Use SortedCollection::Concrete,
+ * which requires including paludis/util/collection_concrete.hh .
*
* \ingroup grpcollections
*/
@@ -164,12 +140,9 @@ namespace paludis
private InstantiationPolicy<SortedCollection<T_>, instantiation_method::NonCopyableTag>,
public InternalCounted<SortedCollection<T_> >,
public std::iterator<typename std::iterator_traits<
- typename std::set<T_>::const_iterator>::iterator_category, T_>
+ typename libwrapiter::ForwardIterator<SequentialCollection<T_>, const T_> >::iterator_category, T_>
{
- private:
- std::set<T_> _items;
-
- public:
+ protected:
///\name Basic operations
///\{
@@ -177,6 +150,14 @@ namespace paludis
{
}
+ ///\}
+
+ public:
+ class Concrete;
+
+ ///\name Basic operations
+ ///\{
+
virtual ~SortedCollection()
{
}
@@ -186,47 +167,27 @@ namespace paludis
///\name Iterate over our items
///\{
- typedef typename std::set<T_>::const_iterator Iterator;
+ typedef libwrapiter::ForwardIterator<SortedCollection<T_>, const T_> Iterator;
- Iterator begin() const
- {
- return _items.begin();
- }
+ virtual Iterator begin() const = 0;
- Iterator end() const
- {
- return _items.end();
- }
+ virtual Iterator end() const = 0;
- typedef typename std::set<T_>::const_reverse_iterator ReverseIterator;
+ struct ReverseTag;
+ typedef libwrapiter::ForwardIterator<ReverseTag, const T_> ReverseIterator;
- ReverseIterator rbegin() const
- {
- return _items.rbegin();
- }
+ virtual ReverseIterator rbegin() const = 0;
- ReverseIterator rend() const
- {
- return _items.rend();
- }
+ virtual ReverseIterator rend() const = 0;
- Iterator last() const
- {
- Iterator result(_items.end());
- if (result != _items.begin())
- --result;
- return result;
- }
+ virtual Iterator last() const = 0;
///\}
///\name Finding items
///\{
- Iterator find(const T_ & v) const
- {
- return _items.find(v);
- }
+ virtual Iterator find(const T_ & v) const = 0;
///\}
@@ -236,43 +197,27 @@ namespace paludis
/**
* Insert an item, return whether we succeeded.
*/
- bool insert(const T_ & v)
- {
- return _items.insert(v).second;
- }
+ virtual bool insert(const T_ & v) = 0;
/**
* Erase an item, return whether we succeeded.
*/
- bool erase(const T_ & v)
- {
- return 0 != _items.erase(v);
- }
+ virtual bool erase(const T_ & v) = 0;
/**
* Insert all items from another container.
*/
- bool merge(typename SortedCollection<T_>::ConstPointer o)
- {
- bool result(true);
- Iterator o_begin(o->begin()), o_end(o->end());
- for ( ; o_begin != o_end ; ++o_begin)
- result &= insert(*o_begin);
- return result;
- }
+ virtual bool merge(typename SortedCollection<T_>::ConstPointer o) = 0;
/**
* Our insert iterator type.
*/
- typedef typename std::insert_iterator<std::set<T_> > Inserter;
+ typedef libwrapiter::OutputIterator<SortedCollection<T_>, T_> Inserter;
/**
* Fetch an inserter.
*/
- Inserter inserter()
- {
- return std::inserter(_items, _items.begin());
- }
+ virtual Inserter inserter() = 0;
///\}
@@ -282,18 +227,12 @@ namespace paludis
/**
* Are we empty?
*/
- bool empty() const
- {
- return _items.empty();
- }
+ virtual bool empty() const = 0;
/**
* How big are we?
*/
- unsigned size() const
- {
- return _items.size();
- }
+ virtual unsigned size() const = 0;
///\}
};
diff --git a/paludis/util/collection_concrete.hh b/paludis/util/collection_concrete.hh
new file mode 100644
index 0000000..f3370d2
--- /dev/null
+++ b/paludis/util/collection_concrete.hh
@@ -0,0 +1,204 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_COLLECTION_CONCRETE_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_COLLECTION_CONCRETE_HH 1
+
+#include <paludis/util/collection.hh>
+#include <list>
+#include <set>
+#include <algorithm>
+
+/** \file
+ * Concrete implementations for the collection classes.
+ *
+ * Do not include this file in other headers if possible. It pulls in big
+ * STL things, slowing down compilation.
+ *
+ * \ingroup grpcollections
+ */
+
+namespace paludis
+{
+ /**
+ * Concrete implementation for a SequentialCollection.
+ *
+ * \see SequentialCollection
+ * \ingroup grpcollections
+ */
+ template <typename T_>
+ class SequentialCollection<T_>::Concrete :
+ public SequentialCollection<T_>
+ {
+ private:
+ std::list<T_> _items;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ Concrete() :
+ SequentialCollection()
+ {
+ }
+
+ virtual ~Concrete()
+ {
+ }
+
+ ///\}
+
+ virtual Iterator begin() const
+ {
+ return Iterator(_items.begin());
+ }
+
+ virtual Iterator end() const
+ {
+ return Iterator(_items.end());
+ }
+
+ virtual Iterator last() const
+ {
+ return Iterator(_items.begin() == _items.end() ? _items.end() : --(_items.end()));
+ }
+
+ virtual Iterator find(const T_ & v) const
+ {
+ return Iterator(std::find(_items.begin(), _items.end(), v));
+ }
+
+ virtual bool append(T_ v)
+ {
+ if (end() != find(v))
+ return false;
+
+ _items.push_back(v);
+ return true;
+ }
+
+ void push_back(const T_ & v)
+ {
+ if (end() == find(v))
+ _items.push_back(v);
+ }
+
+ virtual bool empty() const
+ {
+ return _items.empty();
+ }
+ };
+
+ /**
+ * Concrete implementation for a SortedCollection.
+ *
+ * \see SortedCollection
+ * \ingroup grpcollections
+ */
+ template <typename T_>
+ class SortedCollection<T_>::Concrete :
+ public SortedCollection<T_>
+ {
+ private:
+ std::set<T_> _items;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ Concrete()
+ {
+ }
+
+ virtual ~Concrete()
+ {
+ }
+
+ ///\}
+
+ virtual Iterator begin() const
+ {
+ return Iterator(_items.begin());
+ }
+
+ virtual Iterator end() const
+ {
+ return Iterator(_items.end());
+ }
+
+ virtual ReverseIterator rbegin() const
+ {
+ return ReverseIterator(_items.rbegin());
+ }
+
+ virtual ReverseIterator rend() const
+ {
+ return ReverseIterator(_items.rend());
+ }
+
+ virtual Iterator last() const
+ {
+ typename std::set<T_>::const_iterator result(_items.end());
+ if (result != _items.begin())
+ --result;
+ return Iterator(result);
+ }
+
+ virtual Iterator find(const T_ & v) const
+ {
+ return Iterator(_items.find(v));
+ }
+
+ virtual bool insert(const T_ & v)
+ {
+ return _items.insert(v).second;
+ }
+
+ virtual bool erase(const T_ & v)
+ {
+ return 0 != _items.erase(v);
+ }
+
+ virtual bool merge(typename SortedCollection<T_>::ConstPointer o)
+ {
+ bool result(true);
+ Iterator o_begin(o->begin()), o_end(o->end());
+ for ( ; o_begin != o_end ; ++o_begin)
+ result &= insert(*o_begin);
+ return result;
+ }
+
+ virtual Inserter inserter()
+ {
+ return Inserter(std::inserter(_items, _items.begin()));
+ }
+
+ virtual bool empty() const
+ {
+ return _items.empty();
+ }
+
+ virtual unsigned size() const
+ {
+ return _items.size();
+ }
+ };
+}
+
+#endif
diff --git a/paludis/util/dir_iterator.cc b/paludis/util/dir_iterator.cc
index 5d95c63..e769334 100644
--- a/paludis/util/dir_iterator.cc
+++ b/paludis/util/dir_iterator.cc
@@ -22,6 +22,7 @@
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/stringify.hh>
#include <sys/types.h>
+#include <set>
/** \file
* Implementation of paludis::DirIterator.
diff --git a/paludis/util/dir_iterator.hh b/paludis/util/dir_iterator.hh
index 7865e55..4ffa212 100644
--- a/paludis/util/dir_iterator.hh
+++ b/paludis/util/dir_iterator.hh
@@ -24,7 +24,6 @@
#include <paludis/util/counted_ptr.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <set>
/** \file
* Declarations for paludis::DirIterator.
diff --git a/paludis/util/exception.cc b/paludis/util/exception.cc
index 07d787e..68fcaa6 100644
--- a/paludis/util/exception.cc
+++ b/paludis/util/exception.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/util/exception.hh>
+#include <libebt/libebt.hh>
/** \file
* Exception class implementations.
@@ -27,13 +28,58 @@
using namespace paludis;
+namespace
+{
+ struct ContextTag;
+}
+
+struct Context::ContextData
+{
+ libebt::BacktraceContext<ContextTag> context;
+
+ ContextData(const std::string & s) :
+ context(s)
+ {
+ }
+};
+
+Context::Context(const std::string & s) :
+ _context_data(new ContextData(s))
+{
+}
+
+Context::~Context()
+{
+ delete _context_data;
+}
+
+std::string
+Context::backtrace(const std::string & delim)
+{
+ return libebt::BacktraceContext<ContextTag>::backtrace(delim);
+}
+
+struct Exception::ContextData :
+ public libebt::Backtraceable<Context>
+{
+};
+
Exception::Exception(const std::string & message) throw () :
- _message(message)
+ _message(message),
+ _context_data(new ContextData)
+{
+}
+
+Exception::Exception(const Exception & other) :
+ std::exception(other),
+ _message(other._message),
+ _context_data(new ContextData(*other._context_data))
{
}
Exception::~Exception() throw ()
{
+ delete _context_data;
}
const std::string &
@@ -42,6 +88,12 @@ Exception::message() const throw ()
return _message;
}
+std::string
+Exception::backtrace(const std::string & delim) const
+{
+ return _context_data->backtrace(delim);
+}
+
InternalError::InternalError(const std::string & where, const std::string & message) throw () :
Exception("Eek! Internal error at " + where + ": " + message)
{
diff --git a/paludis/util/exception.hh b/paludis/util/exception.hh
index ac41ae1..06fcebe 100644
--- a/paludis/util/exception.hh
+++ b/paludis/util/exception.hh
@@ -21,10 +21,10 @@
#define PALUDIS_GUARD_PALUDIS_EXCEPTION_HH 1
#include <paludis/util/attributes.hh>
-
+#include <libwrapiter/libwrapiter.hh>
#include <string>
#include <exception>
-#include <libebt/libebt.hh>
+
/** \file
* Declaration for the Exception base class, the InternalError exception
@@ -49,7 +49,30 @@ namespace paludis
*
* \ingroup grpexceptions
*/
- typedef libebt::BacktraceContext<PaludisBacktraceTag> Context;
+ class Context
+ {
+ private:
+ Context(const Context &);
+ const Context & operator= (const Context &);
+
+ struct ContextData;
+ ContextData * const _context_data;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ Context(const std::string &);
+
+ ~Context();
+
+ ///\}
+
+ /**
+ * Current context (forwards to libebt).
+ */
+ static std::string backtrace(const std::string & delim);
+ };
/**
* Base exception class.
@@ -57,28 +80,42 @@ namespace paludis
* \ingroup grpexceptions
*/
class Exception :
- public std::exception,
- public libebt::Backtraceable<PaludisBacktraceTag>
+ public std::exception
{
private:
const std::string _message;
+ struct ContextData;
+ ContextData * const _context_data;
+
+ const Exception & operator= (const Exception &);
protected:
- /**
- * Constructor.
- */
+ ///\name Basic operations
+ ///\{
+
Exception(const std::string & message) throw ();
+ Exception(const Exception &);
+
+ ///\}
+
public:
- /**
- * Destructor.
- */
+ ///\name Basic operations
+ ///\{
+
virtual ~Exception() throw () PALUDIS_ATTRIBUTE((nothrow));
+ ///\}
+
/**
* Return our descriptive error message.
*/
const std::string & message() const throw () PALUDIS_ATTRIBUTE((nothrow));
+
+ /**
+ * Make a backtrace.
+ */
+ std::string backtrace(const std::string & delim) const;
};
/**
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 8b14ccf..495514d 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -10,6 +10,7 @@ dnl on this file at present...
add(`attributes', `hh')
add(`collection', `hh')
+add(`collection_concrete', `hhx')
add(`compare', `hh')
add(`comparison_policy', `hh', `test')
add(`counted_ptr', `hh', `cc', `test')
diff --git a/src/paludis/applets.cc b/src/paludis/applets.cc
index 19088b9..4837f44 100644
--- a/src/paludis/applets.cc
+++ b/src/paludis/applets.cc
@@ -128,8 +128,8 @@ int do_configuration_variable()
return_code = 1;
for (p::RepositoryInfo::SectionIterator s(info->begin_sections()),
s_end(info->end_sections()) ; s != s_end ; ++s)
- for (p::RepositoryInfoSection::KeyValueIterator k(s->begin_kvs()),
- k_end(s->end_kvs()) ; k != k_end ; ++k)
+ for (p::RepositoryInfoSection::KeyValueIterator k((*s)->begin_kvs()),
+ k_end((*s)->end_kvs()) ; k != k_end ; ++k)
if (var_str == k->first)
{
std::cout << k->second << std::endl;
diff --git a/src/paludis/install.cc b/src/paludis/install.cc
index 9470e91..55241a5 100644
--- a/src/paludis/install.cc
+++ b/src/paludis/install.cc
@@ -25,6 +25,7 @@
#include <paludis/util/iterator.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/collection_concrete.hh>
/** \file
* Handle the --install action for the main paludis program.
@@ -502,7 +503,7 @@ do_install()
p::is_installed_only));
// don't clean the thing we just installed
- p::PackageDatabaseEntryCollection clean_list;
+ p::PackageDatabaseEntryCollection::Concrete clean_list;
for (p::PackageDatabaseEntryCollection::Iterator c(collision_list->begin()),
c_end(collision_list->end()) ; c != c_end ; ++c)
if (dep->get<p::dle_version>() != c->get<p::pde_version>())
diff --git a/src/paludis/list.cc b/src/paludis/list.cc
index 5ab9c7f..9ddee7f 100644
--- a/src/paludis/list.cc
+++ b/src/paludis/list.cc
@@ -56,9 +56,9 @@ do_list_repositories()
for (p::RepositoryInfo::SectionIterator i(ii->begin_sections()),
i_end(ii->end_sections()) ; i != i_end ; ++i)
{
- std::cout << " " << colour(cl_heading, i->heading() + ":") << std::endl;
- for (p::RepositoryInfoSection::KeyValueIterator k(i->begin_kvs()),
- k_end(i->end_kvs()) ; k != k_end ; ++k)
+ std::cout << " " << colour(cl_heading, (*i)->heading() + ":") << std::endl;
+ for (p::RepositoryInfoSection::KeyValueIterator k((*i)->begin_kvs()),
+ k_end((*i)->end_kvs()) ; k != k_end ; ++k)
std::cout << " " << std::setw(22) << std::left << (p::stringify(k->first) + ":")
<< std::setw(0) << " " << k->second << std::endl;
std::cout << std::endl;
diff --git a/src/paludis/paludis.cc b/src/paludis/paludis.cc
index a9c0afe..6d496d2 100644
--- a/src/paludis/paludis.cc
+++ b/src/paludis/paludis.cc
@@ -33,6 +33,9 @@
#include <paludis/paludis.hh>
#include <paludis/util/util.hh>
+#include <libebt/libebt.hh>
+#include <libwrapiter/libwrapiter.hh>
+
#include <iostream>
#include <iomanip>
#include <string>
@@ -86,6 +89,8 @@ namespace
cout << "libebt: " << LIBEBT_VERSION_MAJOR << "." << LIBEBT_VERSION_MINOR
<< "." << LIBEBT_VERSION_MICRO << endl;
+ cout << "libwrapiter: " << LIBWRAPITER_VERSION_MAJOR << "." << LIBWRAPITER_VERSION_MINOR
+ << "." << LIBWRAPITER_VERSION_MICRO << endl;
#if HAVE_SANDBOX
cout << "sandbox: enabled" << endl;
#else
@@ -107,9 +112,9 @@ namespace
for (p::RepositoryInfo::SectionIterator i(ii->begin_sections()),
i_end(ii->end_sections()) ; i != i_end ; ++i)
{
- cout << " " << colour(cl_heading, i->heading() + ":") << endl;
- for (p::RepositoryInfoSection::KeyValueIterator k(i->begin_kvs()),
- k_end(i->end_kvs()) ; k != k_end ; ++k)
+ cout << " " << colour(cl_heading, (*i)->heading() + ":") << endl;
+ for (p::RepositoryInfoSection::KeyValueIterator k((*i)->begin_kvs()),
+ k_end((*i)->end_kvs()) ; k != k_end ; ++k)
cout << " " << std::setw(22) << std::left << (p::stringify(k->first) + ":")
<< std::setw(0) << " " << k->second << endl;
cout << endl;
@@ -126,8 +131,6 @@ main(int argc, char *argv[])
try
{
- context.change_context("When parsing command line arguments:");
-
CommandLine::get_instance()->run(argc, argv);
if (CommandLine::get_instance()->a_help.specified())
diff --git a/src/paludis/query.cc b/src/paludis/query.cc
index bf5bfcd..045bc0a 100644
--- a/src/paludis/query.cc
+++ b/src/paludis/query.cc
@@ -24,6 +24,7 @@
#include <iomanip>
#include <iostream>
#include <paludis/paludis.hh>
+#include <paludis/util/collection_concrete.hh>
#include <string>
/** \file
@@ -90,7 +91,7 @@ void do_one_query(
cout << endl;
/* find all repository names. */
- p::RepositoryNameCollection repo_names;
+ p::RepositoryNameCollection::Concrete repo_names;
p::PackageDatabaseEntryCollection::Iterator e(entries->begin()), e_end(entries->end());
for ( ; e != e_end ; ++e)
repo_names.append(e->get<p::pde_repository>());
diff --git a/src/paludis/uninstall.cc b/src/paludis/uninstall.cc
index 2b42893..bf24ebd 100644
--- a/src/paludis/uninstall.cc
+++ b/src/paludis/uninstall.cc
@@ -21,6 +21,7 @@
#include "uninstall.hh"
#include <iostream>
#include <paludis/paludis.hh>
+#include <paludis/util/collection_concrete.hh>
/** \file
* Handle the --uninstall action for the main paludis program.
@@ -68,7 +69,7 @@ do_uninstall()
}
bool ok(true);
- p::PackageDatabaseEntryCollection::Pointer unmerge(new p::PackageDatabaseEntryCollection);
+ p::PackageDatabaseEntryCollection::Pointer unmerge(new p::PackageDatabaseEntryCollection::Concrete);
for (std::list<p::PackageDepAtom::Pointer>::iterator t(targets.begin()), t_end(targets.end()) ;
t != t_end ; ++t)
{
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 0a26832..756da49 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -26,6 +26,9 @@
#include <iostream>
#include <algorithm>
+#include <libebt/libebt.hh>
+#include <libwrapiter/libwrapiter.hh>
+
#include "qualudis_command_line.hh"
#include "config.h"
@@ -528,6 +531,9 @@ int main(int argc, char *argv[])
cout << "libebt: " << LIBEBT_VERSION_MAJOR << "." << LIBEBT_VERSION_MINOR
<< "." << LIBEBT_VERSION_MICRO << endl;
+ cout << "libwrapiter: " << LIBWRAPITER_VERSION_MAJOR << "." << LIBWRAPITER_VERSION_MINOR
+ << "." << LIBWRAPITER_VERSION_MICRO << endl;
+
cout << endl;
cout << "Paludis comes with ABSOLUTELY NO WARRANTY. Paludis is free software, and you" << endl;
cout << "are welcome to redistribute it under the terms of the GNU General Public" << endl;