\section{KCodecs Class Reference}
\label{classKCodecs}\index{KCodecs@{KCodecs}}
A wrapper class for the most commonly used encoding and decoding algorithms. A collection of commonly used encoding and decoding algorithms.  


{\tt \#include $<$kmdcodec.h$>$}

\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf QCString} {\bf quoted\-Printable\-Encode} (const  {\bf QByte\-Array} \&in, bool use\-CRLF=true)
\begin{CompactList}\small\item\em Encodes the given data using the quoted-printable algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf quoted\-Printable\-Encode} (const  {\bf QCString} \&str, bool use\-CRLF=true)
\item 
void {\bf quoted\-Printable\-Encode} (const  {\bf QByte\-Array} \&in, {\bf QByte\-Array} \&out, bool use\-CRLF)
\begin{CompactList}\small\item\em Encodes the given data using the quoted-printable algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf quoted\-Printable\-Decode} (const  {\bf QByte\-Array} \&in)
\begin{CompactList}\small\item\em Decodes a quoted-printable encoded string. \item\end{CompactList}\item 
{\bf QCString} {\bf quoted\-Printable\-Decode} (const  {\bf QCString} \&str)
\item 
void {\bf quoted\-Printable\-Decode} (const  {\bf QByte\-Array} \&in, {\bf QByte\-Array} \&out)
\begin{CompactList}\small\item\em Decodes a quoted-printable encoded data. \item\end{CompactList}\item 
{\bf QCString} {\bf uuencode} (const  {\bf QByte\-Array} \&in)
\begin{CompactList}\small\item\em Encodes the given data using the uuencode algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf uuencode} (const  {\bf QCString} \&str)
\item 
void {\bf uuencode} (const  {\bf QByte\-Array} \&in, {\bf QByte\-Array} \&out)
\begin{CompactList}\small\item\em Encodes the given data using the uuencode algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf uudecode} (const  {\bf QByte\-Array} \&in)
\begin{CompactList}\small\item\em Decodes the given data using the uuencode algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf uudecode} (const  {\bf QCString} \&str)
\item 
void {\bf uudecode} (const  {\bf QByte\-Array} \&in, {\bf QByte\-Array} \&out)
\begin{CompactList}\small\item\em Decodes the given data using the uudecode algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf base64Encode} (const  {\bf QByte\-Array} \&in, bool insert\-LFs=false)
\begin{CompactList}\small\item\em Encodes the given data using the base64 algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf base64Encode} (const  {\bf QCString} \&str, bool insert\-LFs=false)
\item 
void {\bf base64Encode} (const  {\bf QByte\-Array} \&in, {\bf QByte\-Array} \&out, bool insert\-LFs=false)
\begin{CompactList}\small\item\em Encodes the given data using the base64 algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf base64Decode} (const  {\bf QByte\-Array} \&in)
\begin{CompactList}\small\item\em Decodes the given data that was encoded using the base64 algorithm. \item\end{CompactList}\item 
{\bf QCString} {\bf base64Decode} (const  {\bf QCString} \&str)
\item 
void {\bf base64Decode} (const  {\bf QByte\-Array} \&in, {\bf QByte\-Array} \&out)
\begin{CompactList}\small\item\em Decodes the given data that was encoded with the base64 algorithm. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
A wrapper class for the most commonly used encoding and decoding algorithms. A collection of commonly used encoding and decoding algorithms. 

Currently there is support for encoding and decoding input using base64, uu and the quoted-printable specifications.

{\bf  Usage:}

{\bf  \small\begin{alltt}
 {\bf QCString} input = "Aladdin:open sesame";
 {\bf QCString} result = KCodecs::base64Encode(input);
 cout $<$$<$ "Result: " $<$$<$ result.data() $<$$<$ endl;\end{alltt}\normalsize 
}

{\bf \small\begin{alltt} Output should be
 Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ==
 \end{alltt}\normalsize 
}

{\bf  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 {\bf QByte\-Array} as arguments. These functions are specifically tailored for encoding and decoding binary data.}

{\bf }

{\bf \begin{Desc}
\item[Author:]Dawit Alemayehu $<${\tt adawit@kde.org}$>$ 

Rik Hemsley $<${\tt rik@kde.org}$>$ \end{Desc}
}



Definition at line 71 of file kmdcodec.h.

