Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TString.cpp File Reference

#include "stdafx.h"
#include "TString.h"

Go to the source code of this file.

Defines

#define TSTRING_BUFFERSIZE(length)   ((int)(sizeof(WCHAR) * length))
#define TSTRING_BUFFERLENGTHA(ansiString)   (strlen(ansiString) + 1)
#define TSTRING_BUFFERLENGTHW(unicodeString)   (wcslen(unicodeString) + 1)

Functions

TString operator+ (const TString &left, const TString &right)
TString operator+ (const TString &left, PCSTR right)
TString operator+ (const TString &left, PCWSTR right)
TString operator+ (PCSTR left, const TString &right)
TString operator+ (PCWSTR left, const TString &right)
TString operator+ (const TString &left, const WCHAR right)
TString operator+ (const TString &left, const CHAR right)
TString operator+ (const WCHAR left, const TString &right)
TString operator+ (const CHAR left, const TString &right)


Detailed Description

Definition in file TString.cpp.


Define Documentation

#define TSTRING_BUFFERLENGTHA ansiString       (strlen(ansiString) + 1)
 

Calculate the length of the given ANSI String with the terminator

Definition at line 26 of file TString.cpp.

Referenced by TString::set().

#define TSTRING_BUFFERLENGTHW unicodeString       (wcslen(unicodeString) + 1)
 

Calculate the length of the given UNICODE String with the terminator

Definition at line 31 of file TString.cpp.

Referenced by TString::memoryAlloc(), TString::set(), and TString::stringCopy().

#define TSTRING_BUFFERSIZE length       ((int)(sizeof(WCHAR) * length))
 

Calculate the size in bytes of a buffer to store a native string of length length

Definition at line 18 of file TString.cpp.

Referenced by TString::alloc(), TString::getBufferSize(), TString::memoryAlloc(), TString::set(), and TString::stringCopy().


Function Documentation

TString operator+ const TString   left,
const TString   right
 

Overloading of the + operator to perform the concatenation of two strings

Definition at line 122 of file TString.cpp.

References TString::alloc(), TString::bufferLength, TString::string, and TString::stringCopy().

00123 {
00124     // Length of right (less term) + this length (includes term)
00125     const int totalLength = left.bufferLength - 1 + right.bufferLength;
00126 
00127     TString rtrn;
00128 
00129     // Alloc sufficient memory
00130     assert( rtrn.alloc( totalLength ) );
00131 
00132     // Copy left to rtrn (inc term)
00133     assert( rtrn.stringCopy( left, left.bufferLength ) == left.bufferLength );
00134 
00135 #ifdef UNICODE
00136 
00137     wcscat( rtrn.string, right.string );
00138 
00139 #else
00140 
00141     strcat( rtrn.string, right.string );
00142 
00143 #endif
00144 
00145     return rtrn;
00146 }


Generated on Mon Mar 25 06:29:59 2002 for Window Dressing by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001