ReactOS  0.4.15-dev-3324-gda4e15f
CHString Class Reference

#include <chstring.h>

Inheritance diagram for CHString:

Public Member Functions

 CHString ()
 
 CHString (CHSTRING_WCHAR ch, int nRepeat=1)
 
 CHString (CHSTRING_LPCWSTR lpsz)
 
 CHString (CHSTRING_LPCWSTR lpch, int nLength)
 
 CHString (LPCSTR lpsz)
 
 CHString (const CHString &stringSrc)
 
 CHString (const unsigned char *lpsz)
 
 ~CHString ()
 
CHSTRING_LPWSTR AllocSysString () const
 
int Collate (CHSTRING_LPCWSTR lpsz) const
 
int Collate (const wchar_t *lpsz) const
 
int Compare (CHSTRING_LPCWSTR lpsz) const
 
int Compare (const wchar_t *lpsz) const
 
int CompareNoCase (CHSTRING_LPCWSTR lpsz) const
 
int CompareNoCase (const wchar_t *lpsz) const
 
void Empty ()
 
int Find (CHSTRING_WCHAR ch) const
 
int Find (CHSTRING_LPCWSTR lpszSub) const
 
int Find (const wchar_t *lpszSub) const
 
int FindOneOf (CHSTRING_LPCWSTR lpszCharSet) const
 
int FindOneOf (const wchar_t *lpszCharSet) const
 
void Format (UINT nFormatID,...)
 
void Format (CHSTRING_LPCWSTR lpszFormat,...)
 
template<typename ... Params>
void Format (const wchar_t *lpszFormat, Params &&... params)
 
void FormatMessageW (UINT nFormatID,...)
 
void FormatMessageW (CHSTRING_LPCWSTR lpszFormat,...)
 
template<typename ... Params>
void FormatMessageW (const wchar_t *lpszFormat, Params &&... params)
 
void FormatV (CHSTRING_LPCWSTR lpszFormat, va_list argList)
 
void FormatV (const wchar_t *lpszFormat, va_list argList)
 
void FreeExtra ()
 
int GetAllocLength () const
 
CHSTRING_WCHAR GetAt (int nIndex) const
 
CHSTRING_LPWSTR GetBuffer (int nMinBufLength)
 
CHSTRING_LPWSTR GetBufferSetLength (int nNewLength)
 
int GetLength () const
 
BOOL IsEmpty () const
 
CHString Left (int nCount) const
 
int LoadStringW (UINT nID)
 
CHSTRING_LPWSTR LockBuffer ()
 
void MakeLower ()
 
void MakeReverse ()
 
void MakeUpper ()
 
CHString Mid (int nFirst) const
 
CHString Mid (int nFirst, int nCount) const
 
void ReleaseBuffer (int nNewLength=-1)
 
int ReverseFind (CHSTRING_WCHAR ch) const
 
CHString Right (int nCount) const
 
void SetAt (int nIndex, CHSTRING_WCHAR ch)
 
CHString SpanExcluding (CHSTRING_LPCWSTR lpszCharSet) const
 
CHString SpanExcluding (const wchar_t *lpszCharSet) const
 
CHString SpanIncluding (CHSTRING_LPCWSTR lpszCharSet) const
 
CHString SpanIncluding (const wchar_t *lpszCharSet) const
 
void TrimLeft ()
 
void TrimRight ()
 
void UnlockBuffer ()
 
const CHStringoperator= (char ch)
 
const CHStringoperator= (CHSTRING_WCHAR ch)
 
const CHStringoperator= (CHString *p)
 
const CHStringoperator= (LPCSTR lpsz)
 
const CHStringoperator= (CHSTRING_LPCWSTR lpsz)
 
const CHStringoperator= (const CHString &stringSrc)
 
const CHStringoperator= (const unsigned char *lpsz)
 
const CHStringoperator+= (char ch)
 
const CHStringoperator+= (CHSTRING_WCHAR ch)
 
const CHStringoperator+= (CHSTRING_LPCWSTR lpsz)
 
const CHStringoperator+= (const CHString &string)
 
CHSTRING_WCHAR operator[] (int nIndex) const
 
 operator CHSTRING_LPCWSTR () const
 

Protected Member Functions

void AllocBeforeWrite (int nLen)
 
void AllocBuffer (int nLen)
 
void AllocCopy (CHString &dest, int nCopyLen, int nCopyIndex, int nExtraLen) const
 
void AssignCopy (int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
 
void AssignCopy (int nSrcLen, const wchar_t *lpszSrcData)
 
void ConcatCopy (int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
 
void ConcatCopy (int nSrc1Len, const wchar_t *lpszSrc1Data, int nSrc2Len, const wchar_t *lpszSrc2Data)
 
void ConcatInPlace (int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
 
void ConcatInPlace (int nSrcLen, const wchar_t *lpszSrcData)
 
void CopyBeforeWrite ()
 
CHStringDataGetData () const
 
void Init ()
 
int LoadStringW (UINT nID, CHSTRING_LPWSTR lpszBuf, UINT nMaxBuf)
 
void Release ()
 

Static Protected Member Functions

static void WINAPI Release (CHStringData *pData)
 
static int WINAPI SafeStrlen (CHSTRING_LPCWSTR lpsz)
 
static int WINAPI SafeStrlen (const wchar_t *lpsz)
 

Protected Attributes

CHSTRING_LPWSTR m_pchData
 

Friends

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)
 

Detailed Description

Definition at line 31 of file chstring.h.

Constructor & Destructor Documentation

◆ CHString() [1/7]

CHString::CHString ( )

Definition at line 101 of file chstring.cpp.

102 {
103  // Set to empty string
105 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37

◆ CHString() [2/7]

CHString::CHString ( CHSTRING_WCHAR  ch,
int  nRepeat = 1 
)

Definition at line 110 of file chstring.cpp.

111 {
112  // Allow null initialize, in case something goes wrong
114 
115  // If we have a char to insert
116  if (nRepeat >= 1)
117  {
118  // Allocate a buffer big enough
119  AllocBuffer(nRepeat);
120  // And if possible, repeat char
121  if (m_pchData)
122  {
123  for (int i = 0; i < nRepeat; ++i)
124  {
125  m_pchData[i] = ch;
126  }
127  }
128  }
129 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ CHString() [3/7]

CHString::CHString ( CHSTRING_LPCWSTR  lpsz)

Definition at line 134 of file chstring.cpp.

135 {
136  // Allow null initialize, in case something goes wrong
138 
139  // If we have an input string
140  if (lpsz != 0)
141  {
142  // Get its length
143  int Len = SafeStrlen(lpsz);
144  // Then, allocate a big enough buffer and copy string
145  // Note that here, we don't null terminate the string...
146  if (Len)
147  {
148  AllocBuffer(Len);
149  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData),
150  reinterpret_cast<LPCWSTR>(lpsz),
151  Len);
152  }
153  }
154 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
#define Len
Definition: deflate.h:82
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
static int WINAPI SafeStrlen(CHSTRING_LPCWSTR lpsz)
Definition: chstring.cpp:1040

◆ CHString() [4/7]

CHString::CHString ( CHSTRING_LPCWSTR  lpch,
int  nLength 
)

Definition at line 159 of file chstring.cpp.

160 {
161  // Allow null initialize, in case something goes wrong
163 
164  // In case we have a string with a len
165  if (lpch != 0 && nLength != 0)
166  {
167  // Just copy the string
169  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData),
170  reinterpret_cast<LPCWSTR>(lpch),
171  nLength);
172  }
173 }
_In_ DWORD nLength
Definition: wincon.h:473
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)

