ReactOS  0.4.13-dev-66-gc714b7f
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 NDEBUG
 

Functions

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

Variables

LPWSTR afxPchNil = (LPWSTR)L"\0"
 
CHStringData afxNullData = {0, 0, 0}
 
CHeap_Exception HeapException (CHeap_Exception::E_ALLOCATION_ERROR)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 28 of file chstring.cpp.

Function Documentation

◆ mbstowcsz()

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

Definition at line 75 of file chstring.cpp.

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

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

◆ operator delete()

void operator delete ( void ptr)

Definition at line 46 of file chstring.cpp.

47 {
48  // In Windows 2k3, they check for ptr being null.
49  // ISO, POSIX and even MSDN explains that it is allowed
50  // to call free with NULL pointer...
51  if (ptr)
52  {
53  free(ptr);
54  }
55 }
#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 61 of file chstring.cpp.

62 {
63  void* Buffer;
64 
65  Buffer = malloc(uSize);
66  if (!Buffer)
67  {
68  throw HeapException;
69  }
70 
71  return Buffer;
72 }
CHeap_Exception HeapException(CHeap_Exception::E_ALLOCATION_ERROR)
Definition: bufpool.h:45
#define malloc
Definition: debug_ros.c:4
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ operator+() [1/5]

CHString WINAPI operator+ ( WCHAR  ch,
const CHString string 
)

Definition at line 1337 of file chstring.cpp.

1338 {
1339  CHString NewString;
1340 
1341  // Basically concat in a new string
1342  NewString.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData);
1343 
1344  return NewString;
1345 }
void ConcatCopy(int nSrc1Len, LPCWSTR lpszSrc1Data, int nSrc2Len, LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:479
static BYTE * GetData(BYTE *pData, ULONG *pLength)
Definition: assembly.c:113

◆ operator+() [2/5]

CHString WINAPI operator+ ( const CHString string,
WCHAR  ch 
)

Definition at line 1350 of file chstring.cpp.

1351 {
1352  CHString NewString;
1353 
1354  // Basically concat in a new string
1355  NewString.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, 1, &ch);
1356 
1357  return NewString;
1358 }
void ConcatCopy(int nSrc1Len, LPCWSTR lpszSrc1Data, int nSrc2Len, LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:479
static BYTE * GetData(BYTE *pData, ULONG *pLength)
Definition: assembly.c:113

◆ operator+() [3/5]

CHString WINAPI operator+ ( const CHString string,
LPCWSTR  lpsz 
)

Definition at line 1363 of file chstring.cpp.

1364 {
1365  int Len;
1366  CHString NewString;
1367 
1368  // Get string length
1369  Len = CHString::SafeStrlen(lpsz);
1370  // And concat in new string
1371  NewString.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, Len, lpsz);
1372 
1373  return NewString;
1374 }
void ConcatCopy(int nSrc1Len, LPCWSTR lpszSrc1Data, int nSrc2Len, LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:479
#define Len
Definition: deflate.h:82
static BYTE * GetData(BYTE *pData, ULONG *pLength)
Definition: assembly.c:113
static int WINAPI SafeStrlen(LPCWSTR lpsz)
Definition: chstring.cpp:1023

◆ operator+() [4/5]

CHString WINAPI operator+ ( LPCWSTR  lpsz,
const CHString string 
)

Definition at line 1379 of file chstring.cpp.

1380 {
1381  int Len;
1382  CHString NewString;
1383 
1384  // Get string length
1385  Len = CHString::SafeStrlen(lpsz);
1386  // And concat in new string
1387  NewString.ConcatCopy(Len, lpsz, string.GetData()->nDataLength, string.m_pchData);
1388 
1389  return NewString;
1390 }
void ConcatCopy(int nSrc1Len, LPCWSTR lpszSrc1Data, int nSrc2Len, LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:479
#define Len
Definition: deflate.h:82
static BYTE * GetData(BYTE *pData, ULONG *pLength)
Definition: assembly.c:113
static int WINAPI SafeStrlen(LPCWSTR lpsz)
Definition: chstring.cpp:1023

◆ operator+() [5/5]

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

Definition at line 1395 of file chstring.cpp.

1396 {
1397  CHString NewString;
1398 
1399  // Basically concat in a new string
1400  NewString.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData,
1401  string2.GetData()->nDataLength, string2.m_pchData);
1402 
1403  return NewString;
1404 }
static CHAR string2[MAX_PATH]
Definition: automation.c:468
static CHAR string1[MAX_PATH]
Definition: asmname.c:32
void ConcatCopy(int nSrc1Len, LPCWSTR lpszSrc1Data, int nSrc2Len, LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:479

Variable Documentation

◆ afxNullData

◆ afxPchNil

◆ HeapException