From 39f12a17666d54881ee8b0493702cb7a740e24b7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 2 Sep 2011 18:35:22 +0000 Subject: [PATCH] add const BufferIterator::Buffer& buffer() method --- src/buffer.cc | 6 ++++++ src/buffer.hh | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/buffer.cc b/src/buffer.cc index 1e20b2d6..f6409cbb 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -19,6 +19,12 @@ BufferIterator::BufferIterator(const Buffer& buffer, BufferPos position) : m_buf { } +const Buffer& BufferIterator::buffer() const +{ + assert(m_buffer); + return *m_buffer; +} + BufferIterator& BufferIterator::operator=(const BufferIterator& iterator) { m_buffer == iterator.m_buffer; diff --git a/src/buffer.hh b/src/buffer.hh index 7564e444..dd2762a5 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -55,6 +55,8 @@ public: bool is_begin() const; bool is_end() const; + const Buffer& buffer() const; + private: const Buffer* m_buffer; BufferPos m_position;