From 64a9612a017e651bc352939a07768abfdfea905f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 5 Jul 2008 20:54:53 +0200 Subject: [PATCH] add getRemaining method --- GrowingBuffer.cpp | 4 ++++ GrowingBuffer.h | 1 + 2 files changed, 5 insertions(+) diff --git a/GrowingBuffer.cpp b/GrowingBuffer.cpp index 719e793..b1c5dbc 100644 --- a/GrowingBuffer.cpp +++ b/GrowingBuffer.cpp @@ -35,6 +35,10 @@ size_t GrowingBuffer::getSize() { return size; } +size_t GrowingBuffer::getRemaining() { + return limit - position; +} + void GrowingBuffer::seek(size_t position) { this->position = (position > limit) ? limit : position; GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] setting position to %d.\n", __FILE__, __LINE__, position); diff --git a/GrowingBuffer.h b/GrowingBuffer.h index a622a50..856c4d2 100644 --- a/GrowingBuffer.h +++ b/GrowingBuffer.h @@ -26,6 +26,7 @@ public: size_t getPosition(); size_t getLimit(); size_t getSize(); + size_t getRemaining(); /** * Sets the position of the buffer. The next {@link read(void*, size_t)} or -- 2.7.4