]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: iterator::get_remaining()
authorSage Weil <sage.weil@dreamhost.com>
Thu, 26 Jan 2012 00:00:08 +0000 (16:00 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Thu, 2 Feb 2012 19:30:30 +0000 (11:30 -0800)
It's helpful to know how much data is remaining.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/buffer.h

index c4a77b157b0f30621c0b9cd6be3514b6b6f10703..7733121b7b497e72b3ee52099f4e9fadf27bc61d 100644 (file)
@@ -258,8 +258,13 @@ public:
        return *this;
       }
 
+      /// get current iterator offset in buffer::list
       unsigned get_off() { return off; }
+      
+      /// get number of bytes remaining from iterator position to the end of the buffer::list
+      unsigned get_remaining() { return bl->length() - off; }
 
+      /// true if iterator is at the end of the buffer::list
       bool end() {
        return p == ls->end();
        //return off == bl->length();