This is a variable length memory class. A memory is extended automatically if needed. The held initial memory is 0 byte. When data is able to be given, a memory is allocated for the first time. If internal, |\0| is always added to the terminus. You may expect this terminus, when dealing with a strings. Since it is not thread safe, please do not call the same instance from two or more threads.
MyVarMem |
---|
+GetBuffer() const size_t GetLength() const : void* |
+AddHead( const void* pAddData, size_t nDataLen) : size_t |
+Add( const void* pAddData, size_t nDataLen) : size_t |
+AddHead(MyVarMem* pH) : size_t |
+Add(MyVarMem* pH) : size_t |
+Add(const char* pszStr) : size_t |
+virtual void Clear(); virtual int IsEmpty() : void |
+operator const void*() : void* |
+operator const char*() : char* |
The allocated memory pointer is returned. If Add() and AddHead() are called,
an internal memory will be changed, and this value becomes invalid.
In this point, the reason which is not thread safe.
The data length which holds now is returned. Real Alloc size is this length +1 (terminus).
The data given is added to the head of a memory . 0 is returned when it fails.
The given data is added. 0 is returned when it fails.
All allocation memories will be cleared.
When there is no memory, it returns except zero.
const void* operator
const void* operator