ReactOS 0.4.16-dev-338-g34e76ad
ATL::ChTraitsCRT< _CharType > Class Template Reference

#include <cstringt.h>

Inheritance diagram for ATL::ChTraitsCRT< _CharType >:
Collaboration diagram for ATL::ChTraitsCRT< _CharType >:

Static Public Member Functions

static int __cdecl GetBaseTypeLength (_In_z_ LPCWSTR pszSource) noexcept
 
static int __cdecl GetBaseTypeLength (_In_z_ LPCSTR pszSource) noexcept
 
static int __cdecl GetBaseTypeLength (_In_reads_(nLength) LPCWSTR pszSource, _In_ int nLength) noexcept
 
static int __cdecl GetBaseTypeLength (_In_reads_(nLength) LPCSTR pszSource, _In_ int nLength) noexcept
 
static void __cdecl ConvertToBaseType (_Out_writes_(nDestLength) LPWSTR pszDest, _In_ int nDestLength, _In_ LPCWSTR pszSrc, _In_ int nSrcLength=-1)
 
static void __cdecl ConvertToBaseType (_Out_writes_(nDestLength) LPWSTR pszDest, _In_ int nDestLength, _In_ LPCSTR pszSrc, _In_ int nSrcLength=-1)
 
static void __cdecl MakeLower (_Out_writes_(nSrcLength) LPWSTR pszSource, _In_ int nSrcLength)
 
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 LPWSTR __cdecl FindString (_In_z_ LPWSTR pszSource, _In_z_ LPCWSTR pszSub)
 
static LPCWSTR __cdecl FindString (_In_z_ LPCWSTR pszSource, _In_z_ LPCWSTR pszSub)
 
static LPWSTR __cdecl FindChar (_In_z_ LPWSTR pszSource, _In_ WCHAR ch)
 
static LPCWSTR __cdecl FindChar (_In_z_ LPCWSTR pszSource, _In_ WCHAR ch)
 
static LPWSTR __cdecl FindCharReverse (_In_z_ LPWSTR pszSource, _In_ WCHAR ch)
 
static LPCWSTR __cdecl FindCharReverse (_In_z_ LPCWSTR pszSource, _In_ WCHAR ch)
 
static LPWSTR __cdecl FindOneOf (_In_z_ LPWSTR pszSource, _In_z_ LPCWSTR pszCharSet)
 
static LPCWSTR __cdecl FindOneOf (_In_z_ LPCWSTR pszSource, _In_z_ LPCWSTR pszCharSet)
 
static int __cdecl Compare (_In_z_ LPCWSTR psz1, _In_z_ LPCWSTR psz2)
 
static int __cdecl CompareNoCase (_In_z_ LPCWSTR psz1, _In_z_ LPCWSTR psz2)
 
static int __cdecl StringSpanIncluding (_In_z_ LPCWSTR pszBlock, _In_z_ LPCWSTR pszSet)
 
static int __cdecl StringSpanExcluding (_In_z_ LPCWSTR pszBlock, _In_z_ LPCWSTR pszSet)
 
static int __cdecl FormatV (_In_opt_z_ LPWSTR pszDest, _In_z_ LPCWSTR pszFormat, _In_ va_list args)
 
static LPWSTR FormatMessageV (_In_z_ LPCWSTR pszFormat, _In_opt_ va_list *pArgList)
 
static BSTR __cdecl AllocSysString (_In_z_ LPCWSTR pszSource, _In_ int nLength)
 

Additional Inherited Members

- Public Types inherited from ATL::ChTraitsBase< BaseType >
typedef char XCHAR
 
typedef LPSTR PXSTR
 
typedef LPCSTR PCXSTR
 
typedef wchar_t YCHAR
 
typedef LPWSTR PYSTR
 
typedef LPCWSTR PCYSTR
 

Detailed Description

template<typename _CharType = wchar_t>
class ATL::ChTraitsCRT< _CharType >

Definition at line 25 of file cstringt.h.

Member Function Documentation

◆ AllocSysString()

template<typename _CharType = wchar_t>
static BSTR __cdecl ATL::ChTraitsCRT< _CharType >::AllocSysString ( _In_z_ LPCWSTR  pszSource,
_In_ int  nLength 
)
inlinestatic

Definition at line 201 of file cstringt.h.

204 {
205 return ::SysAllocStringLen(pszSource, nLength);
206 }
_In_ DWORD nLength
Definition: wincon.h:473

◆ Compare()

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::Compare ( _In_z_ LPCWSTR  psz1,
_In_z_ LPCWSTR  psz2 
)
inlinestatic

Definition at line 153 of file cstringt.h.

156 {
157 return ::wcscmp(psz1, psz2);
158 }

◆ CompareNoCase()

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::CompareNoCase ( _In_z_ LPCWSTR  psz1,
_In_z_ LPCWSTR  psz2 
)
inlinestatic

