浏览代码

clear for buffer

Kajetan Johannes Hammerle 3 年之前
父节点
当前提交
923055a156
共有 2 个文件被更改,包括 6 次插入0 次删除
  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);
 };