ucommon
Data Structures | Public Member Functions
ucommon::stringpager Class Reference

String pager for storing lists of NULL terminated strings. More...

#include <memory.h>

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

Data Structures

class  member
 Member of string list. More...

Public Member Functions

void add (char *text)
 Add text to list.
void add (char **list)
 Add list to list.
stringpager::memberbegin (void)
 Get root of pager list.
void clear (void)
 Purge all members and release pager member.
unsigned count (void)
 Get the number of items in the pager string list.
char * get (unsigned item)
 Get string item from list.
void operator+= (char *text)
 Convenience operator to add to pager and auto-sort.
stringpageroperator<< (char *text)
 Convenience operator to add to pager.
char * operator[] (unsigned item)
 Return specified member from pager list.
void sort (void)
 Sort members.
 stringpager (size_t pagesize=256)
 Create a pager with a maximum page size.

Additional Inherited Members

- Protected Member Functions inherited from ucommon::memalloc
virtual void * _alloc (size_t size)
 Allocate memory from the pager heap.
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.
page_t * pager (void)
 Acquire a new page from the heap.

Detailed Description

String pager for storing lists of NULL terminated strings.

This is used for accumulating lists which can be destroyed all at once.

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

Definition at line 239 of file memory.h.

Constructor & Destructor Documentation

ucommon::stringpager::stringpager ( size_t  pagesize = 256)

Create a pager with a maximum page size.

Parameters
sizeof pager allocation pages.

Member Function Documentation

void ucommon::stringpager::add ( char *  text)

Add text to list.

Parameters
textto add.
void ucommon::stringpager::add ( char **  list)

Add list to list.

This is a list of string pointers terminated with NULL.

Parameters
listof text to add.
stringpager::member* ucommon::stringpager::begin ( void  )
inline

Get root of pager list.

This is useful for externally enumerating the list of strings.

Returns
first member of list or NULL if empty.

Definition at line 328 of file memory.h.

void ucommon::stringpager::clear ( void  )

Purge all members and release pager member.

The list can then be added to again.

unsigned ucommon::stringpager::count ( void  )
inline

Get the number of items in the pager string list.

Returns
number of items stored.

Definition at line 284 of file memory.h.

char* ucommon::stringpager::get ( unsigned  item)

Get string item from list.

This is useful when stringpager is passed as a pointer and hence inconvenient for the [] operator.

Parameters
itemto access.
Returns
pointer to text for item, or NULL if out of range.

Reimplemented in ucommon::DirPager.

void ucommon::stringpager::operator+= ( char *  text)
inline

Convenience operator to add to pager and auto-sort.

Parameters
textto add to list.

Definition at line 335 of file memory.h.

Here is the call graph for this function:

stringpager& ucommon::stringpager::operator<< ( char *  text)
inline

Convenience operator to add to pager.

Parameters
textto add to list.

Definition at line 342 of file memory.h.

Here is the call graph for this function:

char* ucommon::stringpager::operator[] ( unsigned  item)
inline

Return specified member from pager list.

This is a convenience operator.

Parameters
itemto access.
Returns
text of item or NULL if invalid.

Reimplemented in ucommon::DirPager.

Definition at line 320 of file memory.h.


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