kmail

KMail::Util Namespace Reference

Classes

class  LaterDeleter
 

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 setFromTQCString (TQByteArray &arr, const TQCString &cstr)
 
TQByteArray byteArrayFromTQCStringNoDetach (TQCString &cstr)
 
void restoreTQCString (TQCString &str)
 
void setFromByteArray (TQCString &cstr, const TQByteArray &arr)
 
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)
 
bool checkOverwrite (const KURL &url, TQWidget *w)
 

Detailed Description

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

Function Documentation

◆ append() [1/3]

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

Append a char* to a bytearray.

Trailing nul not copied.

Definition at line 151 of file util.cpp.

◆ append() [2/3]

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

Append a bytearray to a bytearray.

No trailing nuls anywhere.

Definition at line 142 of file util.cpp.

◆ append() [3/3]

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

Append a TQCString to a bytearray.

Trailing nul not copied.

Definition at line 162 of file util.cpp.

◆ ByteArray()

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

Construct a TQByteArray from a DwString.

Definition at line 120 of file util.cpp.

◆ byteArrayFromTQCStringNoDetach()

TQByteArray KMail::Util::byteArrayFromTQCStringNoDetach ( 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 122 of file util.h.

◆ crlf2lf()

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
strThe string to convert.
strLenThe length of the string to convert.
Returns
The new length of the converted string.

Definition at line 42 of file util.cpp.

◆ CString()

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

Construct a TQCString from a DwString.

Definition at line 111 of file util.cpp.

◆ dwString() [1/2]

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

Construct a DwString from a TQByteArray.

Definition at line 135 of file util.cpp.

◆ dwString() [2/2]

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

Construct a DwString from a TQCString.

Definition at line 128 of file util.cpp.

◆ lf2crlf() [1/2]

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

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

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

Definition at line 90 of file util.cpp.

◆ lf2crlf() [2/2]

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

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

Parameters
srcThe source string to convert.
Returns
The result string.

Definition at line 72 of file util.cpp.

◆ restoreTQCString()

void KMail::Util::restoreTQCString ( TQCString &  str)
inline

Restore the TQCString after byteArrayFromTQCStringNoDetach modified it.

Definition at line 134 of file util.h.

◆ setFromByteArray()

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

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

Definition at line 145 of file util.h.

◆ setFromTQCString()

void KMail::Util::setFromTQCString ( TQByteArray &  arr,
const TQCString &  cstr 
)
inline

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

Definition at line 108 of file util.h.