\subsection{Member Function Documentation}
\index{KCodecs@{KCodecs}!quotedPrintableEncode@{quotedPrintableEncode}}
\index{quotedPrintableEncode@{quotedPrintableEncode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::quoted\-Printable\-Encode (const {\bf QByte\-Array} \& {\em in}, bool {\em use\-CRLF} = true)\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e0}


Encodes the given data using the quoted-printable algorithm. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]data to be encoded. \item[{\em use\-CRLF}]if true the input data is expected to have CRLF line breaks and the output will have CRLF line breaks, too. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]quoted-printable encoded data. \end{Desc}


Definition at line 150 of file kmdcodec.cpp.

Referenced by quoted\-Printable\-Encode().\index{KCodecs@{KCodecs}!quotedPrintableEncode@{quotedPrintableEncode}}
\index{quotedPrintableEncode@{quotedPrintableEncode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::quoted\-Printable\-Encode (const {\bf QCString} \& {\em str}, bool {\em use\-CRLF} = true)\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e1}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]data to be encoded. \item[{\em use\-CRLF}]if true the input data is expected to have CRLF line breaks and the output will have CRLF line breaks, too. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]quoted-printable encoded data. \end{Desc}


Definition at line 157 of file kmdcodec.cpp.

References QCString::is\-Empty(), QCString::length(), and quoted\-Printable\-Encode().\index{KCodecs@{KCodecs}!quotedPrintableEncode@{quotedPrintableEncode}}
\index{quotedPrintableEncode@{quotedPrintableEncode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCodecs::quoted\-Printable\-Encode (const {\bf QByte\-Array} \& {\em in}, {\bf QByte\-Array} \& {\em out}, bool {\em use\-CRLF})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e2}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]data to be encoded. \item[{\em out}]decoded data. \item[{\em use\-CRLF}]if true the input data is expected to have CRLF line breaks and the output will have CRLF line breaks, too. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]quoted-printable encoded data. \end{Desc}


Definition at line 167 of file kmdcodec.cpp.

References KStd\-Accel::end().\index{KCodecs@{KCodecs}!quotedPrintableDecode@{quotedPrintableDecode}}
\index{quotedPrintableDecode@{quotedPrintableDecode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::quoted\-Printable\-Decode (const {\bf QByte\-Array} \& {\em in})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e3}


Decodes a quoted-printable encoded string. 

Accepts data with CRLF or standard unix line breaks.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the data to be decoded. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]decoded data. \end{Desc}


Definition at line 283 of file kmdcodec.cpp.

