ucommon
Public Member Functions | Protected Member Functions
ucommon::bufpager Class Reference

Buffered pager for storing paged strings for character protocol. More...

#include <memory.h>

Inheritance diagram for ucommon::bufpager:
Inheritance graph
[legend]
Collaboration diagram for ucommon::bufpager:
Collaboration graph
[legend]

Public Member Functions

void add (const char *text)
 Add text to string buffer.
 bufpager (size_t page=0)
char * copy (size_t *iosize)
 Get pointer to copy character data.
char * dup (void)
 Create an output string from buffer.
size_t get (char *text, size_t size)
 Get string from buffer.
 operator bool ()
 Check if can still save into buffer.
bool operator! ()
 Check if can still save into buffer.
char * operator* ()
 Convenience operator to get text.
bufpageroperator<< (const char *text)
 Convenience operator to add to pager.
void put (const char *text, size_t size)
 Put memory string into buffer including NULL byte.
char * request (size_t *iosize)
 Request character buffer to write into directly.
void reset (void)
 Reset pager text buffer protocol.
void rewind (void)
 Rewind to start of text buffer protocol.
void set (const char *text)
 Set text of string buffer.
void update (size_t size)
 Used to complete a request method.
unsigned long used (void) const
 Get total size.

Protected Member Functions

virtual void * _alloc (size_t size)
 Allocate memory from the pager heap.

Detailed Description

Buffered pager for storing paged strings for character protocol.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 659 of file memory.h.


Member Function Documentation

virtual void* ucommon::bufpager::_alloc ( size_t  size) [protected, virtual]

Allocate memory from the pager heap.

The size of the request must be less than the size of the memory page used. This implements the memory protocol allocation method.

Parameters:
sizeof memory request.
Returns:
allocated memory or NULL if not possible.

Reimplemented from ucommon::memalloc.

void ucommon::bufpager::add ( const char *  text)

Add text to string buffer.

Parameters:
textto add.
char* ucommon::bufpager::copy ( size_t *  iosize)

Get pointer to copy character data.

The memory pointer is positioned at the next chunk automatically.

Parameters:
iosizeof data you can copy.
Returns:
to data from buffer or NULL if past end.
char* ucommon::bufpager::dup ( void  )

Create an output string from buffer.

Returns:
output string allocated.
size_t ucommon::bufpager::get ( char *  text,
size_t  size 
)

Get string from buffer.

Parameters:
textto save into.
sizeof buffer.
Returns:
count of characters copied.
ucommon::bufpager::operator bool ( ) [inline]

Check if can still save into buffer.

Used for is() function.

Returns:
true if pager can still store more.

Definition at line 778 of file memory.h.

bool ucommon::bufpager::operator! ( ) [inline]

Check if can still save into buffer.

Returns:
true if buffer is full.

Definition at line 771 of file memory.h.

char* ucommon::bufpager::operator* ( ) [inline]

Convenience operator to get text.

Returns:
text string of buffer.

Definition at line 734 of file memory.h.

Here is the call graph for this function:

bufpager& ucommon::bufpager::operator<< ( const char *  text) [inline]

Convenience operator to add to pager.

Parameters:
textto add to list.

Definition at line 741 of file memory.h.

void ucommon::bufpager::put ( const char *  text,
size_t  size 
)

Put memory string into buffer including NULL byte.

Parameters:
textto add.
sizeof text to add.
char* ucommon::bufpager::request ( size_t *  iosize)

Request character buffer to write into directly.

Parameters:
iosizemade available.
Returns:
pointer to buffer or NULL if out of memory.
void ucommon::bufpager::set ( const char *  text)

Set text of string buffer.

Parameters:
textto set.
void ucommon::bufpager::update ( size_t  size)

Used to complete a request method.

Parameters:
sizeof data actually written.
unsigned long ucommon::bufpager::used ( void  ) const [inline]

Get total size.

Returns:
number of characters in buffer.

Definition at line 727 of file memory.h.


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