#include <protocols.h>
Inheritance diagram for ucommon::CharacterProtocol:
Public Member Functions | |
int | getchar (void) |
Get the next character. | |
size_t | getline (String &buffer) |
Get a string as a line of input from the buffer. | |
size_t | getline (char *string, size_t size) |
Get text as a line of input from the buffer. | |
size_t | input (InputProtocol &format) |
size_t | load (StringPager *list) |
Load input to a string list. | |
size_t | print (PrintProtocol &format) |
int | putchar (int code) |
Put the next character. | |
size_t | putchars (char *string, size_t count=0) |
size_t | putline (char *string) |
Put a string as a line of output to the buffer. | |
size_t | save (StringPager *list) |
Save output from a string list. | |
Protected Member Functions | |
virtual int | _getch (void)=0 |
Get the next character. | |
virtual int | _putch (int code)=0 |
Put the next character. | |
void | putback (int code) |
Write to back buffer. | |
void | seteol (char *string) |
Set end of line marker. | |
Protected Attributes | |
int | back |
char * | eol |
This is used to access a character from some type of streaming buffer or memory object.
Definition at line 174 of file protocols.h.
virtual int ucommon::CharacterProtocol::_getch | ( | void | ) | [protected, pure virtual] |
Get the next character.
Implemented in ucommon::charmem, and ucommon::BufferProtocol.
virtual int ucommon::CharacterProtocol::_putch | ( | int | code | ) | [protected, pure virtual] |
Put the next character.
code | to put. |
Implemented in ucommon::charmem, and ucommon::BufferProtocol.
int ucommon::CharacterProtocol::getchar | ( | void | ) | [inline] |
size_t ucommon::CharacterProtocol::getline | ( | String & | buffer | ) |
Get a string as a line of input from the buffer.
The eol character(s) are used to mark the end of a line. Because the end of line character is stripped, the length of the string may be less than the actual count read. If at the end of the file buffer and unable to read more data an error occured then 0 is returned.
buffer | to save input into. |
size_t ucommon::CharacterProtocol::getline | ( | char * | string, | |
size_t | size | |||
) |
Get text as a line of input from the buffer.
The eol character(s) are used to mark the end of a line. Because the end of line character is stripped, the length of the string may be less than the actual count read. If at the end of the file buffer and unable to read more data an error occured then 0 is returned.
string | to save input into. | |
size | limit of string to save. |
size_t ucommon::CharacterProtocol::load | ( | StringPager * | list | ) |
Load input to a string list.
The string list filter method is used to control loading.
list | to load into. |
Referenced by ucommon::operator>>().
void ucommon::CharacterProtocol::putback | ( | int | code | ) | [inline, protected] |
Write to back buffer.
Mostly used for input format processing.
code | to write into backbuffer. |
Definition at line 199 of file protocols.h.
int ucommon::CharacterProtocol::putchar | ( | int | code | ) | [inline] |
Put the next character.
code | to put. |
Definition at line 227 of file protocols.h.
size_t ucommon::CharacterProtocol::putline | ( | char * | string | ) |
Put a string as a line of output to the buffer.
The eol character is appended to the end.
string | to write. |
size_t ucommon::CharacterProtocol::save | ( | StringPager * | list | ) |
Save output from a string list.
list | to save from. |
Referenced by ucommon::operator<<().
void ucommon::CharacterProtocol::seteol | ( | char * | string | ) | [inline, protected] |
Set end of line marker.
Normally this is set to cr & lf, which actually supports both lf alone and cr/lf termination of lines. However, putline() will always add the full cr/lf if this mode is used. This option only effects getline() and putline().
string | for eol for getline and putline. |
Definition at line 209 of file protocols.h.