• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Static Public Member Functions | List of all members
KCodecs Class Reference

#include <kmdcodec.h>

Static Public Member Functions

static TQCString quotedPrintableEncode (const TQByteArray &in, bool useCRLF=true)
 
static TQCString quotedPrintableEncode (const TQCString &str, bool useCRLF=true)
 
static void quotedPrintableEncode (const TQByteArray &in, TQByteArray &out, bool useCRLF)
 
static TQCString quotedPrintableDecode (const TQByteArray &in)
 
static TQCString quotedPrintableDecode (const TQCString &str)
 
static void quotedPrintableDecode (const TQByteArray &in, TQByteArray &out)
 
static TQCString uuencode (const TQByteArray &in)
 
static TQCString uuencode (const TQCString &str)
 
static void uuencode (const TQByteArray &in, TQByteArray &out)
 
static TQCString uudecode (const TQByteArray &in)
 
static TQCString uudecode (const TQCString &str)
 
static void uudecode (const TQByteArray &in, TQByteArray &out)
 
static TQCString base64Encode (const TQByteArray &in, bool insertLFs=false)
 
static TQCString base64Encode (const TQCString &str, bool insertLFs=false)
 
static void base64Encode (const TQByteArray &in, TQByteArray &out, bool insertLFs=false)
 
static TQCString base64Decode (const TQByteArray &in)
 
static TQCString base64Decode (const TQCString &str)
 
static void base64Decode (const TQByteArray &in, TQByteArray &out)
 

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.

Usage:

TQCString input = "Aladdin:open sesame";
TQCString result = KCodecs::base64Encode(input);
cout << "Result: " << result.data() << endl;
KCodecs::base64Encode
static TQCString base64Encode(const TQByteArray &in, bool insertLFs=false)
Encodes the given data using the base64 algorithm.
Definition: kmdcodec.cpp:373
endl
kndbgstream & endl(kndbgstream &s)
Does nothing.
Definition: kdebug.h:583
Output should be
Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ==

The above example makes use of the convenience functions (ones that accept/return null-terminated strings) to encode/decode a string. If what you need is to encode or decode binary data, then it is highly recommended that you use the functions that take an input and output TQByteArray as arguments. These functions are specifically tailored for encoding and decoding binary data.

A collection of commonly used encoding and decoding algorithms.

Author
Dawit Alemayehu adawi.nosp@m.t@kd.nosp@m.e.org
Rik Hemsley rik@k.nosp@m.de.o.nosp@m.rg

Definition at line 74 of file kmdcodec.h.

Member Function Documentation

◆ base64Decode() [1/3]

TQCString KCodecs::base64Decode ( const TQByteArray &  in)
static

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

Parameters
indata to be decoded.
Returns
decoded string.

Definition at line 462 of file kmdcodec.cpp.

◆ base64Decode() [2/3]

