Rudiments
Public Member Functions | List of all members
input Class Referenceabstract

Inherits object.

Inherited by filedescriptor, httprequest, and httpserverapi.

Public Member Functions

 input ()
 
virtual ~input ()
 
virtual off64_t setPositionRelativeToBeginning (off64_t offset)
 
virtual off64_t setPositionRelativeToCurrent (off64_t offset)
 
virtual off64_t setPositionRelativeToEnd (off64_t offset)
 
virtual off64_t getPosition ()
 
virtual ssize_t read (byte_t *buffer, size_t size)=0
 
virtual ssize_t read (char *buffer, size_t length)=0
 
virtual ssize_t read (char *buffer)=0
 
virtual ssize_t read (wchar_t *buffer, size_t length)=0
 
virtual ssize_t read (wchar_t *buffer)=0
 
virtual ssize_t readUcs2 (ucs2_t *buffer, size_t length)=0
 
virtual ssize_t readUcs2 (ucs2_t *buffer)=0
 
virtual ssize_t read (int16_t *buffer)=0
 
virtual ssize_t read (int32_t *buffer)=0
 
virtual ssize_t read (int64_t *buffer)=0
 
virtual ssize_t read (byte_t *buffer)=0
 
virtual ssize_t read (uint16_t *buffer)=0
 
virtual ssize_t read (uint32_t *buffer)=0
 
virtual ssize_t read (uint64_t *buffer)=0
 
virtual ssize_t read (float *buffer)=0
 
virtual ssize_t read (double *buffer)=0
 
ssize_t read (char **buffer, const char *terminator)
 
ssize_t read (char **buffer, const char *terminator, size_t maxbytes)
 
virtual ssize_t read (byte_t *buffer, size_t size, int32_t sec, int32_t usec)
 
virtual ssize_t read (char *buffer, size_t length, int32_t sec, int32_t usec)
 