◆ CHString() [5/7]

CHString::CHString ( LPCSTR  lpsz)

Definition at line 178 of file chstring.cpp.

179 {
180  // Allow null initialize, in case something goes wrong
182 
183  // If we have input string
184  if (lpsz != 0)
185  {
186  // Get its length
187  int Len = (int)strlen(lpsz);
188  if (Len)
189  {
190  // Allocate and convert the string
191  AllocBuffer(Len);
192  mbstowcsz(reinterpret_cast<LPWSTR>(m_pchData), lpsz, Len + 1);
193  // Releasing buffer here is to allow to
194  // update the buffer size. We notify we're
195  // done with changing the string: recompute its
196  // length, please
197  ReleaseBuffer();
198  }
199  }
200 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void ReleaseBuffer(int nNewLength=-1)
Definition: chstring.cpp:978
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
#define Len
Definition: deflate.h:82
int mbstowcsz(LPWSTR lpDest, LPCSTR lpSrc, int nLen)
Definition: chstring.cpp:75
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ CHString() [6/7]

CHString::CHString ( const CHString stringSrc)

Definition at line 216 of file chstring.cpp.

217 {
218  // If we have currently no referenced string
219  if (stringSrc.GetData()->nRefs < 0)
220  {
221  // Ensure we have the null string
223  // And then call, the copy operator with input string
224  *this = stringSrc.m_pchData;
225  }
226  else
227  {
228  // Otherwise, just copy the input string
229  m_pchData = stringSrc.m_pchData;
230  // And increment the number of references
231  InterlockedIncrement(&GetData()->nRefs);
232  // The whole point here is: Am I forget to release the old
233  // data?! MS doesn't release it, but I guess we should...
234  }
235 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
long nRefs
Definition: chstring.h:21
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
#define InterlockedIncrement
Definition: armddk.h:53

◆ CHString() [7/7]

CHString::CHString ( const unsigned char lpsz)

Definition at line 205 of file chstring.cpp.

206 {
207  // Null init
208  Init();
209  // And call operator= with const char*, easier
210  *this = (LPCSTR)lpsz;
211 }
void Init()
Definition: chstring.cpp:787
const char * LPCSTR
Definition: xmlstorage.h:183

◆ ~CHString()

CHString::~CHString ( )

Definition at line 240 of file chstring.cpp.

241 {
242  // If we have a string
243  if (GetData() != &afxNullData)
244  {
245  // Check whether it's still in use after we release it
246  if (InterlockedDecrement(&GetData()->nRefs) == 0)
247  {
248  // If so, delete it
249  delete GetData();
250  }
251  }
252 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHStringData afxNullData
Definition: chstring.cpp:39
#define InterlockedDecrement
Definition: armddk.h:52

Member Function Documentation

◆ AllocBeforeWrite()

void CHString::AllocBeforeWrite ( int  nLen)
protected

Definition at line 257 of file chstring.cpp.

258 {
259  // In case we have several strings pointing to our memory zone
260  // Or we need bigger buffer than actual
261  if (GetData()->nRefs > 1 || nLen > GetData()->nAllocLength)
262  {
263  // Just drop current
264  // And allocate a new one which is big enough
265  Release();
266  AllocBuffer(nLen);
267  }
268 }
CHStringData * GetData() const
Definition: chstring.cpp:764
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
void Release()
Definition: chstring.cpp:938

Referenced by AssignCopy(), operator=(), and CHString2::UseStuff().

◆ AllocBuffer()

void CHString::AllocBuffer ( int  nLen)
protected

Definition at line 273 of file chstring.cpp.

274 {
275  // Here we have to allocate a buffer for the string
276  // It actually consists in: CHStringData structure
277  // with a buffer big enough at its end to store the
278  // string.
280 
281  // Null size is easy allocation
282  if (nSize == 0)
283  {
285  return;
286  }
287 
288  // We cannot allow negative sizes
289  if (nSize < 0)
290  {
292  }
293 
294  // Nor too big
295  if (nSize > (INT_MAX - (int)sizeof(CHStringData)) / (int)sizeof(WCHAR))
296  {
298  }
299 
300  // Just allocate big enough buffer, using our own operator new
301  Data = (CHStringData *)operator new(nSize * sizeof(WCHAR) + sizeof(CHStringData));
302  // In case Data is null, throw an exception
303  // Yes, this is stupid! Our operator new is already supposed to through an exception...
304  // Thanks MS
305  if (!Data)
306  {
307  throw HeapException;
308  }
309 
310  Data->nRefs = 1;
311  Data->nDataLength = nSize;
312  Data->nAllocLength = nSize;
313  Data->data()[0] = 0;
314 
315  // We only return the string
316  // We can find back data with some mathematics
317  m_pchData = Data->data();
318 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define INT_MAX
Definition: limits.h:40
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
CHeap_Exception HeapException(CHeap_Exception::E_ALLOCATION_ERROR)
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:154
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
__wchar_t WCHAR
Definition: xmlstorage.h:180
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700

Referenced by AllocBeforeWrite(), CHString(), ConcatCopy(), CopyBeforeWrite(), FreeExtra(), GetBuffer(), and CHString2::UseStuff().

◆ AllocCopy()

void CHString::AllocCopy ( CHString dest,
int  nCopyLen,
int  nCopyIndex,
int  nExtraLen 
) const
protected

Definition at line 323 of file chstring.cpp.

324 {
325  // Once again, we cannot deal with negative lens
326  if (nCopyLen < 0)
327  {
329  }
330 
331  if (nCopyIndex < 0)
332  {
334  }
335 
336  if (nExtraLen < 0)
337  {
339  }
340 
341  // In case what we have to copy is null-sized, just set empty string
342  if (nCopyLen + nExtraLen == 0)
343  {
344  dest.m_pchData = afxPchNil;
345  return;
346  }
347 
348  // Otherwise, allocate a buffer in new string which is big enough
349  // You can note that we absolutely don't check about any existing
350  // (referenced) buffer in dest. Actually, dest is to be EMPTY string.
351  // The whole point of this function is to initialize a virgin string by
352  // copying data from another. This is needed by Left/Mid/Right
353  dest.AllocBuffer(nCopyLen + nExtraLen);
354  // And copy our stuff in
355  wcsncpy(reinterpret_cast<LPWSTR>(dest.m_pchData),
356  reinterpret_cast<LPWSTR>(m_pchData + nCopyIndex),
357  nCopyLen);
358 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:154
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700
static char * dest
Definition: rtl.c:135

Referenced by Left(), Mid(), Right(), and CHString2::UseStuff().

◆ AllocSysString()

CHSTRING_LPWSTR CHString::AllocSysString ( ) const

Definition at line 363 of file chstring.cpp.

364 {
365  BSTR SysString;
366 
367  // Just allocate the string
368  SysString = SysAllocStringLen(reinterpret_cast<LPWSTR>(m_pchData), GetData()->nDataLength);
369  if (!SysString)
370  {
371  throw HeapException;
372  }
373 
374  return reinterpret_cast<CHSTRING_LPWSTR>(SysString);
375 }
CHStringData * GetData() const
Definition: chstring.cpp:764
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
CHeap_Exception HeapException(CHeap_Exception::E_ALLOCATION_ERROR)
OLECHAR * BSTR
Definition: compat.h:2152
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147

Referenced by CHString2::UseStuff().

◆ AssignCopy() [1/2]

void CHString::AssignCopy ( int  nSrcLen,
CHSTRING_LPCWSTR  lpszSrcData 
)
protected

Definition at line 380 of file chstring.cpp.

381 {
382  // Don't allow negative len
383  if (nSrcLen < 0)
384  {
386  }
387 
388  // We will have to modify a string that might be shared, so duplicate it
389  // Ensuring it's big enough to contain our new stuff
390  AllocBeforeWrite(nSrcLen);
391  if (nSrcLen == 0)
392  {
393  Release();
394  return;
395  }
396 
397  // Just copy, write down new size, and ensure it's null terminated
398  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData),
399  reinterpret_cast<LPCWSTR>(lpszSrcData), nSrcLen);
400  GetData()->nDataLength = nSrcLen;
401  m_pchData[nSrcLen] = 0;
402 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
CHStringData * GetData() const
Definition: chstring.cpp:764
void AllocBeforeWrite(int nLen)
Definition: chstring.cpp:257
int nDataLength
Definition: chstring.h:22
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:154
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void Release()
Definition: chstring.cpp:938
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700

Referenced by AssignCopy(), operator=(), and CHString2::UseStuff().

◆ AssignCopy() [2/2]

void CHString::AssignCopy ( int  nSrcLen,
const wchar_t lpszSrcData 
)
inlineprotected

Definition at line 153 of file chstring.h.

154  {
155  AssignCopy(nSrcLen, reinterpret_cast<CHSTRING_LPCWSTR>(lpszSrcData));
156  }
void AssignCopy(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:380

◆ Collate() [1/2]

int CHString::Collate ( CHSTRING_LPCWSTR  lpsz) const

Definition at line 407 of file chstring.cpp.

408 {
409  // Just call the deprecated function here - no matter we are null terminated
410  // Did you read my statement about how safe is this implementation?
411  return wcscoll(reinterpret_cast<LPCWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(lpsz));
412 }
_Check_return_ _CRTIMP int __cdecl wcscoll(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147

Referenced by Collate(), and CHString2::UseStuff().

◆ Collate() [2/2]

int CHString::Collate ( const wchar_t lpsz) const
inline

Definition at line 45 of file chstring.h.

46  {
47  return Collate(reinterpret_cast<CHSTRING_LPCWSTR>(lpsz));
48  }
int Collate(CHSTRING_LPCWSTR lpsz) const
Definition: chstring.cpp:407

◆ Compare() [1/2]

int CHString::Compare ( CHSTRING_LPCWSTR  lpsz) const

Definition at line 417 of file chstring.cpp.

418 {
419  // Just call the deprecated function here - no matter we are null terminated
420  // Did you read my statement about how safe is this implementation?
421  return wcscmp(reinterpret_cast<LPCWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(lpsz));
422 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by Compare(), and CHString2::UseStuff().

◆ Compare() [2/2]

int CHString::Compare ( const wchar_t lpsz) const
inline

Definition at line 50 of file chstring.h.

51  {
52  return Compare(reinterpret_cast<CHSTRING_LPCWSTR>(lpsz));
53  }
int Compare(CHSTRING_LPCWSTR lpsz) const
Definition: chstring.cpp:417

◆ CompareNoCase() [1/2]

int CHString::CompareNoCase ( CHSTRING_LPCWSTR  lpsz) const

Definition at line 427 of file chstring.cpp.

428 {
429  // Just call the deprecated function here - no matter we are null terminated
430  // Did you read my statement about how safe is this implementation?
431  return wcsicmp(reinterpret_cast<LPCWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(lpsz));
432 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
#define wcsicmp
Definition: compat.h:15

Referenced by CompareNoCase(), and CHString2::UseStuff().

◆ CompareNoCase() [2/2]

int CHString::CompareNoCase ( const wchar_t lpsz) const
inline

Definition at line 55 of file chstring.h.

56  {
57  return CompareNoCase(reinterpret_cast<CHSTRING_LPCWSTR>(lpsz));
58  }
int CompareNoCase(CHSTRING_LPCWSTR lpsz) const
Definition: chstring.cpp:427

◆ ConcatCopy() [1/2]

void CHString::ConcatCopy ( int  nSrc1Len,
CHSTRING_LPCWSTR  lpszSrc1Data,
int  nSrc2Len,
CHSTRING_LPCWSTR  lpszSrc2Data 
)
protected

Definition at line 488 of file chstring.cpp.

491 {
492  int TotalLen;
493 
494  if (nSrc1Len < 0 || nSrc2Len < 0)
495  {
497  }
498 
499  // If both len are null, do nothing
500  TotalLen = nSrc1Len + nSrc2Len;
501  if (TotalLen == 0)
502  {
503  return;
504  }
505 
506  // Otherwise, allocate a new buffer to hold everything (caller will release previous buffer)
507  AllocBuffer(TotalLen);
508  // And concat stuff
509  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData),
510  reinterpret_cast<LPCWSTR>(lpszSrc1Data),
511  nSrc1Len);
512  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData + nSrc1Len),
513  reinterpret_cast<LPCWSTR>(lpszSrc2Data),
514  nSrc2Len);
515 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:154
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700

Referenced by ConcatCopy(), ConcatInPlace(), operator+(), and CHString2::UseStuff().

◆ ConcatCopy() [2/2]

void CHString::ConcatCopy ( int  nSrc1Len,
const wchar_t lpszSrc1Data,
int  nSrc2Len,
const wchar_t lpszSrc2Data 
)
inlineprotected

Definition at line 158 of file chstring.h.

159  {
160  ConcatCopy(nSrc1Len, reinterpret_cast<CHSTRING_LPCWSTR>(lpszSrc1Data), nSrc2Len, reinterpret_cast<CHSTRING_LPCWSTR>(lpszSrc2Data));
161  }
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:488

◆ ConcatInPlace() [1/2]

void CHString::ConcatInPlace ( int  nSrcLen,
CHSTRING_LPCWSTR  lpszSrcData 
)
protected

Definition at line 437 of file chstring.cpp.

438 {
439  // With null length, there's not that much to concat...
440  if (nSrcLen == 0)
441  {
442  return;
443  }
444 
445  // Still no negative length
446  if (nSrcLen < 0)
447  {
449  }
450 
451  // Ensure we wouldn't overflow with the concat
452  if (GetData()->nDataLength > INT_MAX - nSrcLen)
453  {
455  }
456 
457  // In case we have to modify a shared string OR if it can't fit into current buffer...
458  if (GetData()->nRefs > 1 || GetData()->nDataLength + nSrcLen > GetData()->nAllocLength)
459  {
460  // Allocate a new buffer! (without forgetting to release old one)
461  CHStringData* OldData = GetData();
462 
463  // You remember about "InPlace" in the function's name?
464  // The cake is a lie
465  ConcatCopy(GetData()->nDataLength, m_pchData, nSrcLen, lpszSrcData);
466  Release(OldData);
467  }
468  else
469  {
470  // Ensure we don't overflow
471  if (nSrcLen > INT_MAX - GetData()->nDataLength)
472  {
474  }
475 
476  // Then, just copy and null terminate
477  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData + GetData()->nDataLength),
478  reinterpret_cast<LPCWSTR>(lpszSrcData),
479  nSrcLen);
480  GetData()->nDataLength += nSrcLen;
481  m_pchData[GetData()->nDataLength] = 0;
482  }
483 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
CHStringData * GetData() const
Definition: chstring.cpp:764
#define INT_MAX
Definition: limits.h:40
int nDataLength
Definition: chstring.h:22
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:154
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:488
void Release()
Definition: chstring.cpp:938
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700

Referenced by ConcatInPlace(), operator+=(), and CHString2::UseStuff().

◆ ConcatInPlace() [2/2]

void CHString::ConcatInPlace ( int  nSrcLen,
const wchar_t lpszSrcData 
)
inlineprotected

Definition at line 163 of file chstring.h.

164  {
165  ConcatInPlace(nSrcLen, reinterpret_cast<CHSTRING_LPCWSTR>(lpszSrcData));
166  }
void ConcatInPlace(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:437

◆ CopyBeforeWrite()

void CHString::CopyBeforeWrite ( )
protected

Definition at line 520 of file chstring.cpp.

521 {
523 
524  // First, we need to get reference count
525  // And we also need to save Data for later copy
526  Data = GetData();
527 
528  if (Data->nRefs <= 1)
529  {
530  // If its not used, don't waste time to realloc, it will do the job
531  return;
532  }
533 
534  // Release current data - we are sure it won't be freed upon that point
535  // Thanks to the reference count check previously done
536  Release();
537  // Alloc new buffer and copy old data in it
538  AllocBuffer(Data->nDataLength);
539  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData),
540  reinterpret_cast<LPCWSTR>(Data->data()),
541  Data->nDataLength);
542 }
CHStringData * GetData() const
Definition: chstring.cpp:764
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
void Release()
Definition: chstring.cpp:938
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)

Referenced by MakeLower(), MakeReverse(), MakeUpper(), ReleaseBuffer(), SetAt(), TrimLeft(), TrimRight(), and CHString2::UseStuff().

◆ Empty()

void CHString::Empty ( )

Definition at line 547 of file chstring.cpp.

548 {
549  // Already empty
550  if (GetData()->nDataLength == 0)
551  {
552  return;
553  }
554 
555  // Empty it easily given it's reference count
556  if (GetData()->nRefs < 0)
557  {
558  *this = afxPchNil;
559  }
560  else
561  {
562  // Otherwise, just release it
563  // It will set back this instance to afxPchNil
564  // while decreasing reference count
565  Release();
566  }
567 }
CHStringData * GetData() const
Definition: chstring.cpp:764
void Release()
Definition: chstring.cpp:938
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37

Referenced by CHString2::UseStuff().

◆ Find() [1/3]

int CHString::Find ( CHSTRING_WCHAR  ch) const

Definition at line 572 of file chstring.cpp.

573 {
575 
576  // Let's use appropriate helper
577  Found = reinterpret_cast<CHSTRING_LPCWSTR>(wcschr(reinterpret_cast<LPCWSTR>(m_pchData), ch));
578  // We have to return a position, so compute it
579  if (Found)
580  {
581  return (Found - m_pchData);
582  }
583 
584  // Otherwise, return no position
585  return -1;
586 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
return Found
Definition: dirsup.c:1270
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
const CHSTRING_WCHAR * CHSTRING_LPCWSTR
Definition: chstring.h:14

Referenced by CHString2::UseStuff().

◆ Find() [2/3]

int CHString::Find ( CHSTRING_LPCWSTR  lpszSub) const

Definition at line 591 of file chstring.cpp.

592 {
594 
595  // Let's use appropriate helper
596  Found = reinterpret_cast<CHSTRING_LPCWSTR>(wcsstr(reinterpret_cast<LPCWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(lpszSub)));
597  // We have to return a position, so compute it
598  if (Found)
599  {
600  return (Found - m_pchData);
601  }
602 
603  // Otherwise, return no position
604  return -1;
605 }
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
return Found
Definition: dirsup.c:1270
const CHSTRING_WCHAR * CHSTRING_LPCWSTR
Definition: chstring.h:14

◆ Find() [3/3]

int CHString::Find ( const wchar_t lpszSub) const
inline

Definition at line 62 of file chstring.h.

63  {
64  return FindOneOf(reinterpret_cast<CHSTRING_LPCWSTR>(lpszSub));
65  }
int FindOneOf(CHSTRING_LPCWSTR lpszCharSet) const
Definition: chstring.cpp:610

◆ FindOneOf() [1/2]

int CHString::FindOneOf ( CHSTRING_LPCWSTR  lpszCharSet) const

Definition at line 610 of file chstring.cpp.

611 {
613 
614  // Let's use appropriate helper
615  Found = reinterpret_cast<CHSTRING_LPCWSTR>(wcspbrk(reinterpret_cast<LPCWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(lpszCharSet)));
616  // We have to return a position, so compute it
617  if (Found)
618  {
619  return (Found - m_pchData);
620  }
621 
622  // Otherwise, return no position
623  return -1;
624 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
return Found
Definition: dirsup.c:1270
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
const CHSTRING_WCHAR * CHSTRING_LPCWSTR
Definition: chstring.h:14

Referenced by Find(), FindOneOf(), and CHString2::UseStuff().

◆ FindOneOf() [2/2]

int CHString::FindOneOf ( const wchar_t lpszCharSet) const
inline

Definition at line 67 of file chstring.h.

68  {
69  return FindOneOf(reinterpret_cast<CHSTRING_LPCWSTR>(lpszCharSet));
70  }
int FindOneOf(CHSTRING_LPCWSTR lpszCharSet) const
Definition: chstring.cpp:610

◆ Format() [1/3]

void CHString::Format ( UINT  nFormatID,
  ... 
)

Definition at line 629 of file chstring.cpp.

630 {
631  // Deprecated and not implemented any longer - well, this is its implementation
632  return;
633 }

Referenced by Format(), and CHString2::UseStuff().

◆ Format() [2/3]

void CHString::Format ( CHSTRING_LPCWSTR  lpszFormat,
  ... 
)

Definition at line 638 of file chstring.cpp.

639 {
640  // Forward to FormatV
641  va_list ArgsList;
642 
643  va_start(ArgsList, lpszFormat);
644  FormatV(lpszFormat, ArgsList);
645  va_end(ArgsList);
646 }
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
va_start(ap, x)
void FormatV(CHSTRING_LPCWSTR lpszFormat, va_list argList)
Definition: chstring.cpp:668

◆ Format() [3/3]

template<typename ... Params>
void CHString::Format ( const wchar_t lpszFormat,
Params &&...  params 
)
inline

Definition at line 74 of file chstring.h.

75  {
76  Format(reinterpret_cast<CHSTRING_LPCWSTR>(lpszFormat), params...);
77  }
void Format(UINT nFormatID,...)
Definition: chstring.cpp:629
GLenum const GLfloat * params
Definition: glext.h:5645

◆ FormatMessageW() [1/3]

void CHString::FormatMessageW ( UINT  nFormatID,
  ... 
)

Definition at line 651 of file chstring.cpp.

652 {
653  // Deprecated and not implemented any longer - well, this is its implementation
654  return;
655 }

Referenced by FormatMessageW(), and CHString2::UseStuff().

◆ FormatMessageW() [2/3]

void CHString::FormatMessageW ( CHSTRING_LPCWSTR  lpszFormat,
  ... 
)

Definition at line 660 of file chstring.cpp.

661 {
663 }
#define UNIMPLEMENTED
Definition: debug.h:115

◆ FormatMessageW() [3/3]

template<typename ... Params>
void CHString::FormatMessageW ( const wchar_t lpszFormat,
Params &&...  params 
)
inline

Definition at line 81 of file chstring.h.

82  {
83  FormatMessageW(reinterpret_cast<CHSTRING_LPCWSTR>(lpszFormat), params...);
84  }
GLenum const GLfloat * params
Definition: glext.h:5645
void FormatMessageW(UINT nFormatID,...)
Definition: chstring.cpp:651

◆ FormatV() [1/2]

void CHString::FormatV ( CHSTRING_LPCWSTR  lpszFormat,
va_list  argList 
)

Definition at line 668 of file chstring.cpp.

669 {
671 }
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by Format(), FormatV(), and CHString2::UseStuff().

◆ FormatV() [2/2]

void CHString::FormatV ( const wchar_t lpszFormat,
va_list  argList 
)
inline

Definition at line 86 of file chstring.h.

87  {
88  return FormatV(reinterpret_cast<CHSTRING_LPCWSTR>(lpszFormat), argList);
89  }
void FormatV(CHSTRING_LPCWSTR lpszFormat, va_list argList)
Definition: chstring.cpp:668

◆ FreeExtra()

void CHString::FreeExtra ( )

Definition at line 676 of file chstring.cpp.

677 {
678  CHStringData* OldData;
679 
680  // No extra? Do nothing
681  if (GetData()->nDataLength == GetData()->nAllocLength)
682  {
683  return;
684  }
685 
686  // Get old buffer
687  OldData = GetData();
688  // Allocate a new one, at the right size (with no place for \0 :-))
689  AllocBuffer(GetData()->nDataLength);
690  // Copy old and release it
691  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(OldData->data()), OldData->nDataLength);
692  Release(OldData);
693 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22
CHSTRING_WCHAR * data()
Definition: chstring.h:25
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
void Release()
Definition: chstring.cpp:938
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)

Referenced by CHString2::UseStuff().

◆ GetAllocLength()

int CHString::GetAllocLength ( ) const

Definition at line 698 of file chstring.cpp.

699 {
700  return GetData()->nAllocLength;
701 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nAllocLength
Definition: chstring.h:23

Referenced by CHString2::UseStuff().

◆ GetAt()

CHSTRING_WCHAR CHString::GetAt ( int  nIndex) const

Definition at line 706 of file chstring.cpp.

707 {
708  // It's up to you to check the index!
709  return m_pchData[nIndex];
710 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147

Referenced by CHString2::UseStuff().

◆ GetBuffer()

CHSTRING_LPWSTR CHString::GetBuffer ( int  nMinBufLength)

Definition at line 715 of file chstring.cpp.

716 {
717  CHSTRING_LPWSTR OldBuffer = m_pchData;
718 
719  // We'll have to allocate a new buffer if it's not big enough
720  // or if it's shared by several strings
721  if (GetData()->nRefs > 1 || GetData()->nAllocLength < nMinBufLength)
722  {
723  CHStringData* OldData = GetData();
724  int OldLen = GetData()->nDataLength;
725 
726  // Ensure we can hold enough
727  if (OldLen > nMinBufLength)
728  {
729  nMinBufLength = OldLen;
730  }
731 
732  // Allocate new buffer
733  AllocBuffer(nMinBufLength);
734  // Copy contents
735  wcsncpy(reinterpret_cast<LPWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(OldBuffer), OldLen);
736  GetData()->nDataLength = OldLen;
737 
738  // Release old
739  Release(OldData);
740  }
741 
742  // Weirdly, here Windows always returns the old buffer
743  // Which basically exposes a wrong buffer
744  return OldBuffer;
745 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22
CHSTRING_WCHAR * CHSTRING_LPWSTR
Definition: chstring.h:15
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void AllocBuffer(int nLen)
Definition: chstring.cpp:273
void Release()
Definition: chstring.cpp:938
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)

Referenced by GetBufferSetLength(), LockBuffer(), and CHString2::UseStuff().

◆ GetBufferSetLength()

CHSTRING_LPWSTR CHString::GetBufferSetLength ( int  nNewLength)

Definition at line 750 of file chstring.cpp.

751 {
752  // Get a buffer big enough
753  // We don't care about the return, it will be set in the string
754  (void)GetBuffer(nNewLength);
755  // Set length, null-terminate and return
756  GetData()->nDataLength = nNewLength;
757  m_pchData[nNewLength] = 0;
758  return m_pchData;
759 }
CHStringData * GetData() const
Definition: chstring.cpp:764
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int nDataLength
Definition: chstring.h:22
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
CHSTRING_LPWSTR GetBuffer(int nMinBufLength)
Definition: chstring.cpp:715

Referenced by CHString2::UseStuff().

◆ GetData()

CHStringData * CHString::GetData ( ) const
protected

Definition at line 764 of file chstring.cpp.

765 {
766  // In case of empty string, return empty data
767  if (m_pchData == afxPchNil)
768  {
769  return &afxNullData;
770  }
771 
772  // Otherwise, do maths
773  return (CHStringData*)((ULONG_PTR)m_pchData - sizeof(CHStringData));
774 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
CHStringData afxNullData
Definition: chstring.cpp:39
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37
#define ULONG_PTR
Definition: config.h:101

Referenced by AllocBeforeWrite(), AllocSysString(), AssignCopy(), CHString(), ConcatInPlace(), CopyBeforeWrite(), Empty(), FreeExtra(), GetAllocLength(), GetBuffer(), GetBufferSetLength(), GetLength(), IsEmpty(), Left(), LockBuffer(), Mid(), operator+=(), operator=(), Release(), ReleaseBuffer(), Right(), TrimLeft(), TrimRight(), UnlockBuffer(), CHString2::UseStuff(), and ~CHString().

◆ GetLength()

int CHString::GetLength ( ) const

Definition at line 779 of file chstring.cpp.

780 {
781  return GetData()->nDataLength;
782 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22

Referenced by CHString2::UseStuff().

◆ Init()

void CHString::Init ( )
protected

Definition at line 787 of file chstring.cpp.

788 {
790 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37

Referenced by CHString(), and CHString2::UseStuff().

◆ IsEmpty()

BOOL CHString::IsEmpty ( ) const

Definition at line 795 of file chstring.cpp.

796 {
797  return (GetData()->nDataLength == 0);
798 }
CHStringData * GetData() const
Definition: chstring.cpp:764

Referenced by CHString2::UseStuff().

◆ Left()

CHString CHString::Left ( int  nCount) const

Definition at line 803 of file chstring.cpp.

804 {
805  CHString NewString;
806 
807  // Validate input (we can't get more than what we have ;-))
808  if (nCount)
809  {
810  if (nCount > GetData()->nDataLength)
811  {
812  nCount = GetData()->nDataLength;
813  }
814  }
815 
816  AllocCopy(NewString, nCount, 0, 0);
817 
818  return NewString;
819 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22
void AllocCopy(CHString &dest, int nCopyLen, int nCopyIndex, int nExtraLen) const
Definition: chstring.cpp:323

Referenced by SpanExcluding(), SpanIncluding(), and CHString2::UseStuff().

◆ LoadStringW() [1/2]

int CHString::LoadStringW ( UINT  nID)

Definition at line 824 of file chstring.cpp.

825 {
826  // Deprecated and not implemented any longer - well, this is its implementation
827  return 0;
828 }

Referenced by CHString2::UseStuff().

◆ LoadStringW() [2/2]

int CHString::LoadStringW ( UINT  nID,
CHSTRING_LPWSTR  lpszBuf,
UINT  nMaxBuf 
)
protected

Definition at line 833 of file chstring.cpp.

834 {
835  // Deprecated and not implemented any longer - well, this is its implementation
836  return 0;
837 }

◆ LockBuffer()

CHSTRING_LPWSTR CHString::LockBuffer ( )

Definition at line 842 of file chstring.cpp.

843 {
844  CHSTRING_LPWSTR LockedBuffer;
845 
846  // The purpose here is basically to set the nRefs to max int
847  LockedBuffer = GetBuffer(0);
848  GetData()->nRefs = INT_MAX;
849 
850  return LockedBuffer;
851 }
CHStringData * GetData() const
Definition: chstring.cpp:764
#define INT_MAX
Definition: limits.h:40
CHSTRING_WCHAR * CHSTRING_LPWSTR
Definition: chstring.h:15
long nRefs
Definition: chstring.h:21
CHSTRING_LPWSTR GetBuffer(int nMinBufLength)
Definition: chstring.cpp:715

Referenced by CHString2::UseStuff().

◆ MakeLower()

void CHString::MakeLower ( )

Definition at line 856 of file chstring.cpp.

857 {
858  // We'll modify string, duplicate it first if needed
859  CopyBeforeWrite();
860 
861  // Let's use appropriate helper
862  _wcslwr(reinterpret_cast<LPWSTR>(m_pchData));
863 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
_CRTIMP wchar_t *__cdecl _wcslwr(_Inout_z_ wchar_t *_String)
void CopyBeforeWrite()
Definition: chstring.cpp:520

Referenced by CHString2::UseStuff().

◆ MakeReverse()

void CHString::MakeReverse ( )

Definition at line 868 of file chstring.cpp.

869 {
870  // We'll modify string, duplicate it first if needed
871  CopyBeforeWrite();
872 
873  // Let's use appropriate helper
874  _wcsrev(reinterpret_cast<LPWSTR>(m_pchData));
875 }
_CRTIMP wchar_t *__cdecl _wcsrev(_Inout_z_ wchar_t *_Str)
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void CopyBeforeWrite()
Definition: chstring.cpp:520

Referenced by CHString2::UseStuff().

◆ MakeUpper()

void CHString::MakeUpper ( )

Definition at line 880 of file chstring.cpp.

881 {
882  // We'll modify string, duplicate it first if needed
883  CopyBeforeWrite();
884 
885  // Let's use appropriate helper
886  _wcsupr(reinterpret_cast<LPWSTR>(m_pchData));
887 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
void CopyBeforeWrite()
Definition: chstring.cpp:520

Referenced by CHString2::UseStuff().

◆ Mid() [1/2]

CHString CHString::Mid ( int  nFirst) const

Definition at line 892 of file chstring.cpp.

893 {
894  // Take string from nFirst up to the end
895  return Mid(nFirst, GetData()->nDataLength - nFirst);
896 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHString Mid(int nFirst) const
Definition: chstring.cpp:892

Referenced by CHString2::UseStuff().

◆ Mid() [2/2]

CHString CHString::Mid ( int  nFirst,
int  nCount 
) const

Definition at line 901 of file chstring.cpp.

902 {
903  CHString NewString;
904 
905  // Validate sizes first
906  if (nFirst < 0)
907  {
908  nFirst = 0;
909  }
910 
911  if (nCount < 0)
912  {
913  nCount = 0;
914  }
915 
916  // Ensure we don't go beyond the string
917  if (nFirst + nCount > GetData()->nDataLength)
918  {
919  nCount = GetData()->nDataLength - nFirst;
920  }
921 
922  // Also ensure we don't read beyond
923  // Yes, this should have been done before previous check
924  // MS does it that way
925  if (nFirst > GetData()->nDataLength)
926  {
927  nCount = 0;
928  }
929 
930  AllocCopy(NewString, nCount, nFirst, 0);
931 
932  return NewString;
933 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22
void AllocCopy(CHString &dest, int nCopyLen, int nCopyIndex, int nExtraLen) const
Definition: chstring.cpp:323

◆ operator CHSTRING_LPCWSTR()

Definition at line 1346 of file chstring.cpp.

1347 {
1348  return m_pchData;
1349 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147

◆ operator+=() [1/4]

Definition at line 1297 of file chstring.cpp.

1298 {
1299  *this += (CHSTRING_WCHAR)ch;
1300  return *this;
1301 }
unsigned short CHSTRING_WCHAR
Definition: chstring.h:13

◆ operator+=() [2/4]

Definition at line 1306 of file chstring.cpp.

1307 {
1308  ConcatInPlace(1, &ch);
1309  return *this;
1310 }
void ConcatInPlace(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:437

◆ operator+=() [3/4]

Definition at line 1315 of file chstring.cpp.

1316 {
1317  int Len;
1318 
1319  Len = SafeStrlen(lpsz);
1320  ConcatInPlace(Len, lpsz);
1321 
1322  return *this;
1323 }
#define Len
Definition: deflate.h:82
void ConcatInPlace(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:437
static int WINAPI SafeStrlen(CHSTRING_LPCWSTR lpsz)
Definition: chstring.cpp:1040

◆ operator+=() [4/4]

Definition at line 1328 of file chstring.cpp.

1329 {
1330  ConcatInPlace(string.GetData()->nDataLength, string.m_pchData);
1331 
1332  return *this;
1333 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void ConcatInPlace(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:437

◆ operator=() [1/7]

Definition at line 1185 of file chstring.cpp.

1186 {
1187  *this = (CHSTRING_WCHAR)ch;
1188  return *this;
1189 }
unsigned short CHSTRING_WCHAR
Definition: chstring.h:13

◆ operator=() [2/7]

Definition at line 1194 of file chstring.cpp.

1195 {
1196  AssignCopy(1, &ch);
1197  return *this;
1198 }
void AssignCopy(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:380

◆ operator=() [3/7]

Definition at line 1203 of file chstring.cpp.

1204 {
1205  *this = *p;
1206  return *this;
1207 }
GLfloat GLfloat p
Definition: glext.h:8902

◆ operator=() [4/7]

Definition at line 1212 of file chstring.cpp.

1213 {
1214  int Len;
1215 
1216  // If we have string, get its len
1217  if (lpsz != 0)
1218  {
1219  Len = (int)strlen(lpsz);
1220  }
1221  else
1222  {
1223  Len = 0;
1224  }
1225 
1226  // Do this call, even with null len, just to get empty string
1228  if (Len == 0)
1229  {
1230  Release();
1231  return *this;
1232  }
1233 
1234  // Convert and copy
1235  mbstowcsz(reinterpret_cast<LPWSTR>(m_pchData), lpsz, Len + 1);
1236  // Get new size and so on
1237  ReleaseBuffer();
1238 
1239  return *this;
1240 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void AllocBeforeWrite(int nLen)
Definition: chstring.cpp:257
void ReleaseBuffer(int nNewLength=-1)
Definition: chstring.cpp:978
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
#define Len
Definition: deflate.h:82
int mbstowcsz(LPWSTR lpDest, LPCSTR lpSrc, int nLen)
Definition: chstring.cpp:75
void Release()
Definition: chstring.cpp:938
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ operator=() [5/7]

Definition at line 1245 of file chstring.cpp.

1246 {
1247  int Len;
1248 
1249  Len = SafeStrlen(lpsz);
1250  AssignCopy(Len, lpsz);
1251 
1252  return *this;
1253 }
void AssignCopy(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:380
#define Len
Definition: deflate.h:82
static int WINAPI SafeStrlen(CHSTRING_LPCWSTR lpsz)
Definition: chstring.cpp:1040

◆ operator=() [6/7]

Definition at line 1258 of file chstring.cpp.

1259 {
1260  // Don't copy string on itself
1261  if (&stringSrc == this)
1262  {
1263  return *this;
1264  }
1265 
1266  // In case we don't have a referenced string here,
1267  // or if the other is not referenced, just copy here
1268  if ((GetData()->nRefs < 0 && GetData() != &afxNullData) ||
1269  stringSrc.GetData()->nRefs < 0)
1270  {
1271  AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData);
1272  return *this;
1273  }
1274 
1275  // Otherwise, release current buffer
1276  Release();
1277  // And set buffer as stringSrc buffer
1278  // And increase its reference count
1279  m_pchData = stringSrc.m_pchData;
1280  InterlockedIncrement(&GetData()->nRefs);
1281 
1282  return *this;
1283 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
CHStringData afxNullData
Definition: chstring.cpp:39
long nRefs
Definition: chstring.h:21
void AssignCopy(int nSrcLen, CHSTRING_LPCWSTR lpszSrcData)
Definition: chstring.cpp:380
void Release()
Definition: chstring.cpp:938
#define InterlockedIncrement
Definition: armddk.h:53

◆ operator=() [7/7]

Definition at line 1288 of file chstring.cpp.

1289 {
1290  *this = (LPCSTR)lpsz;
1291  return *this;
1292 }
const char * LPCSTR
Definition: xmlstorage.h:183

◆ operator[]()

CHSTRING_WCHAR CHString::operator[] ( int  nIndex) const

Definition at line 1338 of file chstring.cpp.

1339 {
1340  return m_pchData[nIndex];
1341 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147

◆ Release() [1/2]

void CHString::Release ( void  )
protected

Definition at line 938 of file chstring.cpp.

939 {
940  // If null string, nothing to do
941  if (GetData() == &afxNullData)
942  {
943  return;
944  }
945 
946  // Otherwise, decrement ref count and release if required
947  if (InterlockedDecrement(&GetData()->nRefs) == 0)
948  {
949  delete GetData();
950  }
951 
952  // In all cases, caller doesn't want string anymore
953  // So, switch back to empty string
955 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
CHStringData afxNullData
Definition: chstring.cpp:39
#define InterlockedDecrement
Definition: armddk.h:52
CHSTRING_WCHAR afxPchNil[1]
Definition: chstring.cpp:37

Referenced by AllocBeforeWrite(), AssignCopy(), ConcatInPlace(), CopyBeforeWrite(), Empty(), FreeExtra(), GetBuffer(), operator=(), and CHString2::UseStuff().

◆ Release() [2/2]

void WINAPI CHString::Release ( CHStringData pData)
staticprotected

Definition at line 960 of file chstring.cpp.

961 {
962  // If empty string, ignore
963  if (pData == &afxNullData)
964  {
965  return;
966  }
967 
968  // Otherwise, simply and free if needed
969  if (InterlockedDecrement(&pData->nRefs) == 0)
970  {
971  delete pData;
972  }
973 }
CHStringData afxNullData
Definition: chstring.cpp:39
#define InterlockedDecrement
Definition: armddk.h:52
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ ReleaseBuffer()

void CHString::ReleaseBuffer ( int  nNewLength = -1)

Definition at line 978 of file chstring.cpp.

979 {
981 
982  // We'll modify buffer, so duplicate
983  CopyBeforeWrite();
984 
985  // If no len provided, get one
986  if (nNewLength == -1)
987  {
988  nNewLength = (int)wcslen(reinterpret_cast<LPCWSTR>(m_pchData));
989  }
990 
991  // Set appropriate size and null-terminate
992  Data = GetData();
993  Data->nDataLength = nNewLength;
994  Data->data()[nNewLength] = 0;
995 }
CHStringData * GetData() const
Definition: chstring.cpp:764
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
void CopyBeforeWrite()
Definition: chstring.cpp:520
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

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

◆ ReverseFind()

int CHString::ReverseFind ( CHSTRING_WCHAR  ch) const

Definition at line 1000 of file chstring.cpp.

1001 {
1002  CHSTRING_WCHAR *Last;
1003 
1004  // Let's use appropriate helper
1005  Last = reinterpret_cast<CHSTRING_WCHAR*>(wcsrchr(reinterpret_cast<LPCWSTR>(m_pchData), ch));
1006  // We have to return a position, so compute it
1007  if (Last)
1008  {
1009  return (Last - m_pchData);
1010  }
1011 
1012  // Otherwise, return no position
1013  return -1;
1014 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
#define wcsrchr
Definition: compat.h:16
unsigned short CHSTRING_WCHAR
Definition: chstring.h:13

Referenced by CHString2::UseStuff().

◆ Right()

CHString CHString::Right ( int  nCount) const

Definition at line 1019 of file chstring.cpp.

1020 {
1021  CHString NewString;
1022 
1023  // Validate input (we can't get more than what we have ;-))
1024  if (nCount >= 0)
1025  {
1026  if (nCount > GetData()->nDataLength)
1027  {
1028  nCount = GetData()->nDataLength;
1029  }
1030  }
1031 
1032  AllocCopy(NewString, nCount, GetData()->nDataLength - nCount, 0);
1033 
1034  return NewString;
1035 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22
void AllocCopy(CHString &dest, int nCopyLen, int nCopyIndex, int nExtraLen) const
Definition: chstring.cpp:323

Referenced by CHString2::UseStuff().

◆ SafeStrlen() [1/2]

int CHString::SafeStrlen ( CHSTRING_LPCWSTR  lpsz)
staticprotected

Definition at line 1040 of file chstring.cpp.

1041 {
1042  // Check we have a string and then get its length
1043  if (lpsz == 0)
1044  {
1045  return 0;
1046  }
1047 
1048  // Of course, it's not safe at all in case string is not null-terminated.
1049  // Things that may happen given strings are not to be null-terminated
1050  // in this class...
1051  return (int)wcslen(reinterpret_cast<LPCWSTR>(lpsz));
1052 }
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by CHString(), operator+(), operator+=(), operator=(), SafeStrlen(), and CHString2::UseStuff().

◆ SafeStrlen() [2/2]

static int WINAPI CHString::SafeStrlen ( const wchar_t lpsz)
inlinestaticprotected

Definition at line 174 of file chstring.h.

175  {
176  return SafeStrlen(reinterpret_cast<CHSTRING_LPCWSTR>(lpsz));
177  }
static int WINAPI SafeStrlen(CHSTRING_LPCWSTR lpsz)
Definition: chstring.cpp:1040

◆ SetAt()

void CHString::SetAt ( int  nIndex,
CHSTRING_WCHAR  ch 
)

Definition at line 1057 of file chstring.cpp.

1058 {
1059  CopyBeforeWrite();
1060 
1061  m_pchData[nIndex] = ch;
1062 }
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void CopyBeforeWrite()
Definition: chstring.cpp:520

Referenced by CHString2::UseStuff().

◆ SpanExcluding() [1/2]

CHString CHString::SpanExcluding ( CHSTRING_LPCWSTR  lpszCharSet) const

Definition at line 1067 of file chstring.cpp.

1068 {
1069  int Count;
1070 
1071  // Get position and then, extract
1072  Count = (int)wcscspn(reinterpret_cast<LPCWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(lpszCharSet));
1073  return Left(Count);
1074 }
_Check_return_ _CRTIMP size_t __cdecl wcscspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
CHString Left(int nCount) const
Definition: chstring.cpp:803
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
int Count
Definition: noreturn.cpp:7
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by SpanExcluding(), and CHString2::UseStuff().

◆ SpanExcluding() [2/2]

CHString CHString::SpanExcluding ( const wchar_t lpszCharSet) const
inline

Definition at line 110 of file chstring.h.

111  {
112  return SpanExcluding(reinterpret_cast<CHSTRING_LPCWSTR>(lpszCharSet));
113  }
CHString SpanExcluding(CHSTRING_LPCWSTR lpszCharSet) const
Definition: chstring.cpp:1067

◆ SpanIncluding() [1/2]

CHString CHString::SpanIncluding ( CHSTRING_LPCWSTR  lpszCharSet) const

Definition at line 1079 of file chstring.cpp.

1080 {
1081  int Count;
1082 
1083  // Get position and then, extract
1084  Count = (int)wcsspn(reinterpret_cast<LPCWSTR>(m_pchData), reinterpret_cast<LPCWSTR>(lpszCharSet));
1085  return Left(Count);
1086 }
CHString Left(int nCount) const
Definition: chstring.cpp:803
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
int Count
Definition: noreturn.cpp:7
_Check_return_ _CRTIMP size_t __cdecl wcsspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by SpanIncluding(), and CHString2::UseStuff().

◆ SpanIncluding() [2/2]

CHString CHString::SpanIncluding ( const wchar_t lpszCharSet) const
inline

Definition at line 115 of file chstring.h.

116  {
117  return SpanIncluding(reinterpret_cast<CHSTRING_LPCWSTR>(lpszCharSet));
118  }
CHString SpanIncluding(CHSTRING_LPCWSTR lpszCharSet) const
Definition: chstring.cpp:1079

◆ TrimLeft()

void CHString::TrimLeft ( )

Definition at line 1091 of file chstring.cpp.

1092 {
1093  int NewBegin;
1094  int NewLength;
1095  CHSTRING_WCHAR *CurrentChar;
1096 
1097  // We'll modify, so copy first
1098  CopyBeforeWrite();
1099 
1100  // Start at the begin of the string
1101  CurrentChar = m_pchData;
1102  while (*CurrentChar != 0)
1103  {
1104  // Browse string till we find something which is not a space
1105  if (!iswspace(*CurrentChar))
1106  {
1107  break;
1108  }
1109 
1110  CurrentChar++;
1111  }
1112 
1113  // Then, calculate new begin (easy) and new length
1114  // And move memory
1115  NewBegin = (CurrentChar - m_pchData);
1116  NewLength = GetData()->nDataLength - NewBegin;
1117  memmove(m_pchData, CurrentChar, NewLength * sizeof(CHSTRING_WCHAR));
1119 }
CHStringData * GetData() const
Definition: chstring.cpp:764
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
int nDataLength
Definition: chstring.h:22
static USHORT USHORT * NewLength
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
#define iswspace(_c)
Definition: ctype.h:669
unsigned short CHSTRING_WCHAR
Definition: chstring.h:13
void CopyBeforeWrite()
Definition: chstring.cpp:520

Referenced by CHString2::UseStuff().

◆ TrimRight()

void CHString::TrimRight ( )

Definition at line 1124 of file chstring.cpp.

1125 {
1126  CHSTRING_WCHAR *CurrentChar;
1127  CHSTRING_WCHAR *CanBeEaten;
1128 
1129  // We'll modify, so copy first
1130  CopyBeforeWrite();
1131 
1132  // Start at the begin of the string -- WHAT?!
1133  // Yes, this algorithm is the same that MS is
1134  // using for its TrimRight.
1135  // It is highly unefficient. It would have been
1136  // easier to start at nDataLength and to get back to
1137  // the begin. Note that it would have been safer as
1138  // well, in case the caller is using non-null-terminated
1139  // strings. But, well...
1140  CurrentChar = m_pchData;
1141  CanBeEaten = 0;
1142  while (*CurrentChar != 0)
1143  {
1144  // If not a space, reset what we can trim
1145  if (!iswspace(*CurrentChar))
1146  {
1147  CanBeEaten = 0;
1148  }
1149  // If it is one, and the first of the spaces serie
1150  // Keep its position
1151  else if (CanBeEaten == 0)
1152  {
1153  CanBeEaten = CurrentChar;
1154  }
1155 
1156  CurrentChar++;
1157  }
1158 
1159  // If nothing to trim, quit
1160  if (CanBeEaten == 0)
1161  {
1162  return;
1163  }
1164 
1165  // Otherwise, shorten the string
1166  GetData()->nDataLength = (CanBeEaten - m_pchData);
1167 }
CHStringData * GetData() const
Definition: chstring.cpp:764
int nDataLength
Definition: chstring.h:22
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
#define iswspace(_c)
Definition: ctype.h:669
unsigned short CHSTRING_WCHAR
Definition: chstring.h:13
void CopyBeforeWrite()
Definition: chstring.cpp:520

Referenced by CHString2::UseStuff().

◆ UnlockBuffer()

void CHString::UnlockBuffer ( )

Definition at line 1172 of file chstring.cpp.

1173 {
1174  // Unlock means just put ref back to 1
1175  // It was previously set to MAX_INT
1176  if (GetData() != &afxNullData)
1177  {
1178  GetData()->nRefs = 1;
1179  }
1180 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHStringData afxNullData
Definition: chstring.cpp:39
long nRefs
Definition: chstring.h:21

Referenced by CHString2::UseStuff().

Friends And Related Function Documentation

◆ operator+ [1/5]

CHString WINAPI operator+ ( CHSTRING_WCHAR  ch,
const CHString string 
)
friend

Definition at line 1354 of file chstring.cpp.

1355 {
1356  CHString NewString;
1357 
1358  // Basically concat in a new string
1359  NewString.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData);
1360 
1361  return NewString;
1362 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:488

◆ operator+ [2/5]

CHString WINAPI operator+ ( const CHString string,
CHSTRING_WCHAR  ch 
)
friend

Definition at line 1367 of file chstring.cpp.

1368 {
1369  CHString NewString;
1370 
1371  // Basically concat in a new string
1372  NewString.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, 1, &ch);
1373 
1374  return NewString;
1375 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:488

◆ operator+ [3/5]

CHString WINAPI operator+ ( const CHString string,
CHSTRING_LPCWSTR  lpsz 
)
friend

Definition at line 1380 of file chstring.cpp.

1381 {
1382  int Len;
1383  CHString NewString;
1384 
1385  // Get string length
1386  Len = CHString::SafeStrlen(lpsz);
1387  // And concat in new string
1388  NewString.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, Len, lpsz);
1389 
1390  return NewString;
1391 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:488
#define Len
Definition: deflate.h:82
static int WINAPI SafeStrlen(CHSTRING_LPCWSTR lpsz)
Definition: chstring.cpp:1040

◆ operator+ [4/5]

CHString WINAPI operator+ ( CHSTRING_LPCWSTR  lpsz,
const CHString string 
)
friend

Definition at line 1396 of file chstring.cpp.

1397 {
1398  int Len;
1399  CHString NewString;
1400 
1401  // Get string length
1402  Len = CHString::SafeStrlen(lpsz);
1403  // And concat in new string
1404  NewString.ConcatCopy(Len, lpsz, string.GetData()->nDataLength, string.m_pchData);
1405 
1406  return NewString;
1407 }
CHStringData * GetData() const
Definition: chstring.cpp:764
CHSTRING_LPWSTR m_pchData
Definition: chstring.h:147
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:488
#define Len
Definition: deflate.h:82
static int WINAPI SafeStrlen(CHSTRING_LPCWSTR lpsz)
Definition: chstring.cpp:1040

◆ operator+ [5/5]

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

Definition at line 1412 of file chstring.cpp.

1413 {
1414  CHString NewString;
1415 
1416  // Basically concat in a new string
1417  NewString.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData,
1418  string2.GetData()->nDataLength, string2.m_pchData);
1419 
1420  return NewString;
1421 }
static CHAR string2[MAX_PATH]
Definition: automation.c:468
static CHAR string1[MAX_PATH]
Definition: asmname.c:32
void ConcatCopy(int nSrc1Len, CHSTRING_LPCWSTR lpszSrc1Data, int nSrc2Len, CHSTRING_LPCWSTR lpszSrc2Data)
Definition: chstring.cpp:488

Member Data Documentation

◆ m_pchData


The documentation for this class was generated from the following files: