AXCEL C++ Framework
Elegance through abstraction
|
Input stream. More...
#include <axcel.h>
Public Member Functions | |
virtual string | type () |
Get type of object. | |
virtual int | getc ()=0 |
Read byte. | |
virtual char * | gets (char *s, int size=0) |
Read line to buffer. | |
virtual string | gets (int size=0) |
Read line. | |
virtual int | scanf (const char *format,...) |
Formatted input. | |
virtual size_t | read (char *ptr, size_t size, size_t nmemb) |
Read raw data. | |
virtual data | read (size_t size, size_t nmemb) |
Read raw data. | |
virtual data | dump () |
Read until EOF. | |
virtual string | drink (const char *eol=0) |
Read string until terminating sequence. | |
virtual data | suck (const char *eol, size_t len=0) |
Read raw data until terminating sequence. | |
input & | operator>> (bool &val) |
input & | operator>> (short &val) |
input & | operator>> (unsigned short &val) |
input & | operator>> (int &val) |
input & | operator>> (unsigned int &val) |
input & | operator>> (long &val) |
input & | operator>> (unsigned long &val) |
input & | operator>> (long long &val) |
input & | operator>> (unsigned long long &val) |
input & | operator>> (float &val) |
input & | operator>> (double &val) |
input & | operator>> (long double &val) |
input & | operator>> (void *&val) |
input & | operator>> (char &c) |
input & | operator>> (char *s) |
input & | operator>> (string &s) |
string axcel::io::input::drink | ( | const char * | eol = 0 | ) | [virtual] |
data axcel::io::input::dump | ( | ) | [virtual] |
Read until EOF.
Reimplemented in axcel::net::socket::tcp, and axcel::console.
virtual int axcel::io::input::getc | ( | ) | [pure virtual] |
Read byte.
Reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. Before returning from the method, one of the following methods of the stream must be called:
Implemented in axcel::data, axcel::string, axcel::fs::file, axcel::net::socket::tcp, axcel::console, and axcel::proc::pstream.
string axcel::io::input::gets | ( | int | size = 0 | ) | [virtual] |
Read line.
size | Max number of characters to read |
Unless size is 0, this method reads in at most size characters from stream and returns it as a string. Reading stops after an EOF or a '\n' character. If a '\n' character is read, it is stored into the string.
char * axcel::io::input::gets | ( | char * | s, |
int | size = 0 |
||
) | [virtual] |
Read line to buffer.
s | Buffer to store string |
size | Maximum size of buffer |
Unless size is 0, this method reads in at most one less than size characters from stream and stores them info the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer.
io::input & axcel::io::input::operator>> | ( | char * | s | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | double & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | long & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | unsigned long long & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | unsigned long & | val | ) |
Reimplemented in axcel::io::ios.
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | long long & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | unsigned int & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | bool & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | unsigned short & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | char & | c | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | float & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | long double & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | void *& | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | short & | val | ) |
Reimplemented in axcel::io::ios.
io::input & axcel::io::input::operator>> | ( | int & | val | ) |
Reimplemented in axcel::io::ios.
size_t axcel::io::input::read | ( | char * | ptr, |
size_t | size, | ||
size_t | nmemb | ||
) | [virtual] |
data axcel::io::input::read | ( | size_t | size, |
size_t | nmemb | ||
) | [virtual] |
int axcel::io::input::scanf | ( | const char * | format, |
... | |||
) | [virtual] |
Formatted input.
format | Format string |
... | Token value arguments |
Scans input according to format as described below. This format may contain conversion specifications; the results from such conversions, if any, are stored in the locations pointed to by the pointer arguments that follow format. Each pointer argument must be of a type that is appropriate for the value returned by the corresponding conversion specification.
If the number of conversion specifications in format exceeds the number of pointer arguments, the results are undefined. If the number of pointer arguments exeeds the number of conversion specifications, then the excess pointer arguments are evaluated, but are otherwise ignored.
The format string consists of a sequence of directives which describe how to process the sequence of input characters. If processing of a directive fails, no further input is read, and scanf() returns. A "failure" can be either the following: input failure, meaning that input characters were unavailable, or matching failure, meaning that the input was inappropriate (see below).
A directive is one of the following:
Each conversion specification in format begins with the character '%' followed by:
The following type modifier characters can appear in a conversion specification:
The following conversion specifiers are available:
This method returns the number of input items successfully matched and assigned, which can be fewer than provided for, or even zero in the event of an early matching failure.
The value EOF is returned if the end of input is reached before either the first successful conversion or a matrching failure occurs (see eof()). EOF is also returned if a read error occurs, in which case the error indicator for the stream is set (see dead()).
data axcel::io::input::suck | ( | const char * | eol, |
size_t | len = 0 |
||
) | [virtual] |
string axcel::io::input::type | ( | ) | [virtual] |
Get type of object.
Reimplemented from axcel::io::iob.
Reimplemented in axcel::io::ios, axcel::data, axcel::string, axcel::fs::file, axcel::net::socket::tcp, axcel::console, and axcel::proc::pstream.