UCommon
|
Buffered pager for storing paged strings for character protocol. More...
#include <memory.h>
Public Member Functions | |
void | add (const char *text) |
Add text to string buffer. More... | |
void | assign (bufpager &source) |
Assign foreign pager to us. More... | |
bufpager (size_t page=0) | |
char * | copy (size_t *iosize) |
Get pointer to copy character data. More... | |
char * | dup (void) |
Create an output string from buffer. More... | |
size_t | get (char *text, size_t size) |
Get string from buffer. More... | |
operator bool () const | |
Check if can still save into buffer. More... | |
bool | operator! () const |
Check if can still save into buffer. More... | |
char * | operator* () |
Convenience operator to get text. More... | |
bufpager & | operator<< (const char *text) |
Convenience operator to add to pager. More... | |
bufpager & | operator= (bufpager &source) |
void | put (const char *text, size_t size) |
Put memory string into buffer including NULL byte. More... | |
char * | request (size_t *iosize) |
Request character buffer to write into directly. More... | |
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. More... | |
void | update (size_t size) |
Used to complete a request method. More... | |
unsigned long | used (void) const |
Get total size. More... | |
![]() | |
void | assign (memalloc &source) |
Assign foreign pager to us. More... | |
unsigned | max (void) const |
Get the maximum number of pages that are permitted. More... | |
memalloc (size_t page=0) | |
Construct a memory pager. More... | |
memalloc & | operator= (memalloc &source) |
unsigned | pages (void) const |
Get the number of pages that have been allocated from the real heap. More... | |
void | purge (void) |
Purge all allocated memory and heap pages immediately. | |
unsigned | size (void) const |
Get the size of a memory page. More... | |
unsigned | utilization (void) const |
Determine fragmentation level of acquired heap pages. More... | |
virtual | ~memalloc () |
Destroy a memory pager. More... | |
![]() | |
int | getchar (void) |
Get the next character. More... | |
size_t | getline (char *string, size_t size) |
Get text as a line of input from the buffer. More... | |
size_t | getline (String &buffer) |
Get a string as a line of input from the buffer. More... | |
size_t | input (InputProtocol &format) |
size_t | load (StringPager *list) |
Load input to a string list. More... | |
size_t | print (const PrintProtocol &format) |
int | putchar (int code) |
Put the next character. More... | |
size_t | putchars (const char *string, size_t count=0) |
size_t | putline (const char *string) |
Put a string as a line of output to the buffer. More... | |
size_t | save (const StringPager *list) |
Save output from a string list. More... | |
Protected Member Functions | |
virtual void * | _alloc (size_t size) |
Allocate memory from the pager heap. More... | |
![]() | |
virtual void | fault (void) const |
Report runtime memory exhaustion. | |
page_t * | pager (void) |
Acquire a new page from the heap. More... | |
![]() | |
void | putback (int code) |
Write to back buffer. More... | |
void | seteol (const char *string) |
Set end of line marker. More... | |
Additional Inherited Members | |
![]() | |
unsigned | limit |
![]() | |
int | back |
const char * | eol |
Buffered pager for storing paged strings for character protocol.
|
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.
size | of memory request. |
Reimplemented from ucommon::memalloc.
void ucommon::bufpager::add | ( | const char * | text | ) |
Add text to string buffer.
text | to add. |
void ucommon::bufpager::assign | ( | bufpager & | source | ) |
Assign foreign pager to us.
This relocates the heap references to our object, clears the other object.
char* ucommon::bufpager::copy | ( | size_t * | iosize | ) |
Get pointer to copy character data.
The memory pointer is positioned at the next chunk automatically.
iosize | of data you can copy. |
char* ucommon::bufpager::dup | ( | void | ) |
Create an output string from buffer.
size_t ucommon::bufpager::get | ( | char * | text, |
size_t | size | ||
) |
Get string from buffer.
text | to save into. |
size | of buffer. |
|
inline |
|
inline |
|
inline |
|
inline |
void ucommon::bufpager::put | ( | const char * | text, |
size_t | size | ||
) |
Put memory string into buffer including NULL byte.
text | to add. |
size | of text to add. |
char* ucommon::bufpager::request | ( | size_t * | iosize | ) |
Request character buffer to write into directly.
iosize | made available. |
void ucommon::bufpager::set | ( | const char * | text | ) |
Set text of string buffer.
text | to set. |
void ucommon::bufpager::update | ( | size_t | size | ) |
Used to complete a request method.
size | of data actually written. |
|
inline |