Referenced by quoted\-Printable\-Decode().\index{KCodecs@{KCodecs}!quotedPrintableDecode@{quotedPrintableDecode}}
\index{quotedPrintableDecode@{quotedPrintableDecode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::quoted\-Printable\-Decode (const {\bf QCString} \& {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e4}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the data to be decoded. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]decoded data. \end{Desc}


Definition at line 290 of file kmdcodec.cpp.

References QCString::is\-Empty(), QCString::length(), and quoted\-Printable\-Decode().\index{KCodecs@{KCodecs}!quotedPrintableDecode@{quotedPrintableDecode}}
\index{quotedPrintableDecode@{quotedPrintableDecode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCodecs::quoted\-Printable\-Decode (const {\bf QByte\-Array} \& {\em in}, {\bf QByte\-Array} \& {\em out})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e5}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]data to be encoded. \item[{\em out}]decoded data.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]quoted-printable encoded data. \end{Desc}


Definition at line 300 of file kmdcodec.cpp.\index{KCodecs@{KCodecs}!uuencode@{uuencode}}
\index{uuencode@{uuencode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::uuencode (const {\bf QByte\-Array} \& {\em in})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e6}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the data to be uuencoded \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a uuencoded data. \end{Desc}


Definition at line 556 of file kmdcodec.cpp.

Referenced by uuencode().\index{KCodecs@{KCodecs}!uuencode@{uuencode}}
\index{uuencode@{uuencode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::uuencode (const {\bf QCString} \& {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e7}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string to be uuencoded. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the encoded string. \end{Desc}


Definition at line 545 of file kmdcodec.cpp.

References QCString::is\-Empty(), QCString::length(), and uuencode().\index{KCodecs@{KCodecs}!uuencode@{uuencode}}
\index{uuencode@{uuencode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCodecs::uuencode (const {\bf QByte\-Array} \& {\em in}, {\bf QByte\-Array} \& {\em out})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e8}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the data to be uuencoded. \item[{\em out}]the container for the uudecoded data. \end{description}
\end{Desc}


Definition at line 563 of file kmdcodec.cpp.

References KStd\-Accel::end().\index{KCodecs@{KCodecs}!uudecode@{uudecode}}
\index{uudecode@{uudecode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::uudecode (const {\bf QByte\-Array} \& {\em in})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e9}


Decodes the given data using the uuencode algorithm. 

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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the data uuencoded data to be decoded. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a decoded string. \end{Desc}


Definition at line 653 of file kmdcodec.cpp.

Referenced by uudecode().\index{KCodecs@{KCodecs}!uudecode@{uudecode}}
\index{uudecode@{uudecode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::uudecode (const {\bf QCString} \& {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e10}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string to be decoded. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a uudecoded string. \end{Desc}


Definition at line 642 of file kmdcodec.cpp.

References QCString::is\-Empty(), QCString::length(), and uudecode().\index{KCodecs@{KCodecs}!uudecode@{uudecode}}
\index{uudecode@{uudecode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCodecs::uudecode (const {\bf QByte\-Array} \& {\em in}, {\bf QByte\-Array} \& {\em out})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e11}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the uuencoded-data to be decoded. \item[{\em out}]the container for the uudecoded data. \end{description}
\end{Desc}


Definition at line 660 of file kmdcodec.cpp.

References KStd\-Accel::end().\index{KCodecs@{KCodecs}!base64Encode@{base64Encode}}
\index{base64Encode@{base64Encode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::base64Encode (const {\bf QByte\-Array} \& {\em in}, bool {\em insert\-LFs} = false)\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e12}


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 {\tt insert\-LFs} is true, then there will be 76 characters or less per line.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the data to be encoded. \item[{\em insert\-LFs}]limit the number of characters per line.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a base64 encoded string. \end{Desc}


Definition at line 368 of file kmdcodec.cpp.

Referenced by KMD5::base64Digest(), and base64Encode().\index{KCodecs@{KCodecs}!base64Encode@{base64Encode}}
\index{base64Encode@{base64Encode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::base64Encode (const {\bf QCString} \& {\em str}, bool {\em insert\-LFs} = false)\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e13}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string to be encoded. \item[{\em insert\-LFs}]limit the number of characters per line. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the decoded string. \end{Desc}


Definition at line 358 of file kmdcodec.cpp.

References base64Encode(), QCString::is\-Empty(), and QCString::length().\index{KCodecs@{KCodecs}!base64Encode@{base64Encode}}
\index{base64Encode@{base64Encode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCodecs::base64Encode (const {\bf QByte\-Array} \& {\em in}, {\bf QByte\-Array} \& {\em out}, bool {\em insert\-LFs} = false)\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e14}


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 {\tt insert\-LFs} 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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the data to be encoded using base64. \item[{\em out}]the container for the encoded data. \item[{\em insert\-LFs}]limit the number of characters per line. \end{description}
\end{Desc}


Definition at line 375 of file kmdcodec.cpp.\index{KCodecs@{KCodecs}!base64Decode@{base64Decode}}
\index{base64Decode@{base64Decode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::base64Decode (const {\bf QByte\-Array} \& {\em in})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e15}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the base64-encoded data to be decoded. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the decoded data. \end{Desc}


Definition at line 457 of file kmdcodec.cpp.

Referenced by base64Decode().\index{KCodecs@{KCodecs}!base64Decode@{base64Decode}}
\index{base64Decode@{base64Decode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KCodecs::base64Decode (const {\bf QCString} \& {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e16}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the base64-encoded string. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the decoded string. \end{Desc}


Definition at line 447 of file kmdcodec.cpp.

References base64Decode(), QCString::is\-Empty(), and QCString::length().\index{KCodecs@{KCodecs}!base64Decode@{base64Decode}}
\index{base64Decode@{base64Decode}!KCodecs@{KCodecs}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCodecs::base64Decode (const {\bf QByte\-Array} \& {\em in}, {\bf QByte\-Array} \& {\em out})\hspace{0.3cm}{\tt  [static]}}\label{classKCodecs_e17}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]the encoded data to be decoded. \item[{\em out}]the container for the decoded data. \end{description}
\end{Desc}


Definition at line 464 of file kmdcodec.cpp.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kmdcodec.h\item 
kmdcodec.cpp\end{CompactItemize}
