mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Update Buffer.hpp
This commit is contained in:
parent
cacc6c7c62
commit
608c444694
@ -148,6 +148,7 @@ public:
|
|||||||
: m_Ptr(o.m_Ptr), m_Cap(o.m_Cap), m_Cur(o.m_Cur)
|
: m_Ptr(o.m_Ptr), m_Cap(o.m_Cap), m_Cur(o.m_Cur)
|
||||||
{
|
{
|
||||||
o.m_Ptr = nullptr;
|
o.m_Ptr = nullptr;
|
||||||
|
o.m_Cap = o.m_Cur = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
@ -175,6 +176,7 @@ public:
|
|||||||
m_Cap = o.m_Cap;
|
m_Cap = o.m_Cap;
|
||||||
m_Cur = o.m_Cur;
|
m_Cur = o.m_Cur;
|
||||||
o.m_Ptr = nullptr;
|
o.m_Ptr = nullptr;
|
||||||
|
o.m_Cap = o.m_Cur = 0;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -856,6 +858,17 @@ public:
|
|||||||
m_Cur += Write(m_Cur, str, size);
|
m_Cur += Write(m_Cur, str, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Steal ownership of the internal memory buffer. Whoever gets hold of the buffer must invoke delete [] on it.
|
||||||
|
*/
|
||||||
|
SQMOD_NODISCARD Pointer Steal()
|
||||||
|
{
|
||||||
|
Pointer ptr = m_Ptr;
|
||||||
|
m_Ptr = nullptr;
|
||||||
|
m_Cap = m_Cur = 0; // Save this before calling this method
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user