Browse Source

clear for buffer

Kajetan Johannes Hammerle 3 years ago
parent
commit
923055a156
2 changed files with 6 additions and 0 deletions
  1. 4 0
      utils/Buffer.cpp
  2. 2 0
      utils/Buffer.h

+ 4 - 0
utils/Buffer.cpp

@@ -50,4 +50,8 @@ void Buffer::swap(Buffer& other) {
     std::swap(length, other.length);
     std::swap(capacity, other.capacity);
     std::swap(buffer, other.buffer);
+}
+
+void Buffer::clear() {
+    length = 0;
 }

+ 2 - 0
utils/Buffer.h

@@ -24,6 +24,8 @@ public:
     int getLength() const;
     operator const char*() const;
 
+    void clear();
+
 private:
     void swap(Buffer& other);
 };