]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added function to find post snapshot
authorArvin Schnell <aschnell@suse.de>
Wed, 9 Feb 2011 11:04:50 +0000 (12:04 +0100)
committerArvin Schnell <aschnell@suse.de>
Wed, 9 Feb 2011 11:04:50 +0000 (12:04 +0100)
snapper/Snapshot.cc
snapper/Snapshot.h

index 0831a7b039d1e7bdfef697255aa08d4a38f48e53..dbff0cd883c1e1da97d66af5e3f608094d9261f9 100644 (file)
@@ -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()
     {
index 7c4746c83d9fce8ca63af0e98c7a744eb7a0c7dc..599efca352751813f00e3b60b0dc0be133651d7a 100644 (file)
@@ -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();