class KCodecs

A collection of commonly used encoding and 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 there is support for encoding and decoding input using base64, uu and the quoted-printable specifications.

Useage:

The convienence functions are well suited for encoding and decoding a relatively small input.


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

 Output should be
 Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ==

QCString  quotedPrintableEncode (const QByteArray & in)

quotedPrintableEncode

[static]

Encodes the given data using the quoted-printable algorithm. Equivalent to quotedPrintableEncode(in, true).

Parameters:
indata to be encoded.

Returns: quoted-printable encoded data.

QCString  quotedPrintableEncode (const QByteArray & in, bool useCRLF)

quotedPrintableEncode

[static]

Encodes the given data using the quoted-printable algorithm.

Parameters:
indata to be encoded.
useCRLFif true the input data is expected to have CRLF line breaks and the output will have CRLF line breaks, too.

Returns: quoted-printable encoded data.

QByteArray  quotedPrintableDecode (const QCString & in)

quotedPrintableDecode

[static]

Decodes a quoted-printable encoded string. Accepts data with CRLF or standard unix line breaks

Parameters:
inthe data to be decoded.

Returns: decoded data.

QCString  uuencode ( const QByteArray& in )

uuencode

[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.

Parameters:
inthe data to be uuencoded

Returns: a uuencoded data.

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

uuencode

[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.

NOTE: the output array is always first reset for sanity and then resized appropriatly. Hence, any data that is present in the output array will be lost.

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

QCString  uuencode ( const QCString& str )

uuencode

[static]

Encodes the given string using the uuencode algorithm.

Parameters:
strthe string to be uuencoded.

Returns: a uuencoded string.

QCString  uudecode ( const QByteArray& in )

uudecode

[static]

Decodes the given data using the uuencode algorithm.

Any 'begin' and 'end' lines liks those generated by *nix utilities will automatically be ignored.

Parameters:
inthe data uuencoded data to be decoded.

Returns: the decoded data.

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

uudecode

[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.

Any 'begin' and 'end' lines liks those generated by *nix utilities will automatically be ignored.

IMPORTANT: the output array is first reset and then resized appropriately. Hence, any data that is present in the output array will be lost.

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

QCString  uudecode ( const QCString& str )

uudecode

[static]

Decodes a uuencoded string.

Parameters:
strthe string to be decoded.

Returns: a uudecoded string.

QCString  base64Encode ( const QByteArray& in, bool insertLFs )

base64Encode

[static]

Encodes the given data using the base64 algorithm.

The boolean argument determines if the encoded data is going to be restricted to 76 characters or less per line as specified by RFC 2045. If insertLFs is true, then there will be 76 characters or less per line.

Parameters:
inthe data to be encoded.
insertLFslimit the number of characters per line.

Returns: a base64 encoded data.

QCString  base64Encode ( const QByteArray& in )

base64Encode

[static]

Use base64Encode(const QByteArray&, bool) with the boolean argument set to false.

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

base64Encode

[static]

Encodes the given data using the base64 algorithm.

Use this function whenever you are dealing with very large data or a stream of data. The boolean argument determines if the encoded data is going to be restricted to 76 characters or less per line as specified by RFC 2045. If insertLFs is true, then there will be 76 characters or less per line.

NOTE: the output array is always first reset for sanity and then resized appropriatly. Hence, any data that is present in the output array will be lost.

Parameters:
inthe data to be encoded using base64.
insertLFslimit the number of characters per line.
outthe container for the encoded data.

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

base64Encode

[static]

Use base64Encode(const QByteArray&, QByteArray&, bool) with the boolean argument set to false.

QCString  base64Encode ( const QCString& str, bool insertLFs )

base64Encode

[static]

Encodes the given string using the base64 algorithm.

The boolean argument determines if the encoded data is going to be restricted to 76 characters or less per line as specified by RFC 2045. If insertLFs is true, then there will be 76 characters or less per line.

Parameters:
strthe string to be encoded.
insertLFslimit the number of characters per line.

Returns: the decoded string.

QCString  base64Encode ( const QCString& str )

base64Encode

[static]

Use base64Encode(const QCString&, bool) with the boolean argument set to false.

QCString  base64Decode ( const QByteArray& in )

base64Decode

[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 )

base64Decode

[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.

IMPORTANT: the output array is first reset and then resized appropriately. Hence, any data that is present in the output array will be lost.

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

QCString  base64Decode ( const QCString& str )

base64Decode

[static]

Decodes a string encoded with the base64 algorithm.

Parameters:
strthe base64-encoded string.

Returns: the decoded string.

QString  base64Encode ( const QString& str )

base64Encode

[static]

Encodes the QString data using the base64 algorithm.

NOTE: 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 )

base64Decode

[static]

Decodes the encoded QString data using the base64 algorithm.

NOTE: 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 )

uuencode

[static]

Encodes the QString data using the uuencode algorithm.

NOTE: 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 )

uudecode

[static]

Decodes the QString data using the uuencode algorithm.

NOTE: 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 )

encodeString

[static]

QString  decodeString ( const QString& data )

decodeString

[static]