1 // Common/DynLimBuf.h 2 3 #ifndef ZIP7_INC_COMMON_DYN_LIM_BUF_H 4 #define ZIP7_INC_COMMON_DYN_LIM_BUF_H 5 6 #include <string.h> 7 8 #include "../../C/Alloc.h" 9 10 #include "MyString.h" 11 12 class CDynLimBuf 13 { 14 Byte *_chars; 15 size_t _pos; 16 size_t _size; 17 size_t _sizeLimit; 18 bool _error; 19 20 CDynLimBuf(const CDynLimBuf &s); 21 22 // ---------- forbidden functions ---------- 23 CDynLimBuf &operator+=(wchar_t c); 24 25 public: 26 CDynLimBuf(size_t limit) throw(); ~CDynLimBuf()27 ~CDynLimBuf() { MyFree(_chars); } 28 Len()29 size_t Len() const { return _pos; } IsError()30 bool IsError() const { return _error; } Empty()31 void Empty() { _pos = 0; _error = false; } 32 33 operator const Byte *() const { return _chars; } 34 // const char *Ptr() const { return _chars; } 35 36 CDynLimBuf &operator+=(char c) throw(); 37 CDynLimBuf &operator+=(const char *s) throw(); 38 }; 39 40 41 #endif 42