4 : content(NULL), contentSize(v_size), padding(v_padding),
14 : content(NULL), contentSize(v_size), padding(v_padding),
21 ::memcpy(this->
content, v_content, v_size);
25 : content(NULL), contentSize(0), padding(0),
28 if (v_parent == NULL)
throw BufferException(
"Cannot make subBuffer for NULL buffer!");
33 bufsize_t copySize = v_size < parentSize ? v_size : parentSize;
34 bufsize_t allocSize = v_size > parentSize ? v_size : parentSize;
36 BYTE *bContent = v_parent->
getContentAt(v_offset, copySize);
37 if (bContent == NULL)
throw BufferException(
"Cannot make Buffer for NULL content!");
42 ::memcpy(this->
content, bContent, copySize);
49 BYTE*
content =
new (std::nothrow) BYTE[allocSize];
51 throw BufferException(
"Cannot allocate buffer of size: 0x" + QString::number(allocSize, 16));
53 ::memset(
content, 0, allocSize);
61 BYTE *newContent = NULL;
67 if (!newContent)
return false;
69 BYTE *oldContent = this->
content;
71 bufsize_t copySize = newSize < oldSize ? newSize : oldSize;
73 ::memcpy(newContent, oldContent, copySize);
virtual bufsize_t getContentSize()=0
virtual BYTE * getContentAt(offset_t offset, bufsize_t size, bool allowExceptions=false)
ByteBuffer(bufsize_t v_size, bufsize_t padding=DEFAULT_PADDING)
BYTE * allocContent(bufsize_t v_size, bufsize_t padding)
virtual bool resize(bufsize_t newSize)