16#ifdef _CONVERSION_DONT_USE_THREAD_LOCALE
24template<
typename _CharType =
wchar_t>
31 if (pszSource ==
NULL)
return -1;
32 return static_cast<int>(
wcslen(pszSource));
37 if (pszSource ==
NULL)
return 0;
59 _In_ int nSrcLength = -1)
64 wmemcpy(pszDest, pszSrc, nSrcLength);
71 _In_ int nSrcLength = -1)
91 return ::GetEnvironmentVariableW(pszVar, pszBuf, nBufLength);
105 return ::wcsstr(pszSource, pszSub);
111 return ::wcsstr(pszSource, pszSub);
118 return ::wcschr(pszSource, ch);
124 return ::wcschr(pszSource, ch);
131 return ::wcsrchr(pszSource, ch);
137 return ::wcsrchr(pszSource, ch);
144 return ::wcspbrk(pszSource, pszCharSet);
150 return ::wcspbrk(pszSource, pszCharSet);
157 return ::wcscmp(psz1, psz2);
164 return ::_wcsicmp(psz1, psz2);
171 return (
int)
::wcsspn(pszBlock, pszSet);
187 return ::_vscwprintf(pszFormat,
args);
188 return ::vswprintf(pszDest, pszFormat,
args);
197 reinterpret_cast<LPWSTR>(&psz), 0, pArgList);
205 return ::SysAllocStringLen(pszSource,
nLength);
224 if (pszSource ==
NULL)
return 0;
225 return static_cast<int>(
strlen(pszSource));
244 _In_ int nDestLength,
246 _In_ int nSrcLength = -1)
248 if (nSrcLength == -1)
256 _In_ int nDestLength,
258 _In_ int nSrcLength = -1)
260 if (nSrcLength == -1)
263 memcpy(pszDest, pszSrc, nSrcLength);
278 return ::GetEnvironmentVariableA(pszVar, pszBuf, nBufLength);
292 return ::strstr(pszSource, pszSub);
298 return ::strstr(pszSource, pszSub);
305 return ::strchr(pszSource, ch);
311 return ::strchr(pszSource, ch);
318 return ::strrchr(pszSource, ch);
324 return ::strrchr(pszSource, ch);
331 return ::strpbrk(pszSource, pszCharSet);
337 return ::strpbrk(pszSource, pszCharSet);
344 return ::strcmp(psz1, psz2);
351 return ::_stricmp(psz1, psz2);
358 return (
int)
::strspn(pszBlock, pszSet);
374 return ::_vscprintf(pszFormat,
args);
375 return ::vsprintf(pszDest, pszFormat,
args);
404namespace _CSTRING_IMPL_
406 template <
typename _CharType,
class StringTraits>
416template <
typename BaseType,
class StringTraits>
418 public CSimpleStringT <BaseType, _CSTRING_IMPL_::_MFCDLLTraitsCheck<BaseType, StringTraits>::c_bIsMFCDLLTraits>
456 template<
class StringTraits_>
460 *
this =
static_cast<const YCHAR*
>(strSrc);
465 template <
typename T_CHAR>
527 int length = pszSrc ? StringTraits::GetBaseTypeLength(pszSrc) : 0;
531 StringTraits::ConvertToBaseType(
result,
length, pszSrc);
549 return str1.Compare(str2) == 0;
554 return str1.Compare(psz2) == 0;
559 CStringT tmp(psz2, str1.GetManager());
565 return str1.GetLength() == 1 && str1[0] == ch2;
570 return str2.Compare(psz1) == 0;
575 CStringT tmp(psz1, str2.GetManager());
581 return str2.GetLength() == 1 && str2[0] == ch1;
586 return str1.Compare(str2) != 0;
591 return str1.Compare(psz2) != 0;
596 CStringT tmp(psz2, str1.GetManager());
602 return str1.GetLength() != 1 || str1[0] != ch2;
607 return str2.Compare(psz1) != 0;
612 CStringT tmp(psz1, str2.GetManager());
618 return str2.GetLength() != 1 || str2[0] != ch1;
641 return LoadString(_AtlBaseModule.GetResourceInstance(), nID);
660 int nLength = StringTraits::GetEnvironmentVariable(pszVar,
NULL, 0);
665 StringTraits::GetEnvironmentVariable(pszVar, pszBuffer,
nLength);
679 StringTraits::MakeLower(pszBuffer,
nLength);
690 StringTraits::MakeUpper(pszBuffer,
nLength);
842 StringTraits::FormatV(pszBuffer +
nCurrent, pszFormat,
args);
851 StringTraits::FormatV(pszBuffer, pszFormat,
args);
861 if (
str.LoadString(nFormatID))
878 PXSTR psz = StringTraits::FormatMessageV(pszFormat, pArgList);
891 const int nOldLen = StringTraits::GetBaseTypeLength(pszOld);
892 const int nNewLen = StringTraits::GetBaseTypeLength(pszNew);
893 const int nDiff = nNewLen - nOldLen;
897 while ((pszFound = StringTraits::FindString(
pszString, pszOld)))
899 nResultLength += nDiff;
908 int nCount = 0, nRemaining =
nLength;
909 while (nRemaining && (pszNext = StringTraits::FindString(pszResult, pszOld)))
911 nRemaining -= (pszNext - pszResult);
912 nRemaining -= nOldLen;
916 pszResult = pszNext + nNewLen;
936 pszFirst = pszBuffer + (pszFirst -
pszString);
940 }
while ((pszFirst = StringTraits::FindChar(pszFirst + 1, chOld)));
954 if (!pszTokens || !pszTokens[0])
970 int iNewStart =
iStart + iRangeOffset;
973 iStart = iNewStart + nCount + 1;
975 return Mid(iNewStart, nCount);
985 static XCHAR str[] = {
' ',
'\t',
'\r',
'\n', 0 };
1007 while (nCount <
nLength && StringTraits::FindChar(pszTargets, pszBuffer[nCount]))
1037 while (
nLength > 0 && StringTraits::FindChar(pszTargets, pszBuffer[
nLength-1]))
ACPI_SIZE strlen(const char *String)
CSimpleStringT & operator=(_In_opt_z_ PCXSTR pszSrc)
ChTraitsBase< BaseType >::PCXSTR PCXSTR
ChTraitsBase< BaseType >::PCYSTR PCYSTR
static void __cdecl CopyCharsOverlapped(_Out_writes_to_(nDestLen, nDestLen) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_(nChars) const XCHAR *pchSrc, _In_ int nChars) noexcept
ChTraitsBase< BaseType >::YCHAR YCHAR
ChTraitsBase< BaseType >::PXSTR PXSTR
void ReleaseBufferSetLength(_In_ int nNewLength)
CSimpleStringT & operator+=(_In_ const CSimpleStringT &strSrc)
ChTraitsBase< BaseType >::PYSTR PYSTR
void ReleaseBuffer(_In_ int nNewLength=-1)
PXSTR GetString() noexcept
static void ThrowMemoryException()
int GetLength() const noexcept
ChTraitsBase< BaseType >::XCHAR XCHAR
int Replace(XCHAR chOld, XCHAR chNew)
CStringT Right(int nCount) const
CStringT(_In_reads_z_(nLength) const YCHAR *pch, _In_ int nLength)
BOOL GetEnvironmentVariable(_In_z_ PCXSTR pszVar)
int CompareNoCase(_In_z_ PCXSTR psz) const
friend bool operator!=(PCXSTR psz1, const CStringT &str2) noexcept
void LoadFromPtr_(_In_opt_z_ const T_CHAR *pszSrc)
CThisSimpleString::PCYSTR PCYSTR
_Check_return_ BOOL LoadString(_In_ HINSTANCE hInstance, _In_ UINT nID)
CStringT & Trim(XCHAR chTarget)
friend bool operator==(PCXSTR psz1, const CStringT &str2) noexcept
friend bool operator==(const CStringT &str1, PCYSTR psz2) noexcept
CStringT & Trim(PCXSTR pszTargets)
CStringT(_In_ const CStringT< YCHAR, StringTraits_ > &strSrc)
CStringT & TrimRight(PCXSTR pszTargets)
CStringT & operator+=(_In_ const CThisSimpleString &str)
CThisSimpleString::PCXSTR PCXSTR
static PCXSTR DefaultTrimChars()
int Replace(PCXSTR pszOld, PCXSTR pszNew)
friend bool operator!=(XCHAR ch1, const CStringT &str2) noexcept
CStringT & operator+=(_In_ XCHAR ch)
CStringT & operator=(_In_opt_z_ PCXSTR pszSrc)
void __cdecl AppendFormat(PCXSTR pszFormat,...)
BOOL LoadString(_In_ UINT nID)
friend bool operator!=(const CStringT &str1, PCYSTR psz2) noexcept
CStringT(_In_opt_z_ const YCHAR *pszSrc)
CStringT Left(int nCount) const
friend bool operator!=(PCYSTR psz1, const CStringT &str2) noexcept
CStringT & operator=(_In_ const CThisSimpleString &strSrc)
void __cdecl Format(UINT nFormatID,...)
void FormatV(PCXSTR pszFormat, va_list args)
void __cdecl AppendFormat(UINT nFormatID,...)
CStringT(_In_ const CStringT &strSrc)
friend bool operator==(XCHAR ch1, const CStringT &str2) noexcept
int Compare(_In_z_ PCXSTR psz) const
void __cdecl FormatMessage(UINT nFormatID,...)
CStringT & operator+=(_In_z_ PCXSTR pszSrc)
CStringT Tokenize(_In_z_ PCXSTR pszTokens, _Inout_ int &iStart) const
CStringT & TrimLeft(XCHAR chTarget)
CStringT Mid(int iFirst) const
void FormatMessageV(PCXSTR pszFormat, va_list *pArgList)
CStringT & TrimLeft(PCXSTR pszTargets)
int Find(_In_ PCXSTR pszSub, _In_opt_ int iStart=0) const noexcept
static void __cdecl Construct(_In_ CStringT *pString)
CStringT & operator=(_In_opt_z_ PCYSTR pszSrc)
friend bool operator==(const CStringT &str1, XCHAR ch2) noexcept
CStringT Mid(int iFirst, int nCount) const
CThisSimpleString::YCHAR YCHAR
CStringT(_In_opt_z_ const XCHAR *pszSrc, _In_ IAtlStringMgr *pStringMgr)
CStringT(_In_ const CThisSimpleString &strSrc)
friend bool operator!=(const CStringT &str1, const CStringT &str2) noexcept
CStringT(_In_opt_z_ const XCHAR *pszSrc)
CThisSimpleString::XCHAR XCHAR
CStringT(_In_ IAtlStringMgr *pStringMgr) noexcept
CThisSimpleString::PXSTR PXSTR
CThisSimpleString::PYSTR PYSTR
int ReverseFind(_In_ XCHAR ch) const noexcept
void AppendFormatV(PCXSTR pszFormat, va_list args)
CStringT & TrimRight(XCHAR chTarget)
CStringT & operator=(_In_ const CStringT &strSrc)
void __cdecl FormatMessage(PCXSTR pszFormat,...)
friend bool operator!=(const CStringT &str1, XCHAR ch2) noexcept
CStringT(_In_opt_z_ const YCHAR *pszSrc, _In_ IAtlStringMgr *pStringMgr)
int FindOneOf(_In_ PCXSTR pszCharSet) const noexcept
friend bool operator!=(const CStringT &str1, PCXSTR psz2) noexcept
CSimpleStringT< BaseType, _CSTRING_IMPL_::_MFCDLLTraitsCheck< BaseType, StringTraits >::c_bIsMFCDLLTraits > CThisSimpleString
CStringT(_In_reads_z_(nLength) const XCHAR *pch, _In_ int nLength)
int Find(_In_ XCHAR ch, _In_opt_ int iStart=0) const noexcept
friend bool operator==(const CStringT &str1, PCXSTR psz2) noexcept
BSTR AllocSysString() const
friend bool operator==(PCYSTR psz1, const CStringT &str2) noexcept
friend bool operator==(const CStringT &str1, const CStringT &str2) noexcept
void __cdecl Format(PCXSTR pszFormat,...)
static int __cdecl StringSpanExcluding(_In_z_ LPCSTR pszBlock, _In_z_ LPCSTR pszSet)
static LPCSTR __cdecl FindOneOf(_In_z_ LPCSTR pszSource, _In_z_ LPCSTR pszCharSet)
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPSTR pszDest, _In_ int nDestLength, _In_ LPCWSTR pszSrc, _In_ int nSrcLength=-1)
static int __cdecl CompareNoCase(_In_z_ LPCSTR psz1, _In_z_ LPCSTR psz2)
static LPSTR __cdecl FindOneOf(_In_z_ LPSTR pszSource, _In_z_ LPCSTR pszCharSet)
static LPSTR __cdecl FindChar(_In_z_ LPSTR pszSource, _In_ CHAR ch)
static LPSTR FormatMessageV(_In_z_ LPCSTR pszFormat, _In_opt_ va_list *pArgList)
static LPSTR __cdecl FindCharReverse(_In_z_ LPSTR pszSource, _In_ CHAR ch)
static BSTR __cdecl AllocSysString(_In_z_ LPCSTR pszSource, _In_ int nLength)
static DWORD GetEnvironmentVariable(_In_z_ LPCSTR pszVar, _Out_writes_opt_(nBufLength) LPSTR pszBuf, _In_opt_ int nBufLength)
static void __cdecl MakeLower(_Out_writes_(nSrcLength) LPSTR pszSource, _In_ int nSrcLength)
static LPCSTR __cdecl FindCharReverse(_In_z_ LPCSTR pszSource, _In_ CHAR ch)
static int __cdecl GetBaseTypeLength(_In_z_ LPCWSTR pszSource) noexcept
static int __cdecl FormatV(_In_opt_z_ LPSTR pszDest, _In_z_ LPCSTR pszFormat, _In_ va_list args)
static int __cdecl StringSpanIncluding(_In_z_ LPCSTR pszBlock, _In_z_ LPCSTR pszSet)
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCSTR pszSource, _In_ int nLength) noexcept
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPSTR pszDest, _In_ int nDestLength, _In_ LPCSTR pszSrc, _In_ int nSrcLength=-1)
static LPCSTR __cdecl FindString(_In_z_ LPCSTR pszSource, _In_z_ LPCSTR pszSub)
static int __cdecl Compare(_In_z_ LPCSTR psz1, _In_z_ LPCSTR psz2)
static void __cdecl MakeUpper(_Out_writes_(nSrcLength) LPSTR pszSource, _In_ int nSrcLength)
static LPCSTR __cdecl FindChar(_In_z_ LPCSTR pszSource, _In_ CHAR ch)
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCWSTR pszSource, _In_ int nLength) noexcept
static LPSTR __cdecl FindString(_In_z_ LPSTR pszSource, _In_z_ LPCSTR pszSub)
static int __cdecl GetBaseTypeLength(_In_z_ LPCSTR pszSource) noexcept
static int __cdecl GetBaseTypeLength(_In_z_ LPCWSTR pszSource) noexcept
static DWORD GetEnvironmentVariable(_In_z_ LPCWSTR pszVar, _Out_writes_opt_(nBufLength) LPWSTR pszBuf, _In_opt_ int nBufLength)
static void __cdecl MakeUpper(_Out_writes_(nSrcLength) LPWSTR pszSource, _In_ int nSrcLength)
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCWSTR pszSource, _In_ int nLength) noexcept
static BSTR __cdecl AllocSysString(_In_z_ LPCWSTR pszSource, _In_ int nLength)
static int __cdecl Compare(_In_z_ LPCWSTR psz1, _In_z_ LPCWSTR psz2)
static LPWSTR FormatMessageV(_In_z_ LPCWSTR pszFormat, _In_opt_ va_list *pArgList)
static LPCWSTR __cdecl FindString(_In_z_ LPCWSTR pszSource, _In_z_ LPCWSTR pszSub)
static LPCWSTR __cdecl FindChar(_In_z_ LPCWSTR pszSource, _In_ WCHAR ch)
static int __cdecl GetBaseTypeLength(_In_reads_(nLength) LPCSTR pszSource, _In_ int nLength) noexcept
static LPWSTR __cdecl FindChar(_In_z_ LPWSTR pszSource, _In_ WCHAR ch)
static int __cdecl StringSpanIncluding(_In_z_ LPCWSTR pszBlock, _In_z_ LPCWSTR pszSet)
static int __cdecl GetBaseTypeLength(_In_z_ LPCSTR pszSource) noexcept
static LPWSTR __cdecl FindCharReverse(_In_z_ LPWSTR pszSource, _In_ WCHAR ch)
static LPCWSTR __cdecl FindCharReverse(_In_z_ LPCWSTR pszSource, _In_ WCHAR ch)
static int __cdecl CompareNoCase(_In_z_ LPCWSTR psz1, _In_z_ LPCWSTR psz2)
static int __cdecl StringSpanExcluding(_In_z_ LPCWSTR pszBlock, _In_z_ LPCWSTR pszSet)
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPWSTR pszDest, _In_ int nDestLength, _In_ LPCSTR pszSrc, _In_ int nSrcLength=-1)
static LPWSTR __cdecl FindOneOf(_In_z_ LPWSTR pszSource, _In_z_ LPCWSTR pszCharSet)
static int __cdecl FormatV(_In_opt_z_ LPWSTR pszDest, _In_z_ LPCWSTR pszFormat, _In_ va_list args)
static LPCWSTR __cdecl FindOneOf(_In_z_ LPCWSTR pszSource, _In_z_ LPCWSTR pszCharSet)
static void __cdecl MakeLower(_Out_writes_(nSrcLength) LPWSTR pszSource, _In_ int nSrcLength)
static LPWSTR __cdecl FindString(_In_z_ LPWSTR pszSource, _In_z_ LPCWSTR pszSub)
static void __cdecl ConvertToBaseType(_Out_writes_(nDestLength) LPWSTR pszDest, _In_ int nDestLength, _In_ LPCWSTR pszSrc, _In_ int nSrcLength=-1)
#define WideCharToMultiByte
#define MultiByteToWideChar
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint GLsizei GLsizei * length
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define memcpy(s1, s2, n)
const ATLSTRINGRESOURCEIMAGE * AtlGetStringResourceImage(_In_ HINSTANCE hInstance, _In_ UINT id) noexcept
UINT WINAPI _AtlGetConversionACP() noexcept
#define _Out_writes_opt_(s)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
_Check_return_ _CRTIMP size_t __cdecl wcsspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
_Check_return_ _CRTIMP size_t __cdecl wcscspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
_Check_return_ _CRTIMP size_t __cdecl strspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
static const bool c_bIsMFCDLLTraits
#define FORMAT_MESSAGE_FROM_STRING
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
_In_ DWORD _In_ DWORD _Out_writes_to_opt_ pcchString LPSTR pszString
#define IS_INTRESOURCE(i)
DWORD WINAPI CharLowerBuffA(_Inout_updates_(cchLength) LPSTR lpsz, _In_ DWORD cchLength)
DWORD WINAPI CharUpperBuffA(_Inout_updates_(cchLength) LPSTR lpsz, _In_ DWORD cchLength)
DWORD WINAPI CharUpperBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
DWORD WINAPI CharLowerBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)