kmail

KMail::Util Namespace Reference


Detailed Description

The Util namespace contains a collection of helper functions use in various places.


Classes

class  LaterDeleter
 A LaterDeleter is intended to be used with the RAII ( Resource Acquisition is Initialization ) paradigm. More...

Functions

size_t crlf2lf (char *str, const size_t strLen)
QCString lf2crlf (const QCString &src)
QByteArray lf2crlf (const QByteArray &src)
QCString CString (const DwString &str)
QByteArray ByteArray (const DwString &str)
DwString dwString (const QCString &str)
DwString dwString (const QByteArray &str)
void append (QByteArray &that, const QByteArray &str)
void append (QByteArray &that, const char *str)
void append (QByteArray &that, const QCString &str)
void insert (QByteArray &that, uint index, const char *s)
void setFromQCString (QByteArray &arr, const QCString &cstr)
QByteArray byteArrayFromQCStringNoDetach (QCString &cstr)
void restoreQCString (QCString &str)
void setFromByteArray (QCString &cstr, const QByteArray &arr)

Function Documentation

void KMail::Util::append ( QByteArray &  that,
const QCString &  str 
)

Append a QCString to a bytearray.

Trailing nul not copied.

Definition at line 164 of file util.cpp.

void KMail::Util::append ( QByteArray &  that,
const char *  str 
)

Append a char* to a bytearray.

Trailing nul not copied.

Definition at line 153 of file util.cpp.

void KMail::Util::append ( QByteArray &  that,
const QByteArray &  str 
)

Append a bytearray to a bytearray.

No trailing nuls anywhere.

Definition at line 144 of file util.cpp.

QByteArray KMail::Util::ByteArray ( const DwString &  str  ) 

Construct a QByteArray from a DwString.

Definition at line 122 of file util.cpp.

QByteArray KMail::Util::byteArrayFromQCStringNoDetach ( QCString &  cstr  )  [inline]

Creates a QByteArray from a QCString without detaching (duplicating the data).

Fast, but be careful, the QCString gets modified by this; this is only good for the case where the QCString is going to be thrown away afterwards anyway.

Definition at line 116 of file util.h.

size_t KMail::Util::crlf2lf ( char *  str,
const size_t  strLen 
)

Convert all sequences of "\r\n" (carriage return followed by a line feed) to a single "\n" (line feed).

The conversion happens in place. Returns the length of the resulting string.

Parameters:
str The string to convert.
strLen The length of the string to convert.
Returns:
The new length of the converted string.

Definition at line 44 of file util.cpp.

QCString KMail::Util::CString ( const DwString &  str  ) 

Construct a QCString from a DwString.

Definition at line 113 of file util.cpp.

DwString KMail::Util::dwString ( const QByteArray &  str  ) 

Construct a DwString from a QByteArray.

Definition at line 137 of file util.cpp.

DwString KMail::Util::dwString ( const QCString &  str  ) 

Construct a DwString from a QCString.

Definition at line 130 of file util.cpp.

QByteArray KMail::Util::lf2crlf ( const QByteArray &  src  ) 

Convert "\n" line endings to "\r\n".

Parameters:
src The source string to convert. NOT null-terminated.
Returns:
The result string. NOT null-terminated.

Definition at line 92 of file util.cpp.

QCString KMail::Util::lf2crlf ( const QCString &  src  ) 

Convert "\n" line endings to "\r\n".

Parameters:
src The source string to convert.
Returns:
The result string.

Definition at line 74 of file util.cpp.

void KMail::Util::restoreQCString ( QCString &  str  )  [inline]

Restore the QCString after byteArrayFromQCStringNoDetach modified it.

Definition at line 128 of file util.h.

void KMail::Util::setFromByteArray ( QCString &  cstr,
const QByteArray &  arr 
) [inline]

Fills a QCString from a QByteArray - adding the trailing null.

Definition at line 139 of file util.h.

void KMail::Util::setFromQCString ( QByteArray &  arr,
const QCString &  cstr 
) [inline]

Fills a QByteArray from a QCString - removing the trailing null.

Definition at line 102 of file util.h.

KDE Home | KDE Accessibility Home | Description of Access Keys