[+] The missing AuByteBuffer::ByteBuffer(const MemoryViewRead &readView, ...) constructor
This commit is contained in:
parent
4e7f3ed3dd
commit
3241ebb349
@ -123,6 +123,8 @@ namespace Aurora::Memory
|
|||||||
*/
|
*/
|
||||||
inline ByteBuffer(const void *in, AuUInt length, bool circular = false, bool expandable = false);
|
inline ByteBuffer(const void *in, AuUInt length, bool circular = false, bool expandable = false);
|
||||||
|
|
||||||
|
inline ByteBuffer(const MemoryViewRead &readView, bool circular = false, bool expandable = false);
|
||||||
|
|
||||||
inline ByteBuffer(const AuList<AuUInt8> &vector, bool circular = false, bool expandable = false);
|
inline ByteBuffer(const AuList<AuUInt8> &vector, bool circular = false, bool expandable = false);
|
||||||
|
|
||||||
inline ByteBuffer(AuUInt length, bool circular = false, bool expandable = false);
|
inline ByteBuffer(AuUInt length, bool circular = false, bool expandable = false);
|
||||||
|
@ -278,7 +278,24 @@ namespace Aurora::Memory
|
|||||||
this->writePtr = this->readPtr + this->length;
|
this->writePtr = this->readPtr + this->length;
|
||||||
AuMemcpy(this->base, in, this->length);
|
AuMemcpy(this->base, in, this->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteBuffer::ByteBuffer(const MemoryViewRead &readView, bool circular, bool expandable) :
|
||||||
|
flagCircular(circular), flagExpandable(expandable), flagReadError(0), flagWriteError(0)
|
||||||
|
{
|
||||||
|
this->scaleSize = kBufferInitialPower;
|
||||||
|
this->base = readView.Size() ? ZAlloc<AuUInt8 *>(readView.Size()) : nullptr;
|
||||||
|
if (!this->base)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->length = readView.Size();
|
||||||
|
this->allocSize = this->length;
|
||||||
|
this->readPtr = this->base;
|
||||||
|
this->writePtr = this->readPtr + this->length;
|
||||||
|
AuMemcpy(this->base, readView.Begin(), this->length);
|
||||||
|
}
|
||||||
|
|
||||||
ByteBuffer::ByteBuffer(const AuList<AuUInt8> &vector, bool circular, bool expandable) :
|
ByteBuffer::ByteBuffer(const AuList<AuUInt8> &vector, bool circular, bool expandable) :
|
||||||
flagCircular(circular), flagExpandable(expandable), flagReadError(0), flagWriteError(0)
|
flagCircular(circular), flagExpandable(expandable), flagReadError(0), flagWriteError(0)
|
||||||
{
|
{
|
||||||
|
@ -336,7 +336,12 @@ namespace Aurora::Memory
|
|||||||
return reinterpret_cast<U8_t>(this->ptr) + this->length;
|
return reinterpret_cast<U8_t>(this->ptr) + this->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryView AtOffset(AuUInt uOffset)
|
AuUInt size() const
|
||||||
|
{
|
||||||
|
return this->length;
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryView AtOffset(AuUInt uOffset) const
|
||||||
{
|
{
|
||||||
if (uOffset < this->uLength)
|
if (uOffset < this->uLength)
|
||||||
{
|
{
|
||||||
@ -350,7 +355,7 @@ namespace Aurora::Memory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryView Take(AuUInt uLength)
|
MemoryView Take(AuUInt uLength) const
|
||||||
{
|
{
|
||||||
if (uLength <= this->uLength)
|
if (uLength <= this->uLength)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user