virtual ssize_t read (char *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (wchar_t *buffer, size_t length, int32_t sec, int32_t usec)
 
virtual ssize_t read (wchar_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t readUcs2 (ucs2_t *buffer, size_t length, int32_t sec, int32_t usec)
 
virtual ssize_t readUcs2 (ucs2_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (int16_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (int32_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (int64_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (byte_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (uint16_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (uint32_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (uint64_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (float *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (double *buffer, int32_t sec, int32_t usec)
 
ssize_t read (char **buffer, const char *terminator, int32_t sec, int32_t usec)
 
ssize_t read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec)
 
ssize_t read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec)
 
- Public Member Functions inherited from object
virtual ~object ()
 

Detailed Description

The input class provides a base class for things from which input can be taken (file descriptors, files, sockets, etc.)

Constructor & Destructor Documentation

◆ input()

input::input ( )

Creates an instance of the input class.

◆ ~input()

virtual input::~input ( )
virtual

Deletes this instance of the input class.

Member Function Documentation

◆ getPosition()

off64_t input::getPosition ( )
inlinevirtual

Returns the position at which the next read will occur or -1 on failure.

This implementation of the method ignores "offset" and always returns -1, however a child class might implement this method to actually set the position.

Reimplemented in filedescriptor.

◆ read() [1/33]

virtual ssize_t input::read ( byte_t *  buffer)
pure virtual

Reads a byte from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [2/33]

virtual ssize_t input::read ( byte_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a byte from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [3/33]

virtual ssize_t input::read ( byte_t *  buffer,
size_t  size 
)
pure virtual

Reads "size" bytes from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [4/33]

virtual ssize_t input::read ( byte_t *  buffer,
size_t  size,
int32_t  sec,
int32_t  usec 
)
virtual

Reads "size" bytes from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [5/33]

ssize_t input::read ( char **  buffer,
const char *  terminator 
)
inline

Reads from the file desciptor into "buffer" until "terminator" is encountered.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read or RESULT_ERROR if an error occurred.

◆ read() [6/33]

ssize_t input::read ( char **  buffer,
const char *  terminator,
int32_t  sec,
int32_t  usec 
)
inline

Reads from the file desciptor into "buffer" until "terminator" is encountered with a timeout of "sec" seconds and "usec" microseconds.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read or RESULT_ERROR if an error occurred.

◆ read() [7/33]

ssize_t input::read ( char **  buffer,
const char *  terminator,
size_t  maxbytes 
)
inline

Reads from the file desciptor into "buffer" until "terminator" is encountered.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read, RESULT_ERROR if an error occurred or RESULT_MAX if maxbytes were read before the terminator was encountered.

Setting maxbytes to 0 disables it.

◆ read() [8/33]

ssize_t input::read ( char **  buffer,
const char *  terminator,
size_t  maxbytes,
char  escapechar,
int32_t  sec,
int32_t  usec 
)

Reads from the file desciptor into "buffer" until "terminator" is encountered, using "escapechar" as an escape character, with a timeout of "sec" seconds and "usec" microseconds.

Note that "buffer" is allocated internally and must be freed by the calling program.

Setting "escapechar" to '\0' disables it.

Returns the number of bytes that were read, RESULT_ERROR if an error occurred or RESULT_MAX if maxbytes were read before the terminator was encountered.

Setting maxbytes to 0 disables it.

◆ read() [9/33]

ssize_t input::read ( char **  buffer,
const char *  terminator,
size_t  maxbytes,
int32_t  sec,
int32_t  usec 
)
inline

Reads from the file desciptor into "buffer" until "terminator" is encountered with a timeout of "sec" seconds and "usec" microseconds.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read, RESULT_ERROR if an error occurred or RESULT_MAX if maxbytes were read before the terminator was encountered.

Setting maxbytes to 0 disables it.

◆ read() [10/33]

virtual ssize_t input::read ( char *  buffer)
pure virtual

Reads a character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [11/33]

virtual ssize_t input::read ( char *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [12/33]

virtual ssize_t input::read ( char *  buffer,
size_t  length 
)
pure virtual

Reads "length" characters from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [13/33]

virtual ssize_t input::read ( char *  buffer,
size_t  length,
int32_t  sec,
int32_t  usec 
)
virtual

Reads "length" characters from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [14/33]

virtual ssize_t input::read ( double *  buffer)
pure virtual

Reads a double-precision floating point number from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [15/33]

virtual ssize_t input::read ( double *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a double-precision floating point number from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [16/33]

virtual ssize_t input::read ( float *  buffer)
pure virtual

Reads a floating point number from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [17/33]

virtual ssize_t input::read ( float *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a floating point number from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [18/33]

virtual ssize_t input::read ( int16_t *  buffer)
pure virtual

Reads a 16-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [19/33]

virtual ssize_t input::read ( int16_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a 16-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [20/33]

virtual ssize_t input::read ( int32_t *  buffer)
pure virtual

Reads a 32-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [21/33]

virtual ssize_t input::read ( int32_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a 32-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [22/33]

virtual ssize_t input::read ( int64_t *  buffer)
pure virtual

Reads a 64-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [23/33]

virtual ssize_t input::read ( int64_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a 64-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [24/33]

virtual ssize_t input::read ( uint16_t *  buffer)
pure virtual

Reads an unsigned 16-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [25/33]

virtual ssize_t input::read ( uint16_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads an unsigned 16-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [26/33]

virtual ssize_t input::read ( uint32_t *  buffer)
pure virtual

Reads an unsigned 32-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [27/33]

virtual ssize_t input::read ( uint32_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads an unsigned 32-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [28/33]

virtual ssize_t input::read ( uint64_t *  buffer)
pure virtual

Reads an unsigned 64-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [29/33]

virtual ssize_t input::read ( uint64_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads an unsigned 64-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [30/33]

virtual ssize_t input::read ( wchar_t *  buffer)
pure virtual

Reads a character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [31/33]

virtual ssize_t input::read ( wchar_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ read() [32/33]

virtual ssize_t input::read ( wchar_t *  buffer,
size_t  length 
)
pure virtual

Reads "length" characters from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ read() [33/33]

virtual ssize_t input::read ( wchar_t *  buffer,
size_t  length,
int32_t  sec,
int32_t  usec 
)
virtual

Reads "length" characters from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ readUcs2() [1/4]

virtual ssize_t input::readUcs2 ( ucs2_t *  buffer)
pure virtual

Reads a character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ readUcs2() [2/4]

virtual ssize_t input::readUcs2 ( ucs2_t *  buffer,
int32_t  sec,
int32_t  usec 
)
virtual

Reads a character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ readUcs2() [3/4]

virtual ssize_t input::readUcs2 ( ucs2_t *  buffer,
size_t  length 
)
pure virtual

Reads "length" characters from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implemented in httprequest, and filedescriptor.

◆ readUcs2() [4/4]

virtual ssize_t input::readUcs2 ( ucs2_t *  buffer,
size_t  length,
int32_t  sec,
int32_t  usec 
)
virtual

Reads "length" characters from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

In this implementation of the method, "sec" and "usec" are ignored, however a child class might implement a timeout using them. In that case, the method would return RESULT_TIMEOUT if a timeout occurred.

Reimplemented in filedescriptor.

◆ setPositionRelativeToBeginning()

off64_t input::setPositionRelativeToBeginning ( off64_t  offset)
inlinevirtual

Sets the position (relative to the beginning of the file descriptor) at which the next read will occur to "offset". Returns that position on success or -1 on failure.

This implementation of the method ignores "offset" and always returns -1, however a child class might implement this method to actually set the position.

Reimplemented in filedescriptor.

◆ setPositionRelativeToCurrent()

off64_t input::setPositionRelativeToCurrent ( off64_t  offset)
inlinevirtual

Advances the position at which the next read will occur by "offset" bytes. Returns that position on success or -1 on failure.

This implementation of the method ignores "offset" and always returns -1, however a child class might implement this method to actually set the position.

Reimplemented in filedescriptor.

◆ setPositionRelativeToEnd()

off64_t input::setPositionRelativeToEnd ( off64_t  offset)
inlinevirtual

Sets the position at which the next read will occur to the end of the file plus "offset" bytes. Generally, "offset" will be negative. Returns the position on success or -1 on failure.

This implementation of the method ignores "offset" and always returns -1, however a child class might implement this method to actually set the position.

Reimplemented in filedescriptor.