mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Improve the constructors in shared buffers implementation.
This commit is contained in:
parent
bca0e1f3c6
commit
861c830bb7
@ -231,13 +231,53 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit size constructor.
|
||||
*/
|
||||
Buffer(SzType n)
|
||||
Buffer(SzType size)
|
||||
: m_Ptr(nullptr)
|
||||
, m_Cap(0)
|
||||
, m_Cur(0)
|
||||
, m_Mem(MemRef::Get())
|
||||
{
|
||||
Request(n < 8 ? 8 : n);
|
||||
Request(size < 8 ? 8 : size);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit size and cursor position constructor.
|
||||
*/
|
||||
Buffer(SzType size, SzType pos)
|
||||
: m_Ptr(nullptr)
|
||||
, m_Cap(0)
|
||||
, m_Cur(0)
|
||||
, m_Mem(MemRef::Get())
|
||||
{
|
||||
Request(size < 8 ? 8 : size);
|
||||
Move(pos);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit size and buffer constructor.
|
||||
*/
|
||||
Buffer(ConstPtr data, SzType size)
|
||||
: m_Ptr(nullptr)
|
||||
, m_Cap(0)
|
||||
, m_Cur(0)
|
||||
, m_Mem(MemRef::Get())
|
||||
{
|
||||
Request(size < 8 ? 8 : size);
|
||||
m_Cur += Write(m_Cur, data, size);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit size, data and cursor position constructor.
|
||||
*/
|
||||
Buffer(ConstPtr data, SzType size, SzType pos)
|
||||
: m_Ptr(nullptr)
|
||||
, m_Cap(0)
|
||||
, m_Cur(0)
|
||||
, m_Mem(MemRef::Get())
|
||||
{
|
||||
Request(size < 8 ? 8 : size);
|
||||
m_Cur += Write(m_Cur, data, size);
|
||||
Move(pos);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user