summaryrefslogtreecommitdiff
path: root/node/Buffer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/Buffer.hpp')
-rw-r--r--node/Buffer.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/node/Buffer.hpp b/node/Buffer.hpp
index 789b835a..46924c14 100644
--- a/node/Buffer.hpp
+++ b/node/Buffer.hpp
@@ -392,6 +392,23 @@ public:
}
/**
+ * Erase something from the middle of the buffer
+ *
+ * @param start Starting position
+ * @param length Length of block to erase
+ * @throw std::out_of_range Position plus length is beyond size of buffer
+ */
+ inline void erase(const unsigned int at,const unsigned int length)
+ throw(std::out_of_range)
+ {
+ const unsigned int endr = at + length;
+ if (endr > _l)
+ throw std::out_of_range("Buffer: erase() range beyond end of buffer");
+ ::memmove(_b + at,_b + endr,_l - endr);
+ _l -= length;
+ }
+
+ /**
* Set buffer data length to zero
*/
inline void clear()