aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-12 19:19:29 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-12 19:19:29 +0000
commit0855d5f130212e199fc50cb1fbbc4a430d488fc9 (patch)
tree5d039a3bd701bbb2e1d2d902dbb3da399214a9c0
parent557c3dd03a88239c90ef6df9602f712fc2ad4891 (diff)
downloadpaludis-0855d5f130212e199fc50cb1fbbc4a430d488fc9.tar.gz
paludis-0855d5f130212e199fc50cb1fbbc4a430d488fc9.tar.xz
Tidy up includes, remove some unnecessary inlines
-rw-r--r--paludis/config_file.cc5
-rw-r--r--paludis/config_file.hh10
-rw-r--r--paludis/default_config.cc304
-rw-r--r--paludis/default_config.hh212
4 files changed, 313 insertions, 218 deletions
diff --git a/paludis/config_file.cc b/paludis/config_file.cc
index a2257e8..5bd036e 100644
--- a/paludis/config_file.cc
+++ b/paludis/config_file.cc
@@ -18,14 +18,17 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <fstream>
#include <paludis/config_file.hh>
#include <paludis/util/exception.hh>
+#include <paludis/util/fs_entry.hh>
#include <paludis/util/log.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/tokeniser.hh>
+#include <fstream>
+#include <istream>
+
/** \file
* Implementation for config_file.hh classes.
*
diff --git a/paludis/config_file.hh b/paludis/config_file.hh
index 7e34f2c..04c306c 100644
--- a/paludis/config_file.hh
+++ b/paludis/config_file.hh
@@ -20,12 +20,12 @@
#ifndef PALUDIS_GUARD_PALUDIS_CONFIG_FILE_HH
#define PALUDIS_GUARD_PALUDIS_CONFIG_FILE_HH 1
-#include <istream>
-#include <list>
-#include <map>
#include <paludis/util/exception.hh>
-#include <paludis/util/fs_entry.hh>
#include <paludis/util/instantiation_policy.hh>
+
+#include <iosfwd>
+#include <list>
+#include <map>
#include <string>
#include <vector>
@@ -37,6 +37,8 @@
namespace paludis
{
+ class FSEntry;
+
/**
* Thrown if an error occurs when reading a ConfigFile.
*
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 51239da..16d679b 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -32,6 +32,7 @@
#include <fstream>
#include <algorithm>
#include <sstream>
+
#include <ctype.h>
/** \file
@@ -42,15 +43,66 @@
using namespace paludis;
+namespace paludis
+{
+ template<>
+ struct Implementation<DefaultConfig> :
+ InternalCounted<DefaultConfig>,
+ InstantiationPolicy<DefaultConfig, instantiation_method::NonCopyableTag>
+ {
+ static std::string config_suffix;
+ static bool config_suffix_can_be_set;
+ std::string paludis_command;
+ std::string root;
+ std::string config_dir;
+ std::string bashrc_files;
+
+ std::list<RepositoryConfigEntry> repos;
+
+ std::map<QualifiedPackageName, std::vector<
+ std::pair<PackageDepAtom::ConstPointer, KeywordName> > > keywords;
+
+ const std::vector<std::pair<PackageDepAtom::ConstPointer, KeywordName> > empty_keywords;
+
+ std::vector<KeywordName> default_keywords;
+
+ std::map<QualifiedPackageName, std::vector<
+ std::pair<PackageDepAtom::ConstPointer, std::string> > > licenses;
+
+ const std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > empty_licenses;
+
+ std::vector<std::string> default_licenses;
+
+ std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > user_masks;
+
+ std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > user_unmasks;
+
+ std::vector<PackageDepAtom::ConstPointer> empty_masks;
+
+ std::map<QualifiedPackageName, std::vector<UseConfigEntry> > use;
+
+ std::vector<UseConfigEntry> empty_use;
+
+ std::vector<std::pair<UseFlagName, UseFlagState> > default_use;
+
+ std::multimap<std::string, std::string> mirrors;
+
+ Implementation() :
+ paludis_command("paludis")
+ {
+ }
+ };
+}
+
DefaultConfigError::DefaultConfigError(const std::string & msg) throw () :
ConfigurationError("Default configuration error: " + msg)
{
}
DefaultConfig::DefaultConfig() :
- _paludis_command("paludis")
+ PrivateImplementationPattern<DefaultConfig>(new Implementation<DefaultConfig>)
{
- _config_suffix_can_be_set = false;
+ _imp->config_suffix_can_be_set = false;
Context context("When loading default configuration:");
@@ -60,8 +112,8 @@ DefaultConfig::DefaultConfig() :
/* indirection */
std::string root_prefix;
std::string config_suffix;
- if (! _config_suffix.empty())
- config_suffix = "-" + _config_suffix;
+ if (! _imp->config_suffix.empty())
+ config_suffix = "-" + _imp->config_suffix;
FSEntry config_dir(FSEntry(getenv_with_default("PALUDIS_HOME", getenv_or_error("HOME"))) /
(".paludis" + config_suffix));
@@ -88,8 +140,8 @@ DefaultConfig::DefaultConfig() :
}
}
- _root = root_prefix;
- _config_dir = stringify(config_dir);
+ _imp->root = root_prefix;
+ _imp->config_dir = stringify(config_dir);
std::map<std::string, std::string> conf_vars;
conf_vars.insert(std::make_pair("ROOT", root_prefix));
@@ -132,13 +184,13 @@ DefaultConfig::DefaultConfig() :
std::map<std::string, std::string> keys(k.begin(), k.end());
keys["repo_file"] = stringify(*repo_file);
keys["root"] = root_prefix;
- _repos.push_back(RepositoryConfigEntry(format, importance, keys));
+ _imp->repos.push_back(RepositoryConfigEntry(format, importance, keys));
}
- if (_repos.empty())
+ if (_imp->repos.empty())
throw DefaultConfigError("No repositories specified");
- _repos.sort();
+ _imp->repos.sort();
}
/* keywords */
@@ -164,18 +216,18 @@ DefaultConfig::DefaultConfig() :
continue;
if ("*" == tokens.at(0))
std::copy(next(tokens.begin()), tokens.end(),
- create_inserter<KeywordName>(std::back_inserter(_default_keywords)));
+ create_inserter<KeywordName>(std::back_inserter(_imp->default_keywords)));
else
{
PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
- _keywords[a->package()].push_back(std::make_pair(a, *t));
+ _imp->keywords[a->package()].push_back(std::make_pair(a, *t));
}
}
}
- if (_default_keywords.empty())
+ if (_imp->default_keywords.empty())
throw DefaultConfigError("No default keywords specified (a keywords.conf file should "
"contain an entry in the form '* keyword')");
}
@@ -202,18 +254,18 @@ DefaultConfig::DefaultConfig() :
if (tokens.empty())
continue;
if ("*" == tokens.at(0))
- std::copy(next(tokens.begin()), tokens.end(), std::back_inserter(_default_licenses));
+ std::copy(next(tokens.begin()), tokens.end(), std::back_inserter(_imp->default_licenses));
else
{
PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
- _licenses[a->package()].push_back(std::make_pair(a, *t));
+ _imp->licenses[a->package()].push_back(std::make_pair(a, *t));
}
}
}
- if (_default_licenses.empty())
+ if (_imp->default_licenses.empty())
throw DefaultConfigError("No default licenses specified (a licenses.conf file should "
"contain an entry in the form '* license license', or '* *' if you don't want any "
"license filtering)");
@@ -237,7 +289,7 @@ DefaultConfig::DefaultConfig() :
line != line_end ; ++line)
{
PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
- _user_masks[a->package()].push_back(a);
+ _imp->user_masks[a->package()].push_back(a);
}
}
}
@@ -260,7 +312,7 @@ DefaultConfig::DefaultConfig() :
line != line_end ; ++line)
{
PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
- _user_unmasks[a->package()].push_back(a);
+ _imp->user_unmasks[a->package()].push_back(a);
}
}
}
@@ -293,7 +345,7 @@ DefaultConfig::DefaultConfig() :
t != t_end ; ++t)
{
if ('-' == t->at(0))
- _default_use.push_back(std::make_pair(UseFlagName(
+ _imp->default_use.push_back(std::make_pair(UseFlagName(
prefix + t->substr(1)), use_disabled));
else if (':' == t->at(t->length() - 1))
{
@@ -303,7 +355,7 @@ DefaultConfig::DefaultConfig() :
prefix.append("_");
}
else
- _default_use.push_back(std::make_pair(UseFlagName(
+ _imp->default_use.push_back(std::make_pair(UseFlagName(
prefix + *t), use_enabled));
}
else
@@ -313,7 +365,7 @@ DefaultConfig::DefaultConfig() :
t != t_end ; ++t)
{
if ('-' == t->at(0))
- _use[a->package()].push_back(UseConfigEntry(
+ _imp->use[a->package()].push_back(UseConfigEntry(
a, UseFlagName(prefix + t->substr(1)), use_disabled));
else if (':' == t->at(t->length() - 1))
{
@@ -323,14 +375,14 @@ DefaultConfig::DefaultConfig() :
prefix.append("_");
}
else
- _use[a->package()].push_back(UseConfigEntry(
+ _imp->use[a->package()].push_back(UseConfigEntry(
a, UseFlagName(prefix + *t), use_enabled));
}
}
}
}
- if (_default_keywords.empty())
+ if (_imp->default_keywords.empty())
throw DefaultConfigError("No default keywords specified (a keywords.conf file should "
"contain an entry in the form '* keyword')");
}
@@ -358,25 +410,25 @@ DefaultConfig::DefaultConfig() :
continue;
for (std::vector<std::string>::const_iterator mm(next(m.begin())),
mm_end(m.end()) ; mm != mm_end ; ++mm)
- _mirrors.insert(std::make_pair(m.at(0), *mm));
+ _imp->mirrors.insert(std::make_pair(m.at(0), *mm));
}
}
}
- _bashrc_files = stringify(config_dir / "bashrc");
+ _imp->bashrc_files = stringify(config_dir / "bashrc");
}
DefaultConfig::~DefaultConfig()
{
}
-std::string DefaultConfig::_config_suffix;
-bool DefaultConfig::_config_suffix_can_be_set(true);
+std::string Implementation<DefaultConfig>::config_suffix;
+bool Implementation<DefaultConfig>::config_suffix_can_be_set(true);
void
DefaultConfig::set_config_suffix(const std::string & s)
{
- if (! _config_suffix_can_be_set)
+ if (! Implementation<DefaultConfig>::config_suffix_can_be_set)
throw InternalError(PALUDIS_HERE, "DefaultConfig::set_config_suffix called after "
"DefaultConfig has been instantiated.");
@@ -392,12 +444,206 @@ DefaultConfig::set_config_suffix(const std::string & s)
if ('-' == s.at(0) || '-' == s.at(s.length() - 1))
throw DefaultConfigError("Invalid config suffix '" + s + "'");
- _config_suffix = s;
+ Implementation<DefaultConfig>::config_suffix = s;
}
std::string
DefaultConfig::bashrc_files() const
{
- return _bashrc_files;
+ return _imp->bashrc_files;
+}
+
+std::string
+DefaultConfig::config_suffix()
+{
+ return Implementation<DefaultConfig>::config_suffix;
+}
+
+DefaultConfig::RepositoryIterator
+DefaultConfig::begin_repositories() const
+{
+ return _imp->repos.begin();
+}
+
+DefaultConfig::RepositoryIterator
+DefaultConfig::end_repositories() const
+{
+ return _imp->repos.end();
+}
+
+DefaultConfig::PackageKeywordsIterator
+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();
+ else
+ return _imp->empty_keywords.begin();
+}
+
+DefaultConfig::PackageKeywordsIterator
+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();
+ else
+ return _imp->empty_keywords.end();
+}
+
+DefaultConfig::DefaultKeywordsIterator
+DefaultConfig::begin_default_keywords() const
+{
+ return _imp->default_keywords.begin();
+}
+
+DefaultConfig::DefaultKeywordsIterator
+DefaultConfig::end_default_keywords() const
+{
+ return _imp->default_keywords.end();
+}
+
+DefaultConfig::PackageLicensesIterator
+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();
+ else
+ return _imp->empty_licenses.begin();
+}
+
+DefaultConfig::PackageLicensesIterator
+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();
+ else
+ return _imp->empty_licenses.end();
+}
+
+DefaultConfig::DefaultLicensesIterator
+DefaultConfig::begin_default_licenses() const
+{
+ return _imp->default_licenses.begin();
+}
+
+DefaultConfig::DefaultLicensesIterator
+DefaultConfig::end_default_licenses() const
+{
+ return _imp->default_licenses.end();
+}
+
+DefaultConfig::UserMasksIterator
+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();
+ else
+ return _imp->empty_masks.begin();
+}
+
+DefaultConfig::UserMasksIterator
+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();
+ else
+ return _imp->empty_masks.end();
+}
+
+DefaultConfig::UserUnmasksIterator
+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();
+ else
+ return _imp->empty_masks.begin();
+}
+
+DefaultConfig::UserUnmasksIterator
+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();
+ else
+ return _imp->empty_masks.end();
+}
+
+DefaultConfig::UseConfigIterator
+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();
+ else
+ return _imp->empty_use.begin();
+}
+
+DefaultConfig::UseConfigIterator
+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();
+ else
+ return _imp->empty_use.end();
+}
+
+DefaultConfig::DefaultUseIterator
+DefaultConfig::begin_default_use() const
+{
+ return _imp->default_use.begin();
+}
+
+DefaultConfig::DefaultUseIterator
+DefaultConfig::end_default_use() const
+{
+ return _imp->default_use.end();
+}
+
+std::string
+DefaultConfig::paludis_command() const
+{
+ return _imp->paludis_command;
+}
+
+void
+DefaultConfig::set_paludis_command(const std::string & s)
+{
+ _imp->paludis_command = s;
+}
+
+std::string
+DefaultConfig::root() const
+{
+ return _imp->root;
+}
+
+std::string
+DefaultConfig::config_dir() const
+{
+ return _imp->config_dir;
+}
+
+DefaultConfig::MirrorIterator
+DefaultConfig::begin_mirrors(const std::string & m) const
+{
+ return _imp->mirrors.lower_bound(m);
+}
+
+DefaultConfig::MirrorIterator
+DefaultConfig::end_mirrors(const std::string & m) const
+{
+ return _imp->mirrors.upper_bound(m);
}
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index 107bf03..ed89891 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -23,8 +23,6 @@
#include <paludis/dep_atom.hh>
#include <paludis/name.hh>
#include <paludis/util/exception.hh>
-#include <paludis/util/fs_entry.hh>
-#include <paludis/util/iterator.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/smart_record.hh>
@@ -139,52 +137,16 @@ namespace paludis
* \ingroup grpdefaultconfig
*/
class DefaultConfig :
- public InstantiationPolicy<DefaultConfig, instantiation_method::SingletonAsNeededTag>
+ public InstantiationPolicy<DefaultConfig, instantiation_method::SingletonAsNeededTag>,
+ private PrivateImplementationPattern<DefaultConfig>
{
friend class InstantiationPolicy<DefaultConfig, instantiation_method::SingletonAsNeededTag>;
private:
- static std::string _config_suffix;
- static bool _config_suffix_can_be_set;
- std::string _paludis_command;
- std::string _root;
- std::string _config_dir;
- std::string _bashrc_files;
-
DefaultConfig();
~DefaultConfig();
- std::list<RepositoryConfigEntry> _repos;
-
- std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, KeywordName> > > _keywords;
-
- const std::vector<std::pair<PackageDepAtom::ConstPointer, KeywordName> > _empty_keywords;
-
- std::vector<KeywordName> _default_keywords;
-
- std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, std::string> > > _licenses;
-
- const std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > _empty_licenses;
-
- std::vector<std::string> _default_licenses;
-
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > _user_masks;
-
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > _user_unmasks;
-
- std::vector<PackageDepAtom::ConstPointer> _empty_masks;
-
- std::map<QualifiedPackageName, std::vector<UseConfigEntry> > _use;
-
- std::vector<UseConfigEntry> _empty_use;
-
- std::vector<std::pair<UseFlagName, UseFlagState> > _default_use;
-
- std::multimap<std::string, std::string> _mirrors;
-
public:
/**
* Set config suffix. Must be called before we do anything, or not
@@ -195,10 +157,7 @@ namespace paludis
/**
* Get config suffix.
*/
- static std::string config_suffix()
- {
- return _config_suffix;
- }
+ static std::string config_suffix();
///\name Repositories
///{
@@ -211,18 +170,12 @@ namespace paludis
/**
* Iterator to the start of our repositories.
*/
- RepositoryIterator begin_repositories() const
- {
- return _repos.begin();
- }
+ RepositoryIterator begin_repositories() const;
/**
* Iterator to past the end of our repositories.
*/
- RepositoryIterator end_repositories() const
- {
- return _repos.end();
- }
+ RepositoryIterator end_repositories() const;
///}
@@ -239,29 +192,13 @@ namespace paludis
* Iterator to the start of the package.keywords entries for a
* particular package.
*/
- PackageKeywordsIterator begin_package_keywords(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r;
- if (_keywords.end() != ((r = _keywords.find(d))))
- return r->second.begin();
- else
- return _empty_keywords.begin();
- }
+ PackageKeywordsIterator begin_package_keywords(const QualifiedPackageName & d) const;
/**
* Iterator to past the end of the package.keywords entries for a
* particular file.
*/
- PackageKeywordsIterator end_package_keywords(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r;
- if (_keywords.end() != ((r = _keywords.find(d))))
- return r->second.end();
- else
- return _empty_keywords.end();
- }
+ PackageKeywordsIterator end_package_keywords(const QualifiedPackageName & d) const;
/**
* Iterator over the default keywords entries.
@@ -271,18 +208,12 @@ namespace paludis
/**
* Iterator to the start of our default keywords entries.
*/
- DefaultKeywordsIterator begin_default_keywords() const
- {
- return _default_keywords.begin();
- }
+ DefaultKeywordsIterator begin_default_keywords() const;
/**
* Iterator to past the end of our default keywords entries.
*/
- DefaultKeywordsIterator end_default_keywords() const
- {
- return _default_keywords.end();
- }
+ DefaultKeywordsIterator end_default_keywords() const;
///}
@@ -299,29 +230,13 @@ namespace paludis
* Iterator to the start of the licenses entries for a
* particular package.
*/
- PackageLicensesIterator begin_package_licenses(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
- if (_licenses.end() != ((r = _licenses.find(d))))
- return r->second.begin();
- else
- return _empty_licenses.begin();
- }
+ PackageLicensesIterator begin_package_licenses(const QualifiedPackageName & d) const;
/**
* Iterator to past the end of the licenses entries for a
* particular file.
*/
- PackageLicensesIterator end_package_licenses(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<
- std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r;
- if (_licenses.end() != ((r = _licenses.find(d))))
- return r->second.end();
- else
- return _empty_licenses.end();
- }
+ PackageLicensesIterator end_package_licenses(const QualifiedPackageName & d) const;
/**
* Iterator over the default licenses entries.
@@ -331,18 +246,12 @@ namespace paludis
/**
* Iterator to the start of our default license entries.
*/
- DefaultLicensesIterator begin_default_licenses() const
- {
- return _default_licenses.begin();
- }
+ DefaultLicensesIterator begin_default_licenses() const;
/**
* Iterator to past the end of our default license entries.
*/
- DefaultLicensesIterator end_default_licenses() const
- {
- return _default_licenses.end();
- }
+ DefaultLicensesIterator end_default_licenses() const;
///}
@@ -358,26 +267,12 @@ namespace paludis
/**
* Iterator to the start of the user package masks.
*/
- UserMasksIterator begin_user_masks(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
- if (_user_masks.end() != ((r = _user_masks.find(d))))
- return r->second.begin();
- else
- return _empty_masks.begin();
- }
+ UserMasksIterator begin_user_masks(const QualifiedPackageName & d) const;
/**
* Iterator to past the end of the user package masks.
*/
- UserMasksIterator end_user_masks(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
- if (_user_masks.end() != ((r = _user_masks.find(d))))
- return r->second.end();
- else
- return _empty_masks.end();
- }
+ UserMasksIterator end_user_masks(const QualifiedPackageName & d) const;
/**
* Iterator over the user package unmasks.
@@ -388,26 +283,12 @@ namespace paludis
/**
* Iterator to the start of the user package unmasks.
*/
- UserUnmasksIterator begin_user_unmasks(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
- if (_user_unmasks.end() != ((r = _user_unmasks.find(d))))
- return r->second.begin();
- else
- return _empty_masks.begin();
- }
+ UserUnmasksIterator begin_user_unmasks(const QualifiedPackageName & d) const;
/**
* Iterator to past the end of the user package unmasks.
*/
- UserUnmasksIterator end_user_unmasks(const QualifiedPackageName & d) const
- {
- std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r;
- if (_user_unmasks.end() != ((r = _user_unmasks.find(d))))
- return r->second.end();
- else
- return _empty_masks.end();
- }
+ UserUnmasksIterator end_user_unmasks(const QualifiedPackageName & d) const;
///}
@@ -423,27 +304,13 @@ namespace paludis
* Iterator to the start of the use configuration for a particular
* package.
*/
- UseConfigIterator begin_use_config(const QualifiedPackageName & q) const
- {
- std::map<QualifiedPackageName, std::vector<UseConfigEntry> >::const_iterator r;
- if (_use.end() != ((r = _use.find(q))))
- return r->second.begin();
- else
- return _empty_use.begin();
- }
+ UseConfigIterator begin_use_config(const QualifiedPackageName & q) const;
/**
* Iterator to past the end of the use configuration for a
* particular package.
*/
- UseConfigIterator end_use_config(const QualifiedPackageName & q) const
- {
- std::map<QualifiedPackageName, std::vector<UseConfigEntry> >::const_iterator r;
- if (_use.end() != ((r = _use.find(q))))
- return r->second.end();
- else
- return _empty_use.end();
- }
+ UseConfigIterator end_use_config(const QualifiedPackageName & q) const;
/**
* Iterator over the default use settings.
@@ -453,18 +320,13 @@ namespace paludis
/**
* Iterator to the start of the default use settings.
*/
- DefaultUseIterator begin_default_use() const
- {
- return _default_use.begin();
- }
+ DefaultUseIterator begin_default_use() const;
/**
* Iterator to past the end of the default use settings.
*/
- DefaultUseIterator end_default_use() const
- {
- return _default_use.end();
- }
+ DefaultUseIterator end_default_use() const;
+
///}
/**
@@ -475,46 +337,28 @@ namespace paludis
/**
* The paludis command.
*/
- std::string paludis_command() const
- {
- return _paludis_command;
- }
+ std::string paludis_command() const;
/**
* Set the paludis command.
*/
- void set_paludis_command(const std::string & s)
- {
- _paludis_command = s;
- }
+ void set_paludis_command(const std::string & s);
/**
* The ROOT.
*/
- std::string root() const
- {
- return _root;
- }
+ std::string root() const;
/**
* The config directory.
*/
- std::string config_dir() const
- {
- return _config_dir;
- }
+ std::string config_dir() const;
typedef std::multimap<std::string, std::string>::const_iterator MirrorIterator;
- MirrorIterator begin_mirrors(const std::string & m) const
- {
- return _mirrors.lower_bound(m);
- }
+ MirrorIterator begin_mirrors(const std::string & m) const;
- MirrorIterator end_mirrors(const std::string & m) const
- {
- return _mirrors.upper_bound(m);
- }
+ MirrorIterator end_mirrors(const std::string & m) const;
};
}