From: David ‘Bombe’ Roden Date: Sat, 5 Jul 2008 18:54:53 +0000 (+0200) Subject: add getRemaining method X-Git-Tag: 0.1~29 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=64a9612a017e651bc352939a07768abfdfea905f;p=ecparse.git add getRemaining method --- 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