aboutsummaryrefslogtreecommitdiff
path: root/CPP/Common/DynamicBuffer.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/Common/DynamicBuffer.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/CPP/Common/DynamicBuffer.h b/CPP/Common/DynamicBuffer.h
index 714be4a..b03d371 100644
--- a/CPP/Common/DynamicBuffer.h
+++ b/CPP/Common/DynamicBuffer.h
@@ -5,7 +5,7 @@
5 5
6#include <string.h> 6#include <string.h>
7 7
8#include "Common.h" 8#include "MyTypes.h"
9 9
10template <class T> class CDynamicBuffer 10template <class T> class CDynamicBuffer
11{ 11{
@@ -43,6 +43,14 @@ public:
43 operator const T *() const { return _items; } 43 operator const T *() const { return _items; }
44 ~CDynamicBuffer() { delete []_items; } 44 ~CDynamicBuffer() { delete []_items; }
45 45
46 void Free()
47 {
48 delete []_items;
49 _items = NULL;
50 _size = 0;
51 _pos = 0;
52 }
53
46 T *GetCurPtrAndGrow(size_t addSize) 54 T *GetCurPtrAndGrow(size_t addSize)
47 { 55 {
48 size_t rem = _size - _pos; 56 size_t rem = _size - _pos;
@@ -63,6 +71,6 @@ public:
63 // void Empty() { _pos = 0; } 71 // void Empty() { _pos = 0; }
64}; 72};
65 73
66typedef CDynamicBuffer<unsigned char> CByteDynamicBuffer; 74typedef CDynamicBuffer<Byte> CByteDynamicBuffer;
67 75
68#endif 76#endif