#include <xdr.h>
Public Types | |
enum | Status { Ok = 0, ReadPastEnd, ReadCorruptData, IOError } |
Public Member Functions | |
XdrStream () | |
Create a fresh XdrStream with no QIODevice. | |
XdrStream (QIODevice *d) | |
Create an XdrStream to encode to/decode from a given QIODevice. | |
XdrStream (QByteArray *a, QIODevice::OpenMode mode) | |
Create an XdrStream and an internal QBuffer device to encode to and/or decode from a specified QByteArray. | |
XdrStream (const QByteArray &a) | |
Create a read-only XdrStream to decode from a given QByteArray. | |
QIODevice * | device () |
Return the current QIODevice that this XdrStream refers to. | |
void | setDevice (QIODevice *d) |
Change this XdrStream to encode to/decode from a different device. | |
Status | status () const |
Returns the current encoding/decoding status. | |
void | setStatus (Status st) |
Set the current encode/decode status flag. | |
void | resetStatus () |
Reset the status to the initial Ok state. | |
bool | atEnd () |
Returns true if we have read to the end of the underlying device. | |
void | readRawData (void *buf, int len) |
Read raw data from the underlying QIODevice. | |
void | skipRawData (int len) |
Skip over a given number of bytes on the underlying QIODevice. | |
void | writeRawData (const void *buf, int len) |
Write raw data to the underlying QIODevice. | |
void | readPadData (void *buf, int len) |
Read a given number of bytes of raw data, then skip 0-3 bytes to pad the raw block length to a 4-byte boundary as the XDR spec requires. | |
void | skipPadData (int len) |
Skip len bytes, rounded up to the next 4-byte boundary. | |
void | writePadData (const void *buf, int len) |
Write a specified block of raw data, followed by 0-3 zero bytes to pad the data block to a 4-byte boundary as the XDR spec requires. | |
void | readBytes (char *&s, qint32 &len) |
XDR-decode an 'opaque' field. | |
void | writeBytes (const char *s, qint32 len) |
XDR-encode an 'opaque' field. | |
XdrStream & | operator<< (bool b) |
XDR-encode a boolean. | |
XdrStream & | operator<< (qint8 i) |
Encode an 8-bit integer (XDR 'char'). | |
XdrStream & | operator<< (qint16 i) |
Encode a 16-bit integer (XDR 'short'). | |
XdrStream & | operator<< (qint32 i) |
Encode a 32-bit integer (XDR 'int'). | |
XdrStream & | operator<< (qint64 i) |
Encode a 64-bit integer (XDR 'hyper'). | |
XdrStream & | operator<< (quint8 i) |
Encode an 8-bit unsigned integer (XDR 'unsigned char'). | |
XdrStream & | operator<< (quint16 i) |
Encode a 16-bit unsigned integer (XDR 'unsigned short'). | |
XdrStream & | operator<< (quint32 i) |
Encode a 32-bit unsigned integer (XDR 'unsigned int'). | |
XdrStream & | operator<< (quint64 i) |
Encode a 64-bit unsigned integer (XDR 'unsigned hyper'). | |
XdrStream & | operator<< (float f) |
Encode a 32-bit IEEE floating-point value (XDR 'float'). | |
XdrStream & | operator<< (double f) |
Encode a 64-bit IEEE floating-point value (XDR 'double'). | |
XdrStream & | operator>> (bool &b) |
XDR-decode a boolean. | |
XdrStream & | operator>> (qint8 &i) |
Decode an 8-bit integer (XDR 'char'). | |
XdrStream & | operator>> (qint16 &i) |
Decode a 16-bit integer (XDR 'short'). | |
XdrStream & | operator>> (qint32 &i) |
Decode a 32-bit integer (XDR 'int'). | |
XdrStream & | operator>> (qint64 &i) |
Decode a 64-bit integer (XDR 'hyper'). | |
XdrStream & | operator>> (quint8 &i) |
Decode an 8-bit unsigned integer (XDR 'unsigned char'). | |
XdrStream & | operator>> (quint16 &i) |
Decode a 16-bit unsigned integer (XDR 'unsigned short'). | |
XdrStream & | operator>> (quint32 &i) |
Decode a 32-bit unsigned integer (XDR 'unsigned int'). | |
XdrStream & | operator>> (quint64 &i) |
Decode a 64-bit unsigned integer (XDR 'unsigned hyper'). | |
XdrStream & | operator>> (float &f) |
Decode a 32-bit IEEE floating-point value (XDR 'float'). | |
XdrStream & | operator>> (double &f) |
Decode a 64-bit IEEE floating-point value (XDR 'double'). | |
XdrStream & | operator>> (QByteArray &a) |
Encode a QByteArray as a variable-length XDR 'opaque' field. | |
XdrStream & | operator<< (const QByteArray &a) |
Decode a variable-length XDR 'opaque' field into a QByteArray. | |
XdrStream & | operator<< (const QString &s) |
Encode a QString as an XDR 'string' using UTF-8 encoding. | |
XdrStream & | operator>> (QString &s) |
Decode an XDR 'string' into a QString using UTF-8 encoding. | |
QString | errorString () |
Return a string describing the last encoding or decoding error that occurred, if any. |
This class provides an interface modeled on QDataStream, but uses the XDR encoding as specified in RFC 1832.
|
Create a fresh XdrStream with no QIODevice. A device must be set with setDevice() before using. |
|
Create an XdrStream to encode to/decode from a given QIODevice. The caller is responsible for ensuring that the QIODevice pointer remains valid for the lifetime of this XdrStream. |
|
XDR-decode an 'opaque' field. Allocates a new char[] array to hold the opaque data, and returns the pointer and array length in "out" parameters.
|
|
Read raw data from the underlying QIODevice. This method does not perform any XDR decoding. |
|
Skip over a given number of bytes on the underlying QIODevice. This method does not perform any XDR decoding, and it requires that the underlying device support seeking. |
|
XDR-encode an 'opaque' field.
|
|
Write raw data to the underlying QIODevice. This method does not perform any XDR encoding. |