Aegis  4.25.D505
Public Types | Public Member Functions | Protected Member Functions | Private Attributes
input_ty Class Reference

#include <input.h>

Inheritance diagram for input_ty:
input_822wrap input_base64 input_bunzip2 input_catenate input_cpio input_crlf input_crop input_curl input_env input_file input_gunzip input_multipart input_null input_quoted_printable input_stdin input_string input_svt_checkout input_tar input_uudecode input_verify_checksum

Public Types

typedef input_typointer

Public Member Functions

virtual ~input_ty ()
 input_ty ()
ssize_t read (void *data, size_t nbytes)
void read_strictest (void *data, size_t size)
bool read_strict (void *data, size_t size)
void skip (size_t size)
void fatal_error (const char *msg)
void error (const char *msg)
bool one_line (nstring &result)
off_t ftell ()
virtual nstring name ()=0
virtual off_t length ()=0
int getch ()
void ungetc (int c)
int peek ()
virtual void keepalive ()
void pushback_transfer (input &from)
void pullback_transfer (input_ty::pointer to)
void pullback_transfer (input &to)
void unread (const void *data, size_t nbytes)
bool at_end ()
virtual bool is_remote () const
void reference_count_up ()
void reference_count_down ()
bool reference_count_valid () const

Protected Member Functions

virtual ssize_t read_inner (void *data, size_t nbytes)=0
virtual off_t ftell_inner ()=0
int getc_complicated ()
void ungetc_complicated (int c)

Private Attributes

long reference_count
unsigned char * buffer
size_t buffer_size
unsigned char * buffer_position
unsigned char * buffer_end

Detailed Description

The input_ty abstract class represent a generic input source.

Definition at line 33 of file input.h.


Member Typedef Documentation

Definition at line 36 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.)

The default constructor.


Member Function Documentation

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.

void input_ty::error ( const char *  msg)

The error method is used to report an error on an input stream.

Parameters:
msgThe error message to be printed.
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.

Parameters:
msgThe error message to be printed.
off_t input_ty::ftell ( )

The ftell method is used to determine the current buffered data position within the input.

virtual off_t input_ty::ftell_inner ( ) [protected, pure virtual]
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.

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 158 of file input.h.

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_quoted_printable, input_crlf, input_multipart, input_curl, input_bunzip2, input_crop, input_gunzip, input_uudecode, input_verify_checksum, input_822wrap, input_base64, input_cpio, and input_catenate.

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_quoted_printable, input_crlf, input_multipart, input_file, input_bunzip2, input_crop, input_gunzip, input_uudecode, input_822wrap, input_stdin, input_base64, and input_catenate.

virtual off_t input_ty::length ( ) [pure virtual]
virtual nstring input_ty::name ( ) [pure virtual]
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:
resultWhere 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.
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 189 of file input.h.

The pullback_transfer method is used by input filter classes' destructors to return unused buffeered input.

The pullback_transfer method is used by input filter classes' destructors to return unused buffeered input.

The pushback_transfer method is used by input filter classes' destructors to return unused buffeered input.

ssize_t 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:
dataWhere to put the results of the read.
nbytesThe maximum number of bytes to read.
Returns:
The actual number of bytes read, or zero for end-of-file.
virtual ssize_t 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:
dataWhere to put the results of the read.
nbytesThe maximum number of bytes to read.
Returns:
The actual number of bytes read, or zero for end-of-file.

Implemented in input_quoted_printable, input_crlf, input_multipart, input_curl, input_tar, input_file, input_bunzip2, input_crop, input_gunzip, input_uudecode, input_822wrap, input_stdin, input_base64, input_cpio, input_svt_checkout, input_null, input_string, input_catenate, input_verify_checksum, and input_env.

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:
dataWhere to put the results of the read.
sizeThe number of bytes to read.
Returns:
bool; true if data was read, false if 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:
dataWhere to put the results of the read.
sizeThe number of bytes to read.
bool input_ty::reference_count_valid ( ) const [inline]

Definition at line 249 of file input.h.

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:
sizeThe number of bytes to discard.
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 170 of file input.h.

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.

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:
dataThe base of the array of bytes to be returned.
nbytesThe number of bytes to be returned.

Field Documentation

unsigned char* input_ty::buffer [private]

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 297 of file input.h.

unsigned char* input_ty::buffer_end [private]

The buffer_end instance variable is used to remember the highwater mark of data stored in the buffer.

Definition at line 315 of file input.h.

unsigned char* input_ty::buffer_position [private]

The buffer_position instance variable is used to remember the read position of the data within the buffer.

Definition at line 309 of file input.h.

size_t input_ty::buffer_size [private]

The buffer_size instance variable is used to remember the allocation size of the dynamically allocated buffer.

Definition at line 303 of file input.h.

long input_ty::reference_count [private]

Definition at line 290 of file input.h.


The documentation for this class was generated from the following file: