aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-11-13 23:48:36 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-11-13 23:48:36 +0000
commit7d264966104e6c79ee6fc74a1b5545aca68dde10 (patch)
tree0c4cd6b15243e274184c70797d2b1a3a9c5d935a
parent324f4dd660878d5d9d28f440fd82555c2738b444 (diff)
downloadpaludis-7d264966104e6c79ee6fc74a1b5545aca68dde10.tar.gz
paludis-7d264966104e6c79ee6fc74a1b5545aca68dde10.tar.xz
Add find() to Manifest2Reader, so that we can pick out specific manifests by file type (EBUILD, DIST, etc) and filename.
-rw-r--r--paludis/repositories/e/manifest2_reader.cc24
-rw-r--r--paludis/repositories/e/manifest2_reader.hh3
2 files changed, 22 insertions, 5 deletions
diff --git a/paludis/repositories/e/manifest2_reader.cc b/paludis/repositories/e/manifest2_reader.cc
index 6840d8b..5a2b09f 100644
--- a/paludis/repositories/e/manifest2_reader.cc
+++ b/paludis/repositories/e/manifest2_reader.cc
@@ -28,8 +28,10 @@
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/member_iterator-impl.hh>
#include <list>
+#include <map>
#include <paludis/repositories/e/manifest2_entry-sr.cc>
@@ -44,7 +46,7 @@ namespace paludis
struct Implementation<Manifest2Reader>
{
FSEntry manifest;
- std::list<Manifest2Entry> entries;
+ std::map<std::pair<std::string, std::string>, Manifest2Entry> entries;
Implementation(const FSEntry & f) :
manifest(f)
@@ -121,7 +123,7 @@ Manifest2Reader::Manifest2Reader(const FSEntry & f) :
<< "Skipping unknown checksum type " << checksum_type;
}
- _imp->entries.push_back(Manifest2Entry::create()
+ _imp->entries.insert(std::make_pair(std::make_pair(type,name), Manifest2Entry::create()
.type(type)
.size(size)
.name(name)
@@ -129,7 +131,7 @@ Manifest2Reader::Manifest2Reader(const FSEntry & f) :
.sha256(sha256)
.rmd160(rmd160)
.md5(md5)
- );
+ ));
}
}
@@ -140,11 +142,23 @@ Manifest2Reader::~Manifest2Reader()
Manifest2Reader::ConstIterator
Manifest2Reader::begin() const
{
- return ConstIterator(_imp->entries.begin());
+ return ConstIterator(second_iterator(_imp->entries.begin()));
}
Manifest2Reader::ConstIterator
Manifest2Reader::end() const
{
- return ConstIterator(_imp->entries.end());
+ return ConstIterator(second_iterator(_imp->entries.end()));
+}
+
+Manifest2Reader::ConstIterator
+Manifest2Reader::find(const std::string & type, const std::string & name) const
+{
+ return ConstIterator(second_iterator(_imp->entries.find(std::make_pair(type,name))));
+}
+
+Manifest2Reader::ConstIterator
+Manifest2Reader::find(const std::pair<const std::string, const std::string> & p) const
+{
+ return ConstIterator(second_iterator(_imp->entries.find(p)));
}
diff --git a/paludis/repositories/e/manifest2_reader.hh b/paludis/repositories/e/manifest2_reader.hh
index 874d683..8aba06e 100644
--- a/paludis/repositories/e/manifest2_reader.hh
+++ b/paludis/repositories/e/manifest2_reader.hh
@@ -78,6 +78,9 @@ namespace paludis
ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ ConstIterator find(const std::string & type, const std::string & name) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ ConstIterator find(const std::pair<const std::string, const std::string> & p) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
///}
};
}