/src/wxwidgets/include/wx/wxcrt.h
Line | Count | Source |
1 | | /////////////////////////////////////////////////////////////////////////////// |
2 | | // Name: wx/wxcrt.h |
3 | | // Purpose: Type-safe ANSI and Unicode builds compatible wrappers for |
4 | | // CRT functions |
5 | | // Author: Joel Farley, Ove Kaaven |
6 | | // Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik |
7 | | // Created: 1998/06/12 |
8 | | // Copyright: (c) 1998-2006 wxWidgets dev team |
9 | | // Licence: wxWindows licence |
10 | | /////////////////////////////////////////////////////////////////////////////// |
11 | | |
12 | | #ifndef _WX_WXCRT_H_ |
13 | | #define _WX_WXCRT_H_ |
14 | | |
15 | | #include "wx/wxcrtbase.h" |
16 | | #include "wx/string.h" |
17 | | |
18 | | #ifndef __WX_SETUP_H__ |
19 | | // For non-configure builds assume vsscanf is available, if not Visual C |
20 | | #if !defined (__VISUALC__) |
21 | | #define HAVE_VSSCANF 1 |
22 | | #endif |
23 | | #endif |
24 | | |
25 | | // ============================================================================ |
26 | | // misc functions |
27 | | // ============================================================================ |
28 | | |
29 | | /* checks whether the passed in pointer is null and if the string is empty */ |
30 | 0 | inline bool wxIsEmpty(const char *s) { return !s || !*s; } |
31 | 0 | inline bool wxIsEmpty(const wchar_t *s) { return !s || !*s; } |
32 | 0 | inline bool wxIsEmpty(const wxScopedCharBuffer& s) { return wxIsEmpty(s.data()); } |
33 | 0 | inline bool wxIsEmpty(const wxScopedWCharBuffer& s) { return wxIsEmpty(s.data()); } |
34 | 0 | inline bool wxIsEmpty(const wxString& s) { return s.empty(); } |
35 | 0 | inline bool wxIsEmpty(const wxCStrData& s) { return s.AsString().empty(); } |
36 | | |
37 | | |
38 | | |
39 | | /* multibyte to wide char conversion functions and macros */ |
40 | | |
41 | | /* multibyte<->widechar conversion */ |
42 | | WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); |
43 | | WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); |
44 | | |
45 | | // Obsolete helpers. |
46 | | #define wxMB2WX wxMB2WC |
47 | | #define wxWX2MB wxWC2MB |
48 | | #define wxWC2WX wxStrncpy |
49 | | #define wxWX2WC wxStrncpy |
50 | | |
51 | | |
52 | | // RN: We could do the usual tricky compiler detection here, |
53 | | // and use their variant (such as wmemchr, etc.). The problem |
54 | | // is that these functions are quite rare, even though they are |
55 | | // part of the current POSIX standard. In addition, most compilers |
56 | | // (including even MSC) inline them just like we do right in their |
57 | | // headers. |
58 | | // |
59 | | #include <string.h> |
60 | | |
61 | | //implement our own wmem variants |
62 | | inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) |
63 | 0 | { |
64 | 0 | for(;l && *s != c;--l, ++s) {} |
65 | |
|
66 | 0 | if(l) |
67 | 0 | return const_cast<wxChar*>(s); |
68 | 0 | return nullptr; |
69 | 0 | } |
70 | | |
71 | | inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) |
72 | 0 | { |
73 | 0 | for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} |
74 | 0 |
|
75 | 0 | if(len) |
76 | 0 | return *sz1 < *sz2 ? -1 : *sz1 > *sz2; |
77 | 0 | else |
78 | 0 | return 0; |
79 | 0 | } |
80 | | |
81 | | inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len) |
82 | 0 | { |
83 | 0 | return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); |
84 | 0 | } |
85 | | |
86 | | inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len) |
87 | 0 | { |
88 | 0 | return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); |
89 | 0 | } |
90 | | |
91 | | inline wxChar* wxTmemset(wxChar* szOut, wxChar cIn, size_t len) |
92 | 0 | { |
93 | 0 | wxChar* szRet = szOut; |
94 | 0 |
|
95 | 0 | while (len--) |
96 | 0 | *szOut++ = cIn; |
97 | 0 |
|
98 | 0 | return szRet; |
99 | 0 | } |
100 | | |
101 | | // provide trivial wrappers for char* versions for both ANSI and Unicode builds |
102 | | // (notice that these intentionally return "char *" and not "void *" unlike the |
103 | | // standard memxxx() for symmetry with the wide char versions): |
104 | | inline char* wxTmemchr(const char* s, char c, size_t len) |
105 | 0 | { return const_cast<char*>(static_cast<const char*>(memchr(s, c, len))); } |
106 | | inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len) |
107 | 0 | { return memcmp(sz1, sz2, len); } |
108 | | inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) |
109 | 0 | { return (char*)memcpy(szOut, szIn, len); } |
110 | | inline char* wxTmemmove(char* szOut, const char* szIn, size_t len) |
111 | 0 | { return (char*)memmove(szOut, szIn, len); } |
112 | | inline char* wxTmemset(char* szOut, char cIn, size_t len) |
113 | 0 | { return (char*)memset(szOut, cIn, len); } |
114 | | |
115 | | |
116 | | // ============================================================================ |
117 | | // wx wrappers for CRT functions in both char* and wchar_t* versions |
118 | | // ============================================================================ |
119 | | |
120 | | // A few notes on implementation of these wrappers: |
121 | | // |
122 | | // We need both char* and wchar_t* versions of functions like wxStrlen() for |
123 | | // compatibility with both ANSI and Unicode builds. |
124 | | // |
125 | | // This makes passing wxString or c_str()/mb_str()/wc_str() result to them |
126 | | // ambiguous, so we need to provide overrides for that as well (in cases where |
127 | | // it makes sense). |
128 | | // |
129 | | // We can do this without problems for some functions (wxStrlen()), but in some |
130 | | // cases, we can't stay compatible with both ANSI and Unicode builds, e.g. for |
131 | | // wxStrcpy(const wxString&), which can only return either char* or wchar_t*. |
132 | | // In these cases, we preserve ANSI build compatibility by returning char*. |
133 | | |
134 | | // ---------------------------------------------------------------------------- |
135 | | // locale functions |
136 | | // ---------------------------------------------------------------------------- |
137 | | |
138 | | // NB: we can't provide const wchar_t* (= wxChar*) overload, because calling |
139 | | // wxSetlocale(category, NULL) -- which is a common thing to do -- would be |
140 | | // ambiguous |
141 | | WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale); |
142 | | inline char* wxSetlocale(int category, const wxScopedCharBuffer& locale) |
143 | 0 | { return wxSetlocale(category, locale.data()); } |
144 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
145 | | inline char* wxSetlocale(int category, const wxString& locale) |
146 | 0 | { return wxSetlocale(category, locale.mb_str()); } |
147 | | inline char* wxSetlocale(int category, const wxCStrData& locale) |
148 | 0 | { return wxSetlocale(category, locale.AsCharBuf()); } |
149 | | #endif |
150 | | |
151 | | // ---------------------------------------------------------------------------- |
152 | | // string functions |
153 | | // ---------------------------------------------------------------------------- |
154 | | |
155 | | /* safe version of strlen() (returns 0 if passed null pointer) */ |
156 | | // NB: these are defined in wxcrtbase.h, see the comment there |
157 | | // inline size_t wxStrlen(const char *s) { return s ? strlen(s) : 0; } |
158 | | // inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_Strlen_(s) : 0; } |
159 | 0 | inline size_t wxStrlen(const wxScopedCharBuffer& s) { return wxStrlen(s.data()); } |
160 | 0 | inline size_t wxStrlen(const wxScopedWCharBuffer& s) { return wxStrlen(s.data()); } |
161 | 0 | inline size_t wxStrlen(const wxString& s) { return s.length(); } |
162 | 0 | inline size_t wxStrlen(const wxCStrData& s) { return s.AsString().length(); } |
163 | | |
164 | | // this is a function new in 2.9 so we don't care about backwards compatibility and |
165 | | // so don't need to support wxScopedCharBuffer/wxScopedWCharBuffer overloads |
166 | | #if defined(wxCRT_StrnlenA) |
167 | 0 | inline size_t wxStrnlen(const char *str, size_t maxlen) { return wxCRT_StrnlenA(str, maxlen); } |
168 | | #else |
169 | | inline size_t wxStrnlen(const char *str, size_t maxlen) |
170 | | { |
171 | | size_t n; |
172 | | for ( n = 0; n < maxlen; n++ ) |
173 | | if ( !str[n] ) |
174 | | break; |
175 | | |
176 | | return n; |
177 | | } |
178 | | #endif |
179 | | |
180 | | #if defined(wxCRT_StrnlenW) |
181 | 0 | inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) { return wxCRT_StrnlenW(str, maxlen); } |
182 | | #else |
183 | | inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) |
184 | | { |
185 | | size_t n; |
186 | | for ( n = 0; n < maxlen; n++ ) |
187 | | if ( !str[n] ) |
188 | | break; |
189 | | |
190 | | return n; |
191 | | } |
192 | | #endif |
193 | | |
194 | | // NB: these are defined in wxcrtbase.h, see the comment there |
195 | | // inline char* wxStrdup(const char *s) { return wxStrdupA(s); } |
196 | | // inline wchar_t* wxStrdup(const wchar_t *s) { return wxStrdupW(s); } |
197 | 0 | inline char* wxStrdup(const wxScopedCharBuffer& s) { return wxStrdup(s.data()); } |
198 | 0 | inline wchar_t* wxStrdup(const wxScopedWCharBuffer& s) { return wxStrdup(s.data()); } |
199 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
200 | 0 | inline char* wxStrdup(const wxString& s) { return wxStrdup(s.mb_str()); } |
201 | 0 | inline char* wxStrdup(const wxCStrData& s) { return wxStrdup(s.AsCharBuf()); } |
202 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
203 | | |
204 | | inline char *wxStrcpy(char *dest, const char *src) |
205 | 0 | { return wxCRT_StrcpyA(dest, src); } |
206 | | inline wchar_t *wxStrcpy(wchar_t *dest, const wchar_t *src) |
207 | 0 | { return wxCRT_StrcpyW(dest, src); } |
208 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
209 | | inline char *wxStrcpy(char *dest, const wxString& src) |
210 | 0 | { return wxCRT_StrcpyA(dest, src.mb_str()); } |
211 | | inline char *wxStrcpy(char *dest, const wxCStrData& src) |
212 | 0 | { return wxCRT_StrcpyA(dest, src.AsCharBuf()); } |
213 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
214 | | inline char *wxStrcpy(char *dest, const wxScopedCharBuffer& src) |
215 | 0 | { return wxCRT_StrcpyA(dest, src.data()); } |
216 | | inline wchar_t *wxStrcpy(wchar_t *dest, const wxString& src) |
217 | 0 | { return wxCRT_StrcpyW(dest, src.wc_str()); } |
218 | | inline wchar_t *wxStrcpy(wchar_t *dest, const wxCStrData& src) |
219 | 0 | { return wxCRT_StrcpyW(dest, src.AsWCharBuf()); } |
220 | | inline wchar_t *wxStrcpy(wchar_t *dest, const wxScopedWCharBuffer& src) |
221 | 0 | { return wxCRT_StrcpyW(dest, src.data()); } |
222 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
223 | | inline char *wxStrcpy(char *dest, const wchar_t *src) |
224 | 0 | { return wxCRT_StrcpyA(dest, wxConvLibc.cWC2MB(src)); } |
225 | | inline wchar_t *wxStrcpy(wchar_t *dest, const char *src) |
226 | 0 | { return wxCRT_StrcpyW(dest, wxConvLibc.cMB2WC(src)); } |
227 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
228 | | |
229 | | inline char *wxStrncpy(char *dest, const char *src, size_t n) |
230 | 0 | { return wxCRT_StrncpyA(dest, src, n); } |
231 | | inline wchar_t *wxStrncpy(wchar_t *dest, const wchar_t *src, size_t n) |
232 | 0 | { return wxCRT_StrncpyW(dest, src, n); } |
233 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
234 | | inline char *wxStrncpy(char *dest, const wxString& src, size_t n) |
235 | 0 | { return wxCRT_StrncpyA(dest, src.mb_str(), n); } |
236 | | inline char *wxStrncpy(char *dest, const wxCStrData& src, size_t n) |
237 | 0 | { return wxCRT_StrncpyA(dest, src.AsCharBuf(), n); } |
238 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
239 | | inline char *wxStrncpy(char *dest, const wxScopedCharBuffer& src, size_t n) |
240 | 0 | { return wxCRT_StrncpyA(dest, src.data(), n); } |
241 | | inline wchar_t *wxStrncpy(wchar_t *dest, const wxString& src, size_t n) |
242 | 0 | { return wxCRT_StrncpyW(dest, src.wc_str(), n); } |
243 | | inline wchar_t *wxStrncpy(wchar_t *dest, const wxCStrData& src, size_t n) |
244 | 0 | { return wxCRT_StrncpyW(dest, src.AsWCharBuf(), n); } |
245 | | inline wchar_t *wxStrncpy(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n) |
246 | 0 | { return wxCRT_StrncpyW(dest, src.data(), n); } |
247 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
248 | | inline char *wxStrncpy(char *dest, const wchar_t *src, size_t n) |
249 | 0 | { return wxCRT_StrncpyA(dest, wxConvLibc.cWC2MB(src), n); } |
250 | | inline wchar_t *wxStrncpy(wchar_t *dest, const char *src, size_t n) |
251 | 0 | { return wxCRT_StrncpyW(dest, wxConvLibc.cMB2WC(src), n); } |
252 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
253 | | |
254 | | // this is a function new in 2.9 so we don't care about backwards compatibility and |
255 | | // so don't need to support wchar_t/char overloads |
256 | | inline size_t wxStrlcpy(char *dest, const char *src, size_t n) |
257 | 0 | { |
258 | 0 | const size_t len = wxCRT_StrlenA(src); |
259 | |
|
260 | 0 | if ( n ) |
261 | 0 | { |
262 | 0 | if ( n-- > len ) |
263 | 0 | n = len; |
264 | 0 | memcpy(dest, src, n); |
265 | 0 | dest[n] = '\0'; |
266 | 0 | } |
267 | |
|
268 | 0 | return len; |
269 | 0 | } |
270 | | inline size_t wxStrlcpy(wchar_t *dest, const wchar_t *src, size_t n) |
271 | 0 | { |
272 | 0 | const size_t len = wxCRT_StrlenW(src); |
273 | 0 | if ( n ) |
274 | 0 | { |
275 | 0 | if ( n-- > len ) |
276 | 0 | n = len; |
277 | 0 | memcpy(dest, src, n * sizeof(wchar_t)); |
278 | 0 | dest[n] = L'\0'; |
279 | 0 | } |
280 | |
|
281 | 0 | return len; |
282 | 0 | } |
283 | | |
284 | | inline char *wxStrcat(char *dest, const char *src) |
285 | 0 | { return wxCRT_StrcatA(dest, src); } |
286 | | inline wchar_t *wxStrcat(wchar_t *dest, const wchar_t *src) |
287 | 0 | { return wxCRT_StrcatW(dest, src); } |
288 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
289 | | inline char *wxStrcat(char *dest, const wxString& src) |
290 | 0 | { return wxCRT_StrcatA(dest, src.mb_str()); } |
291 | | inline char *wxStrcat(char *dest, const wxCStrData& src) |
292 | 0 | { return wxCRT_StrcatA(dest, src.AsCharBuf()); } |
293 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
294 | | inline char *wxStrcat(char *dest, const wxScopedCharBuffer& src) |
295 | 0 | { return wxCRT_StrcatA(dest, src.data()); } |
296 | | inline wchar_t *wxStrcat(wchar_t *dest, const wxString& src) |
297 | 0 | { return wxCRT_StrcatW(dest, src.wc_str()); } |
298 | | inline wchar_t *wxStrcat(wchar_t *dest, const wxCStrData& src) |
299 | 0 | { return wxCRT_StrcatW(dest, src.AsWCharBuf()); } |
300 | | inline wchar_t *wxStrcat(wchar_t *dest, const wxScopedWCharBuffer& src) |
301 | 0 | { return wxCRT_StrcatW(dest, src.data()); } |
302 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
303 | | inline char *wxStrcat(char *dest, const wchar_t *src) |
304 | 0 | { return wxCRT_StrcatA(dest, wxConvLibc.cWC2MB(src)); } |
305 | | inline wchar_t *wxStrcat(wchar_t *dest, const char *src) |
306 | 0 | { return wxCRT_StrcatW(dest, wxConvLibc.cMB2WC(src)); } |
307 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
308 | | |
309 | | inline char *wxStrncat(char *dest, const char *src, size_t n) |
310 | 0 | { return wxCRT_StrncatA(dest, src, n); } |
311 | | inline wchar_t *wxStrncat(wchar_t *dest, const wchar_t *src, size_t n) |
312 | 0 | { return wxCRT_StrncatW(dest, src, n); } |
313 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
314 | | inline char *wxStrncat(char *dest, const wxString& src, size_t n) |
315 | 0 | { return wxCRT_StrncatA(dest, src.mb_str(), n); } |
316 | | inline char *wxStrncat(char *dest, const wxCStrData& src, size_t n) |
317 | 0 | { return wxCRT_StrncatA(dest, src.AsCharBuf(), n); } |
318 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
319 | | inline char *wxStrncat(char *dest, const wxScopedCharBuffer& src, size_t n) |
320 | 0 | { return wxCRT_StrncatA(dest, src.data(), n); } |
321 | | inline wchar_t *wxStrncat(wchar_t *dest, const wxString& src, size_t n) |
322 | 0 | { return wxCRT_StrncatW(dest, src.wc_str(), n); } |
323 | | inline wchar_t *wxStrncat(wchar_t *dest, const wxCStrData& src, size_t n) |
324 | 0 | { return wxCRT_StrncatW(dest, src.AsWCharBuf(), n); } |
325 | | inline wchar_t *wxStrncat(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n) |
326 | 0 | { return wxCRT_StrncatW(dest, src.data(), n); } |
327 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
328 | | inline char *wxStrncat(char *dest, const wchar_t *src, size_t n) |
329 | 0 | { return wxCRT_StrncatA(dest, wxConvLibc.cWC2MB(src), n); } |
330 | | inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n) |
331 | 0 | { return wxCRT_StrncatW(dest, wxConvLibc.cMB2WC(src), n); } |
332 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
333 | | |
334 | | |
335 | | #define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2) |
336 | 358 | #define WX_STR_CALL(func, a1, a2) func(a1, a2) |
337 | | |
338 | | // This macro defines string function for all possible variants of arguments, |
339 | | // except for those taking wxString or wxCStrData as second argument. |
340 | | // Parameters: |
341 | | // rettype - return type |
342 | | // name - name of the (overloaded) function to define |
343 | | // crtA - function to call for char* versions (takes two arguments) |
344 | | // crtW - ditto for wchar_t* function |
345 | | // forString - function to call when the *first* argument is wxString; |
346 | | // the second argument can be any string type, so this is |
347 | | // typically a template |
348 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
349 | | #define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ |
350 | | inline rettype WX_STR_DECL(name, const char *, const char *) \ |
351 | 0 | { return WX_STR_CALL(crtA, s1, s2); } \Unexecuted instantiation: wxStrcmp(char const*, char const*) Unexecuted instantiation: wxStricmp(char const*, char const*) Unexecuted instantiation: wxStrcoll(char const*, char const*) Unexecuted instantiation: wxStrspn(char const*, char const*) Unexecuted instantiation: wxStrcspn(char const*, char const*) Unexecuted instantiation: wxStrncmp(char const*, char const*, unsigned long) Unexecuted instantiation: wxStrnicmp(char const*, char const*, unsigned long) |
352 | | inline rettype WX_STR_DECL(name, const char *, const wchar_t *) \ |
353 | 0 | { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \Unexecuted instantiation: wxStrcmp(char const*, wchar_t const*) Unexecuted instantiation: wxStricmp(char const*, wchar_t const*) Unexecuted instantiation: wxStrcoll(char const*, wchar_t const*) Unexecuted instantiation: wxStrspn(char const*, wchar_t const*) Unexecuted instantiation: wxStrcspn(char const*, wchar_t const*) Unexecuted instantiation: wxStrncmp(char const*, wchar_t const*, unsigned long) Unexecuted instantiation: wxStrnicmp(char const*, wchar_t const*, unsigned long) |
354 | | inline rettype WX_STR_DECL(name, const char *, const wxScopedCharBuffer&) \ |
355 | 0 | { return WX_STR_CALL(crtA, s1, s2.data()); } \Unexecuted instantiation: wxStrcmp(char const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStricmp(char const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcoll(char const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrspn(char const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcspn(char const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrncmp(char const*, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(char const*, wxScopedCharTypeBuffer<char> const&, unsigned long) |
356 | | inline rettype WX_STR_DECL(name, const char *, const wxScopedWCharBuffer&) \ |
357 | 0 | { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \Unexecuted instantiation: wxStrcmp(char const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStricmp(char const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcoll(char const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrspn(char const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcspn(char const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrncmp(char const*, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(char const*, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) |
358 | | \ |
359 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \ |
360 | 358 | { return WX_STR_CALL(crtW, s1, s2); } \Unexecuted instantiation: wxStrcmp(wchar_t const*, wchar_t const*) wxStricmp(wchar_t const*, wchar_t const*) Line | Count | Source | 360 | 358 | { return WX_STR_CALL(crtW, s1, s2); } \ |
Unexecuted instantiation: wxStrcoll(wchar_t const*, wchar_t const*) Unexecuted instantiation: wxStrspn(wchar_t const*, wchar_t const*) Unexecuted instantiation: wxStrcspn(wchar_t const*, wchar_t const*) Unexecuted instantiation: wxStrncmp(wchar_t const*, wchar_t const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wchar_t const*, wchar_t const*, unsigned long) |
361 | | inline rettype WX_STR_DECL(name, const wchar_t *, const char *) \ |
362 | 0 | { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \Unexecuted instantiation: wxStrcmp(wchar_t const*, char const*) Unexecuted instantiation: wxStricmp(wchar_t const*, char const*) Unexecuted instantiation: wxStrcoll(wchar_t const*, char const*) Unexecuted instantiation: wxStrspn(wchar_t const*, char const*) Unexecuted instantiation: wxStrcspn(wchar_t const*, char const*) Unexecuted instantiation: wxStrncmp(wchar_t const*, char const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wchar_t const*, char const*, unsigned long) |
363 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \ |
364 | 0 | { return WX_STR_CALL(crtW, s1, s2.data()); } \Unexecuted instantiation: wxStrcmp(wchar_t const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStricmp(wchar_t const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcoll(wchar_t const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrspn(wchar_t const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcspn(wchar_t const*, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrncmp(wchar_t const*, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wchar_t const*, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) |
365 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedCharBuffer&) \ |
366 | 0 | { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \Unexecuted instantiation: wxStrcmp(wchar_t const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStricmp(wchar_t const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcoll(wchar_t const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrspn(wchar_t const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcspn(wchar_t const*, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrncmp(wchar_t const*, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wchar_t const*, wxScopedCharTypeBuffer<char> const&, unsigned long) |
367 | | \ |
368 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \ |
369 | 0 | { return WX_STR_CALL(crtA, s1.data(), s2); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<char> const&, char const*) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<char> const&, char const*) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<char> const&, char const*) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<char> const&, char const*) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<char> const&, char const*) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<char> const&, char const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<char> const&, char const*, unsigned long) |
370 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wchar_t *) \ |
371 | 0 | { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<char> const&, wchar_t const*) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<char> const&, wchar_t const*) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<char> const&, wchar_t const*) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<char> const&, wchar_t const*) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<char> const&, wchar_t const*) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<char> const&, wchar_t const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<char> const&, wchar_t const*, unsigned long) |
372 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\ |
373 | 0 | { return WX_STR_CALL(crtA, s1.data(), s2.data()); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<char> const&, unsigned long) |
374 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedWCharBuffer&) \ |
375 | 0 | { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<char> const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) |
376 | | \ |
377 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \ |
378 | 0 | { return WX_STR_CALL(crtW, s1.data(), s2); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<wchar_t> const&, wchar_t const*) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<wchar_t> const&, wchar_t const*) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<wchar_t> const&, wchar_t const*) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<wchar_t> const&, wchar_t const*) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<wchar_t> const&, wchar_t const*) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<wchar_t> const&, wchar_t const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<wchar_t> const&, wchar_t const*, unsigned long) |
379 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const char *) \ |
380 | 0 | { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<wchar_t> const&, char const*) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<wchar_t> const&, char const*) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<wchar_t> const&, char const*) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<wchar_t> const&, char const*) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<wchar_t> const&, char const*) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<wchar_t> const&, char const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<wchar_t> const&, char const*, unsigned long) |
381 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \ |
382 | 0 | { return WX_STR_CALL(crtW, s1.data(), s2.data()); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) |
383 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedCharBuffer&) \ |
384 | 0 | { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<wchar_t> const&, wxScopedCharTypeBuffer<char> const&, unsigned long) |
385 | | \ |
386 | | inline rettype WX_STR_DECL(name, const wxString&, const char*) \ |
387 | 0 | { return WX_STR_CALL(forString, s1, s2); } \Unexecuted instantiation: wxStrcmp(wxString const&, char const*) Unexecuted instantiation: wxStricmp(wxString const&, char const*) Unexecuted instantiation: wxStrcoll(wxString const&, char const*) Unexecuted instantiation: wxStrspn(wxString const&, char const*) Unexecuted instantiation: wxStrcspn(wxString const&, char const*) Unexecuted instantiation: wxStrncmp(wxString const&, char const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxString const&, char const*, unsigned long) |
388 | | inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \ |
389 | 0 | { return WX_STR_CALL(forString, s1, s2); } \Unexecuted instantiation: wxStrcmp(wxString const&, wchar_t const*) Unexecuted instantiation: wxStricmp(wxString const&, wchar_t const*) Unexecuted instantiation: wxStrcoll(wxString const&, wchar_t const*) Unexecuted instantiation: wxStrspn(wxString const&, wchar_t const*) Unexecuted instantiation: wxStrcspn(wxString const&, wchar_t const*) Unexecuted instantiation: wxStrncmp(wxString const&, wchar_t const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxString const&, wchar_t const*, unsigned long) |
390 | | inline rettype WX_STR_DECL(name, const wxString&, const wxScopedCharBuffer&) \ |
391 | 0 | { return WX_STR_CALL(forString, s1, s2); } \Unexecuted instantiation: wxStrcmp(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStricmp(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcoll(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrspn(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcspn(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrncmp(wxString const&, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxString const&, wxScopedCharTypeBuffer<char> const&, unsigned long) |
392 | | inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \ |
393 | 0 | { return WX_STR_CALL(forString, s1, s2); } \Unexecuted instantiation: wxStrcmp(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStricmp(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcoll(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrspn(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcspn(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrncmp(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) |
394 | | inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \ |
395 | 0 | { return WX_STR_CALL(forString, s1, s2); } \Unexecuted instantiation: wxStrcmp(wxString const&, wxString const&) Unexecuted instantiation: wxStricmp(wxString const&, wxString const&) Unexecuted instantiation: wxStrcoll(wxString const&, wxString const&) Unexecuted instantiation: wxStrspn(wxString const&, wxString const&) Unexecuted instantiation: wxStrcspn(wxString const&, wxString const&) Unexecuted instantiation: wxStrncmp(wxString const&, wxString const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxString const&, wxString const&, unsigned long) |
396 | | inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \ |
397 | 0 | { return WX_STR_CALL(forString, s1, s2); } \Unexecuted instantiation: wxStrcmp(wxString const&, wxCStrData const&) Unexecuted instantiation: wxStricmp(wxString const&, wxCStrData const&) Unexecuted instantiation: wxStrcoll(wxString const&, wxCStrData const&) Unexecuted instantiation: wxStrspn(wxString const&, wxCStrData const&) Unexecuted instantiation: wxStrcspn(wxString const&, wxCStrData const&) Unexecuted instantiation: wxStrncmp(wxString const&, wxCStrData const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxString const&, wxCStrData const&, unsigned long) |
398 | | \ |
399 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const char*) \ |
400 | 0 | { return WX_STR_CALL(forString, s1.AsString(), s2); } \Unexecuted instantiation: wxStrcmp(wxCStrData const&, char const*) Unexecuted instantiation: wxStricmp(wxCStrData const&, char const*) Unexecuted instantiation: wxStrcoll(wxCStrData const&, char const*) Unexecuted instantiation: wxStrspn(wxCStrData const&, char const*) Unexecuted instantiation: wxStrcspn(wxCStrData const&, char const*) Unexecuted instantiation: wxStrncmp(wxCStrData const&, char const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxCStrData const&, char const*, unsigned long) |
401 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \ |
402 | 0 | { return WX_STR_CALL(forString, s1.AsString(), s2); } \Unexecuted instantiation: wxStrcmp(wxCStrData const&, wchar_t const*) Unexecuted instantiation: wxStricmp(wxCStrData const&, wchar_t const*) Unexecuted instantiation: wxStrcoll(wxCStrData const&, wchar_t const*) Unexecuted instantiation: wxStrspn(wxCStrData const&, wchar_t const*) Unexecuted instantiation: wxStrcspn(wxCStrData const&, wchar_t const*) Unexecuted instantiation: wxStrncmp(wxCStrData const&, wchar_t const*, unsigned long) Unexecuted instantiation: wxStrnicmp(wxCStrData const&, wchar_t const*, unsigned long) |
403 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedCharBuffer&) \ |
404 | 0 | { return WX_STR_CALL(forString, s1.AsString(), s2); } \Unexecuted instantiation: wxStrcmp(wxCStrData const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStricmp(wxCStrData const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcoll(wxCStrData const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrspn(wxCStrData const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrcspn(wxCStrData const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: wxStrncmp(wxCStrData const&, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxCStrData const&, wxScopedCharTypeBuffer<char> const&, unsigned long) |
405 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \ |
406 | 0 | { return WX_STR_CALL(forString, s1.AsString(), s2); } \Unexecuted instantiation: wxStrcmp(wxCStrData const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStricmp(wxCStrData const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcoll(wxCStrData const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrspn(wxCStrData const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrcspn(wxCStrData const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: wxStrncmp(wxCStrData const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxCStrData const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) |
407 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \ |
408 | 0 | { return WX_STR_CALL(forString, s1.AsString(), s2); } \Unexecuted instantiation: wxStrcmp(wxCStrData const&, wxString const&) Unexecuted instantiation: wxStricmp(wxCStrData const&, wxString const&) Unexecuted instantiation: wxStrcoll(wxCStrData const&, wxString const&) Unexecuted instantiation: wxStrspn(wxCStrData const&, wxString const&) Unexecuted instantiation: wxStrcspn(wxCStrData const&, wxString const&) Unexecuted instantiation: wxStrncmp(wxCStrData const&, wxString const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxCStrData const&, wxString const&, unsigned long) |
409 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \ |
410 | 0 | { return WX_STR_CALL(forString, s1.AsString(), s2); }Unexecuted instantiation: wxStrcmp(wxCStrData const&, wxCStrData const&) Unexecuted instantiation: wxStricmp(wxCStrData const&, wxCStrData const&) Unexecuted instantiation: wxStrcoll(wxCStrData const&, wxCStrData const&) Unexecuted instantiation: wxStrspn(wxCStrData const&, wxCStrData const&) Unexecuted instantiation: wxStrcspn(wxCStrData const&, wxCStrData const&) Unexecuted instantiation: wxStrncmp(wxCStrData const&, wxCStrData const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxCStrData const&, wxCStrData const&, unsigned long) |
411 | | #else // wxNO_IMPLICIT_WXSTRING_ENCODING |
412 | | #define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ |
413 | | inline rettype WX_STR_DECL(name, const char *, const char *) \ |
414 | | { return WX_STR_CALL(crtA, s1, s2); } \ |
415 | | \ |
416 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \ |
417 | | { return WX_STR_CALL(crtW, s1, s2); } \ |
418 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \ |
419 | | { return WX_STR_CALL(crtW, s1, s2.data()); } \ |
420 | | \ |
421 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \ |
422 | | { return WX_STR_CALL(crtA, s1.data(), s2); } \ |
423 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\ |
424 | | { return WX_STR_CALL(crtA, s1.data(), s2.data()); } \ |
425 | | \ |
426 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \ |
427 | | { return WX_STR_CALL(crtW, s1.data(), s2); } \ |
428 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \ |
429 | | { return WX_STR_CALL(crtW, s1.data(), s2.data()); } \ |
430 | | \ |
431 | | inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \ |
432 | | { return WX_STR_CALL(forString, s1, s2); } \ |
433 | | inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \ |
434 | | { return WX_STR_CALL(forString, s1, s2); } \ |
435 | | inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \ |
436 | | { return WX_STR_CALL(forString, s1, s2); } \ |
437 | | inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \ |
438 | | { return WX_STR_CALL(forString, s1, s2); } \ |
439 | | \ |
440 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \ |
441 | | { return WX_STR_CALL(forString, s1.AsString(), s2); } \ |
442 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \ |
443 | | { return WX_STR_CALL(forString, s1.AsString(), s2); } \ |
444 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \ |
445 | | { return WX_STR_CALL(forString, s1.AsString(), s2); } \ |
446 | | inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \ |
447 | | { return WX_STR_CALL(forString, s1.AsString(), s2); } |
448 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
449 | | |
450 | | // This defines strcmp-like function, i.e. one returning the result of |
451 | | // comparison; see WX_STR_FUNC_NO_INVERT for explanation of the arguments |
452 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
453 | | #define WX_STRCMP_FUNC(name, crtA, crtW, forString) \ |
454 | | WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \ |
455 | | \ |
456 | | inline int WX_STR_DECL(name, const char *, const wxCStrData&) \ |
457 | 0 | { return -WX_STR_CALL(forString, s2.AsString(), s1); } \Unexecuted instantiation: wxStrcmp(char const*, wxCStrData const&) Unexecuted instantiation: wxStricmp(char const*, wxCStrData const&) Unexecuted instantiation: wxStrcoll(char const*, wxCStrData const&) Unexecuted instantiation: wxStrncmp(char const*, wxCStrData const&, unsigned long) Unexecuted instantiation: wxStrnicmp(char const*, wxCStrData const&, unsigned long) |
458 | | inline int WX_STR_DECL(name, const char *, const wxString&) \ |
459 | 0 | { return -WX_STR_CALL(forString, s2, s1); } \Unexecuted instantiation: wxStrcmp(char const*, wxString const&) Unexecuted instantiation: wxStricmp(char const*, wxString const&) Unexecuted instantiation: wxStrcoll(char const*, wxString const&) Unexecuted instantiation: wxStrncmp(char const*, wxString const&, unsigned long) Unexecuted instantiation: wxStrnicmp(char const*, wxString const&, unsigned long) |
460 | | \ |
461 | | inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ |
462 | 0 | { return -WX_STR_CALL(forString, s2.AsString(), s1); } \Unexecuted instantiation: wxStrcmp(wchar_t const*, wxCStrData const&) Unexecuted instantiation: wxStricmp(wchar_t const*, wxCStrData const&) Unexecuted instantiation: wxStrcoll(wchar_t const*, wxCStrData const&) Unexecuted instantiation: wxStrncmp(wchar_t const*, wxCStrData const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wchar_t const*, wxCStrData const&, unsigned long) |
463 | | inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \ |
464 | 0 | { return -WX_STR_CALL(forString, s2, s1); } \Unexecuted instantiation: wxStrcmp(wchar_t const*, wxString const&) Unexecuted instantiation: wxStricmp(wchar_t const*, wxString const&) Unexecuted instantiation: wxStrcoll(wchar_t const*, wxString const&) Unexecuted instantiation: wxStrncmp(wchar_t const*, wxString const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wchar_t const*, wxString const&, unsigned long) |
465 | | \ |
466 | | inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \ |
467 | 0 | { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<char> const&, wxCStrData const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<char> const&, wxCStrData const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<char> const&, wxCStrData const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<char> const&, wxCStrData const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<char> const&, wxCStrData const&, unsigned long) |
468 | | inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \ |
469 | 0 | { return -WX_STR_CALL(forString, s2, s1.data()); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<char> const&, wxString const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<char> const&, wxString const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<char> const&, wxString const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<char> const&, wxString const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<char> const&, wxString const&, unsigned long) |
470 | | \ |
471 | | inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ |
472 | 0 | { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<wchar_t> const&, wxCStrData const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<wchar_t> const&, wxCStrData const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<wchar_t> const&, wxCStrData const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<wchar_t> const&, wxCStrData const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<wchar_t> const&, wxCStrData const&, unsigned long) |
473 | | inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ |
474 | 0 | { return -WX_STR_CALL(forString, s2, s1.data()); }Unexecuted instantiation: wxStrcmp(wxScopedCharTypeBuffer<wchar_t> const&, wxString const&) Unexecuted instantiation: wxStricmp(wxScopedCharTypeBuffer<wchar_t> const&, wxString const&) Unexecuted instantiation: wxStrcoll(wxScopedCharTypeBuffer<wchar_t> const&, wxString const&) Unexecuted instantiation: wxStrncmp(wxScopedCharTypeBuffer<wchar_t> const&, wxString const&, unsigned long) Unexecuted instantiation: wxStrnicmp(wxScopedCharTypeBuffer<wchar_t> const&, wxString const&, unsigned long) |
475 | | #else // wxNO_IMPLICIT_WXSTRING_ENCODING |
476 | | #define WX_STRCMP_FUNC(name, crtA, crtW, forString) \ |
477 | | WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \ |
478 | | \ |
479 | | inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ |
480 | | { return -WX_STR_CALL(forString, s2.AsString(), s1); } \ |
481 | | inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \ |
482 | | { return -WX_STR_CALL(forString, s2, s1); } \ |
483 | | \ |
484 | | inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ |
485 | | { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \ |
486 | | inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ |
487 | | { return -WX_STR_CALL(forString, s2, s1.data()); } |
488 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
489 | | |
490 | | |
491 | | // This defines a string function that is *not* strcmp-like, i.e. doesn't |
492 | | // return the result of comparison and so if the second argument is a string, |
493 | | // it has to be converted to char* or wchar_t* |
494 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
495 | | #define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \ |
496 | | WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ |
497 | | \ |
498 | | inline rettype WX_STR_DECL(name, const char *, const wxCStrData&) \ |
499 | 0 | { return WX_STR_CALL(crtA, s1, s2.AsCharBuf()); } \Unexecuted instantiation: wxStrspn(char const*, wxCStrData const&) Unexecuted instantiation: wxStrcspn(char const*, wxCStrData const&) |
500 | | inline rettype WX_STR_DECL(name, const char *, const wxString&) \ |
501 | 0 | { return WX_STR_CALL(crtA, s1, s2.mb_str()); } \Unexecuted instantiation: wxStrspn(char const*, wxString const&) Unexecuted instantiation: wxStrcspn(char const*, wxString const&) |
502 | | \ |
503 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ |
504 | 0 | { return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \Unexecuted instantiation: wxStrspn(wchar_t const*, wxCStrData const&) Unexecuted instantiation: wxStrcspn(wchar_t const*, wxCStrData const&) |
505 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \ |
506 | 0 | { return WX_STR_CALL(crtW, s1, s2.wc_str()); } \Unexecuted instantiation: wxStrspn(wchar_t const*, wxString const&) Unexecuted instantiation: wxStrcspn(wchar_t const*, wxString const&) |
507 | | \ |
508 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \ |
509 | 0 | { return WX_STR_CALL(crtA, s1.data(), s2.AsCharBuf()); } \Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<char> const&, wxCStrData const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<char> const&, wxCStrData const&) |
510 | | inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \ |
511 | 0 | { return WX_STR_CALL(crtA, s1.data(), s2.mb_str()); } \Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<char> const&, wxString const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<char> const&, wxString const&) |
512 | | \ |
513 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ |
514 | 0 | { return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<wchar_t> const&, wxCStrData const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<wchar_t> const&, wxCStrData const&) |
515 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ |
516 | 0 | { return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); }Unexecuted instantiation: wxStrspn(wxScopedCharTypeBuffer<wchar_t> const&, wxString const&) Unexecuted instantiation: wxStrcspn(wxScopedCharTypeBuffer<wchar_t> const&, wxString const&) |
517 | | #else // wxNO_IMPLICIT_WXSTRING_ENCODING |
518 | | #define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \ |
519 | | WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ |
520 | | \ |
521 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ |
522 | | { return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \ |
523 | | inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \ |
524 | | { return WX_STR_CALL(crtW, s1, s2.wc_str()); } \ |
525 | | \ |
526 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ |
527 | | { return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \ |
528 | | inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ |
529 | | { return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); } |
530 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
531 | | |
532 | | template<typename T> |
533 | | inline int wxStrcmp_String(const wxString& s1, const T& s2) |
534 | 0 | { return s1.compare(s2); }Unexecuted instantiation: int wxStrcmp_String<wxString>(wxString const&, wxString const&) Unexecuted instantiation: int wxStrcmp_String<wchar_t const*>(wxString const&, wchar_t const* const&) Unexecuted instantiation: int wxStrcmp_String<char const*>(wxString const&, char const* const&) Unexecuted instantiation: int wxStrcmp_String<wxScopedCharTypeBuffer<char> >(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: int wxStrcmp_String<wxScopedCharTypeBuffer<wchar_t> >(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: int wxStrcmp_String<wxCStrData>(wxString const&, wxCStrData const&) |
535 | | WX_STRCMP_FUNC(wxStrcmp, wxCRT_StrcmpA, wxCRT_StrcmpW, wxStrcmp_String) |
536 | | |
537 | | template<typename T> |
538 | | inline int wxStricmp_String(const wxString& s1, const T& s2) |
539 | 0 | { return s1.CmpNoCase(s2); }Unexecuted instantiation: int wxStricmp_String<wxString>(wxString const&, wxString const&) Unexecuted instantiation: int wxStricmp_String<wchar_t const*>(wxString const&, wchar_t const* const&) Unexecuted instantiation: int wxStricmp_String<char const*>(wxString const&, char const* const&) Unexecuted instantiation: int wxStricmp_String<wxScopedCharTypeBuffer<char> >(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: int wxStricmp_String<wxScopedCharTypeBuffer<wchar_t> >(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: int wxStricmp_String<wxCStrData>(wxString const&, wxCStrData const&) |
540 | | WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String) |
541 | | |
542 | | #if defined(wxCRT_StrcollA) && defined(wxCRT_StrcollW) |
543 | | |
544 | | template<typename T> |
545 | | inline int wxStrcoll_String(const wxString& s1, const T& s2); |
546 | | WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String) |
547 | | |
548 | | template<typename T> |
549 | | inline int wxStrcoll_String(const wxString& s1, const T& s2) |
550 | 0 | { |
551 | | // NB: strcoll() doesn't work correctly on UTF-8 strings, so we have to use |
552 | | // wc_str() even if wxUSE_UNICODE_UTF8; the (const wchar_t*) cast is |
553 | | // there just as optimization to avoid going through |
554 | | // wxStrcoll<wxScopedWCharBuffer>: |
555 | 0 | return wxStrcoll((const wchar_t*)s1.wc_str(), s2); |
556 | 0 | } Unexecuted instantiation: int wxStrcoll_String<wxString>(wxString const&, wxString const&) Unexecuted instantiation: int wxStrcoll_String<wchar_t const*>(wxString const&, wchar_t const* const&) Unexecuted instantiation: int wxStrcoll_String<char const*>(wxString const&, char const* const&) Unexecuted instantiation: int wxStrcoll_String<wxScopedCharTypeBuffer<char> >(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: int wxStrcoll_String<wxScopedCharTypeBuffer<wchar_t> >(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: int wxStrcoll_String<wxCStrData>(wxString const&, wxCStrData const&) |
557 | | |
558 | | #endif // defined(wxCRT_Strcoll[AW]) |
559 | | |
560 | | template<typename T> |
561 | | inline size_t wxStrspn_String(const wxString& s1, const T& s2) |
562 | 0 | { |
563 | 0 | size_t pos = s1.find_first_not_of(s2); |
564 | 0 | return pos == wxString::npos ? s1.length() : pos; |
565 | 0 | } Unexecuted instantiation: unsigned long wxStrspn_String<wxString>(wxString const&, wxString const&) Unexecuted instantiation: unsigned long wxStrspn_String<wchar_t const*>(wxString const&, wchar_t const* const&) Unexecuted instantiation: unsigned long wxStrspn_String<char const*>(wxString const&, char const* const&) Unexecuted instantiation: unsigned long wxStrspn_String<wxScopedCharTypeBuffer<char> >(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: unsigned long wxStrspn_String<wxScopedCharTypeBuffer<wchar_t> >(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: unsigned long wxStrspn_String<wxCStrData>(wxString const&, wxCStrData const&) |
566 | | WX_STR_FUNC(size_t, wxStrspn, wxCRT_StrspnA, wxCRT_StrspnW, wxStrspn_String) |
567 | | |
568 | | template<typename T> |
569 | | inline size_t wxStrcspn_String(const wxString& s1, const T& s2) |
570 | 0 | { |
571 | 0 | size_t pos = s1.find_first_of(s2); |
572 | 0 | return pos == wxString::npos ? s1.length() : pos; |
573 | 0 | } Unexecuted instantiation: unsigned long wxStrcspn_String<wxString>(wxString const&, wxString const&) Unexecuted instantiation: unsigned long wxStrcspn_String<wchar_t const*>(wxString const&, wchar_t const* const&) Unexecuted instantiation: unsigned long wxStrcspn_String<char const*>(wxString const&, char const* const&) Unexecuted instantiation: unsigned long wxStrcspn_String<wxScopedCharTypeBuffer<char> >(wxString const&, wxScopedCharTypeBuffer<char> const&) Unexecuted instantiation: unsigned long wxStrcspn_String<wxScopedCharTypeBuffer<wchar_t> >(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&) Unexecuted instantiation: unsigned long wxStrcspn_String<wxCStrData>(wxString const&, wxCStrData const&) |
574 | | WX_STR_FUNC(size_t, wxStrcspn, wxCRT_StrcspnA, wxCRT_StrcspnW, wxStrcspn_String) |
575 | | |
576 | | #undef WX_STR_DECL |
577 | | #undef WX_STR_CALL |
578 | | #define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2, size_t n) |
579 | | #define WX_STR_CALL(func, a1, a2) func(a1, a2, n) |
580 | | |
581 | | template<typename T> |
582 | | inline int wxStrncmp_String(const wxString& s1, const T& s2, size_t n) |
583 | 0 | { return s1.compare(0, n, s2, 0, n); }Unexecuted instantiation: int wxStrncmp_String<wxString>(wxString const&, wxString const&, unsigned long) Unexecuted instantiation: int wxStrncmp_String<wchar_t const*>(wxString const&, wchar_t const* const&, unsigned long) Unexecuted instantiation: int wxStrncmp_String<char const*>(wxString const&, char const* const&, unsigned long) Unexecuted instantiation: int wxStrncmp_String<wxScopedCharTypeBuffer<char> >(wxString const&, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: int wxStrncmp_String<wxScopedCharTypeBuffer<wchar_t> >(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: int wxStrncmp_String<wxCStrData>(wxString const&, wxCStrData const&, unsigned long) |
584 | | WX_STRCMP_FUNC(wxStrncmp, wxCRT_StrncmpA, wxCRT_StrncmpW, wxStrncmp_String) |
585 | | |
586 | | template<typename T> |
587 | | inline int wxStrnicmp_String(const wxString& s1, const T& s2, size_t n) |
588 | 0 | { return s1.substr(0, n).CmpNoCase(wxString(s2).substr(0, n)); }Unexecuted instantiation: int wxStrnicmp_String<wxString>(wxString const&, wxString const&, unsigned long) Unexecuted instantiation: int wxStrnicmp_String<wchar_t const*>(wxString const&, wchar_t const* const&, unsigned long) Unexecuted instantiation: int wxStrnicmp_String<char const*>(wxString const&, char const* const&, unsigned long) Unexecuted instantiation: int wxStrnicmp_String<wxScopedCharTypeBuffer<char> >(wxString const&, wxScopedCharTypeBuffer<char> const&, unsigned long) Unexecuted instantiation: int wxStrnicmp_String<wxScopedCharTypeBuffer<wchar_t> >(wxString const&, wxScopedCharTypeBuffer<wchar_t> const&, unsigned long) Unexecuted instantiation: int wxStrnicmp_String<wxCStrData>(wxString const&, wxCStrData const&, unsigned long) |
589 | | WX_STRCMP_FUNC(wxStrnicmp, wxCRT_StrnicmpA, wxCRT_StrnicmpW, wxStrnicmp_String) |
590 | | |
591 | | #undef WX_STR_DECL |
592 | | #undef WX_STR_CALL |
593 | | #undef WX_STRCMP_FUNC |
594 | | #undef WX_STR_FUNC |
595 | | #undef WX_STR_FUNC_NO_INVERT |
596 | | |
597 | | #if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW) |
598 | | |
599 | | inline size_t wxStrxfrm(char *dest, const char *src, size_t n) |
600 | 0 | { return wxCRT_StrxfrmA(dest, src, n); } |
601 | | inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n) |
602 | 0 | { return wxCRT_StrxfrmW(dest, src, n); } |
603 | | template<typename T> |
604 | | inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer<T>& src, size_t n) |
605 | | { return wxStrxfrm(dest, src.data(), n); } |
606 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
607 | | inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n) |
608 | 0 | { return wxCRT_StrxfrmA(dest, src.mb_str(), n); } |
609 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
610 | | inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n) |
611 | 0 | { return wxCRT_StrxfrmW(dest, src.wc_str(), n); } |
612 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
613 | | inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n) |
614 | 0 | { return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); } |
615 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
616 | | inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n) |
617 | 0 | { return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); } |
618 | | |
619 | | #endif // defined(wxCRT_Strxfrm[AW]) |
620 | | |
621 | | inline char *wxStrtok(char *str, const char *delim, char **saveptr) |
622 | 0 | { return wxCRT_StrtokA(str, delim, saveptr); } |
623 | | inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr) |
624 | 0 | { return wxCRT_StrtokW(str, delim, saveptr); } |
625 | | template<typename T> |
626 | | inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer<T>& delim, T **saveptr) |
627 | | { return wxStrtok(str, delim.data(), saveptr); } |
628 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
629 | | inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr) |
630 | 0 | { return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); } |
631 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
632 | | inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr) |
633 | 0 | { return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); } |
634 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
635 | | inline char *wxStrtok(char *str, const wxString& delim, char **saveptr) |
636 | 0 | { return wxCRT_StrtokA(str, delim.mb_str(), saveptr); } |
637 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
638 | | inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr) |
639 | 0 | { return wxCRT_StrtokW(str, delim.wc_str(), saveptr); } |
640 | | |
641 | | inline const char *wxStrstr(const char *haystack, const char *needle) |
642 | 0 | { return wxCRT_StrstrA(haystack, needle); } |
643 | | inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle) |
644 | 0 | { return wxCRT_StrstrW(haystack, needle); } |
645 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
646 | | inline const char *wxStrstr(const char *haystack, const wxString& needle) |
647 | 0 | { return wxCRT_StrstrA(haystack, needle.mb_str()); } |
648 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
649 | | inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle) |
650 | 0 | { return wxCRT_StrstrW(haystack, needle.wc_str()); } |
651 | | // these functions return char* pointer into the non-temporary conversion buffer |
652 | | // used by c_str()'s implicit conversion to char*, for ANSI build compatibility |
653 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
654 | | inline const char *wxStrstr(const wxString& haystack, const wxString& needle) |
655 | 0 | { return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); } |
656 | | inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle) |
657 | 0 | { return wxCRT_StrstrA(haystack, needle.mb_str()); } |
658 | | inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle) |
659 | 0 | { return wxCRT_StrstrA(haystack, needle.AsCharBuf()); } |
660 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
661 | | // if 'needle' is char/wchar_t, then the same is probably wanted as return value |
662 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
663 | | inline const char *wxStrstr(const wxString& haystack, const char *needle) |
664 | 0 | { return wxCRT_StrstrA(haystack.c_str(), needle); } |
665 | | inline const char *wxStrstr(const wxCStrData& haystack, const char *needle) |
666 | 0 | { return wxCRT_StrstrA(haystack, needle); } |
667 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
668 | | inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle) |
669 | 0 | { return wxCRT_StrstrW(haystack.c_str(), needle); } |
670 | | inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle) |
671 | 0 | { return wxCRT_StrstrW(haystack, needle); } |
672 | | |
673 | | inline const char *wxStrchr(const char *s, char c) |
674 | 0 | { return wxCRT_StrchrA(s, c); } |
675 | | inline const wchar_t *wxStrchr(const wchar_t *s, wchar_t c) |
676 | 0 | { return wxCRT_StrchrW(s, c); } |
677 | | inline const char *wxStrrchr(const char *s, char c) |
678 | 0 | { return wxCRT_StrrchrA(s, c); } |
679 | | inline const wchar_t *wxStrrchr(const wchar_t *s, wchar_t c) |
680 | 0 | { return wxCRT_StrrchrW(s, c); } |
681 | | inline const char *wxStrchr(const char *s, const wxUniChar& uc) |
682 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } |
683 | | inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniChar& c) |
684 | 0 | { return wxCRT_StrchrW(s, (wchar_t)c); } |
685 | | inline const char *wxStrrchr(const char *s, const wxUniChar& uc) |
686 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } |
687 | | inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniChar& c) |
688 | 0 | { return wxCRT_StrrchrW(s, (wchar_t)c); } |
689 | | inline const char *wxStrchr(const char *s, const wxUniCharRef& uc) |
690 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } |
691 | | inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniCharRef& c) |
692 | 0 | { return wxCRT_StrchrW(s, (wchar_t)c); } |
693 | | inline const char *wxStrrchr(const char *s, const wxUniCharRef& uc) |
694 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } |
695 | | inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniCharRef& c) |
696 | 0 | { return wxCRT_StrrchrW(s, (wchar_t)c); } |
697 | | template<typename T> |
698 | | inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, T c) |
699 | | { return wxStrchr(s.data(), c); } |
700 | | template<typename T> |
701 | | inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, T c) |
702 | | { return wxStrrchr(s.data(), c); } |
703 | | template<typename T> |
704 | | inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c) |
705 | | { return wxStrchr(s.data(), (T)c); } |
706 | | template<typename T> |
707 | | inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c) |
708 | | { return wxStrrchr(s.data(), (T)c); } |
709 | | template<typename T> |
710 | | inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c) |
711 | | { return wxStrchr(s.data(), (T)c); } |
712 | | template<typename T> |
713 | | inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c) |
714 | | { return wxStrrchr(s.data(), (T)c); } |
715 | | // these functions return char* pointer into the non-temporary conversion buffer |
716 | | // used by c_str()'s implicit conversion to char*, for ANSI build compatibility |
717 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
718 | | inline const char* wxStrchr(const wxString& s, char c) |
719 | 0 | { return wxCRT_StrchrA((const char*)s.c_str(), c); } |
720 | | inline const char* wxStrrchr(const wxString& s, char c) |
721 | 0 | { return wxCRT_StrrchrA((const char*)s.c_str(), c); } |
722 | | inline const char* wxStrchr(const wxString& s, int c) |
723 | 0 | { return wxCRT_StrchrA((const char*)s.c_str(), c); } |
724 | | inline const char* wxStrrchr(const wxString& s, int c) |
725 | 0 | { return wxCRT_StrrchrA((const char*)s.c_str(), c); } |
726 | | inline const char* wxStrchr(const wxString& s, const wxUniChar& uc) |
727 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : nullptr; } |
728 | | inline const char* wxStrrchr(const wxString& s, const wxUniChar& uc) |
729 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : nullptr; } |
730 | | inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc) |
731 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : nullptr; } |
732 | | inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc) |
733 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : nullptr; } |
734 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
735 | | inline const wchar_t* wxStrchr(const wxString& s, wchar_t c) |
736 | 0 | { return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); } |
737 | | inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c) |
738 | 0 | { return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); } |
739 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
740 | | inline const char* wxStrchr(const wxCStrData& s, char c) |
741 | 0 | { return wxCRT_StrchrA(s.AsChar(), c); } |
742 | | inline const char* wxStrrchr(const wxCStrData& s, char c) |
743 | 0 | { return wxCRT_StrrchrA(s.AsChar(), c); } |
744 | | inline const char* wxStrchr(const wxCStrData& s, int c) |
745 | 0 | { return wxCRT_StrchrA(s.AsChar(), c); } |
746 | | inline const char* wxStrrchr(const wxCStrData& s, int c) |
747 | 0 | { return wxCRT_StrrchrA(s.AsChar(), c); } |
748 | | inline const char* wxStrchr(const wxCStrData& s, const wxUniChar& uc) |
749 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } |
750 | | inline const char* wxStrrchr(const wxCStrData& s, const wxUniChar& uc) |
751 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } |
752 | | inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc) |
753 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } |
754 | | inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc) |
755 | 0 | { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } |
756 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
757 | | inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c) |
758 | 0 | { return wxCRT_StrchrW(s.AsWChar(), c); } |
759 | | inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c) |
760 | 0 | { return wxCRT_StrrchrW(s.AsWChar(), c); } |
761 | | |
762 | | inline const char *wxStrpbrk(const char *s, const char *accept) |
763 | 0 | { return wxCRT_StrpbrkA(s, accept); } |
764 | | inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept) |
765 | 0 | { return wxCRT_StrpbrkW(s, accept); } |
766 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
767 | | inline const char *wxStrpbrk(const char *s, const wxString& accept) |
768 | 0 | { return wxCRT_StrpbrkA(s, accept.mb_str()); } |
769 | | inline const char *wxStrpbrk(const char *s, const wxCStrData& accept) |
770 | 0 | { return wxCRT_StrpbrkA(s, accept.AsCharBuf()); } |
771 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
772 | | inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept) |
773 | 0 | { return wxCRT_StrpbrkW(s, accept.wc_str()); } |
774 | | inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept) |
775 | 0 | { return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); } |
776 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
777 | | inline const char *wxStrpbrk(const wxString& s, const wxString& accept) |
778 | 0 | { return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); } |
779 | | inline const char *wxStrpbrk(const wxString& s, const char *accept) |
780 | 0 | { return wxCRT_StrpbrkA(s.c_str(), accept); } |
781 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
782 | | inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept) |
783 | 0 | { return wxCRT_StrpbrkW(s.wc_str(), accept); } |
784 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
785 | | inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept) |
786 | 0 | { return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); } |
787 | | inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept) |
788 | 0 | { return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); } |
789 | | inline const char *wxStrpbrk(const wxCStrData& s, const char *accept) |
790 | 0 | { return wxCRT_StrpbrkA(s.AsChar(), accept); } |
791 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
792 | | inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept) |
793 | 0 | { return wxCRT_StrpbrkW(s.AsWChar(), accept); } |
794 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
795 | | inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept) |
796 | 0 | { return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); } |
797 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
798 | | template <typename S, typename T> |
799 | | inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer<T>& accept) |
800 | | { return wxStrpbrk(s, accept.data()); } |
801 | | |
802 | | |
803 | | /* inlined non-const versions */ |
804 | | template <typename T> |
805 | | inline char *wxStrstr(char *haystack, T needle) |
806 | | { return const_cast<char*>(wxStrstr(const_cast<const char*>(haystack), needle)); } |
807 | | template <typename T> |
808 | | inline wchar_t *wxStrstr(wchar_t *haystack, T needle) |
809 | | { return const_cast<wchar_t*>(wxStrstr(const_cast<const wchar_t*>(haystack), needle)); } |
810 | | |
811 | | template <typename T> |
812 | | inline char * wxStrchr(char *s, T c) |
813 | | { return const_cast<char*>(wxStrchr(const_cast<const char*>(s), c)); } |
814 | | template <typename T> |
815 | | inline wchar_t * wxStrchr(wchar_t *s, T c) |
816 | 0 | { return const_cast<wchar_t*>(wxStrchr(const_cast<const wchar_t*>(s), c)); } |
817 | | template <typename T> |
818 | | inline char * wxStrrchr(char *s, T c) |
819 | | { return const_cast<char*>(wxStrrchr(const_cast<const char*>(s), c)); } |
820 | | template <typename T> |
821 | | inline wchar_t * wxStrrchr(wchar_t *s, T c) |
822 | | { return const_cast<wchar_t*>(wxStrrchr(const_cast<const wchar_t*>(s), c)); } |
823 | | |
824 | | template <typename T> |
825 | | inline char * wxStrpbrk(char *s, T accept) |
826 | | { return const_cast<char*>(wxStrpbrk(const_cast<const char*>(s), accept)); } |
827 | | template <typename T> |
828 | | inline wchar_t * wxStrpbrk(wchar_t *s, T accept) |
829 | 0 | { return const_cast<wchar_t*>(wxStrpbrk(const_cast<const wchar_t*>(s), accept)); } |
830 | | |
831 | | |
832 | | // ---------------------------------------------------------------------------- |
833 | | // stdio.h functions |
834 | | // ---------------------------------------------------------------------------- |
835 | | |
836 | | // NB: using fn_str() for mode is a hack to get the same type (char*/wchar_t*) |
837 | | // as needed, the conversion itself doesn't matter, it's ASCII |
838 | | inline FILE *wxFopen(const wxString& path, const wxString& mode) |
839 | 0 | { return wxCRT_Fopen(path.fn_str(), mode.fn_str()); } |
840 | | inline FILE *wxFreopen(const wxString& path, const wxString& mode, FILE *stream) |
841 | 0 | { return wxCRT_Freopen(path.fn_str(), mode.fn_str(), stream); } |
842 | | inline int wxRemove(const wxString& path) |
843 | 0 | { return wxCRT_Remove(path.fn_str()); } |
844 | | inline int wxRename(const wxString& oldpath, const wxString& newpath) |
845 | 0 | { return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); } |
846 | | |
847 | | extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s); |
848 | | extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream); |
849 | | extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s); |
850 | | |
851 | | extern WXDLLIMPEXP_BASE int wxFputc(const wxUniChar& c, FILE *stream); |
852 | | |
853 | | #define wxPutc(c, stream) wxFputc(c, stream) |
854 | | #define wxPutchar(c) wxFputc(c, stdout) |
855 | | #define wxFputchar(c) wxPutchar(c) |
856 | | |
857 | | // NB: We only provide ANSI version of fgets() because fgetws() interprets the |
858 | | // stream according to current locale, which is rarely what is desired. |
859 | | inline char *wxFgets(char *s, int size, FILE *stream) |
860 | 0 | { return wxCRT_FgetsA(s, size, stream); } |
861 | | // This version calls ANSI version and converts the string using wxConvLibc |
862 | | extern WXDLLIMPEXP_BASE wchar_t *wxFgets(wchar_t *s, int size, FILE *stream); |
863 | | |
864 | | #define wxGets(s) wxGets_is_insecure_and_dangerous_use_wxFgets_instead |
865 | | |
866 | | // NB: We only provide ANSI versions of this for the same reasons as in the |
867 | | // case of wxFgets() above |
868 | 0 | inline int wxFgetc(FILE *stream) { return wxCRT_FgetcA(stream); } |
869 | 0 | inline int wxUngetc(int c, FILE *stream) { return wxCRT_UngetcA(c, stream); } |
870 | | |
871 | | #define wxGetc(stream) wxFgetc(stream) |
872 | | #define wxGetchar() wxFgetc(stdin) |
873 | | #define wxFgetchar() wxGetchar() |
874 | | |
875 | | // ---------------------------------------------------------------------------- |
876 | | // stdlib.h functions |
877 | | // |
878 | | // We only use wxConvLibc here because if the string is non-ASCII, |
879 | | // then it's fine for the conversion to yield empty string, as atoi() |
880 | | // will return 0 for it, which is the correct thing to do in this |
881 | | // case. |
882 | | // ---------------------------------------------------------------------------- |
883 | | |
884 | | #ifdef wxCRT_AtoiW |
885 | | inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); } |
886 | | #else |
887 | 0 | inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str(wxConvLibc)); } |
888 | | #endif |
889 | | |
890 | | #ifdef wxCRT_AtolW |
891 | 0 | inline long wxAtol(const wxString& str) { return wxCRT_AtolW(str.wc_str()); } |
892 | | #else |
893 | | inline long wxAtol(const wxString& str) { return wxCRT_AtolA(str.mb_str(wxConvLibc)); } |
894 | | #endif |
895 | | |
896 | | #ifdef wxCRT_AtofW |
897 | 0 | inline double wxAtof(const wxString& str) { return wxCRT_AtofW(str.wc_str()); } |
898 | | #else |
899 | | inline double wxAtof(const wxString& str) { return wxCRT_AtofA(str.mb_str(wxConvLibc)); } |
900 | | #endif |
901 | | |
902 | | inline double wxStrtod(const char *nptr, char **endptr) |
903 | 0 | { return wxCRT_StrtodA(nptr, endptr); } |
904 | | inline double wxStrtod(const wchar_t *nptr, wchar_t **endptr) |
905 | 0 | { return wxCRT_StrtodW(nptr, endptr); } |
906 | | template<typename T> |
907 | | inline double wxStrtod(const wxScopedCharTypeBuffer<T>& nptr, T **endptr) |
908 | | { return wxStrtod(nptr.data(), endptr); } |
909 | | |
910 | | // We implement wxStrto*() like this so that the code compiles when NULL is |
911 | | // passed in - - if we had just char** and wchar_t** overloads for 'endptr', it |
912 | | // would be ambiguous. The solution is to use a template so that endptr can be |
913 | | // any type: when NULL constant is used, the type will be int and we can handle |
914 | | // that case specially. Otherwise, we infer the type that 'nptr' should be |
915 | | // converted to from the type of 'endptr'. We need wxStrtoxCharType<T> template |
916 | | // to make the code compile even for T=int (that's the case when it's not going |
917 | | // to be ever used, but it still has to compile). |
918 | | template<typename T> struct wxStrtoxCharType {}; |
919 | | template<> struct wxStrtoxCharType<char**> |
920 | | { |
921 | | typedef const char* Type; |
922 | 0 | static char** AsPointer(char **p) { return p; } |
923 | | }; |
924 | | template<> struct wxStrtoxCharType<wchar_t**> |
925 | | { |
926 | | typedef const wchar_t* Type; |
927 | 0 | static wchar_t** AsPointer(wchar_t **p) { return p; } |
928 | | }; |
929 | | template<> struct wxStrtoxCharType<int> |
930 | | { |
931 | | typedef const char* Type; /* this one is never used */ |
932 | | static char** AsPointer(int WXUNUSED_UNLESS_DEBUG(p)) |
933 | 0 | { |
934 | 0 | wxASSERT_MSG( p == 0, "passing non-null int is invalid" ); |
935 | 0 | return nullptr; |
936 | 0 | } |
937 | | }; |
938 | | |
939 | | template<typename T> |
940 | | inline double wxStrtod(const wxString& nptr, T endptr) |
941 | 0 | { |
942 | 0 | if (!endptr) |
943 | 0 | { |
944 | | // when we don't care about endptr, use the string representation that |
945 | | // doesn't require any conversion (it doesn't matter for this function |
946 | | // even if its UTF-8): |
947 | 0 | wxStringCharType** p = nullptr; |
948 | 0 | return wxStrtod(nptr.wx_str(), p); |
949 | 0 | } |
950 | | // note that it is important to use c_str() here and not mb_str() or |
951 | | // wc_str(), because we store the pointer into (possibly converted) |
952 | | // buffer in endptr and so it must be valid even when wxStrtod() returns |
953 | 0 | typedef typename wxStrtoxCharType<T>::Type CharType; |
954 | 0 | return wxStrtod((CharType)nptr.c_str(), |
955 | 0 | wxStrtoxCharType<T>::AsPointer(endptr)); |
956 | 0 | } Unexecuted instantiation: double wxStrtod<wchar_t**>(wxString const&, wchar_t**) Unexecuted instantiation: double wxStrtod<int>(wxString const&, int) |
957 | | template<typename T> |
958 | | inline double wxStrtod(const wxCStrData& nptr, T endptr) |
959 | 0 | { return wxStrtod(nptr.AsString(), endptr); } |
960 | | |
961 | | #ifdef wxHAS_NULLPTR_T |
962 | | |
963 | | inline double wxStrtod(const wxString& nptr, std::nullptr_t) |
964 | 0 | { return wxStrtod(nptr.wx_str(), static_cast<wxStringCharType**>(nullptr)); } |
965 | | inline double wxStrtod(const wxCStrData& nptr, std::nullptr_t) |
966 | 0 | { return wxStrtod(nptr.AsString(), static_cast<wxStringCharType**>(nullptr)); } |
967 | | |
968 | | #define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) \ |
969 | | inline rettype name(const wxString& nptr, std::nullptr_t, int base) \ |
970 | 0 | { return name(nptr.wx_str(), static_cast<wxStringCharType**>(nullptr), \ |
971 | 0 | base); } \ Unexecuted instantiation: wxStrtol(wxString const&, decltype(nullptr), int) Unexecuted instantiation: wxStrtoul(wxString const&, decltype(nullptr), int) Unexecuted instantiation: wxStrtoll(wxString const&, decltype(nullptr), int) Unexecuted instantiation: wxStrtoull(wxString const&, decltype(nullptr), int) |
972 | | inline rettype name(const wxCStrData& nptr, std::nullptr_t, int base) \ |
973 | 0 | { return name(nptr.AsString(), static_cast<wxStringCharType**>(nullptr), \ |
974 | 0 | base); } Unexecuted instantiation: wxStrtol(wxCStrData const&, decltype(nullptr), int) Unexecuted instantiation: wxStrtoul(wxCStrData const&, decltype(nullptr), int) Unexecuted instantiation: wxStrtoll(wxCStrData const&, decltype(nullptr), int) Unexecuted instantiation: wxStrtoull(wxCStrData const&, decltype(nullptr), int) |
975 | | |
976 | | #else // !wxHAS_NULLPTR_T |
977 | | #define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) |
978 | | #endif // wxHAS_NULLPTR_T/!wxHAS_NULLPTR_T |
979 | | |
980 | | |
981 | | #define WX_STRTOX_FUNC(rettype, name, implA, implW) \ |
982 | | /* see wxStrtod() above for explanation of this code: */ \ |
983 | | inline rettype name(const char *nptr, char **endptr, int base) \ |
984 | 0 | { return implA(nptr, endptr, base); } \Unexecuted instantiation: wxStrtol(char const*, char**, int) Unexecuted instantiation: wxStrtoul(char const*, char**, int) Unexecuted instantiation: wxStrtoll(char const*, char**, int) Unexecuted instantiation: wxStrtoull(char const*, char**, int) |
985 | | inline rettype name(const wchar_t *nptr, wchar_t **endptr, int base) \ |
986 | 0 | { return implW(nptr, endptr, base); } \Unexecuted instantiation: wxStrtol(wchar_t const*, wchar_t**, int) Unexecuted instantiation: wxStrtoul(wchar_t const*, wchar_t**, int) Unexecuted instantiation: wxStrtoll(wchar_t const*, wchar_t**, int) Unexecuted instantiation: wxStrtoull(wchar_t const*, wchar_t**, int) |
987 | | template<typename T> \ |
988 | | inline rettype name(const wxScopedCharTypeBuffer<T>& nptr, T **endptr, int)\ |
989 | | { return name(nptr.data(), endptr); } \ |
990 | | template<typename T> \ |
991 | | inline rettype name(const wxString& nptr, T endptr, int base) \ |
992 | 0 | { \ |
993 | 0 | if (!endptr) \ |
994 | 0 | { \ |
995 | 0 | wxStringCharType** p = nullptr; \ |
996 | 0 | return name(nptr.wx_str(), p, base); \ |
997 | 0 | } \ |
998 | 0 | typedef typename wxStrtoxCharType<T>::Type CharType; \ |
999 | 0 | return name((CharType)nptr.c_str(), \ |
1000 | 0 | wxStrtoxCharType<T>::AsPointer(endptr), \ |
1001 | 0 | base); \ |
1002 | 0 | } \ Unexecuted instantiation: long wxStrtol<wchar_t**>(wxString const&, wchar_t**, int) Unexecuted instantiation: unsigned long wxStrtoul<wchar_t**>(wxString const&, wchar_t**, int) Unexecuted instantiation: long long wxStrtoll<wchar_t**>(wxString const&, wchar_t**, int) Unexecuted instantiation: unsigned long long wxStrtoull<wchar_t**>(wxString const&, wchar_t**, int) Unexecuted instantiation: unsigned long wxStrtoul<int>(wxString const&, int, int) Unexecuted instantiation: long wxStrtol<int>(wxString const&, int, int) |
1003 | | template<typename T> \ |
1004 | | inline rettype name(const wxCStrData& nptr, T endptr, int base) \ |
1005 | 0 | { return name(nptr.AsString(), endptr, base); } \Unexecuted instantiation: unsigned long wxStrtoul<int>(wxCStrData const&, int, int) Unexecuted instantiation: long wxStrtol<int>(wxCStrData const&, int, int) |
1006 | | WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) |
1007 | | |
1008 | | WX_STRTOX_FUNC(long, wxStrtol, wxCRT_StrtolA, wxCRT_StrtolW) |
1009 | | WX_STRTOX_FUNC(unsigned long, wxStrtoul, wxCRT_StrtoulA, wxCRT_StrtoulW) |
1010 | | WX_STRTOX_FUNC(wxLongLong_t, wxStrtoll, wxCRT_StrtollA, wxCRT_StrtollW) |
1011 | | WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW) |
1012 | | |
1013 | | #undef WX_STRTOX_FUNC |
1014 | | |
1015 | | // iOS 11 doesn't have system() anymore and usage was deprecated even before |
1016 | | #ifndef __WXDARWIN_IPHONE__ |
1017 | | // mingw32 doesn't provide _tsystem() even though it provides other stdlib.h |
1018 | | // functions in their wide versions |
1019 | | #ifdef wxCRT_SystemW |
1020 | | inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); } |
1021 | | #elif !defined wxNO_IMPLICIT_WXSTRING_ENCODING |
1022 | 0 | inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); } |
1023 | | #endif |
1024 | | #endif // !__WXDARWIN_IPHONE__ |
1025 | | |
1026 | 0 | inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); } |
1027 | 0 | inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); } |
1028 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
1029 | 0 | inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); } |
1030 | 0 | inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsCharBuf()); } |
1031 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
1032 | 0 | inline char* wxGetenv(const wxScopedCharBuffer& name) { return wxCRT_GetenvA(name.data()); } |
1033 | 0 | inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW(name.data()); } |
1034 | | |
1035 | | // ---------------------------------------------------------------------------- |
1036 | | // time.h functions |
1037 | | // ---------------------------------------------------------------------------- |
1038 | | |
1039 | | #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING |
1040 | | inline size_t wxStrftime(char *s, size_t max, |
1041 | | const wxString& format, const struct tm *tm) |
1042 | 0 | { |
1043 | 0 | wxGCC_ONLY_WARNING_SUPPRESS(format-nonliteral) |
1044 | 0 |
|
1045 | 0 | return wxCRT_StrftimeA(s, max, format.mb_str(), tm); |
1046 | 0 |
|
1047 | 0 | wxGCC_ONLY_WARNING_RESTORE(format-nonliteral) |
1048 | 0 | } |
1049 | | #endif // wxNO_IMPLICIT_WXSTRING_ENCODING |
1050 | | |
1051 | | inline size_t wxStrftime(wchar_t *s, size_t max, |
1052 | | const wxString& format, const struct tm *tm) |
1053 | 0 | { return wxCRT_StrftimeW(s, max, format.wc_str(), tm); } |
1054 | | |
1055 | | // NB: we can't provide both char* and wchar_t* versions for obvious reasons |
1056 | | // and returning wxString wouldn't work either (it would be immediately |
1057 | | // destroyed and if assigned to char*/wchar_t*, the pointer would be |
1058 | | // invalid), so we only keep ASCII version, because the returned value |
1059 | | // is always ASCII anyway |
1060 | | #define wxAsctime asctime |
1061 | | #define wxCtime ctime |
1062 | | |
1063 | | |
1064 | | // ---------------------------------------------------------------------------- |
1065 | | // ctype.h functions |
1066 | | // ---------------------------------------------------------------------------- |
1067 | | |
1068 | | // FIXME-UTF8: we'd be better off implementing these ourselves, as the CRT |
1069 | | // version is locale-dependent |
1070 | | // FIXME-UTF8: these don't work when EOF is passed in because of wxUniChar, |
1071 | | // is this OK or not? |
1072 | | |
1073 | 0 | inline bool wxIsalnum(const wxUniChar& c) { return wxCRT_IsalnumW(c) != 0; } |
1074 | 0 | inline bool wxIsalpha(const wxUniChar& c) { return wxCRT_IsalphaW(c) != 0; } |
1075 | 0 | inline bool wxIscntrl(const wxUniChar& c) { return wxCRT_IscntrlW(c) != 0; } |
1076 | 0 | inline bool wxIsdigit(const wxUniChar& c) { return wxCRT_IsdigitW(c) != 0; } |
1077 | 0 | inline bool wxIsgraph(const wxUniChar& c) { return wxCRT_IsgraphW(c) != 0; } |
1078 | 0 | inline bool wxIslower(const wxUniChar& c) { return wxCRT_IslowerW(c) != 0; } |
1079 | 0 | inline bool wxIsprint(const wxUniChar& c) { return wxCRT_IsprintW(c) != 0; } |
1080 | 0 | inline bool wxIspunct(const wxUniChar& c) { return wxCRT_IspunctW(c) != 0; } |
1081 | 0 | inline bool wxIsspace(const wxUniChar& c) { return wxCRT_IsspaceW(c) != 0; } |
1082 | 0 | inline bool wxIsupper(const wxUniChar& c) { return wxCRT_IsupperW(c) != 0; } |
1083 | 0 | inline bool wxIsxdigit(const wxUniChar& c) { return wxCRT_IsxdigitW(c) != 0; } |
1084 | | |
1085 | 0 | inline wxUniChar wxTolower(const wxUniChar& c) { return wxCRT_TolowerW(c); } |
1086 | 0 | inline wxUniChar wxToupper(const wxUniChar& c) { return wxCRT_ToupperW(c); } |
1087 | | |
1088 | 0 | inline bool wxIsascii(const wxUniChar& c) { return c.IsAscii(); } |
1089 | | |
1090 | | #endif /* _WX_WXCRT_H_ */ |