ReactOS 0.4.15-dev-7942-gd23573b
chstring.cpp File Reference
#include <chstring.h>
#include <debug.h>
Include dependency graph for chstring.cpp:

Go to the source code of this file.

Macros

#define CHSTRING_BUILD
 
#define NDEBUG
 

Functions

void operator delete (void *ptr)
 
voidoperator new (size_t uSize)
 
int mbstowcsz (LPWSTR lpDest, LPCSTR lpSrc, int nLen)
 
CHString WINAPI operator+ (CHSTRING_WCHAR ch, const CHString &string)
 
CHString WINAPI operator+ (const CHString &string, CHSTRING_WCHAR ch)
 
CHString WINAPI operator+ (const CHString &string, CHSTRING_LPCWSTR lpsz)
 
CHString WINAPI operator+ (CHSTRING_LPCWSTR lpsz, const CHString &string)
 
CHString WINAPI operator+ (const CHString &string1, const CHString &string2)
 

Variables

CHSTRING_WCHAR afxPchNil [1] = {0}
 
CHStringData afxNullData = {0, 0, 0}
 
CHeap_Exception HeapException (CHeap_Exception::E_ALLOCATION_ERROR)
 

Macro Definition Documentation

◆ CHSTRING_BUILD

#define CHSTRING_BUILD

Definition at line 27 of file chstring.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 30 of file chstring.cpp.

Function Documentation

◆ mbstowcsz()

int mbstowcsz ( LPWSTR  lpDest,
LPCSTR  lpSrc,
int  nLen 
)

Definition at line 77 of file chstring.cpp.

78{
79 int Conv;
80
81 // If we have nothing to convert or if output doesn't exist, return
82 if (nLen == 0 || lpDest == 0)
83 {
84 return 0;
85 }
86
87 // Then, simply convert
88 Conv = MultiByteToWideChar(CP_ACP, 0, lpSrc, -1, lpDest, nLen);
89 // In case of conversion success, null terminate the string
90 if (Conv != 0)
91 {
92 lpDest[nLen] = 0;
93 }
94
95 return Conv;
96}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110

Referenced by CHString::CHString(), and CHString::operator=().

◆ operator delete()

void operator delete ( void ptr)
noexcept

Definition at line 48 of file chstring.cpp.

49{
50 // In Windows 2k3, they check for ptr being null.
51 // ISO, POSIX and even MSDN explains that it is allowed
52 // to call free with NULL pointer...
53 if (ptr)
54 {
55 free(ptr);
56 }
57}
#define free
Definition: debug_ros.c:5
static PVOID ptr
Definition: dispmode.c:27

◆ operator new()

void * operator new ( size_t  uSize)

Definition at line 63 of file chstring.cpp.

64{
65 void* Buffer;
66
67 Buffer = malloc(uSize);
68 if (!Buffer)
69 {
70 throw HeapException;
71 }
72
73 return Buffer;
74}
CHeap_Exception HeapException(CHeap_Exception::E_ALLOCATION_ERROR)
Definition: bufpool.h:45
#define malloc
Definition: debug_ros.c:4

◆ operator+() [1/5]

Definition at line 1398 of file chstring.cpp.

1399{
1400 int Len;
1401 CHString NewString;
1402
1403 // Get string length
1404 Len = CHString::SafeStrlen(lpsz);
1405 // And concat in new string
1406 NewString.ConcatCopy(Len, lpsz, string.GetData()->nDataLength, string.m_pchData);
1407
1408 return NewString;
1409}
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:490
static int WINAPI SafeStrlen(CHSTRING_LPCWSTR lpsz)
Definition: chstring.cpp:1042
#define Len
Definition: deflate.h:82
static BYTE * GetData(BYTE *pData, ULONG *pLength)
Definition: assembly.c:114

◆ operator+() [2/5]

Definition at line 1356 of file chstring.cpp.

1357{
1358 CHString NewString;
1359
1360 // Basically concat in a new string
1361 NewString.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData);
1362
1363 return NewString;
1364}

◆ operator+() [3/5]

Definition at line 1382 of file chstring.cpp.

1383{
1384 int Len;
1385 CHString NewString;
1386
1387 // Get string length
1388 Len = CHString::SafeStrlen(lpsz);
1389 // And concat in new string
1390 NewString.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, Len, lpsz);
1391
1392 return NewString;
1393}

◆ operator+() [4/5]

Definition at line 1369 of file chstring.cpp.

1370{
1371 CHString NewString;
1372
1373 // Basically concat in a new string
1374 NewString.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, 1, &ch);
1375
1376 return NewString;
1377}

◆ operator+() [5/5]

CHString WINAPI operator+ ( const CHString string1,
const CHString string2 
)

Definition at line 1414 of file chstring.cpp.

1415{
1416 CHString NewString;
1417
1418 // Basically concat in a new string
1419 NewString.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData,
1420 string2.GetData()->nDataLength, string2.m_pchData);
1421
1422 return NewString;
1423}
static CHAR string1[MAX_PATH]
Definition: asmname.c:32
static CHAR string2[MAX_PATH]
Definition: automation.c:449

Variable Documentation

◆ afxNullData

◆ afxPchNil

◆ HeapException