void KCodecs::base64Decode ( const TQByteArray &  in,
TQByteArray &  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 which cuts down the number of copy operation that have to be performed in the process. This is also the preferred method for decoding an encoded binary data.

NOTE: the output array is first reset and then resized appropriately before use, hence, all data stored in the output array will be lost.

Parameters
indata to be decoded.
outdecoded data.

Definition at line 469 of file kmdcodec.cpp.

◆ base64Decode() [3/3]

TQCString KCodecs::base64Decode ( const TQCString &  str)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as the above functions except it accepts a null terminated string instead an array.

Parameters
strstring to be decoded.
Returns
decoded string.

Definition at line 452 of file kmdcodec.cpp.

◆ base64Encode() [1/3]

TQCString KCodecs::base64Encode ( const TQByteArray &  in,
bool  insertLFs = false 
)
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
indata to be encoded.
insertLFslimit the number of characters per line.
Returns
base64 encoded string.

Definition at line 373 of file kmdcodec.cpp.

◆ base64Encode() [2/3]

void KCodecs::base64Encode ( const TQByteArray &  in,
TQByteArray &  out,
bool  insertLFs = false 
)
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 which cuts down the number of copy operation that have to be performed in the process. This is also the preferred method for encoding binary 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 first reset and then resized appropriately before use, hence, all data stored in the output array will be lost.

Parameters
indata to be encoded.
outencoded data.
insertLFslimit the number of characters per line.

Definition at line 380 of file kmdcodec.cpp.

◆ base64Encode() [3/3]

TQCString KCodecs::base64Encode ( const TQCString &  str,
bool  insertLFs = false 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as the above functions except it accepts a null terminated string instead an array.

Parameters
strstring to be encoded.
insertLFslimit the number of characters per line.
Returns
decoded string.

Definition at line 363 of file kmdcodec.cpp.

◆ quotedPrintableDecode() [1/3]

TQCString KCodecs::quotedPrintableDecode ( const TQByteArray &  in)
static

Decodes a quoted-printable encoded data.

Accepts data with CRLF or standard unix line breaks.

Parameters
indata to be decoded.
Returns
decoded string.

Definition at line 288 of file kmdcodec.cpp.

◆ quotedPrintableDecode() [2/3]

void KCodecs::quotedPrintableDecode ( const TQByteArray &  in,
TQByteArray &  out 
)
static

Decodes a quoted-printable encoded data.

Accepts data with CRLF or standard unix line breaks. Use this function if you want the result of the decoding to be placed in another array which cuts down the number of copy operation that have to be performed in the process. This is also the preferred method for decoding an encoded binary data.

NOTE: the output array is first reset and then resized appropriately before use, hence, all data stored in the output array will be lost.

Parameters
indata to be decoded.
outdecoded data.

Definition at line 305 of file kmdcodec.cpp.

◆ quotedPrintableDecode() [3/3]

TQCString KCodecs::quotedPrintableDecode ( const TQCString &  str)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as above except it accepts a null terminated string instead an array.

Parameters
strstring to be decoded.
Returns
decoded string.

Definition at line 295 of file kmdcodec.cpp.

◆ quotedPrintableEncode() [1/3]

TQCString KCodecs::quotedPrintableEncode ( const TQByteArray &  in,
bool  useCRLF = true 
)
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 string.

Definition at line 155 of file kmdcodec.cpp.

◆ quotedPrintableEncode() [2/3]

void KCodecs::quotedPrintableEncode ( const TQByteArray &  in,
TQByteArray &  out,
bool  useCRLF 
)
static

Encodes the given data using the quoted-printable algorithm.

Use this function if you want the result of the encoding to be placed in another array which cuts down the number of copy operation that have to be performed in the process. This is also the preferred method for encoding binary data.

NOTE: the output array is first reset and then resized appropriately before use, hence, all data stored in the output array will be lost.

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

Definition at line 172 of file kmdcodec.cpp.

◆ quotedPrintableEncode() [3/3]

TQCString KCodecs::quotedPrintableEncode ( const TQCString &  str,
bool  useCRLF = true 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as above except it accepts a null terminated string instead an array.

Parameters
strstring 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 string.

Definition at line 162 of file kmdcodec.cpp.

◆ uudecode() [1/3]

TQCString KCodecs::uudecode ( const TQByteArray &  in)
static

Decodes the given data using the uudecode algorithm.

Any 'begin' and 'end' lines like those generated by the utilities in unix and unix-like OS will be automatically ignored.

Parameters
indata to be decoded.
Returns
decoded string.

Definition at line 661 of file kmdcodec.cpp.

◆ uudecode() [2/3]

void KCodecs::uudecode ( const TQByteArray &  in,
TQByteArray &  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 which cuts down the number of copy operation that have to be performed in the process. This is the preferred method for decoding binary data.

Any 'begin' and 'end' lines like those generated by the utilities in unix and unix-like OS will be automatically ignored.

NOTE: the output array is first reset and then resized appropriately before use, hence, all data stored in the output array will be lost.

Parameters
indata to be decoded.
outuudecoded data.

Definition at line 668 of file kmdcodec.cpp.

◆ uudecode() [3/3]

TQCString KCodecs::uudecode ( const TQCString &  str)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as the above functions except it accepts a null terminated string instead an array.

Parameters
strstring to be decoded.
Returns
uudecoded string.

Definition at line 650 of file kmdcodec.cpp.

◆ uuencode() [1/3]

TQCString KCodecs::uuencode ( const TQByteArray &  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.

Parameters
indata to be uuencoded
Returns
uuencoded string.

Definition at line 564 of file kmdcodec.cpp.

◆ uuencode() [2/3]

void KCodecs::uuencode ( const TQByteArray &  in,
TQByteArray &  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 operation that have to be performed in the process. This is the preffered method for encoding binary data.

NOTE: the output array is first reset and then resized appropriately before use, hence, all data stored in the output array will be lost.

Parameters
indata to be uuencoded.
outuudecoded data.

Definition at line 571 of file kmdcodec.cpp.

◆ uuencode() [3/3]

TQCString KCodecs::uuencode ( const TQCString &  str)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Same as the above functions except it accepts a null terminated string instead an array.

Parameters
strstring to be uuencoded.
Returns
encoded string.

Definition at line 553 of file kmdcodec.cpp.


The documentation for this class was generated from the following files:
  • kmdcodec.h
  • kmdcodec.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.