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)
void commit (size_t size)
char * copy (size_t *iosize)
char * dup (void)
 Create an output string from buffer.
size_t get (char *text, size_t size)
 Get string from buffer.
unsigned long getUsed (void)
 Get total size.
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.
void release (void)
char * request (size_t *iosize)
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.
- Public Member Functions inherited from ucommon::memalloc
unsigned getAlloc (void)
 Get the size of a memory page.
unsigned getLimit (void)
 Get the maximum number of pages that are permitted.
unsigned getPages (void)
 Get the number of pages that have been allocated from the real heap.
 memalloc (size_t page=0)
 Construct a memory pager.
void purge (void)
 Purge all allocated memory and heap pages immediately.
unsigned utilization (void)
 Determine fragmentation level of acquired heap pages.
virtual ~memalloc ()
 Destroy a memory pager.
- Public Member Functions inherited from ucommon::MemoryProtocol
void * alloc (size_t size)
 Convenience function.
char * dup (const char *string)
 Duplicate NULL terminated string into allocated memory.
void * dup (void *memory, size_t size)
 Duplicate existing memory block into allocated memory.
void * zalloc (size_t size)
 Allocate memory from the pager heap.
- Public Member Functions inherited from ucommon::CharacterProtocol
int get (void)
 Get the next character.
int put (int code)
 Put the next character.

Protected Member Functions

virtual void * _alloc (size_t size)
 Allocate memory from the pager heap.
- Protected Member Functions inherited from ucommon::memalloc
page_t * pager (void)
 Acquire a new page from the heap.
- Protected Member Functions inherited from ucommon::MemoryProtocol
virtual void * _alloc (size_t size)=0
 Protocol to allocate memory from the pager heap.
virtual void _lock (void)
virtual void _unlock (void)
- Protected Member Functions inherited from ucommon::CharacterProtocol
virtual int _getch (void)=0
 Get the next character.
virtual int _putch (int code)=0
 Put the next character.

Additional Inherited Members

- Protected Attributes inherited from ucommon::memalloc
unsigned limit

Detailed Description

Buffered pager for storing paged strings for character protocol.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 597 of file memory.h.

Member Function Documentation

virtual void* ucommon::bufpager::_alloc ( size_t  size)
protectedvirtual

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::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.
unsigned long ucommon::bufpager::getUsed ( void  )
inline

Get total size.

Returns
number of characters in buffer.

Definition at line 664 of file memory.h.

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

Convenience operator to get text.

Returns
text string of buffer.

Definition at line 671 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 678 of file memory.h.

Here is the call graph for this function:

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.
void ucommon::bufpager::set ( const char *  text)

Set text of string buffer.

Parameters
textto set.

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