Definition at line 160 of file cstringt.h.

163 {
164 return ::_wcsicmp(psz1, psz2);
165 }

◆ ConvertToBaseType() [1/2]

template<typename _CharType = wchar_t>
static void __cdecl ATL::ChTraitsCRT< _CharType >::ConvertToBaseType ( _Out_writes_(nDestLength) LPWSTR  pszDest,
_In_ int  nDestLength,
_In_ LPCSTR  pszSrc,
_In_ int  nSrcLength = -1 
)
inlinestatic

Definition at line 67 of file cstringt.h.

72 {
73 if (nSrcLength == -1)
74 nSrcLength = 1 + GetBaseTypeLength(pszSrc);
75
76 ::MultiByteToWideChar(_AtlGetConversionACP(), 0, pszSrc, nSrcLength, pszDest, nDestLength);
77 }
static int __cdecl GetBaseTypeLength(_In_z_ LPCWSTR pszSource) noexcept
Definition: cstringt.h:29
#define MultiByteToWideChar
Definition: compat.h:110
UINT WINAPI _AtlGetConversionACP() noexcept
Definition: cstringt.h:14

◆ ConvertToBaseType() [2/2]

template<typename _CharType = wchar_t>
static void __cdecl ATL::ChTraitsCRT< _CharType >::ConvertToBaseType ( _Out_writes_(nDestLength) LPWSTR  pszDest,
_In_ int  nDestLength,
_In_ LPCWSTR  pszSrc,
_In_ int  nSrcLength = -1 
)
inlinestatic

Definition at line 55 of file cstringt.h.

60 {
61 if (nSrcLength == -1)
62 nSrcLength = 1 + GetBaseTypeLength(pszSrc);
63
64 wmemcpy(pszDest, pszSrc, nSrcLength);
65 }

Referenced by ATL::ChTraitsCRT< char >::AllocSysString(), and test_basetypes().

◆ FindChar() [1/2]

template<typename _CharType = wchar_t>
static LPCWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindChar ( _In_z_ LPCWSTR  pszSource,
_In_ WCHAR  ch 
)
inlinestatic

Definition at line 120 of file cstringt.h.

123 {
124 return ::wcschr(pszSource, ch);
125 }

◆ FindChar() [2/2]

template<typename _CharType = wchar_t>
static LPWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindChar ( _In_z_ LPWSTR  pszSource,
_In_ WCHAR  ch 
)
inlinestatic

Definition at line 114 of file cstringt.h.

117 {
118 return ::wcschr(pszSource, ch);
119 }

◆ FindCharReverse() [1/2]

template<typename _CharType = wchar_t>
static LPCWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindCharReverse ( _In_z_ LPCWSTR  pszSource,
_In_ WCHAR  ch 
)
inlinestatic

Definition at line 133 of file cstringt.h.

136 {
137 return ::wcsrchr(pszSource, ch);
138 }

◆ FindCharReverse() [2/2]

template<typename _CharType = wchar_t>
static LPWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindCharReverse ( _In_z_ LPWSTR  pszSource,
_In_ WCHAR  ch 
)
inlinestatic

Definition at line 127 of file cstringt.h.

130 {
131 return ::wcsrchr(pszSource, ch);
132 }

◆ FindOneOf() [1/2]

template<typename _CharType = wchar_t>
static LPCWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindOneOf ( _In_z_ LPCWSTR  pszSource,
_In_z_ LPCWSTR  pszCharSet 
)
inlinestatic

Definition at line 146 of file cstringt.h.

149 {
150 return ::wcspbrk(pszSource, pszCharSet);
151 }

◆ FindOneOf() [2/2]

template<typename _CharType = wchar_t>
static LPWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindOneOf ( _In_z_ LPWSTR  pszSource,
_In_z_ LPCWSTR  pszCharSet 
)
inlinestatic

Definition at line 140 of file cstringt.h.

143 {
144 return ::wcspbrk(pszSource, pszCharSet);
145 }

◆ FindString() [1/2]

template<typename _CharType = wchar_t>
static LPCWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindString ( _In_z_ LPCWSTR  pszSource,
_In_z_ LPCWSTR  pszSub 
)
inlinestatic

Definition at line 107 of file cstringt.h.

110 {
111 return ::wcsstr(pszSource, pszSub);
112 }

◆ FindString() [2/2]

template<typename _CharType = wchar_t>
static LPWSTR __cdecl ATL::ChTraitsCRT< _CharType >::FindString ( _In_z_ LPWSTR  pszSource,
_In_z_ LPCWSTR  pszSub 
)
inlinestatic

Definition at line 101 of file cstringt.h.

104 {
105 return ::wcsstr(pszSource, pszSub);
106 }

◆ FormatMessageV()

