diff options
Diffstat (limited to 'CPP/Common/DynLimBuf.h')
-rw-r--r-- | CPP/Common/DynLimBuf.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/CPP/Common/DynLimBuf.h b/CPP/Common/DynLimBuf.h new file mode 100644 index 0000000..e80a7e7 --- /dev/null +++ b/CPP/Common/DynLimBuf.h | |||
@@ -0,0 +1,41 @@ | |||
1 | // Common/DynLimBuf.h | ||
2 | |||
3 | #ifndef __COMMON_DYN_LIM_BUF_H | ||
4 | #define __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(); | ||
27 | ~CDynLimBuf() { MyFree(_chars); } | ||
28 | |||
29 | size_t Len() const { return _pos; } | ||
30 | bool IsError() const { return _error; } | ||
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 | ||