input_ty Class Reference
#include <input.h>
Detailed Description
The
input_ty abstract class represent a generic
input source.
Definition at line 31 of file input.h.
Constructor & Destructor Documentation
virtual input_ty::~input_ty |
( |
|
) |
[virtual] |
The destructor is used to close the given input, and delete all resources associated with it. Once this returns, the given input is no longer available for *any* use. (Think of this method as "close" if it helps.)
Member Function Documentation
long input_ty::read |
( |
void * |
data, |
|
|
size_t |
nbytes | |
|
) |
| | |
The read method is used to read buffered data from the given input stream. At most size bytes will be read into buffer. The number of bytes actually read will be returned. At end-of-file, a value <=0 will be returned, and buffer will be unchanged. All file read errors or format errors are fatal, and will cause the method to not return.
- Parameters:
-
| data | Where to put the results of the read. |
| nbytes | The maximum number of bytes to read. |
- Returns:
- The actual number of bytes read, or zero for end-of-file.
void input_ty::read_strictest |
( |
void * |
data, |
|
|
size_t |
size | |
|
) |
| | |
The read_strictest method is used to read data from the given input stream. Exactly size bytes will be read into buffer. If there are less than size bytes available, a fatal error will result.
- Parameters:
-
| data | Where to put the results of the read. |
| size | The number of bytes to read. |
bool input_ty::read_strict |
( |
void * |
data, |
|
|
size_t |
size | |
|
) |
| | |
The read_strict method is used to read data from the given input stream. Exactly size bytes will be read into buffer, or zero bytes at end-of-file. If there are less than size bytes available, a fatal error will result.
- Parameters:
-
| data | Where to put the results of the read. |
| size | The number of bytes to read. |
- Returns:
- bool; true if data was read, false if end-of-file
void input_ty::skip |
( |
size_t |
size |
) |
|
The skip method is used to read data from the given input stream and discard it. Exactly size bytes will be read. If there are less than size bytes available, a fatal error will result.
- Parameters:
-
| size | The number of bytes to discard. |
void input_ty::fatal_error |
( |
const char * |
msg |
) |
|
The fatal_error method is used to report a fatal error on an input stream. This method does not return.
bool input_ty::one_line |
( |
nstring & |
result |
) |
|
The one_line method is used to read one line from the input (up to the next newline character or end of input).
- Parameters:
-
| result | Where the text is stored. The newline is not included in the returned string. |
- Returns:
- bool; true if any text was read, false if end-of-file is reached.
The ftell method is used to determine the current buffered data position within the input.
virtual nstring input_ty::name |
( |
|
) |
[pure virtual] |
The name method is used to determine the name of the input.
Implemented in input_822wrap, input_base64, input_bunzip2, input_catenate, input_cpio, input_crlf, input_crop, input_curl, input_env, input_file, input_gunzip, input_null, input_quoted_printable, input_stdin, input_string, input_svt_checkout, input_uudecode, and input_verify_checksum.
virtual long input_ty::length |
( |
|
) |
[pure virtual] |
The length method is used to determine the length of the input. May return -1 if the length is unknown.
Implemented in input_822wrap, input_base64, input_bunzip2, input_catenate, input_cpio, input_crlf, input_crop, input_curl, input_env, input_file, input_gunzip, input_null, input_quoted_printable, input_stdin, input_string, input_svt_checkout, input_uudecode, and input_verify_checksum.
int input_ty::getch |
( |
|
) |
[inline] |
The getch method is used to get the next character from the input. Returns a value<=0 at end-of-file.
Definition at line 143 of file input.h.
void input_ty::ungetc |
( |
int |
c |
) |
[inline] |
The ungetc method is used to push back a character of input. Think of it as undoing the effects of the getch method.
Definition at line 155 of file input.h.
int input_ty::peek |
( |
|
) |
[inline] |
The peek method is used to obtain the value of the next input character, without advancing the read position.
- Returns:
- the next character, or -1 if the end of file has been reached.
Definition at line 174 of file input.h.
virtual void input_ty::keepalive |
( |
|
) |
[virtual] |
The keepalive method is used to set the SO_KEEPALIVE socket option, if the file is a socket. Does nothing otherwise.
Reimplemented in input_822wrap, input_base64, input_bunzip2, input_catenate, input_crlf, input_crop, input_file, input_gunzip, input_quoted_printable, input_stdin, and input_uudecode.
void input_ty::pushback_transfer |
( |
input & |
from |
) |
|
The pushback_transfer method is used by input filter classes' destructors to return unused buffeered input.
void input_ty::pullback_transfer |
( |
input_ty * |
to |
) |
|
The pullback_transfer method is used by input filter classes' destructors to return unused buffeered input.
void input_ty::pullback_transfer |
( |
input & |
to |
) |
|
The pullback_transfer method is used by input filter classes' destructors to return unused buffeered input.
void input_ty::unread |
( |
const void * |
data, |
|
|
size_t |
nbytes | |
|
) |
| | |
The unread method may be used to reverse the effects of the read method. The data is pushed into the buffer. Think of it as a whole bunhs of ungetc calls (backwards).
- Parameters:
-
| data | The base of the array of bytes to be returned. |
| nbytes | The number of bytes to be returned. |
bool input_ty::at_end |
( |
|
) |
|
The at_end method is used to determine whether or not this input stream is at the end of input.
virtual bool input_ty::is_remote |
( |
|
) |
const [virtual] |
The is_remote method is used to determine whether or not an input stream is from a local file or a remote source. This is only intended to be a generally informative thing, to provide information to the user, it isn't (and can't be) utterly precise.
Reimplemented in input_822wrap, input_base64, input_bunzip2, input_catenate, input_cpio, input_crlf, input_crop, input_curl, input_gunzip, input_quoted_printable, input_uudecode, and input_verify_checksum.
void input_ty::reference_count_up |
( |
|
) |
|
void input_ty::reference_count_down |
( |
|
) |
|
bool input_ty::reference_count_valid |
( |
|
) |
const [inline] |
virtual long input_ty::read_inner |
( |
void * |
data, |
|
|
size_t |
nbytes | |
|
) |
| | [protected, pure virtual] |
The read_inner method is used to read unbuffered data from the given input stream. At most nbytes bytes will be read into data. The number of bytes actually read will be returned. At end-of-file, a value <= 0 will be returned, and data will be unchanged. All file read errors or format errors are fatal, and will cause the method to not return.
- Parameters:
-
| data | Where to put the results of the read. |
| nbytes | The maximum number of bytes to read. |
- Returns:
- The actual number of bytes read, or zero for end-of-file.
Implemented in input_822wrap, input_base64, input_bunzip2, input_catenate, input_cpio, input_crlf, input_crop, input_curl, input_env, input_file, input_gunzip, input_null, input_quoted_printable, input_stdin, input_string, input_svt_checkout, input_uudecode, and input_verify_checksum.
virtual long input_ty::ftell_inner |
( |
|
) |
[protected, pure virtual] |
The ftell_inner method is used to determine the unbuffered current position within the input.
Implemented in input_822wrap, input_base64, input_bunzip2, input_catenate, input_cpio, input_crlf, input_crop, input_curl, input_env, input_file, input_gunzip, input_null, input_quoted_printable, input_stdin, input_string, input_svt_checkout, input_uudecode, and input_verify_checksum.
int input_ty::getc_complicated |
( |
|
) |
[protected] |
The getc_complicated method is used to get a character from the input. Usually users do not call this method directly, but use the getch method instead.
void input_ty::ungetc_complicated |
( |
int |
c |
) |
[protected] |
The ungetc_complicated method is used to push a character back onto an input. Usually users do not call this method directly, but use the input_ungetc macro instead.
Field Documentation
The buffer instance variable is used to remember the base of a dynamically allocated array used to buffer the data for buffered input.
Definition at line 282 of file input.h.
The buffer_size instance variable is used to remember the allocation size of the dynamically allocated buffer.
Definition at line 288 of file input.h.
The buffer_position instance variable is used to remember the read position of the data within the buffer.
Definition at line 294 of file input.h.
The buffer_end instance variable is used to remember the highwater mark of data stored in the buffer.
Definition at line 300 of file input.h.
The documentation for this class was generated from the following file: