aboutsummaryrefslogtreecommitdiff
path: root/paludis/package_id.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-14 09:43:03 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-14 09:43:03 +0000
commit3f23bc84239efb3917f47ff84fa43bca3aacd049 (patch)
tree0cc7ad113b0c50d081a5b8a5cda9e1b9d7fa0391 /paludis/package_id.cc
parent13fd474a32135f52536d2a1a14c89be9bd9ed089 (diff)
downloadpaludis-3f23bc84239efb3917f47ff84fa43bca3aacd049.tar.gz
paludis-3f23bc84239efb3917f47ff84fa43bca3aacd049.tar.xz
Move common metadata key code into a base class
Diffstat (limited to 'paludis/package_id.cc')
-rw-r--r--paludis/package_id.cc48
1 files changed, 2 insertions, 46 deletions
diff --git a/paludis/package_id.cc b/paludis/package_id.cc
index f5aa6439b..2d0b6de37 100644
--- a/paludis/package_id.cc
+++ b/paludis/package_id.cc
@@ -64,13 +64,13 @@ namespace paludis
template <>
struct Implementation<PackageID>
{
- mutable std::list<tr1::shared_ptr<const MetadataKey> > keys;
mutable std::list<tr1::shared_ptr<const Mask> > masks;
};
}
PackageID::PackageID() :
- PrivateImplementationPattern<PackageID>(new Implementation<PackageID>)
+ PrivateImplementationPattern<PackageID>(new Implementation<PackageID>),
+ _imp(PrivateImplementationPattern<PackageID>::_imp)
{
}
@@ -79,32 +79,6 @@ PackageID::~PackageID()
}
void
-PackageID::add_metadata_key(const tr1::shared_ptr<const MetadataKey> & k) const
-{
- using namespace tr1::placeholders;
-
- if (indirect_iterator(_imp->keys.end()) != std::find_if(indirect_iterator(_imp->keys.begin()), indirect_iterator(_imp->keys.end()),
- tr1::bind(std::equal_to<std::string>(), k->raw_name(), tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1))))
- throw ConfigurationError("Tried to add duplicate key '" + k->raw_name() + "' to ID '" + stringify(*this) + "'");
-
- _imp->keys.push_back(k);
-}
-
-PackageID::MetadataConstIterator
-PackageID::begin_metadata() const
-{
- need_keys_added();
- return MetadataConstIterator(_imp->keys.begin());
-}
-
-PackageID::MetadataConstIterator
-PackageID::end_metadata() const
-{
- need_keys_added();
- return MetadataConstIterator(_imp->keys.end());
-}
-
-void
PackageID::add_mask(const tr1::shared_ptr<const Mask> & k) const
{
_imp->masks.push_back(k);
@@ -136,24 +110,6 @@ PackageID::invalidate_masks() const
_imp->masks.clear();
}
-PackageID::MetadataConstIterator
-PackageID::find_metadata(const std::string & s) const
-{
- using namespace tr1::placeholders;
-
- need_keys_added();
-
- // tr1::mem_fn on a sptr doesn't work with boost
- // return std::find_if(begin_metadata(), end_metadata(),
- // tr1::bind(std::equal_to<std::string>(), s, tr1::bind(tr1::mem_fn(&MetadataKey::raw_name), _1)));
-
- for (MetadataConstIterator i(begin_metadata()), i_end(end_metadata()) ;
- i != i_end ; ++i)
- if ((*i)->raw_name() == s)
- return i;
- return end_metadata();
-}
-
std::ostream &
paludis::operator<< (std::ostream & s, const PackageID & i)
{