libcommonc++  0.7
XDREncoder Class Reference

An encoder for XDR, the eXternal Data Representation format. More...

#include <XDREncoder.h++>

Public Member Functions

 XDREncoder (DataWriter &writer)
 Construct a new XDREncoder that will encode values to the given DataWriter. More...
 
 ~XDREncoder ()
 Destructor. More...
 
XDREncoderencode (bool v)
 Encode a boolean value. More...
 
XDREncoderencode (byte_t v)
 Encode a byte value. More...
 
XDREncoderencode (char v)
 Encode a char value. More...
 
XDREncoderencode (int16_t v)
 Encode a signed 16-bit integer value. More...
 
XDREncoderencode (uint16_t v)
 Encode an unsigned 16-bit integer value. More...
 
XDREncoderencode (int32_t v)
 Encode a signed 32-bit integer value. More...
 
XDREncoderencode (uint32_t v)
 Encode an unsigned 32-bit integer value. More...
 
XDREncoderencode (const int64_t &v)
 Encode a signed 64-bit integer value. More...
 
XDREncoderencode (const uint64_t &v)
 Encode an unsigned 64-bit integer value. More...
 
XDREncoderencode (float v)
 Encode a floating point value. More...
 
XDREncoderencode (const double &v)
 Encode a double-precision floating point value. More...
 
XDREncoderencode (const char *s, size_t maxlen=0)
 Encode a string. More...
 
XDREncoderencode (const String &s, size_t maxlen=0)
 Encode a string. More...
 
XDREncoderencode (const byte_t *v, size_t len)
 Encode a block of opaque data. More...
 
XDREncoderencode (const Variant &v)
 Encode an arbitrary Variant value. More...
 

Detailed Description

An encoder for XDR, the eXternal Data Representation format.

XDR is a scheme for encoding primitive datatypes in a platform-independent manner. For more information, see RFC 1832.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ XDREncoder()

XDREncoder ( DataWriter writer)

Construct a new XDREncoder that will encode values to the given DataWriter.

Parameters
writerThe DataWriter.

◆ ~XDREncoder()

~XDREncoder ( )

Destructor.

Member Function Documentation

◆ encode() [1/15]

XDREncoder& encode ( bool  v)
inline

Encode a boolean value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [2/15]

XDREncoder& encode ( byte_t  v)
inline

Encode a byte value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [3/15]

XDREncoder& encode ( char  v)
inline

Encode a char value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [4/15]

XDREncoder& encode ( int16_t  v)
inline

Encode a signed 16-bit integer value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [5/15]

XDREncoder& encode ( uint16_t  v)
inline

Encode an unsigned 16-bit integer value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [6/15]

XDREncoder& encode ( int32_t  v)
inline

Encode a signed 32-bit integer value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [7/15]

XDREncoder& encode ( uint32_t  v)
inline

Encode an unsigned 32-bit integer value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [8/15]

XDREncoder& encode ( const int64_t &  v)
inline

Encode a signed 64-bit integer value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [9/15]

XDREncoder& encode ( const uint64_t &  v)
inline

Encode an unsigned 64-bit integer value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [10/15]

XDREncoder& encode ( float  v)
inline

Encode a floating point value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [11/15]

XDREncoder& encode ( const double &  v)
inline

Encode a double-precision floating point value.

Parameters
vThe value to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [12/15]

XDREncoder & encode ( const char *  s,
size_t  maxlen = 0 
)

Encode a string.

Parameters
sThe character array to encode.
maxlenThe maximum number of characters to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [13/15]

XDREncoder & encode ( const String s,
size_t  maxlen = 0 
)
inline

Encode a string.

Parameters
sThe String to encode.
maxlenThe maximum number of characters to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [14/15]

XDREncoder & encode ( const byte_t v,
size_t  len 
)

Encode a block of opaque data.

Parameters
vThe byte array to encode.
lenThe number of bytes to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

◆ encode() [15/15]

XDREncoder & encode ( const Variant v)

Encode an arbitrary Variant value.

Parameters
vThe Variant to encode.
Returns
The XDREncoder.
Exceptions
IOExceptionIf an I/O error occcurs.

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