ReactOS  0.4.12-dev-432-g3463b2d
cstringt.h
Go to the documentation of this file.
1 #ifndef __CSTRINGT_H__
2 #define __CSTRINGT_H__
3 
4 #pragma once
5 #include <atlsimpstr.h>
6 #include <stddef.h>
7 #include <stdio.h>
8 #include <wchar.h>
9 #include <atlmem.h>
10 
11 namespace ATL
12 {
13 
15 {
16 #ifdef _CONVERSION_DONT_USE_THREAD_LOCALE
17  return CP_ACP;
18 #else
19  return CP_THREAD_ACP;
20 #endif
21 }
22 
23 
24 template<typename _CharType = wchar_t>
25 class ChTraitsCRT : public ChTraitsBase<_CharType>
26 {
27 public:
28 
29  static int __cdecl GetBaseTypeLength(_In_z_ LPCWSTR pszSource) throw()
30  {
31  if (pszSource == NULL) return -1;
32  return static_cast<int>(wcslen(pszSource));
33  }
34 
35  static int __cdecl GetBaseTypeLength(_In_z_ LPCSTR pszSource) throw()
36  {
37  if (pszSource == NULL) return 0;
38  return ::MultiByteToWideChar(_AtlGetConversionACP(), 0, pszSource, -1, NULL, 0) - 1;
39  }
40 
42  _In_reads_(nLength) LPCWSTR pszSource,
43  _In_ int nLength) throw()
44  {
45  return nLength;
46  }
47 
49  _In_reads_(nLength) LPCSTR pszSource,
50  _In_ int nLength) throw()
51  {
53  }
54 
56  _Out_writes_(nDestLength) LPWSTR pszDest,
57  _In_ int nDestLength,
58  _In_ LPCWSTR pszSrc,
59  _In_ int nSrcLength = -1)
60  {
61  if (nSrcLength == -1)
62  nSrcLength = 1 + GetBaseTypeLength(pszSrc);
63 
64  wmemcpy(pszDest, pszSrc, nSrcLength);
65  }
66 
68  _Out_writes_(nDestLength) LPWSTR pszDest,
69  _In_ int nDestLength,
70  _In_ LPCSTR pszSrc,
71  _In_ int nSrcLength = -1)
72  {
73  if (nSrcLength == -1)
74  nSrcLength = 1 + GetBaseTypeLength(pszSrc);
75 
76  ::MultiByteToWideChar(_AtlGetConversionACP(), 0, pszSrc, nSrcLength, pszDest, nDestLength);
77  }
78 
79  static void __cdecl MakeLower(
80  _Out_writes_(nSrcLength) LPWSTR pszSource,
81  _In_ int nSrcLength)
82  {
83  ::CharLowerBuffW(pszSource, nSrcLength);
84  }
85 
87  _In_z_ LPCWSTR pszVar,
88  _Out_writes_opt_(nBufLength) LPWSTR pszBuf,
89  _In_opt_ int nBufLength)
90  {
91  return ::GetEnvironmentVariableW(pszVar, pszBuf, nBufLength);
92  }
93 
94  static void __cdecl MakeUpper(
95  _Out_writes_(nSrcLength) LPWSTR pszSource,
96  _In_ int nSrcLength)
97  {
98  ::CharUpperBuffW(pszSource, nSrcLength);
99  }
100 
102  _In_z_ LPCWSTR pszSource,
103  _In_z_ LPCWSTR pszSub)
104  {
105  return ::wcsstr(pszSource, pszSub);
106  }
107 
109  _In_z_ LPCWSTR pszSource,
110  _In_ WCHAR ch)
111  {
112  return ::wcschr(pszSource, ch);
113  }
114 
116  _In_z_ LPCWSTR pszSource,
117  _In_ WCHAR ch)
118  {
119  return ::wcsrchr(pszSource, ch);
120  }
121 
123  _In_z_ LPCWSTR pszSource,
124  _In_z_ LPCWSTR pszCharSet)
125  {
126  return ::wcspbrk(pszSource, pszCharSet);
127  }
128 
129  static int __cdecl Compare(
130  _In_z_ LPCWSTR psz1,
131  _In_z_ LPCWSTR psz2)
132  {
133  return ::wcscmp(psz1, psz2);
134  }
135 
136  static int __cdecl CompareNoCase(
137  _In_z_ LPCWSTR psz1,
138  _In_z_ LPCWSTR psz2)
139  {
140  return ::_wcsicmp(psz1, psz2);
141  }
142 
143  static int __cdecl FormatV(
144  _In_opt_z_ LPWSTR pszDest,
145  _In_z_ LPCWSTR pszFormat,
146  _In_ va_list args)
147  {
148  if (pszDest == NULL)
149  return ::_vscwprintf(pszFormat, args);
150  return ::vswprintf(pszDest, pszFormat, args);
151  }
152 
154  _In_z_ LPCWSTR pszSource,
155  _In_ int nLength)
156  {
158  }
159 };
160 
161 
162 // Template specialization
163 
164 template<>
165 class ChTraitsCRT<char> : public ChTraitsBase<char>
166 {
167 public:
168 
169  static int __cdecl GetBaseTypeLength(_In_z_ LPCWSTR pszSource) throw()
170  {
171  return ::WideCharToMultiByte(_AtlGetConversionACP(), 0, pszSource, -1, NULL, 0, NULL, NULL) - 1;
172  }
173 
174  static int __cdecl GetBaseTypeLength(_In_z_ LPCSTR pszSource) throw()
175  {
176  if (pszSource == NULL) return 0;
177  return static_cast<int>(strlen(pszSource));
178  }
179 
181  _In_reads_(nLength) LPCWSTR pszSource,
182  _In_ int nLength) throw()
183  {
185  }
186 
188  _In_reads_(nLength) LPCSTR pszSource,
189  _In_ int nLength) throw()
190  {
191  return nLength;
192  }
193 
195  _Out_writes_(nDestLength) LPSTR pszDest,
196  _In_ int nDestLength,
197  _In_ LPCWSTR pszSrc,
198  _In_ int nSrcLength = -1)
199  {
200  if (nSrcLength == -1)
201  nSrcLength = 1 + GetBaseTypeLength(pszSrc);
202 
203  ::WideCharToMultiByte(_AtlGetConversionACP(), 0, pszSrc, nSrcLength, pszDest, nDestLength, NULL, NULL);
204  }
205 
207  _Out_writes_(nDestLength) LPSTR pszDest,
208  _In_ int nDestLength,
209  _In_ LPCSTR pszSrc,
210  _In_ int nSrcLength = -1)
211  {
212  if (nSrcLength == -1)
213  nSrcLength = 1 + GetBaseTypeLength(pszSrc);
214 
215  memcpy(pszDest, pszSrc, nSrcLength);
216  }
217 
218  static void __cdecl MakeLower(
219  _Out_writes_(nSrcLength) LPSTR pszSource,
220  _In_ int nSrcLength)
221  {
222  ::CharLowerBuffA(pszSource, nSrcLength);
223  }
224 
226  _In_z_ LPCSTR pszVar,
227  _Out_writes_opt_(nBufLength) LPSTR pszBuf,
228  _In_opt_ int nBufLength)
229  {
230  return ::GetEnvironmentVariableA(pszVar, pszBuf, nBufLength);
231  }
232 
233  static void __cdecl MakeUpper(
234  _Out_writes_(nSrcLength) LPSTR pszSource,
235  _In_ int nSrcLength)
236  {
237  ::CharUpperBuffA(pszSource, nSrcLength);
238  }
239 
241  _In_z_ LPCSTR pszSource,
242  _In_z_ LPCSTR pszSub)
243  {
244  return ::strstr(pszSource, pszSub);
245  }
246 
248  _In_z_ LPCSTR pszSource,
249  _In_ CHAR ch)
250  {
251  return ::strchr(pszSource, ch);
252  }
253 
255  _In_z_ LPCSTR pszSource,
256  _In_ CHAR ch)
257  {
258  return ::strrchr(pszSource, ch);
259  }
260 
262  _In_z_ LPCSTR pszSource,
263  _In_z_ LPCSTR pszCharSet)
264  {
265  return ::strpbrk(pszSource, pszCharSet);
266  }
267 
268  static int __cdecl Compare(
269  _In_z_ LPCSTR psz1,
270  _In_z_ LPCSTR psz2)
271  {
272  return ::strcmp(psz1, psz2);
273  }
274 
275  static int __cdecl CompareNoCase(
276  _In_z_ LPCSTR psz1,
277  _In_z_ LPCSTR psz2)
278  {
279  return ::_stricmp(psz1, psz2);
280  }
281 
282  static int __cdecl FormatV(
283  _In_opt_z_ LPSTR pszDest,
284  _In_z_ LPCSTR pszFormat,
285  _In_ va_list args)
286  {
287  if (pszDest == NULL)
288  return ::_vscprintf(pszFormat, args);
289  return ::vsprintf(pszDest, pszFormat, args);
290  }
291 
293  _In_z_ LPCSTR pszSource,
294  _In_ int nLength)
295  {
296  int nLen = ChTraitsCRT<wchar_t>::GetBaseTypeLength(pszSource, nLength);
297  BSTR bstr = ::SysAllocStringLen(NULL, nLen);
298  if (bstr)
299  {
300  ChTraitsCRT<wchar_t>::ConvertToBaseType(bstr, nLen, pszSource, nLength);
301  }
302  return bstr;
303  }
304 
305 };
306 
307 
308 namespace _CSTRING_IMPL_
309 {
310  template <typename _CharType, class StringTraits>
312  {
313  const static bool c_bIsMFCDLLTraits = false;
314  };
315 }
316 
317 
318 // TODO: disable conversion functions when _CSTRING_DISABLE_NARROW_WIDE_CONVERSION is defined.
319 
320 template <typename BaseType, class StringTraits>
321 class CStringT :
322  public CSimpleStringT <BaseType, _CSTRING_IMPL_::_MFCDLLTraitsCheck<BaseType, StringTraits>::c_bIsMFCDLLTraits>
323 {
324 public:
326  typedef StringTraits StrTraits;
327  typedef typename CThisSimpleString::XCHAR XCHAR;
328  typedef typename CThisSimpleString::PXSTR PXSTR;
330  typedef typename CThisSimpleString::YCHAR YCHAR;
331  typedef typename CThisSimpleString::PYSTR PYSTR;
333 
334 public:
335  CStringT() throw() :
336  CThisSimpleString(StringTraits::GetDefaultManager())
337  {
338  }
339 
340  explicit CStringT( _In_ IAtlStringMgr* pStringMgr) throw() :
341  CThisSimpleString(pStringMgr)
342  {
343  }
344 
345  static void __cdecl Construct(_In_ CStringT* pString)
346  {
347  new(pString) CStringT;
348  }
349 
350  CStringT(_In_ const CStringT& strSrc) :
351  CThisSimpleString(strSrc)
352  {
353  }
354 
355  CStringT(_In_ const CThisSimpleString& strSrc) :
356  CThisSimpleString(strSrc)
357  {
358  }
359 
360  template<class StringTraits_>
362  CThisSimpleString(StringTraits::GetDefaultManager())
363  {
364  *this = static_cast<const YCHAR*>(strSrc);
365  }
366 
367 protected:
368  /* helper function */
369  template <typename T_CHAR>
370  void LoadFromPtr_(_In_opt_z_ const T_CHAR* pszSrc)
371  {
372  if (pszSrc == NULL)
373  return;
374  if (IS_INTRESOURCE(pszSrc))
375  LoadString(LOWORD(pszSrc));
376  else
377  *this = pszSrc;
378  }
379 
380 public:
381  CStringT(_In_opt_z_ const XCHAR* pszSrc) :
382  CThisSimpleString(StringTraits::GetDefaultManager())
383  {
384  LoadFromPtr_(pszSrc);
385  }
386 
387  CStringT(_In_opt_z_ const XCHAR* pszSrc,
388  _In_ IAtlStringMgr* pStringMgr) : CThisSimpleString(pStringMgr)
389  {
390  LoadFromPtr_(pszSrc);
391  }
392 
393  CStringT(_In_opt_z_ const YCHAR* pszSrc) :
394  CThisSimpleString(StringTraits::GetDefaultManager())
395  {
396  LoadFromPtr_(pszSrc);
397  }
398 
399  CStringT(_In_opt_z_ const YCHAR* pszSrc,
400  _In_ IAtlStringMgr* pStringMgr) : CThisSimpleString(pStringMgr)
401  {
402  LoadFromPtr_(pszSrc);
403  }
404 
406  _In_ int nLength) :
407  CThisSimpleString(pch, nLength, StringTraits::GetDefaultManager())
408  {
409  }
410 
412  _In_ int nLength) :
413  CThisSimpleString(pch, nLength, StringTraits::GetDefaultManager())
414  {
415  }
416 
417  CStringT& operator=(_In_ const CStringT& strSrc)
418  {
420  return *this;
421  }
422 
424  {
426  return *this;
427  }
428 
430  {
431  int length = pszSrc ? StringTraits::GetBaseTypeLength(pszSrc) : 0;
432  if (length > 0)
433  {
435  StringTraits::ConvertToBaseType(result, length, pszSrc);
437  }
438  else
439  {
441  }
442  return *this;
443  }
444 
446  {
448  return *this;
449  }
450 
451  friend bool operator==(const CStringT& str1, const CStringT& str2) throw()
452  {
453  return str1.Compare(str2) == 0;
454  }
455 
456  friend bool operator==(const CStringT& str1, PCXSTR psz2) throw()
457  {
458  return str1.Compare(psz2) == 0;
459  }
460 
461  friend bool operator==(const CStringT& str1, PCYSTR psz2) throw()
462  {
463  CStringT tmp(psz2, str1.GetManager());
464  return tmp.Compare(str1) == 0;
465  }
466 
467  friend bool operator==(const CStringT& str1, XCHAR ch2) throw()
468  {
469  return str1.GetLength() == 1 && str1[0] == ch2;
470  }
471 
472  friend bool operator==(PCXSTR psz1, const CStringT& str2) throw()
473  {
474  return str2.Compare(psz1) == 0;
475  }
476 
477  friend bool operator==(PCYSTR psz1, const CStringT& str2) throw()
478  {
479  CStringT tmp(psz1, str2.GetManager());
480  return tmp.Compare(str2) == 0;
481  }
482 
483  friend bool operator==(XCHAR ch1, const CStringT& str2) throw()
484  {
485  return str2.GetLength() == 1 && str2[0] == ch1;
486  }
487 
489  {
491  return *this;
492  }
493 
495  {
497  return *this;
498  }
499 
501  {
503  return *this;
504  }
505 
507  {
509  }
510 
512  _In_ UINT nID)
513  {
515  if (pImage == NULL) return FALSE;
516 
517  int nLength = StringTraits::GetBaseTypeLength(pImage->achString, pImage->nLength);
519  StringTraits::ConvertToBaseType(pszBuffer, nLength, pImage->achString, pImage->nLength);
521 
522  return TRUE;
523  }
524 
526  {
528 
529  if (nLength > 0)
530  {
532  StringTraits::GetEnvironmentVariable(pszVar, pszBuffer, nLength);
534  return TRUE;
535  }
536 
538  return FALSE;
539  }
540 
542  {
545 
546  StringTraits::MakeLower(pszBuffer, nLength);
548 
549  return *this;
550  }
551 
553  {
556 
557  StringTraits::MakeUpper(pszBuffer, nLength);
559 
560  return *this;
561  }
562 
563  int Find(_In_ PCXSTR pszSub, _In_opt_ int iStart = 0) const throw()
564  {
566 
567  if (iStart >= nLength || iStart < 0)
568  return -1;
569 
571  PCXSTR pszResult = StringTraits::FindString(pszString + iStart, pszSub);
572 
573  return pszResult ? ((int)(pszResult - pszString)) : -1;
574  }
575 
576  int Find(_In_ XCHAR ch, _In_opt_ int iStart = 0) const throw()
577  {
579 
580  if (iStart >= nLength || iStart < 0)
581  return -1;
582 
584  PCXSTR pszResult = StringTraits::FindChar(pszString + iStart, ch);
585 
586  return pszResult ? ((int)(pszResult - pszString)) : -1;
587  }
588 
589  int FindOneOf(_In_ PCXSTR pszCharSet) const throw()
590  {
592  PCXSTR pszResult = StringTraits::FindOneOf(pszString, pszCharSet);
593 
594  return pszResult ? ((int)(pszResult - pszString)) : -1;
595  }
596 
597  int ReverseFind(_In_ XCHAR ch) const throw()
598  {
600  PCXSTR pszResult = StringTraits::FindCharReverse(pszString, ch);
601 
602  return pszResult ? ((int)(pszResult - pszString)) : -1;
603  }
604 
605  int Compare(_In_z_ PCXSTR psz) const
606  {
607  return StringTraits::Compare(CThisSimpleString::GetString(), psz);
608  }
609 
610  int CompareNoCase(_In_z_ PCXSTR psz) const
611  {
612  return StringTraits::CompareNoCase(CThisSimpleString::GetString(), psz);
613  }
614 
615  CStringT Mid(int iFirst, int nCount) const
616  {
618 
619  if (iFirst < 0)
620  iFirst = 0;
621  if (nCount < 0)
622  nCount = 0;
623  if (iFirst > nLength)
624  iFirst = nLength;
625  if (iFirst + nCount > nLength)
626  nCount = nLength - iFirst;
627 
628  return CStringT(CThisSimpleString::GetString() + iFirst, nCount);
629  }
630 
631  CStringT Mid(int iFirst) const
632  {
634 
635  if (iFirst < 0)
636  iFirst = 0;
637  if (iFirst > nLength)
638  iFirst = nLength;
639 
640  return CStringT(CThisSimpleString::GetString() + iFirst, nLength - iFirst);
641  }
642 
643  CStringT Left(int nCount) const
644  {
646 
647  if (nCount < 0)
648  nCount = 0;
649  if (nCount > nLength)
650  nCount = nLength;
651 
652  return CStringT(CThisSimpleString::GetString(), nCount);
653  }
654 
655  CStringT Right(int nCount) const
656  {
658 
659  if (nCount < 0)
660  nCount = 0;
661  if (nCount > nLength)
662  nCount = nLength;
663 
664  return CStringT(CThisSimpleString::GetString() + nLength - nCount, nCount);
665  }
666 
667 
668  void __cdecl Format(UINT nFormatID, ...)
669  {
670  va_list args;
671  va_start(args, nFormatID);
672  CStringT formatString;
673  if (formatString.LoadString(nFormatID))
674  FormatV(formatString, args);
675  va_end(args);
676  }
677 
678  void __cdecl Format(PCXSTR pszFormat, ...)
679  {
680  va_list args;
681  va_start(args, pszFormat);
682  FormatV(pszFormat, args);
683  va_end(args);
684  }
685 
686  void FormatV(PCXSTR pszFormat, va_list args)
687  {
688  int nLength = StringTraits::FormatV(NULL, pszFormat, args);
689 
691  StringTraits::FormatV(pszBuffer, pszFormat, args);
693  }
694 
695 
696  int Replace(PCXSTR pszOld, PCXSTR pszNew)
697  {
699 
701  const int nOldLen = StringTraits::GetBaseTypeLength(pszOld);
702  const int nNewLen = StringTraits::GetBaseTypeLength(pszNew);
703  const int nDiff = nNewLen - nOldLen;
704  int nResultLength = nLength;
705 
706  PCXSTR pszFound;
707  while ((pszFound = StringTraits::FindString(pszString, pszOld)))
708  {
709  nResultLength += nDiff;
710  pszString = pszFound + nOldLen;
711  }
712 
714  return 0;
715 
716  PXSTR pszResult = CThisSimpleString::GetBuffer(nResultLength);
717  PXSTR pszNext;
718  int nCount = 0, nRemaining = nLength;
719  while (nRemaining && (pszNext = StringTraits::FindString(pszResult, pszOld)))
720  {
721  nRemaining -= (pszNext - pszResult);
722  nRemaining -= nOldLen;
723  if (nRemaining > 0)
724  CThisSimpleString::CopyCharsOverlapped(pszNext + nNewLen, nRemaining + 1, pszNext + nOldLen, nRemaining + 1);
725  CThisSimpleString::CopyCharsOverlapped(pszNext, nNewLen, pszNew, nNewLen);
726  pszResult = pszNext + nNewLen;
727  nCount++;
728  }
729 
731 
732  return nCount;
733  }
734 
735  int Replace(XCHAR chOld, XCHAR chNew)
736  {
738  PXSTR pszFirst = StringTraits::FindChar(pszString, chOld);
739  if (!pszFirst)
740  return 0;
741 
743  int nCount = 0;
744 
746  pszFirst = pszBuffer + (pszFirst - pszString);
747  do {
748  *pszFirst = chNew;
749  ++nCount;
750  } while ((pszFirst = StringTraits::FindChar(pszFirst + 1, chOld)));
751 
753  return nCount;
754  }
755 
756 
758  {
759  static XCHAR str[] = { ' ', '\t', '\r', '\n', 0 };
760  return str;
761  }
762 
763 
765  {
766  return TrimLeft(DefaultTrimChars());
767  }
768 
770  {
771  XCHAR str[2] = { chTarget, 0 };
772  return TrimLeft(str);
773  }
774 
775  CStringT& TrimLeft(PCXSTR pszTargets)
776  {
779  int nCount = 0;
780 
781  while (nCount < nLength && StringTraits::FindChar(pszTargets, pszBuffer[nCount]))
782  nCount++;
783 
784  if (nCount > 0)
785  {
786  CThisSimpleString::CopyCharsOverlapped(pszBuffer, nLength - nCount, pszBuffer + nCount, nLength - nCount);
787  nLength -= nCount;
788  }
790 
791  return *this;
792  }
793 
794 
796  {
797  return TrimRight(DefaultTrimChars());
798  }
799 
801  {
802  XCHAR str[2] = { chTarget, 0 };
803  return TrimRight(str);
804  }
805 
806  CStringT& TrimRight(PCXSTR pszTargets)
807  {
810 
811  while (nLength > 0 && StringTraits::FindChar(pszTargets, pszBuffer[nLength-1]))
812  nLength--;
813 
815 
816  return *this;
817  }
818 
819 
821  {
822  return Trim(DefaultTrimChars());
823  }
824 
825  CStringT& Trim(XCHAR chTarget)
826  {
827  XCHAR str[2] = { chTarget, 0 };
828  return Trim(str);
829  }
830 
831  CStringT& Trim(PCXSTR pszTargets)
832  {
833  return TrimRight(pszTargets).TrimLeft(pszTargets);
834  }
835 
836 
838  {
839  return StringTraits::AllocSysString(CThisSimpleString::GetString(), CThisSimpleString::GetLength());
840  }
841 
842 
843 };
844 
845 } //namespace ATL
846 
847 #endif
CStringT & TrimRight(XCHAR chTarget)
Definition: cstringt.h:800
CStringT & TrimRight(PCXSTR pszTargets)
Definition: cstringt.h:806
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPSTR pszDest, _In_ int nDestLength, _In_ LPCSTR pszSrc, _In_ int nSrcLength=-1)
Definition: cstringt.h:206
CStringT(_In_ IAtlStringMgr *pStringMgr)
Definition: cstringt.h:340
#define _In_opt_z_
Definition: no_sal2.h:221
#define TRUE
Definition: types.h:120
void FormatV(PCXSTR pszFormat, va_list args)
Definition: cstringt.h:686
CStringT(_In_reads_z_(nLength) const XCHAR *pch, _In_ int nLength)
Definition: cstringt.h:405
static int __cdecl FormatV(_In_opt_z_ LPSTR pszDest, _In_z_ LPCSTR pszFormat, _In_ va_list args)
Definition: cstringt.h:282
#define WideCharToMultiByte
Definition: compat.h:101
CStringT & TrimLeft(XCHAR chTarget)
Definition: cstringt.h:769
#define __cdecl
Definition: accygwin.h:79
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
void __cdecl Format(PCXSTR pszFormat,...)
Definition: cstringt.h:678
CStringT & operator=(_In_ const CThisSimpleString &strSrc)
Definition: cstringt.h:445
CStringT(_In_opt_z_ const YCHAR *pszSrc)
Definition: cstringt.h:393
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
DWORD WINAPI CharLowerBuffA(_Inout_updates_(cchLength) LPSTR lpsz, _In_ DWORD cchLength)
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define CP_ACP
Definition: compat.h:99
static LPSTR __cdecl FindOneOf(_In_z_ LPCSTR pszSource, _In_z_ LPCSTR pszCharSet)
Definition: cstringt.h:261
#define _In_reads_(size)
Definition: no_sal2.h:228
char CHAR
Definition: xmlstorage.h:175
static void __cdecl Construct(_In_ CStringT *pString)
Definition: cstringt.h:345
CStringT Right(int nCount) const
Definition: cstringt.h:655
int CompareNoCase(_In_z_ PCXSTR psz) const
Definition: cstringt.h:610
CStringT Mid(int iFirst, int nCount) const
Definition: cstringt.h:615
_In_ DWORD nLength
Definition: wincon.h:461
static void __cdecl MakeUpper(_Out_writes_(nSrcLength) LPWSTR pszSource, _In_ int nSrcLength)
Definition: cstringt.h:94
CStringT & operator=(_In_ const CStringT &strSrc)
Definition: cstringt.h:417
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:668
_In_ UINT iStart
Definition: wingdi.h:3598
#define _Check_return_
Definition: no_sal2.h:13
CStringT & TrimLeft()
Definition: cstringt.h:764
OLECHAR * BSTR
Definition: compat.h:1927
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
const ATLSTRINGRESOURCEIMAGE * AtlGetStringResourceImage(_In_ HINSTANCE hInstance, _In_ UINT id)
Definition: atlcore.h:268
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCSTR pszSource, _In_ int nLength)
Definition: cstringt.h:187
char * LPSTR
Definition: xmlstorage.h:182
CStringT & TrimLeft(PCXSTR pszTargets)
Definition: cstringt.h:775
friend bool operator==(const CStringT &str1, PCYSTR psz2)
Definition: cstringt.h:461
Definition: match.c:390
static int __cdecl Compare(_In_z_ LPCWSTR psz1, _In_z_ LPCWSTR psz2)
Definition: cstringt.h:129
#define _stricmp
Definition: cat.c:22
#define _In_opt_
Definition: no_sal2.h:213
CThisSimpleString::PCXSTR PCXSTR
Definition: cstringt.h:329
friend bool operator==(PCXSTR psz1, const CStringT &str2)
Definition: cstringt.h:472
CStringT & operator+=(_In_ const CThisSimpleString &str)
Definition: cstringt.h:488
#define _Out_writes_(size)
Definition: no_sal2.h:367
int Replace(XCHAR chOld, XCHAR chNew)
Definition: cstringt.h:735
CStringT & MakeUpper()
Definition: cstringt.h:552
HINSTANCE hInstance
Definition: charmap.c:20
static int __cdecl GetBaseTypeLength(_In_z_ LPCSTR pszSource)
Definition: cstringt.h:35
#define va_end(ap)
Definition: acmsvcex.h:90
static LPSTR __cdecl FindCharReverse(_In_z_ LPCSTR pszSource, _In_ CHAR ch)
Definition: cstringt.h:254
static DWORD GetEnvironmentVariable(_In_z_ LPCSTR pszVar, _Out_writes_opt_(nBufLength) LPSTR pszBuf, _In_opt_ int nBufLength)
Definition: cstringt.h:225
static BSTR __cdecl AllocSysString(_In_z_ LPCWSTR pszSource, _In_ int nLength)
Definition: cstringt.h:153
CThisSimpleString::PYSTR PYSTR
Definition: cstringt.h:331
friend bool operator==(const CStringT &str1, XCHAR ch2)
Definition: cstringt.h:467
friend bool operator==(const CStringT &str1, PCXSTR psz2)
Definition: cstringt.h:456
CSimpleStringT< BaseType, _CSTRING_IMPL_::_MFCDLLTraitsCheck< BaseType, StringTraits >::c_bIsMFCDLLTraits > CThisSimpleString
Definition: cstringt.h:325
const WCHAR * str
CThisSimpleString::YCHAR YCHAR
Definition: cstringt.h:330
StringTraits StrTraits
Definition: cstringt.h:326
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:27
char * va_list
Definition: acmsvcex.h:78
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
HINSTANCE GetResourceInstance()
Definition: atlcore.h:203
void LoadFromPtr_(_In_opt_z_ const T_CHAR *pszSrc)
Definition: cstringt.h:370
const char * LPCSTR
Definition: xmlstorage.h:183
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPSTR pszDest, _In_ int nDestLength, _In_ LPCWSTR pszSrc, _In_ int nSrcLength=-1)
Definition: cstringt.h:194
friend bool operator==(PCYSTR psz1, const CStringT &str2)
Definition: cstringt.h:477
static int __cdecl GetBaseTypeLength(_In_z_ LPCWSTR pszSource)
Definition: cstringt.h:29
int Find(_In_ XCHAR ch, _In_opt_ int iStart=0) const
Definition: cstringt.h:576
Definition: rosdlgs.h:5
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:411
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
CThisSimpleString::XCHAR XCHAR
Definition: cstringt.h:327
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static LPWSTR __cdecl FindCharReverse(_In_z_ LPCWSTR pszSource, _In_ WCHAR ch)
Definition: cstringt.h:115
CStringT & operator=(_In_opt_z_ PCYSTR pszSrc)
Definition: cstringt.h:429
CStringT(_In_opt_z_ const YCHAR *pszSrc, _In_ IAtlStringMgr *pStringMgr)
Definition: cstringt.h:399
unsigned int UINT
Definition: ndis.h:50
_Check_return_ BOOL LoadString(_In_ HINSTANCE hInstance, _In_ UINT nID)
Definition: cstringt.h:511
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCSTR pszSource, _In_ int nLength)
Definition: cstringt.h:48
DWORD WINAPI CharUpperBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
unsigned long DWORD
Definition: ntddk_ex.h:95
CStringT & Trim(PCXSTR pszTargets)
Definition: cstringt.h:831
static void __cdecl MakeLower(_Out_writes_(nSrcLength) LPWSTR pszSource, _In_ int nSrcLength)
Definition: cstringt.h:79
CThisSimpleString::PXSTR PXSTR
Definition: cstringt.h:328
CStringT Mid(int iFirst) const
Definition: cstringt.h:631
static void __cdecl MakeLower(_Out_writes_(nSrcLength) LPSTR pszSource, _In_ int nSrcLength)
Definition: cstringt.h:218
static int __cdecl GetBaseTypeLength(_In_z_ LPCSTR pszSource)
Definition: cstringt.h:174
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCWSTR pszSource, _In_ int nLength)
Definition: cstringt.h:41
BOOL GetEnvironmentVariable(_In_z_ PCXSTR pszVar)
Definition: cstringt.h:525
friend bool operator==(const CStringT &str1, const CStringT &str2)
Definition: cstringt.h:451
static int __cdecl FormatV(_In_opt_z_ LPWSTR pszDest, _In_z_ LPCWSTR pszFormat, _In_ va_list args)
Definition: cstringt.h:143
BSTR AllocSysString() const
Definition: cstringt.h:837
CStringT(_In_reads_z_(nLength) const YCHAR *pch, _In_ int nLength)
Definition: cstringt.h:411
static int __cdecl GetBaseTypeLength(_In_z_ LPCWSTR pszSource)
Definition: cstringt.h:169
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int FindOneOf(_In_ PCXSTR pszCharSet) const
Definition: cstringt.h:589
CStringT & TrimRight()
Definition: cstringt.h:795
friend bool operator==(XCHAR ch1, const CStringT &str2)
Definition: cstringt.h:483
UINT WINAPI _AtlGetConversionACP()
Definition: cstringt.h:14
#define WINAPI
Definition: msvc.h:20
static LPSTR __cdecl FindChar(_In_z_ LPCSTR pszSource, _In_ CHAR ch)
Definition: cstringt.h:247
DWORD WINAPI CharUpperBuffA(_Inout_updates_(cchLength) LPSTR lpsz, _In_ DWORD cchLength)
#define _In_
Definition: no_sal2.h:204
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:696
DWORD WINAPI CharLowerBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
_Check_return_ _CRTIMP int __cdecl _vscwprintf(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static PCXSTR DefaultTrimChars()
Definition: cstringt.h:757
_Check_return_ _CRTIMP int __cdecl _vscprintf(_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
static DWORD GetEnvironmentVariable(_In_z_ LPCWSTR pszVar, _Out_writes_opt_(nBufLength) LPWSTR pszBuf, _In_opt_ int nBufLength)
Definition: cstringt.h:86
static BSTR __cdecl AllocSysString(_In_z_ LPCSTR pszSource, _In_ int nLength)
Definition: cstringt.h:292
static int __cdecl CompareNoCase(_In_z_ LPCWSTR psz1, _In_z_ LPCWSTR psz2)
Definition: cstringt.h:136
#define _In_z_
Definition: no_sal2.h:239
_In_ UINT _Out_writes_opt_(cch) LPSTR lpszFile
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
static void __cdecl MakeUpper(_Out_writes_(nSrcLength) LPSTR pszSource, _In_ int nSrcLength)
Definition: cstringt.h:233
static int __cdecl Compare(_In_z_ LPCSTR psz1, _In_z_ LPCSTR psz2)
Definition: cstringt.h:268
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
CStringT & operator+=(_In_z_ PCXSTR pszSrc)
Definition: cstringt.h:494
#define va_start(ap, A)
Definition: acmsvcex.h:91
CStringT & operator=(_In_opt_z_ PCXSTR pszSrc)
Definition: cstringt.h:423
CStringT(_In_opt_z_ const XCHAR *pszSrc, _In_ IAtlStringMgr *pStringMgr)
Definition: cstringt.h:387
static LPWSTR __cdecl FindChar(_In_z_ LPCWSTR pszSource, _In_ WCHAR ch)
Definition: cstringt.h:108
#define T_CHAR
Definition: mscvpdb.h:845
#define MultiByteToWideChar
Definition: compat.h:100
CStringT & Trim(XCHAR chTarget)
Definition: cstringt.h:825
char * strchr(const char *String, int ch)
Definition: utclib.c:501
int Find(_In_ PCXSTR pszSub, _In_opt_ int iStart=0) const
Definition: cstringt.h:563
CStringT(_In_ const CStringT &strSrc)
Definition: cstringt.h:350
static LPWSTR __cdecl FindOneOf(_In_z_ LPCWSTR pszSource, _In_z_ LPCWSTR pszCharSet)
Definition: cstringt.h:122
static void __cdecl CopyCharsOverlapped(_Out_writes_to_(nDestLen, nDestLen) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:432
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPWSTR pszDest, _In_ int nDestLength, _In_ LPCWSTR pszSrc, _In_ int nSrcLength=-1)
Definition: cstringt.h:55
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:506
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define GetEnvironmentVariable
Definition: winbase.h:3628
#define _In_reads_z_(size)
Definition: no_sal2.h:238
CAtlBaseModule _AtlBaseModule
Definition: atlbase.cpp:26
CStringT(_In_opt_z_ const XCHAR *pszSrc)
Definition: cstringt.h:381
WCHAR * pch
Definition: msvc.h:81
int ReverseFind(_In_ XCHAR ch) const
Definition: cstringt.h:597
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPWSTR pszDest, _In_ int nDestLength, _In_ LPCSTR pszSrc, _In_ int nSrcLength=-1)
Definition: cstringt.h:67
int Compare(_In_z_ PCXSTR psz) const
Definition: cstringt.h:605
CStringT(_In_ const CThisSimpleString &strSrc)
Definition: cstringt.h:355
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CP_THREAD_ACP
Definition: winnls.h:230
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:412
GLuint64EXT * result
Definition: glext.h:11304
static LPSTR __cdecl FindString(_In_z_ LPCSTR pszSource, _In_z_ LPCSTR pszSub)
Definition: cstringt.h:240
CStringT & Trim()
Definition: cstringt.h:820
CStringT & operator+=(_In_ XCHAR ch)
Definition: cstringt.h:500
#define args
Definition: format.c:66
_CRTIMP int __cdecl vswprintf(_Out_ wchar_t *, const wchar_t *, va_list)
CStringT Left(int nCount) const
Definition: cstringt.h:643
CStringT & MakeLower()
Definition: cstringt.h:541
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static int __cdecl CompareNoCase(_In_z_ LPCSTR psz1, _In_z_ LPCSTR psz2)
Definition: cstringt.h:275
CThisSimpleString::PCYSTR PCYSTR
Definition: cstringt.h:332
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static LPWSTR __cdecl FindString(_In_z_ LPCWSTR pszSource, _In_z_ LPCWSTR pszSub)
Definition: cstringt.h:101
CStringT(_In_ const CStringT< YCHAR, StringTraits_ > &strSrc)
Definition: cstringt.h:361
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCWSTR pszSource, _In_ int nLength)
Definition: cstringt.h:180
_In_ DWORD _In_ DWORD _Out_writes_to_opt_ pcchString LPSTR pszString
Definition: wincrypt.h:4507
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29