class KCodecs

A collection of commonly used encoding/decoding algorithms. More...

Definition#include <kmdcodec.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Static Methods


Detailed Description

A wrapper class for the most commonly used encoding and decoding algorithms. Currently it provides encoding and decoding facilities for the base64, uuencode/uudecode and quoted-printable algorithms.

@section Useage:


 QCString input = "Aladdin:open sesame";
 QCString result = KCodecs::base64Encode( input );
 printf ( "Result: %c", result.data() );

Output should be Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ==

<u>NOTE:</u> A unit test program is available under the tests directory that exercises all the codecs provided here. You can compile the unit test program under kdelibs/kdecore/tests by doing @p "make kmdcodectest".

QCString  uuencode ( const QByteArray& in )

[static]

Encodes the given data using the uuencode algorithm.

The output is split into lines starting with the number of encoded octets in the line and ending with a newline. No line is longer than 45 octets (60 characters), excluding the line terminator.

<u>NOTE:</u> data should be just the actual data. Any 'begin' and 'end' lines such as those generated by a *nix uuencode utility must not be included.

Parameters:
inthe data to be uuencoded

Returns: a uuencoded data.

void  uuencode ( const QByteArray& in, QByteArray& out )

[static]

Encodes the given data using the uuencode algorithm.

Use this function if you want the result of the encoding to be placed in another array and cut down the number of copy opertation that have to be performed in the process.

<u>NOTE:</u> the output array is first reset and then resized to the appropriate size.

Parameters:
inthe data to be uuencoded.
outthe container for the uudecoded data.

QCString  uuencode ( const QCString& str )

[static]

Encodes the given string using the uuencode algorithm.

Parameters:
strthe string to be uuencoded.

Returns: a uuencoded string.

QCString  uudecode ( const QByteArray& in )

[static]

Decodes the given data using the uuencode algorithm.

<u>NOTE:</u> data should be just the actual data. Any 'begin' and 'end' lines such as those generated by *nix utilities must NOT be included.

Parameters:
inthe data uuencoded data to be decoded.

Returns: the decoded data.

void  uudecode ( const QByteArray& in, QByteArray& out )

[static]

Decodes the given data using the uudecode algorithm.

Use this function if you want the result of the decoding to be placed in another array and cut down the number of copy opertation that have to be performed in the process.

<u>NOTE:</u> the output array is first reset and then resized to the appropriate size.

Parameters:
inthe uuencoded-data to be decoded.
outthe container for the uudecoded data.

QCString  uudecode ( const QCString& str )

[static]

Decodes a uuencoded string.

Parameters:
strthe string to be decoded.

Returns: a uudecoded string.

QCString  quotedPrintableEncode (const QByteArray & in)

[static]

Encodes the given data using the quoted-printable algorithm.

Parameters:
indata to be encoded.

Returns: quoted-printable encoded data.

QCString  quotedPrintableEncodeUNIXLineEnds (const QByteArray &)

[static]

Encodes the given data using the quoted-printable algorithm. Use this if your data has UNIX line ends instead of \r\n.

Parameters:
indata to be encoded.

Returns: quoted-printable encoded data.

QByteArray  quotedPrintableDecode (const QCString & in)

[static]

Decodes a quoted-printable encoded string.

Parameters:
inthe data to be decoded.

Returns: decoded data.

QCString  base64Encode ( const QByteArray& in )

[static]

Encodes the given data using the base64 algorithm.

Parameters:
inthe data to be encoded.

Returns: a base64 encoded data.

void  base64Encode ( const QByteArray& in, QByteArray& out )

[static]

Encodes the given data using the base64 algorithm.

Use this function if you want the result of the encoding to be placed in another array and cut down the number of copy opertation that have to be performed in the process.

<u>NOTE:</u> the output array is first reset and then resized to the appropriate size.

Parameters:
inthe data to be encoded using base64.
outthe container for the encoded data.

QCString  base64Encode ( const QCString& str )

[static]

Encodes the given string using the base64 algorithm.

Parameters:
strthe string to be encoded.

Returns: the decoded string.

QCString  base64Decode ( const QByteArray& in )

[static]

Decodes the given data that was encoded using the base64 algorithm.

Parameters:
inthe base64-encoded data to be decoded.

Returns: the decoded data.

void  base64Decode ( const QByteArray& in, QByteArray& out )

[static]

Decodes the given data that was encoded with the base64 algorithm.

Use this function if you want the result of the decoding to be placed in another array and cut down the number of copy opertation that have to be performed in the process.

<u>NOTE:</u> the output array is first reset and then resized to the appropriate size.

Parameters:
inthe encoded data to be decoded.
outthe container for the decoded data.

QCString  base64Decode ( const QCString& str )

[static]

Decodes a string encoded with the base64 algorithm.

Parameters:
strthe base64-encoded string.

Returns: the decoded string.

QString  base64Encode ( const QString& str )

[static]

Encodes the QString data using the base64 algorithm.

<u>IMPORTANT:</u> This function is ONLY provided for convenience and backward compatability! Using it can result in an incorrectly encoded data since the conversion of the QString input to latin-1 can and will result in data loss if the input data contains non- latin1 characters. As such it is highly recommended that you avoid this function unless you are absolutely certain that your input does not contain any non-latin1 character!!

QString  base64Decode ( const QString& str )

[static]

Decodes the encoded QString data using the base64 algorithm.

<u>IMPORTANT:</u> This function is ONLY provided for convenience and backward compatability! Using it can result in an incorrectly decoded data since the conversion of the QString input to latin-1 can and will result in data loss if the input data contains non- latin1 characters. As such it is highly recommended that you avoid this function unless you are absolutely certain that your input does not contain any non-latin1 character!!

QString  uuencode ( const QString& str )

[static]

Encodes the QString data using the uuencode algorithm.

<u>IMPORTANT:</u> This function is ONLY provided for convenience and backward compatability! Using it can result in an incorrectly encoded data since the conversion of the QString input to latin-1 can and will result in data loss if the input data contains non- latin1 characters. As such it is highly recommended that you avoid this function unless you are absolutely certain that your input does not contain any non-latin1 character!!

QString  uudecode ( const QString& str )

[static]

Decodes the QString data using the uuencode algorithm.

<u>IMPORTANT:</u> This function is ONLY provided for convenience and backward compatability! Using it can result in an incorrectly decoded data since the conversion of the QString input to latin-1 can and will result in data loss if the input data contains non- latin1 characters. As such it is highly recommended that you avoid this function unless you are absolutely certain that your input does not contain any non-latin1 character!!

QString  encodeString ( const QString& data )

[static]

QString  decodeString ( const QString& data )

[static]