String pager for storing lists of NULL terminated strings.
More...
#include <memory.h>
Public Member Functions |
| void | add (char *text) |
| | Add text to list.
|
| void | add (char **list) |
| | Add list to list.
|
| stringpager::member * | begin (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.
|
| stringpager & | operator<< (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 |
| 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.
|
| 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.
|
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:
-
| size | of pager allocation pages. |
Member Function Documentation
| void ucommon::stringpager::add |
( |
char * |
text | ) |
|
Add text to list.
- Parameters:
-
| void ucommon::stringpager::add |
( |
char ** |
list | ) |
|
Add list to list.
This is a list of string pointers terminated with NULL.
- Parameters:
-
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:
-
- 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:
-
Definition at line 335 of file memory.h.
| stringpager& ucommon::stringpager::operator<< |
( |
char * |
text | ) |
|
|
inline |
Convenience operator to add to pager.
- Parameters:
-
Definition at line 342 of file memory.h.
| char* ucommon::stringpager::operator[] |
( |
unsigned |
item | ) |
|
|
inline |
Return specified member from pager list.
This is a convenience operator.
- Parameters:
-
- 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: