PoDoFo 0.9.6
Public Member Functions | List of all members
PoDoFo::PdfRefCountedBuffer Class Reference

#include <PdfRefCountedBuffer.h>

Public Member Functions

 PdfRefCountedBuffer ()
 
 PdfRefCountedBuffer (char *pBuffer, size_t lSize)
 
 PdfRefCountedBuffer (size_t lSize)
 
 PdfRefCountedBuffer (const PdfRefCountedBuffer &rhs)
 
 ~PdfRefCountedBuffer ()
 
char * GetBuffer () const
 
size_t GetSize () const
 
void Resize (size_t lSize)
 
const PdfRefCountedBufferoperator= (const PdfRefCountedBuffer &rhs)
 
void SetTakePossesion (bool bTakePossession)
 
bool TakePossesion () const
 
bool operator== (const PdfRefCountedBuffer &rhs) const
 
bool operator< (const PdfRefCountedBuffer &rhs) const
 
bool operator> (const PdfRefCountedBuffer &rhs) const
 

Detailed Description

A reference counted buffer object which is deleted as soon as the last object having access to it is deleted.

The attached memory object can be resized.

Constructor & Destructor Documentation

◆ PdfRefCountedBuffer() [1/4]

PoDoFo::PdfRefCountedBuffer::PdfRefCountedBuffer ( )
inline

Created an empty reference counted buffer The buffer will be initialized to NULL

◆ PdfRefCountedBuffer() [2/4]

PoDoFo::PdfRefCountedBuffer::PdfRefCountedBuffer ( char *  pBuffer,
size_t  lSize 
)

Created an reference counted buffer and use an exiting buffer The buffer will be owned by this object.

Parameters
pBuffera pointer to an allocated buffer
lSizesize of the allocated buffer
See also
SetTakePossesion

◆ PdfRefCountedBuffer() [3/4]

PoDoFo::PdfRefCountedBuffer::PdfRefCountedBuffer ( size_t  lSize)
inline

Create a new PdfRefCountedBuffer.

Parameters
lSizebuffer size

◆ PdfRefCountedBuffer() [4/4]

PoDoFo::PdfRefCountedBuffer::PdfRefCountedBuffer ( const PdfRefCountedBuffer rhs)
inline

Copy an existing PdfRefCountedBuffer and increase the reference count

Parameters
rhsthe PdfRefCountedBuffer to copy

◆ ~PdfRefCountedBuffer()

PoDoFo::PdfRefCountedBuffer::~PdfRefCountedBuffer ( )
inline

Decrease the reference count and delete the buffer if this is the last owner

Member Function Documentation

◆ GetBuffer()

char * PoDoFo::PdfRefCountedBuffer::GetBuffer ( ) const
inline

Get access to the buffer

Returns
the buffer

◆ GetSize()

size_t PoDoFo::PdfRefCountedBuffer::GetSize ( ) const
inline

Return the buffer size.

Returns
the buffer size

◆ operator<()

bool PoDoFo::PdfRefCountedBuffer::operator< ( const PdfRefCountedBuffer rhs) const

Compare to buffers.

Parameters
rhscompare to this buffer
Returns
true if this buffer is lexically smaller than rhs

◆ operator=()

const PdfRefCountedBuffer & PoDoFo::PdfRefCountedBuffer::operator= ( const PdfRefCountedBuffer rhs)

Copy an existing PdfRefCountedBuffer and increase the reference count

Parameters
rhsthe PdfRefCountedBuffer to copy
Returns
the copied object

◆ operator==()

bool PoDoFo::PdfRefCountedBuffer::operator== ( const PdfRefCountedBuffer rhs) const

Compare to buffers.

Parameters
rhscompare to this buffer
Returns
true if both buffers contain the same contents

◆ operator>()

bool PoDoFo::PdfRefCountedBuffer::operator> ( const PdfRefCountedBuffer rhs) const

Compare to buffers.

Parameters
rhscompare to this buffer
Returns
true if this buffer is lexically greater than rhs

◆ Resize()

void PoDoFo::PdfRefCountedBuffer::Resize ( size_t  lSize)
inline

Resize the buffer to hold at least lSize bytes.

Parameters
lSizethe size of bytes the buffer can at least hold

If the buffer is larger no operation is performed.

◆ SetTakePossesion()

void PoDoFo::PdfRefCountedBuffer::SetTakePossesion ( bool  bTakePossession)
inline

If the PdfRefCountedBuffer has no possession on its buffer, it won't delete the buffer. By default the buffer is owned and deleted by the PdfRefCountedBuffer object.

Parameters
bTakePossessionif false the buffer will not be deleted.

◆ TakePossesion()

bool PoDoFo::PdfRefCountedBuffer::TakePossesion ( ) const
inline
Returns
true if the buffer is owned by the PdfRefCountedBuffer and is deleted along with it.