wibble  0.1.28
Classes | Public Member Functions | Public Attributes
wibble::sys::Buffer Class Reference

Variable-size, reference-counted memory buffer. More...

#include <buffer.h>

Inheritance diagram for wibble::sys::Buffer:
Inheritance graph
[legend]
Collaboration diagram for wibble::sys::Buffer:
Collaboration graph
[legend]

List of all members.

Classes

class  Data

Public Member Functions

 Buffer () throw ()
 Create a 0-lenght buffer.
 Buffer (size_t size)
 Create a buffer with the specified size.
 Buffer (void *buf, size_t size, bool own=true)
 Create a buffer from existing data.
 Buffer (const void *buf, size_t size)
 Create a buffer with a copy of the given data.
 Buffer (const Buffer &buf) throw ()
 ~Buffer ()
Bufferoperator= (const Buffer &buf)
void * data () throw ()
 Return a pointer to the buffer.
const void * data () const throw ()
 Return a pointer to the buffer.
size_t size () const throw ()
 Return the buffer size.
void resize (size_t newSize)
 Resize the buffer to hold exactly the specified amount of bytes.
bool operator== (const Buffer &buf) const throw ()
 Compare the contents of two buffers.
bool operator!= (const Buffer &buf) const throw ()
bool operator< (const Buffer &buf) const throw ()
 Compare the contents of two buffers.

Public Attributes

Dataitem

Detailed Description

Variable-size, reference-counted memory buffer.


Constructor & Destructor Documentation

wibble::sys::Buffer::Buffer ( ) throw () [inline]

Create a 0-lenght buffer.

wibble::sys::Buffer::Buffer ( size_t  size) [inline]

Create a buffer with the specified size.

References item, and wibble::sys::Buffer::Data::ref().

wibble::sys::Buffer::Buffer ( void *  buf,
size_t  size,
bool  own = true 
) [inline]

Create a buffer from existing data.

Parameters:
bufThe data to put in this buffer
sizeThe dimension of buf
ownIf true, take ownership of buf, else make a copy of it.

References item, and wibble::sys::Buffer::Data::ref().

wibble::sys::Buffer::Buffer ( const void *  buf,
size_t  size 
) [inline]

Create a buffer with a copy of the given data.

It will always make a copy of the contents of buf.

References item, and wibble::sys::Buffer::Data::ref().

wibble::sys::Buffer::Buffer ( const Buffer buf) throw () [inline]

References item.


Member Function Documentation

void* wibble::sys::Buffer::data ( ) throw () [inline]
const void* wibble::sys::Buffer::data ( ) const throw () [inline]

Return a pointer to the buffer.

References wibble::sys::Buffer::Data::_data, and item.

bool wibble::sys::Buffer::operator!= ( const Buffer buf) const throw () [inline]

References operator==().

bool wibble::sys::Buffer::operator< ( const Buffer buf) const throw () [inline]

Compare the contents of two buffers.

References item.

Buffer& wibble::sys::Buffer::operator= ( const Buffer buf) [inline]
bool wibble::sys::Buffer::operator== ( const Buffer buf) const throw () [inline]

Compare the contents of two buffers.

References item.

Referenced by operator!=().

void wibble::sys::Buffer::resize ( size_t  newSize) [inline]

Resize the buffer to hold exactly the specified amount of bytes.

References item, wibble::sys::Buffer::Data::ref(), wibble::sys::Buffer::Data::resize(), size(), and wibble::sys::Buffer::Data::unref().

Referenced by TestBuffer::resize().

size_t wibble::sys::Buffer::size ( ) const throw () [inline]

Member Data Documentation


The documentation for this class was generated from the following file: