diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-06 17:56:47 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-06 17:56:47 -0700 |
| commit | 876aa0883d66340960381ec6388c55b23e5d2b5e (patch) | |
| tree | 918e1246e2cb98fe74037ff083dcceb475bc6802 /node/Buffer.hpp | |
| parent | 36db5865e7ab4ed92ede99f10835fba40e9b9fd8 (diff) | |
| parent | 477feee8a3fbc84d00c2939b5fc8a9bbf19af2ca (diff) | |
| download | infinitytier-876aa0883d66340960381ec6388c55b23e5d2b5e.tar.gz infinitytier-876aa0883d66340960381ec6388c55b23e5d2b5e.zip | |
Merge branch 'adamierymenko-dev' into netcon
Diffstat (limited to 'node/Buffer.hpp')
| -rw-r--r-- | node/Buffer.hpp | 17 |
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() |
