From f19f813537c7aea1c20749c914e756b54a9c3cf5 Mon Sep 17 00:00:00 2001 From: Igor Pavlov <87184205+ip7z@users.noreply.github.com> Date: Mon, 27 Dec 2021 00:00:00 +0000 Subject: '21.07' --- CPP/Common/DynLimBuf.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 CPP/Common/DynLimBuf.h (limited to 'CPP/Common/DynLimBuf.h') 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 @@ +// Common/DynLimBuf.h + +#ifndef __COMMON_DYN_LIM_BUF_H +#define __COMMON_DYN_LIM_BUF_H + +#include <string.h> + +#include "../../C/Alloc.h" + +#include "MyString.h" + +class CDynLimBuf +{ + Byte *_chars; + size_t _pos; + size_t _size; + size_t _sizeLimit; + bool _error; + + CDynLimBuf(const CDynLimBuf &s); + + // ---------- forbidden functions ---------- + CDynLimBuf &operator+=(wchar_t c); + +public: + CDynLimBuf(size_t limit) throw(); + ~CDynLimBuf() { MyFree(_chars); } + + size_t Len() const { return _pos; } + bool IsError() const { return _error; } + void Empty() { _pos = 0; _error = false; } + + operator const Byte *() const { return _chars; } + // const char *Ptr() const { return _chars; } + + CDynLimBuf &operator+=(char c) throw(); + CDynLimBuf &operator+=(const char *s) throw(); +}; + + +#endif -- cgit v1.2.3-55-g6feb