template<typename _CharType = wchar_t>
static LPWSTR ATL::ChTraitsCRT< _CharType >::FormatMessageV ( _In_z_ LPCWSTR  pszFormat,
_In_opt_ va_list pArgList 
)
inlinestatic

Definition at line 192 of file cstringt.h.

193 {
194 LPWSTR psz;
197 reinterpret_cast<LPWSTR>(&psz), 0, pArgList);
198 return psz;
199 }
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:447
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:445
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ FormatV()

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::FormatV ( _In_opt_z_ LPWSTR  pszDest,
_In_z_ LPCWSTR  pszFormat,
_In_ va_list  args 
)
inlinestatic

Definition at line 181 of file cstringt.h.

185 {
186 if (pszDest == NULL)
187 return ::_vscwprintf(pszFormat, args);
188 return ::vswprintf(pszDest, pszFormat, args);
189 }
#define NULL
Definition: types.h:112
Definition: match.c:390

◆ GetBaseTypeLength() [1/4]

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::GetBaseTypeLength ( _In_reads_(nLength) LPCSTR  pszSource,
_In_ int  nLength 
)
inlinestaticnoexcept

Definition at line 48 of file cstringt.h.

51 {
52 return ::MultiByteToWideChar(_AtlGetConversionACP(), 0, pszSource, nLength, NULL, 0);
53 }

◆ GetBaseTypeLength() [2/4]

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::GetBaseTypeLength ( _In_reads_(nLength) LPCWSTR  pszSource,
_In_ int  nLength 
)
inlinestaticnoexcept

Definition at line 41 of file cstringt.h.

44 {
45 return nLength;
46 }

◆ GetBaseTypeLength() [3/4]

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::GetBaseTypeLength ( _In_z_ LPCSTR  pszSource)
inlinestaticnoexcept

Definition at line 35 of file cstringt.h.

36 {
37 if (pszSource == NULL) return 0;
38 return ::MultiByteToWideChar(_AtlGetConversionACP(), 0, pszSource, -1, NULL, 0) - 1;
39 }

◆ GetBaseTypeLength() [4/4]

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::GetBaseTypeLength ( _In_z_ LPCWSTR  pszSource)
inlinestaticnoexcept

Definition at line 29 of file cstringt.h.

30 {
31 if (pszSource == NULL) return -1;
32 return static_cast<int>(wcslen(pszSource));
33 }
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by ATL::ChTraitsCRT< char >::AllocSysString(), ATL::ChTraitsCRT< char >::ConvertToBaseType(), ATL::ChTraitsCRT< _CharType >::ConvertToBaseType(), and test_basetypes().

◆ GetEnvironmentVariable()

template<typename _CharType = wchar_t>
static DWORD ATL::ChTraitsCRT< _CharType >::GetEnvironmentVariable ( _In_z_ LPCWSTR  pszVar,
_Out_writes_opt_(nBufLength) LPWSTR  pszBuf,
_In_opt_ int  nBufLength 
)
inlinestatic

Definition at line 86 of file cstringt.h.

90 {
91 return ::GetEnvironmentVariableW(pszVar, pszBuf, nBufLength);
92 }

◆ MakeLower()

template<typename _CharType = wchar_t>
static void __cdecl ATL::ChTraitsCRT< _CharType >::MakeLower ( _Out_writes_(nSrcLength) LPWSTR  pszSource,
_In_ int  nSrcLength 
)
inlinestatic

Definition at line 79 of file cstringt.h.

82 {
83 ::CharLowerBuffW(pszSource, nSrcLength);
84 }
DWORD WINAPI CharLowerBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)

◆ MakeUpper()

template<typename _CharType = wchar_t>
static void __cdecl ATL::ChTraitsCRT< _CharType >::MakeUpper ( _Out_writes_(nSrcLength) LPWSTR  pszSource,
_In_ int  nSrcLength 
)
inlinestatic

Definition at line 94 of file cstringt.h.

97 {
98 ::CharUpperBuffW(pszSource, nSrcLength);
99 }
DWORD WINAPI CharUpperBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)

◆ StringSpanExcluding()

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::StringSpanExcluding ( _In_z_ LPCWSTR  pszBlock,
_In_z_ LPCWSTR  pszSet 
)
inlinestatic

Definition at line 174 of file cstringt.h.

177 {
178 return (int)::wcscspn(pszBlock, pszSet);
179 }
_Check_return_ _CRTIMP size_t __cdecl wcscspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)

◆ StringSpanIncluding()

template<typename _CharType = wchar_t>
static int __cdecl ATL::ChTraitsCRT< _CharType >::StringSpanIncluding ( _In_z_ LPCWSTR  pszBlock,
_In_z_ LPCWSTR  pszSet 
)
inlinestatic

Definition at line 167 of file cstringt.h.

170 {
171 return (int)::wcsspn(pszBlock, pszSet);
172 }
_Check_return_ _CRTIMP size_t __cdecl wcsspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)

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