From: Arvin Schnell Date: Wed, 9 Feb 2011 11:04:50 +0000 (+0100) Subject: - added function to find post snapshot X-Git-Tag: v0.1.3~500 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=05249d68df28e06c3fc118e4466901bd652f5c8f;p=thirdparty%2Fsnapper.git - added function to find post snapshot --- diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 0831a7b0..dbff0cd8 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -201,6 +201,22 @@ namespace snapper } + Snapshots::const_iterator + Snapshots::findPost(const_iterator pre) const + { + assert(pre != end()); + assert(pre->getType() == PRE); + + for (const_iterator it = begin(); it != end(); ++it) + { + if (it->getType() == POST && it->getPreNum() == pre->getNum()) + return it; + } + + return end(); + } + + unsigned int Snapshots::nextNumber() { diff --git a/snapper/Snapshot.h b/snapper/Snapshot.h index 7c4746c8..599efca3 100644 --- a/snapper/Snapshot.h +++ b/snapper/Snapshot.h @@ -104,6 +104,8 @@ namespace snapper iterator find(unsigned int num); const_iterator find(unsigned int num) const; + const_iterator findPost(const_iterator pre) const; + private: void assertInit();