Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

mootio::mcbuffer Class Reference

Streambuf-like class for I/O on C char* buffers. More...

#include <mootBufferIO.h>

Inheritance diagram for mootio::mcbuffer:

Inheritance graph
[legend]
Collaboration diagram for mootio::mcbuffer:

Collaboration graph
[legend]
List of all members.

Public Methods

Constructors etc.
Output Methods
Utilities

Public Attributes

Static Public Attributes


Detailed Description

This class provides an API for in-memory I/O which does not resort to C++ sstream : this is a Good Thing, because:


Constructor & Destructor Documentation

mootio::mcbuffer::mcbuffer size_t    size = CB_DEFAULT_SIZE [inline]
 

Default constructor, given optional initial buffer size

mootio::mcbuffer::mcbuffer void *    data,
size_t    used,
size_t    alloc = 0,
size_t    get = CB_DEFAULT_GET
[inline]
 

Constructor from a user-specified buffer Read/write operations will be performed on this buffer as long as possible. On write overflow, a new local buffer will be allocated (which will be freed on release()). User is responsible for freeing memory associated with @data passed to this constructor.

mootio::mcbuffer::mcbuffer const micbuffer   cb [inline]
 

Copy constructor

virtual mootio::mcbuffer::~mcbuffer void    [inline, virtual]
 

Destructor


Member Function Documentation

void mootio::mcbuffer::assign const void *    data,
size_t    len
[inline]
 

Asignment to a different data buffer (always copies)

Reimplemented from mootio::micbuffer.

void mootio::mcbuffer::clear void    [inline]
 

Clear buffer

Reimplemented from mootio::micbuffer.

virtual bool mootio::mcbuffer::flush void    [inline, virtual]
 

"Flush" all data before offset() from the buffer.

Reimplemented from mootio::mostream.

virtual bool mootio::mcbuffer::putc unsigned char    c [inline, virtual]
 

Write a single byte to the buffer

Reimplemented from mootio::mostream.

virtual bool mootio::mcbuffer::puts const std::string &    s [inline, virtual]
 

Write a C++ string to the buffer

Reimplemented from mootio::mostream.

virtual bool mootio::mcbuffer::puts const char *    s [inline, virtual]
 

Write a C string to the buffer

Reimplemented from mootio::mostream.

void mootio::mcbuffer::release void    [inline]
 

Free locally allocated data buffer, if any. Implicitly calls clear()

Reimplemented from mootio::micbuffer.

bool mootio::mcbuffer::reserve size_t    size,
size_t    pad = 0
[inline]
 

Grow the buffer to fit at least @size + @pad bytes in it

virtual bool mootio::mcbuffer::vprintf const char *    fmt,
va_list &    ap
[inline, virtual]
 

printf() to the buffer, va_list version

Reimplemented from mootio::mostream.

virtual bool mootio::mcbuffer::write const char *    buf,
size_t    n
[inline, virtual]
 

Write @n bytes from @buf to the buffer

Reimplemented from mootio::mostream.


Member Data Documentation

size_t mootio::mcbuffer::cb_alloc
 

bool mootio::mcbuffer::cb_created
 

const size_t mootio::mcbuffer::CB_DEFAULT_GET = 32 [static]
 

const size_t mootio::mcbuffer::CB_DEFAULT_SIZE = 32 [static]
 

size_t mootio::mcbuffer::cb_get
 

char* mootio::mcbuffer::cb_wdata
 


The documentation for this class was generated from the following file:
Generated on Mon Sep 11 16:10:39 2006 for libmoot by doxygen1.2.18