]> git.saurik.com Git - wxWidgets.git/blame - include/wx/wxcrtvararg.h
Return false from wxFileName::AppendDir() and InsertDir() on failure.
[wxWidgets.git] / include / wx / wxcrtvararg.h
CommitLineData
e713a90b
VS
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/wxcrtvararg.h
3// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
4// printf(), scanf() and related CRT functions
e9670814 5// Author: Joel Farley, Ove Kåven
e713a90b
VS
6// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
7// Created: 2007-02-19
8// RCS-ID: $Id$
9// Copyright: (c) 2007 REA Elektronik GmbH
10// Licence: wxWindows licence
11///////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_WXCRTVARARG_H_
14#define _WX_WXCRTVARARG_H_
15
3a3dde0d
VS
16// NB: User code should include wx/crt.h instead of including this
17// header directly.
18
e713a90b
VS
19#include "wx/wxcrt.h"
20#include "wx/strvararg.h"
21
2523e9b7
VS
22#include "wx/string.h"
23
24// ----------------------------------------------------------------------------
25// CRT functions aliases
26// ----------------------------------------------------------------------------
e713a90b
VS
27
28/* Required for wxPrintf() etc */
29#include <stdarg.h>
30
e713a90b
VS
31/* printf() family saga */
32
33/*
6bc7b913
VZ
34 For many old Unix systems [v]snprintf()/vsscanf() exists in the system
35 libraries but not in the headers, so we need to declare it ourselves to be
36 able to use it.
e713a90b 37 */
6bc7b913
VZ
38#ifdef __UNIX__
39
e713a90b
VS
40#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
41#ifdef __cplusplus
42 extern "C"
43#else
44 extern
45#endif
46 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
47#endif /* !HAVE_VSNPRINTF_DECL */
48
49#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL)
50#ifdef __cplusplus
51 extern "C"
52#else
53 extern
54#endif
52de37c7 55 int snprintf(char *str, size_t size, const char *format, ...);
e713a90b
VS
56#endif /* !HAVE_SNPRINTF_DECL */
57
a93cf225
SN
58#if defined(HAVE_VSSCANF) && !defined(HAVE_VSSCANF_DECL)
59#ifdef __cplusplus
60 extern "C"
61#else
62 extern
63#endif
64 int vsscanf(const char *str, const char *format, va_list ap);
6bc7b913 65#endif /* !HAVE_VSSCANF_DECL */
a93cf225 66
e713a90b
VS
67/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
68 * same isn't done for snprintf below, the builtin wxSnprintf_ is used
69 * instead since it's already a simple wrapper */
70#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
71 inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap)
72 {
73 return vsnprintf(str, size, (char*)format, ap);
74 }
75#endif
76
6bc7b913
VZ
77#endif /* __UNIX__ */
78
e713a90b 79/*
e461247b
VZ
80 mingw32 normally uses MSVCRT which has non-standard vswprintf() and so
81 normally _vsnwprintf() is used instead, the only exception is when mingw32
82 is used with STLPort which does have a standard vswprintf() starting from
83 version 5.1 which we can use.
e713a90b 84 */
e461247b
VZ
85#ifdef __MINGW32__
86 #if defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510
87 #ifndef HAVE_VSWPRINTF
88 #define HAVE_VSWPRINTF
89 #endif
90 #elif defined(HAVE_VSWPRINTF)
91 /* can't use non-standard vswprintf() */
92 #undef HAVE_VSWPRINTF
93 #endif
94#endif /* __MINGW32__ */
e713a90b 95
ed12c5a2
VS
96#if defined(__WATCOMC__)
97 #define HAVE_VSWPRINTF 1
98#endif
99
e713a90b
VS
100#if wxUSE_PRINTF_POS_PARAMS
101 /*
102 The systems where vsnprintf() supports positional parameters should
103 define the HAVE_UNIX98_PRINTF symbol.
104
105 On systems which don't (e.g. Windows) we are forced to use
106 our wxVsnprintf() implementation.
107 */
108 #if defined(HAVE_UNIX98_PRINTF)
52de37c7 109 #ifdef HAVE_VSWPRINTF
57c42b62 110 #define wxCRT_VsnprintfW vswprintf
52de37c7
VS
111 #endif
112 #ifdef HAVE_BROKEN_VSNPRINTF_DECL
113 #define wxCRT_VsnprintfA wx_fixed_vsnprintf
114 #else
115 #define wxCRT_VsnprintfA vsnprintf
e713a90b
VS
116 #endif
117 #else /* !HAVE_UNIX98_PRINTF */
118 /*
119 The only compiler with positional parameters support under Windows
120 is VC++ 8.0 which provides a new xxprintf_p() functions family.
121 The 2003 PSDK includes a slightly earlier version of VC8 than the
122 main release and does not have the printf_p functions.
123 */
124 #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__
52de37c7 125 #define wxCRT_VsnprintfA _vsprintf_p
57c42b62 126 #define wxCRT_VsnprintfW _vswprintf_p
e713a90b
VS
127 #endif
128 #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
129#else /* !wxUSE_PRINTF_POS_PARAMS */
130 /*
131 We always want to define safe snprintf() function to be used instead of
132 sprintf(). Some compilers already have it (or rather vsnprintf() which
133 we really need...), otherwise we implement it using our own printf()
134 code.
135
136 We define function with a trailing underscore here because the real one
137 is a wrapper around it as explained below
138 */
139
52de37c7
VS
140 #if defined(__VISUALC__) || \
141 (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
142 #define wxCRT_VsnprintfA _vsnprintf
57c42b62 143 #define wxCRT_VsnprintfW _vsnwprintf
52de37c7
VS
144 #else
145 #if defined(HAVE__VSNWPRINTF)
57c42b62 146 #define wxCRT_VsnprintfW _vsnwprintf
52de37c7 147 #elif defined(HAVE_VSWPRINTF)
57c42b62 148 #define wxCRT_VsnprintfW vswprintf
52de37c7 149 #elif defined(__WATCOMC__)
57c42b62 150 #define wxCRT_VsnprintfW _vsnwprintf
e713a90b 151 #endif
e713a90b 152
52de37c7 153 #if defined(HAVE_VSNPRINTF) \
2415cf67 154 || defined(__WATCOMC__)
52de37c7
VS
155 #ifdef HAVE_BROKEN_VSNPRINTF_DECL
156 #define wxCRT_VsnprintfA wx_fixed_vsnprintf
157 #else
158 #define wxCRT_VsnprintfA vsnprintf
e713a90b 159 #endif
52de37c7
VS
160 #endif
161 #endif
e713a90b
VS
162#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */
163
57c42b62 164#ifndef wxCRT_VsnprintfW
e713a90b
VS
165 /* no (suitable) vsnprintf(), cook our own */
166 WXDLLIMPEXP_BASE int
57c42b62 167 wxCRT_VsnprintfW(wchar_t *buf, size_t len, const wchar_t *format, va_list argptr);
52de37c7
VS
168 #define wxUSE_WXVSNPRINTFW 1
169#else
170 #define wxUSE_WXVSNPRINTFW 0
171#endif
e713a90b 172
52de37c7
VS
173#ifndef wxCRT_VsnprintfA
174 /* no (suitable) vsnprintf(), cook our own */
175 WXDLLIMPEXP_BASE int
176 wxCRT_VsnprintfA(char *buf, size_t len, const char *format, va_list argptr);
177 #define wxUSE_WXVSNPRINTFA 1
e713a90b 178#else
52de37c7 179 #define wxUSE_WXVSNPRINTFA 0
e713a90b
VS
180#endif
181
52de37c7
VS
182// for wxString code, define wxUSE_WXVSNPRINTF to indicate that wx
183// implementation is used no matter what (in UTF-8 build, either *A or *W
184// version may be called):
185#if !wxUSE_UNICODE
186 #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
187#elif wxUSE_UNICODE_WCHAR
188 #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFW
189#elif wxUSE_UTF8_LOCALE_ONLY
190 #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
191#else // UTF-8 under any locale
192 #define wxUSE_WXVSNPRINTF (wxUSE_WXVSNPRINTFA && wxUSE_WXVSNPRINTFW)
e713a90b
VS
193#endif
194
52de37c7
VS
195#define wxCRT_FprintfA fprintf
196#define wxCRT_PrintfA printf
197#define wxCRT_VfprintfA vfprintf
198#define wxCRT_VprintfA vprintf
199#define wxCRT_VsprintfA vsprintf
200
52de37c7
VS
201/*
202 In Unicode mode we need to have all standard functions such as wprintf() and
203 so on but not all systems have them so use our own implementations in this
204 case.
205 */
206#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
207 #define wxNEED_WPRINTF
208#endif
ccd96bfe
PC
209#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF)
210 #define wxNEED_VSWSCANF
211#endif
52de37c7 212
e713a90b 213
57c42b62 214#if defined(wxNEED_WPRINTF)
e713a90b 215 /*
c49f8879
VS
216 we need to implement all wide character printf functions either because
217 we don't have them at all or because they don't have the semantics we
218 need
e713a90b 219 */
872ef943
VS
220 int wxCRT_PrintfW( const wchar_t *format, ... );
221 int wxCRT_FprintfW( FILE *stream, const wchar_t *format, ... );
52de37c7
VS
222 int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list ap );
223 int wxCRT_VprintfW( const wchar_t *format, va_list ap );
224 int wxCRT_VsprintfW( wchar_t *str, const wchar_t *format, va_list ap );
fc1f568e
VZ
225#else /* !wxNEED_WPRINTF */
226 #define wxCRT_FprintfW fwprintf
227 #define wxCRT_PrintfW wprintf
228 #define wxCRT_VfprintfW vfwprintf
229 #define wxCRT_VprintfW vwprintf
e461247b 230
fc1f568e
VZ
231 #if defined(__WINDOWS__) && !defined(HAVE_VSWPRINTF)
232 // only non-standard vswprintf() without buffer size argument can be used here
233 #define wxCRT_VsprintfW vswprintf
234 #endif
57c42b62 235#endif /* wxNEED_WPRINTF */
2523e9b7
VS
236
237
eb6cb207
VS
238/* Required for wxScanf() etc. */
239#define wxCRT_ScanfA scanf
240#define wxCRT_SscanfA sscanf
241#define wxCRT_FscanfA fscanf
242#define wxCRT_VsscanfA vsscanf
243
57c42b62 244#if defined(wxNEED_WPRINTF)
872ef943
VS
245 int wxCRT_ScanfW(const wchar_t *format, ...);
246 int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...);
247 int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...);
934960d1 248#else
b6937696
JJ
249 #define wxCRT_ScanfW wxVMS_USE_STD wscanf
250 #define wxCRT_SscanfW wxVMS_USE_STD swscanf
251 #define wxCRT_FscanfW wxVMS_USE_STD fwscanf
ccd96bfe
PC
252#endif
253#ifdef wxNEED_VSWSCANF
254 int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap);
255#else
b6937696 256 #define wxCRT_VsscanfW wxVMS_USE_STD vswscanf
934960d1 257#endif
eb6cb207 258
2523e9b7
VS
259// ----------------------------------------------------------------------------
260// user-friendly wrappers to CRT functions
261// ----------------------------------------------------------------------------
262
263#ifdef __WATCOMC__
264 // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
265 #define wxPrintf wxPrintf_Impl
266 #define wxFprintf wxFprintf_Impl
267 #define wxSprintf wxSprintf_Impl
268 #define wxSnprintf wxSnprintf_Impl
269#endif
270
52de37c7
VS
271 // FIXME-UTF8: remove this
272#if wxUSE_UNICODE
273 #define wxCRT_PrintfNative wxCRT_PrintfW
274 #define wxCRT_FprintfNative wxCRT_FprintfW
275#else
276 #define wxCRT_PrintfNative wxCRT_PrintfA
277 #define wxCRT_FprintfNative wxCRT_FprintfA
278#endif
279
e68a8744
VS
280
281WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxPrintf, 1, (const wxFormatString&),
282 wxCRT_PrintfNative, wxCRT_PrintfA)
283inline int wxPrintf(const wxFormatString& s)
284{
285 return wxPrintf("%s", s.InputAsString());
286}
287
288WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&),
289 wxCRT_FprintfNative, wxCRT_FprintfA)
290inline int wxFprintf(FILE *f, const wxFormatString& s)
291{
292 return wxFprintf(f, "%s", s.InputAsString());
293}
2523e9b7
VS
294
295// va_list versions of printf functions simply forward to the respective
296// CRT function; note that they assume that va_list was created using
297// wxArgNormalizer<T>!
298#if wxUSE_UNICODE_UTF8
299 #if wxUSE_UTF8_LOCALE_ONLY
52de37c7
VS
300 #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
301 return implA args
2523e9b7 302 #else
52de37c7
VS
303 #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
304 if ( wxLocaleIsUtf8 ) return implA args; \
305 else return implW args
2523e9b7 306 #endif
52de37c7
VS
307#elif wxUSE_UNICODE_WCHAR
308 #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
309 return implW args
310#else // ANSI
311 #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
312 return implA args
e713a90b
VS
313#endif
314
2523e9b7
VS
315inline int
316wxVprintf(const wxString& format, va_list ap)
317{
0d23e825 318 WX_VARARG_VFOO_IMPL((wxFormatString(format), ap),
52de37c7 319 wxCRT_VprintfW, wxCRT_VprintfA);
2523e9b7
VS
320}
321
322inline int
323wxVfprintf(FILE *f, const wxString& format, va_list ap)
324{
0d23e825 325 WX_VARARG_VFOO_IMPL((f, wxFormatString(format), ap),
52de37c7 326 wxCRT_VfprintfW, wxCRT_VfprintfA);
2523e9b7
VS
327}
328
329#undef WX_VARARG_VFOO_IMPL
330
331
332// wxSprintf() and friends have to be implemented in two forms, one for
333// writing to char* buffer and one for writing to wchar_t*:
334
d1f6e2cf
VS
335#if !wxUSE_UTF8_LOCALE_ONLY
336int WXDLLIMPEXP_BASE wxDoSprintfWchar(char *str, const wxChar *format, ...);
337#endif
338#if wxUSE_UNICODE_UTF8
339int WXDLLIMPEXP_BASE wxDoSprintfUtf8(char *str, const char *format, ...);
340#endif
1528e0b8 341WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (char*, const wxFormatString&),
d1f6e2cf 342 wxDoSprintfWchar, wxDoSprintfUtf8)
2523e9b7
VS
343
344int WXDLLIMPEXP_BASE
345wxVsprintf(char *str, const wxString& format, va_list argptr);
346
d1f6e2cf
VS
347#if !wxUSE_UTF8_LOCALE_ONLY
348int WXDLLIMPEXP_BASE wxDoSnprintfWchar(char *str, size_t size, const wxChar *format, ...);
349#endif
350#if wxUSE_UNICODE_UTF8
351int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(char *str, size_t size, const char *format, ...);
352#endif
1528e0b8 353WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxFormatString&),
d1f6e2cf 354 wxDoSnprintfWchar, wxDoSnprintfUtf8)
2523e9b7
VS
355
356int WXDLLIMPEXP_BASE
357wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr);
358
359#if wxUSE_UNICODE
d1f6e2cf
VS
360
361#if !wxUSE_UTF8_LOCALE_ONLY
362int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...);
363#endif
364#if wxUSE_UNICODE_UTF8
365int WXDLLIMPEXP_BASE wxDoSprintfUtf8(wchar_t *str, const char *format, ...);
366#endif
1528e0b8 367WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (wchar_t*, const wxFormatString&),
d1f6e2cf 368 wxDoSprintfWchar, wxDoSprintfUtf8)
2523e9b7
VS
369
370int WXDLLIMPEXP_BASE
371wxVsprintf(wchar_t *str, const wxString& format, va_list argptr);
372
d1f6e2cf
VS
373#if !wxUSE_UTF8_LOCALE_ONLY
374int WXDLLIMPEXP_BASE wxDoSnprintfWchar(wchar_t *str, size_t size, const wxChar *format, ...);
375#endif
376#if wxUSE_UNICODE_UTF8
377int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(wchar_t *str, size_t size, const char *format, ...);
378#endif
1528e0b8 379WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxFormatString&),
d1f6e2cf 380 wxDoSnprintfWchar, wxDoSnprintfUtf8)
2523e9b7
VS
381
382int WXDLLIMPEXP_BASE
383wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr);
d1f6e2cf 384
2523e9b7
VS
385#endif // wxUSE_UNICODE
386
387#ifdef __WATCOMC__
388 // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
389 //
390 // fortunately, OpenWatcom implements __VA_ARGS__, so we can provide macros
391 // that cast the format argument to wxString:
392 #undef wxPrintf
393 #undef wxFprintf
394 #undef wxSprintf
395 #undef wxSnprintf
396
397 #define wxPrintf(fmt, ...) \
59a14f69 398 wxPrintf_Impl(wxFormatString(fmt), __VA_ARGS__)
2523e9b7 399 #define wxFprintf(f, fmt, ...) \
59a14f69 400 wxFprintf_Impl(f, wxFormatString(fmt), __VA_ARGS__)
2523e9b7 401 #define wxSprintf(s, fmt, ...) \
59a14f69 402 wxSprintf_Impl(s, wxFormatString(fmt), __VA_ARGS__)
2523e9b7 403 #define wxSnprintf(s, n, fmt, ...) \
59a14f69 404 wxSnprintf_Impl(s, n, wxFormatString(fmt), __VA_ARGS__)
2523e9b7
VS
405#endif // __WATCOMC__
406
407
408// We can't use wxArgNormalizer<T> for variadic arguments to wxScanf() etc.
409// because they are writable, so instead of providing friendly template
410// vararg-like functions, we just provide both char* and wchar_t* variants
411// of these functions. The type of output variadic arguments for %s must match
412// the type of 'str' and 'format' arguments.
c49f8879
VS
413//
414// For compatibility with earlier wx versions, we also provide wxSscanf()
415// version with the first argument (input string) wxString; for this version,
416// the type of output string values is determined by the type of format string
417// only.
418
eb6cb207
VS
419#define _WX_SCANFUNC_EXTRACT_ARGS_1(x) x
420#define _WX_SCANFUNC_EXTRACT_ARGS_2(x,y) x, y
421#define _WX_SCANFUNC_EXTRACT_ARGS(N, args) _WX_SCANFUNC_EXTRACT_ARGS_##N args
c49f8879 422
eb6cb207 423#define _WX_VARARG_PASS_WRITABLE(i) a##i
c49f8879 424
eb6cb207
VS
425#define _WX_DEFINE_SCANFUNC(N, dummy1, name, impl, passfixed, numfixed, fixed)\
426 template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
427 int name(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, fixed), \
428 _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
429 { \
430 return impl(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, passfixed), \
431 _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WRITABLE)); \
432 }
c49f8879 433
eb6cb207 434#define WX_DEFINE_SCANFUNC(name, numfixed, fixed, impl, passfixed) \
eb6cb207
VS
435 _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
436 _WX_DEFINE_SCANFUNC, \
437 dummy1, name, impl, passfixed, numfixed, fixed)
438
57c42b62
VS
439// this is needed to normalize the format string, see src/common/strvararg.cpp
440// for more details
441#ifdef __WINDOWS__
442 #define wxScanfConvertFormatW(fmt) fmt
443#else
de4983f3 444 const wxScopedWCharBuffer
57c42b62
VS
445 WXDLLIMPEXP_BASE wxScanfConvertFormatW(const wchar_t *format);
446#endif
447
eb6cb207
VS
448WX_DEFINE_SCANFUNC(wxScanf, 1, (const char *format),
449 wxCRT_ScanfA, (format))
450WX_DEFINE_SCANFUNC(wxScanf, 1, (const wchar_t *format),
57c42b62 451 wxCRT_ScanfW, (wxScanfConvertFormatW(format)))
eb6cb207
VS
452
453WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const char *format),
454 wxCRT_FscanfA, (stream, format))
455WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const wchar_t *format),
57c42b62 456 wxCRT_FscanfW, (stream, wxScanfConvertFormatW(format)))
eb6cb207
VS
457
458WX_DEFINE_SCANFUNC(wxSscanf, 2, (const char *str, const char *format),
459 wxCRT_SscanfA, (str, format))
460WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wchar_t *str, const wchar_t *format),
57c42b62 461 wxCRT_SscanfW, (str, wxScanfConvertFormatW(format)))
de4983f3 462WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedCharBuffer& str, const char *format),
eb6cb207 463 wxCRT_SscanfA, (str.data(), format))
de4983f3 464WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format),
57c42b62 465 wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format)))
eb6cb207
VS
466WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format),
467 wxCRT_SscanfA, (str.mb_str(), format))
468WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format),
57c42b62 469 wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format)))
eb6cb207
VS
470WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format),
471 wxCRT_SscanfA, (str.AsCharBuf(), format))
472WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format),
57c42b62 473 wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format)))
eb6cb207
VS
474
475// Visual C++ doesn't provide vsscanf()
476#ifndef __VISUALC___
c49f8879
VS
477int WXDLLIMPEXP_BASE wxVsscanf(const char *str, const char *format, va_list ap);
478int WXDLLIMPEXP_BASE wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap);
de4983f3
VS
479int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedCharBuffer& str, const char *format, va_list ap);
480int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedWCharBuffer& str, const wchar_t *format, va_list ap);
c49f8879
VS
481int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const char *format, va_list ap);
482int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const wchar_t *format, va_list ap);
483int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const char *format, va_list ap);
484int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap);
eb6cb207 485#endif // !__VISUALC__
2523e9b7 486
e713a90b 487#endif /* _WX_WXCRTVARARG_H_ */