Add Buffer::copy_from(GWBUF*)
This makes it easier to create a Buffer from GWBUF that the API functions pass as arguments.
This commit is contained in:
@ -423,9 +423,22 @@ public:
|
|||||||
* @see Buffer::operator =
|
* @see Buffer::operator =
|
||||||
*/
|
*/
|
||||||
bool copy_from(const Buffer& rhs)
|
bool copy_from(const Buffer& rhs)
|
||||||
|
{
|
||||||
|
return copy_from(rhs.m_pBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone a GWBUF and free the current buffer
|
||||||
|
*
|
||||||
|
* @param buf Buffer to clone
|
||||||
|
*
|
||||||
|
* @return True if buffer was copied
|
||||||
|
*
|
||||||
|
* @attention Invalidates all iterators.
|
||||||
|
*/
|
||||||
|
bool copy_from(GWBUF* pBuffer)
|
||||||
{
|
{
|
||||||
bool copied = true;
|
bool copied = true;
|
||||||
GWBUF* pBuffer = rhs.m_pBuffer;
|
|
||||||
|
|
||||||
if (pBuffer)
|
if (pBuffer)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user