kmail

KMail::Util Namespace Reference

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


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)
TQCString lf2crlf (const TQCString &src)
TQByteArray lf2crlf (const TQByteArray &src)
TQCString CString (const DwString &str)
TQByteArray ByteArray (const DwString &str)
DwString dwString (const TQCString &str)
DwString dwString (const TQByteArray &str)
void append (TQByteArray &that, const TQByteArray &str)
void append (TQByteArray &that, const char *str)
void append (TQByteArray &that, const TQCString &str)
void insert (TQByteArray &that, uint index, const char *s)
void setFromQCString (TQByteArray &arr, const TQCString &cstr)
TQByteArray byteArrayFromQCStringNoDetach (TQCString &cstr)
void restoreQCString (TQCString &str)
void setFromByteArray (TQCString &cstr, const TQByteArray &arr)
bool checkOverwrite (const KURL &url, TQWidget *w)

Detailed Description

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

Function Documentation

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

Append a TQCString to a bytearray.

Trailing nul not copied.

Definition at line 164 of file util.cpp.

void KMail::Util::append ( TQByteArray &  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 ( TQByteArray &  that,
const TQByteArray &  str 
)

Append a bytearray to a bytearray.

No trailing nuls anywhere.

Definition at line 144 of file util.cpp.

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

Construct a TQByteArray from a DwString.

Definition at line 122 of file util.cpp.

TQByteArray KMail::Util::byteArrayFromQCStringNoDetach ( TQCString &  cstr  )  [inline]

Creates a TQByteArray from a TQCString without detaching (duplicating the data).

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

Definition at line 124 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.

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

Construct a TQCString from a DwString.

Definition at line 113 of file util.cpp.

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

Construct a DwString from a QByteArray.

Definition at line 137 of file util.cpp.

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

Construct a DwString from a QCString.

Definition at line 130 of file util.cpp.

TQByteArray KMail::Util::lf2crlf ( const TQByteArray &  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.

TQCString KMail::Util::lf2crlf ( const TQCString &  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 ( TQCString &  str  )  [inline]

Restore the TQCString after byteArrayFromQCStringNoDetach modified it.

Definition at line 136 of file util.h.

void KMail::Util::setFromByteArray ( TQCString &  cstr,
const TQByteArray &  arr 
) [inline]

Fills a TQCString from a TQByteArray - adding the trailing null.

Definition at line 147 of file util.h.

void KMail::Util::setFromQCString ( TQByteArray &  arr,
const TQCString &  cstr 
) [inline]

Fills a TQByteArray from a TQCString - removing the trailing null.

Definition at line 110 of file util.h.