fixed vararg functions with format argument to not use wxString or reference argument (the latter is invalid C++, the former doesn't work with Watcom and produces at least warnings with GCC 3.3)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45781 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -95,17 +95,26 @@ public: | ||||
|     static void SetResolution(int ppi); | ||||
|     static int GetResolution(); | ||||
|  | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wxString&), DoPsPrintfFormat) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wxString&), | ||||
|                                DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8) | ||||
| #ifdef __WATCOMC__ | ||||
|     // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const char*), DoPsPrintfFormat) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wchar_t*), DoPsPrintfFormat) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const char*), | ||||
|                                DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wchar_t*), | ||||
|                                DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8) | ||||
| #endif | ||||
|  | ||||
|     void PsPrint( const wxString& psdata ); | ||||
|     void PsPrint( int ch ); | ||||
|  | ||||
| private: | ||||
|     void DoPsPrintfFormat(const wxString& fmt, ... ); | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
|     void DoPsPrintfFormatWchar(const wxChar *fmt, ... ); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
|     void DoPsPrintfFormatUtf8(const char *fmt, ... ); | ||||
| #endif | ||||
|  | ||||
|     static float ms_PSScaleFactor; | ||||
|  | ||||
|   | ||||
| @@ -473,9 +473,12 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); | ||||
|  | ||||
| #define DECLARE_LOG_FUNCTION(level)                                         \ | ||||
|     extern void WXDLLIMPEXP_BASE                                            \ | ||||
|     wxDoLog##level(const wxString& format, ...);                            \ | ||||
|     wxDoLog##level##Wchar(const wxChar *format, ...);                       \ | ||||
|     extern void WXDLLIMPEXP_BASE                                            \ | ||||
|     wxDoLog##level##Utf8(const char *format, ...);                          \ | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                                \ | ||||
|                                1, (const wxString&), wxDoLog##level)        \ | ||||
|                                1, (const wxString&),                        \ | ||||
|                                wxDoLog##level##Wchar, wxDoLog##level##Utf8) \ | ||||
|     DECLARE_LOG_FUNCTION_WATCOM(level)                                      \ | ||||
|     extern void WXDLLIMPEXP_BASE wxVLog##level(const wxString& format,      \ | ||||
|                                                va_list argptr) | ||||
| @@ -486,22 +489,30 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); | ||||
|     // something too big for Borland C++ to handle | ||||
|     #define DECLARE_LOG_FUNCTION_WATCOM(level)                              \ | ||||
|         WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                            \ | ||||
|                                    1, (const char*), wxDoLog##level)        \ | ||||
|                                    1, (const char*),                        \ | ||||
|                                    wxDoLog##level##Wchar,                   \ | ||||
|                                    wxDoLog##level##Utf8)                    \ | ||||
|         WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                            \ | ||||
|                                    1, (const wchar_t*), wxDoLog##level)     \ | ||||
|                                    1, (const wchar_t*),                     \ | ||||
|                                    wxDoLog##level##Wchar,                   \ | ||||
|                                    wxDoLog##level##Utf8)                    \ | ||||
|         WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                            \ | ||||
|                                    1, (const wxCStrData&), wxDoLog##level) | ||||
|                                    1, (const wxCStrData&),                  \ | ||||
|                                    wxDoLog##level##Wchar,                   \ | ||||
|                                    wxDoLog##level##Utf8) | ||||
| #else | ||||
|     #define DECLARE_LOG_FUNCTION_WATCOM(level) | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, expdecl)            \ | ||||
|     extern void expdecl wxDoLog##level(argclass arg,                        \ | ||||
|                                        const wxString& format, ...);        \ | ||||
|     extern void expdecl wxDoLog##level##Wchar(argclass arg,                 \ | ||||
|                                               const wxChar *format, ...);   \ | ||||
|     extern void expdecl wxDoLog##level##Utf8(argclass arg,                  \ | ||||
|                                              const char *format, ...);      \ | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                                \ | ||||
|                                2, (argclass, const wxString&),              \ | ||||
|                                wxDoLog##level)                              \ | ||||
|                                wxDoLog##level##Wchar, wxDoLog##level##Utf8) \ | ||||
|     DECLARE_LOG_FUNCTION2_EXP_WATCOM(level, argclass, arg, expdecl)         \ | ||||
|     extern void expdecl wxVLog##level(argclass arg,                         \ | ||||
|                                       const wxString& format,               \ | ||||
| @@ -514,13 +525,16 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); | ||||
|     #define DECLARE_LOG_FUNCTION2_EXP_WATCOM(level, argclass, arg, expdecl) \ | ||||
|         WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                            \ | ||||
|                                    2, (argclass, const char*),              \ | ||||
|                                    wxDoLog##level)                          \ | ||||
|                                    wxDoLog##level##Wchar,                   \ | ||||
|                                    wxDoLog##level##Utf8)                    \ | ||||
|         WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                            \ | ||||
|                                    2, (argclass, const wchar_t*),           \ | ||||
|                                    wxDoLog##level)                          \ | ||||
|                                    wxDoLog##level##Wchar,                   \ | ||||
|                                    wxDoLog##level##Utf8)                    \ | ||||
|         WX_DEFINE_VARARG_FUNC_VOID(wxLog##level,                            \ | ||||
|                                    2, (argclass, const wxCStrData&),        \ | ||||
|                                    wxDoLog##level) | ||||
|                                    wxDoLog##level##Wchar,                   \ | ||||
|                                    wxDoLog##level##Utf8) | ||||
| #else | ||||
|     #define DECLARE_LOG_FUNCTION2_EXP_WATCOM(level, argclass, arg, expdecl) | ||||
| #endif | ||||
|   | ||||
| @@ -26,6 +26,8 @@ | ||||
| #include "wx/dynarray.h" | ||||
| #include "wx/arrstr.h" | ||||
|  | ||||
| #include <stdarg.h> | ||||
|  | ||||
| // fwd decls | ||||
| class WXDLLIMPEXP_BASE wxIconLocation; | ||||
| class WXDLLIMPEXP_BASE wxFileTypeImpl; | ||||
| @@ -117,13 +119,30 @@ private: | ||||
| class WXDLLIMPEXP_BASE wxFileTypeInfo | ||||
| { | ||||
| private: | ||||
|     void VarArgInit(const wxString& mimeType, | ||||
|                     const wxString& openCmd, | ||||
|                     const wxString& printCmd, | ||||
|                     const wxString& desc, | ||||
|                     // the other parameters form a NULL terminated list of | ||||
|                     // extensions | ||||
|                     ...); | ||||
|     void DoVarArgInit(const wxString& mimeType, | ||||
|                       const wxString& openCmd, | ||||
|                       const wxString& printCmd, | ||||
|                       const wxString& desc, | ||||
|                       va_list argptr); | ||||
|  | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
|     void VarArgInitWchar(const wxChar *mimeType, | ||||
|                          const wxChar *openCmd, | ||||
|                          const wxChar *printCmd, | ||||
|                          const wxChar *desc, | ||||
|                          // the other parameters form a NULL terminated list of | ||||
|                          // extensions | ||||
|                          ...); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
|     void VarArgInitUtf8(const char *mimeType, | ||||
|                         const char *openCmd, | ||||
|                         const char *printCmd, | ||||
|                         const char *desc, | ||||
|                         // the other parameters form a NULL terminated list of | ||||
|                         // extensions | ||||
|                         ...); | ||||
| #endif | ||||
| public: | ||||
|     // ctors | ||||
|         // a normal item | ||||
| @@ -138,21 +157,21 @@ public: | ||||
|     WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo, | ||||
|                                4, (const wxString&, const wxString&, | ||||
|                                    const wxString&, const wxString&), | ||||
|                                VarArgInit) | ||||
|                                VarArgInitWchar, VarArgInitUtf8) | ||||
| #ifdef __WATCOMC__ | ||||
|     // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 | ||||
|     WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo, | ||||
|                                4, (const char*, const char*, | ||||
|                                    const char*, const char*), | ||||
|                                VarArgInit) | ||||
|                                VarArgInitWchar, VarArgInitUtf8) | ||||
|     WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo, | ||||
|                                4, (const wchar_t*, const wchar_t*, | ||||
|                                    const wchar_t*, const wchar_t*), | ||||
|                                VarArgInit) | ||||
|                                VarArgInitWchar, VarArgInitUtf8) | ||||
|     WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo, | ||||
|                                4, (const wxCStrData&, const wxCStrData&, | ||||
|                                    const wxCStrData&, const wxCStrData&), | ||||
|                                VarArgInit) | ||||
|                                VarArgInitWchar, VarArgInitUtf8) | ||||
| #endif | ||||
|  | ||||
|         // the array elements correspond to the parameters of the ctor above in | ||||
|   | ||||
| @@ -37,18 +37,27 @@ public: | ||||
|  | ||||
|     // show a message to the user | ||||
|     // void Printf(const wxString& format, ...) = 0; | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxString&), DoPrintf) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxString&), | ||||
|                                DoPrintfWchar, DoPrintfUtf8) | ||||
| #ifdef __WATCOMC__ | ||||
|     // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const char*), DoPrintf) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wchar_t*), DoPrintf) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxCStrData&), DoPrintf) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const char*), | ||||
|                                DoPrintfWchar, DoPrintfUtf8) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wchar_t*), | ||||
|                                DoPrintfWchar, DoPrintfUtf8) | ||||
|     WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxCStrData&), | ||||
|                                DoPrintfWchar, DoPrintfUtf8) | ||||
| #endif | ||||
|  | ||||
| protected: | ||||
|     // NB: this is pure virtual so that it can be implemented in dllexported | ||||
|     //     wxMessagOutput class | ||||
|     virtual void DoPrintf(const wxString& format, ...) = 0; | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
|     virtual void DoPrintfWchar(const wxChar *format, ...) = 0; | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
|     virtual void DoPrintfUtf8(const char *format, ...) = 0; | ||||
| #endif | ||||
|  | ||||
|     // called by DoPrintf() to output formatted string | ||||
|     virtual void Output(const wxString& str) = 0; | ||||
| @@ -73,7 +82,12 @@ public: | ||||
|     static wxMessageOutput* Set(wxMessageOutput* msgout); | ||||
|  | ||||
| protected: | ||||
|     virtual void DoPrintf(const wxString& format, ...); | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
|     virtual void DoPrintfWchar(const wxChar *format, ...); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
|     virtual void DoPrintfUtf8(const char *format, ...); | ||||
| #endif | ||||
|     virtual void Output(const wxString& str) = 0; | ||||
|  | ||||
| private: | ||||
|   | ||||
| @@ -297,8 +297,14 @@ class WXDLLIMPEXP_BASE wxStringPrintfMixinBase | ||||
| protected: | ||||
|     wxStringPrintfMixinBase() {} | ||||
|  | ||||
|     int DoPrintf(const wxString& format, ...); | ||||
|     static wxString DoFormat(const wxString& format, ...); | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
|     int DoPrintfWchar(const wxChar *format, ...); | ||||
|     static wxString DoFormatWchar(const wxChar *format, ...); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
|     int DoPrintfUtf8(const char *format, ...); | ||||
|     static wxString DoFormatUtf8(const char *format, ...); | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| // this class contains template wrappers for wxString's vararg methods, it's | ||||
| @@ -322,9 +328,9 @@ public: | ||||
|     // if !wxNEEDS_WXSTRING_PRINTF_MIXIN: | ||||
|  | ||||
|     // static wxString Format(const wString& format, ...) ATTRIBUTE_PRINTF_1; | ||||
|     WX_DEFINE_VARARG_FUNC2_SANS_N0(static typename StringReturnType<T1>::type, | ||||
|                                    Format, 1, (const wxString&), | ||||
|                                    DoFormat, DoFormat) | ||||
|     WX_DEFINE_VARARG_FUNC_SANS_N0(static typename StringReturnType<T1>::type, | ||||
|                                   Format, 1, (const wxString&), | ||||
|                                   DoFormatWchar, DoFormatUtf8) | ||||
|     // We have to implement the version without template arguments manually | ||||
|     // because of the StringReturnType<> hack, although WX_DEFINE_VARARG_FUNC | ||||
|     // normally does it itself. It has to be a template so that we can use | ||||
| @@ -339,9 +345,11 @@ public: | ||||
|     } | ||||
|  | ||||
|     // int Printf(const wxString& format, ...); | ||||
|     WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxString&), DoPrintf) | ||||
|     WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxString&), | ||||
|                           DoPrintfWchar, DoPrintfUtf8) | ||||
|     // int sprintf(const wxString& format, ...) ATTRIBUTE_PRINTF_2; | ||||
|     WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxString&), DoPrintf) | ||||
|     WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxString&), | ||||
|                           DoPrintfWchar, DoPrintfUtf8) | ||||
|  | ||||
| protected: | ||||
|     wxStringPrintfMixin() : wxStringPrintfMixinBase() {} | ||||
| @@ -1533,11 +1541,15 @@ public: | ||||
|     // as sprintf(), returns the number of characters written or < 0 on error | ||||
|     // (take 'this' into account in attribute parameter count) | ||||
|   // int Printf(const wxString& format, ...); | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxString&), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxString&), | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
| #ifdef __WATCOMC__ | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const char*), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wchar_t*), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxCStrData&), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const char*) | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wchar_t*) | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
|   WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxCStrData&) | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
| #endif | ||||
| #endif // !wxNEEDS_WXSTRING_PRINTF_MIXIN | ||||
|     // as vprintf(), returns the number of characters written or < 0 on error | ||||
| @@ -1546,12 +1558,16 @@ public: | ||||
| #ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN | ||||
|     // returns the string containing the result of Printf() to it | ||||
|   // static wxString Format(const wxString& format, ...) ATTRIBUTE_PRINTF_1; | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxString&), DoFormat) | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxString&), | ||||
|                         DoFormatWchar, DoFormatUtf8) | ||||
| #ifdef __WATCOMC__ | ||||
|   // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const char*), DoFormat) | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wchar_t*), DoFormat) | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxCStrData&), DoFormat) | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const char*), | ||||
|                         DoFormatWchar, DoFormatUtf8) | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wchar_t*), | ||||
|                         DoFormatWchar, DoFormatUtf8) | ||||
|   WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxCStrData&), | ||||
|                         DoFormatWchar, DoFormatUtf8) | ||||
| #endif | ||||
| #endif | ||||
|     // the same as above, but takes a va_list | ||||
| @@ -1589,12 +1605,16 @@ public: | ||||
|   // use Printf() | ||||
|   // (take 'this' into account in attribute parameter count) | ||||
|   // int sprintf(const wxString& format, ...) ATTRIBUTE_PRINTF_2; | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxString&), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxString&), | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
| #ifdef __WATCOMC__ | ||||
|   // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const char*), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wchar_t*), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxCStrData&), DoPrintf) | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const char*), | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wchar_t*), | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
|   WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxCStrData&), | ||||
|                         DoPrintfWchar, DoPrintfUtf8) | ||||
| #endif | ||||
| #endif // wxNEEDS_WXSTRING_PRINTF_MIXIN | ||||
|  | ||||
| @@ -2369,8 +2389,14 @@ private: | ||||
| #endif // !wxUSE_STL_BASED_WXSTRING | ||||
|  | ||||
| #ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN | ||||
|   int DoPrintf(const wxString& format, ...); | ||||
|   static wxString DoFormat(const wxString& format, ...); | ||||
|   #if !wxUSE_UTF8_LOCALE_ONLY | ||||
|   int DoPrintfWchar(const wxChar *format, ...); | ||||
|   static wxString DoFormatWchar(const wxChar *format, ...); | ||||
|   #endif | ||||
|   #if wxUSE_UNICODE_UTF8 | ||||
|   int DoPrintfUtf8(const char *format, ...); | ||||
|   static wxString DoFormatUtf8(const char *format, ...); | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| #if !wxUSE_STL_BASED_WXSTRING | ||||
|   | ||||
| @@ -70,33 +70,25 @@ class WXDLLIMPEXP_BASE wxString; | ||||
| //                  if wxUSE_UNICODE_UTF8 and running under UTF-8 locale | ||||
| //                  (ignored otherwise)  [fprintf] | ||||
| // | ||||
| #define WX_DEFINE_VARARG_FUNC2(rettype, name, numfixed, fixed, impl, implUtf8)\ | ||||
| #define WX_DEFINE_VARARG_FUNC(rettype, name, numfixed, fixed, impl, implUtf8) \ | ||||
|     _WX_VARARG_DEFINE_FUNC_N0(rettype, name, impl, implUtf8, numfixed, fixed) \ | ||||
|     WX_DEFINE_VARARG_FUNC2_SANS_N0(rettype, name, numfixed, fixed, impl, implUtf8) | ||||
|     WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, numfixed, fixed, impl, implUtf8) | ||||
|  | ||||
| // ditto, but without the version with 0 template/vararg arguments | ||||
| #define WX_DEFINE_VARARG_FUNC2_SANS_N0(rettype, name,                         \ | ||||
| #define WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name,                          \ | ||||
|                                        numfixed, fixed, impl, implUtf8)       \ | ||||
|     _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS,                                      \ | ||||
|                     _WX_VARARG_DEFINE_FUNC,                                   \ | ||||
|                     rettype, name, impl, implUtf8, numfixed, fixed) | ||||
|  | ||||
| // like WX_DEFINE_VARARG_FUNC2, but for impl=implUtf8: | ||||
| #define WX_DEFINE_VARARG_FUNC(rettype, name, numfixed, fixed, impl)           \ | ||||
|     WX_DEFINE_VARARG_FUNC2(rettype, name, numfixed, fixed, impl, impl) | ||||
|  | ||||
| // Like WX_DEFINE_VARARG_FUNC2, but for variadic functions that don't return | ||||
| // Like WX_DEFINE_VARARG_FUNC, but for variadic functions that don't return | ||||
| // a value. | ||||
| #define WX_DEFINE_VARARG_FUNC_VOID2(name, numfixed, fixed, impl, implUtf8)    \ | ||||
| #define WX_DEFINE_VARARG_FUNC_VOID(name, numfixed, fixed, impl, implUtf8)     \ | ||||
|     _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed)     \ | ||||
|     _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS,                                      \ | ||||
|                     _WX_VARARG_DEFINE_FUNC_VOID,                              \ | ||||
|                     void, name, impl, implUtf8, numfixed, fixed) | ||||
|  | ||||
| // like WX_DEFINE_VARARG_FUNC_VOID2, but for impl=implUtf8: | ||||
| #define WX_DEFINE_VARARG_FUNC_VOID(name, numfixed, fixed, impl)               \ | ||||
|     WX_DEFINE_VARARG_FUNC_VOID2(name, numfixed, fixed, impl, impl) | ||||
|  | ||||
| // Like WX_DEFINE_VARARG_FUNC_VOID, but instead of wrapping an implementation | ||||
| // function, does nothing in defined functions' bodies. | ||||
| // | ||||
| @@ -108,11 +100,11 @@ class WXDLLIMPEXP_BASE wxString; | ||||
|                         void, name, dummy, dummy, numfixed, fixed) | ||||
|  | ||||
| // Like WX_DEFINE_VARARG_FUNC_CTOR, but for defining template constructors | ||||
| #define WX_DEFINE_VARARG_FUNC_CTOR(name, numfixed, fixed, impl)               \ | ||||
|     _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, impl, numfixed, fixed)         \ | ||||
| #define WX_DEFINE_VARARG_FUNC_CTOR(name, numfixed, fixed, impl, implUtf8)     \ | ||||
|     _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed)     \ | ||||
|     _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS,                                      \ | ||||
|                     _WX_VARARG_DEFINE_FUNC_CTOR,                              \ | ||||
|                     void, name, impl, impl, numfixed, fixed) | ||||
|                     void, name, impl, implUtf8, numfixed, fixed) | ||||
|  | ||||
| // ---------------------------------------------------------------------------- | ||||
| // wxArgNormalizer*<T> converters | ||||
| @@ -548,7 +540,7 @@ private: | ||||
| #define _WX_VARARG_ARG(i)               T##i a##i | ||||
|  | ||||
| // Like _WX_VARARG_ARG_UNUSED, but outputs argument's type with WXUNUSED: | ||||
| #define _WX_VARARG_ARG_UNUSED(i)             T##i WXUNUSED(a##i) | ||||
| #define _WX_VARARG_ARG_UNUSED(i)        T##i WXUNUSED(a##i) | ||||
|  | ||||
| // Generates code snippet for i-th type in vararg function's template<...>: | ||||
| #define _WX_VARARG_TEMPL(i)             typename T##i | ||||
|   | ||||
| @@ -259,10 +259,10 @@ | ||||
| //             we'll also need wxArgNormalizer<T> specializations for char, | ||||
| //             wchar_t, wxUniChar and wxUniCharRef to handle this correctly | ||||
|  | ||||
| WX_DEFINE_VARARG_FUNC2(int, wxPrintf, 1, (const wxString&), | ||||
|                        wxCRT_Printf, printf) | ||||
| WX_DEFINE_VARARG_FUNC2(int, wxFprintf, 2, (FILE*, const wxString&), | ||||
|                        wxCRT_Fprintf, fprintf) | ||||
| WX_DEFINE_VARARG_FUNC(int, wxPrintf, 1, (const wxString&), | ||||
|                       wxCRT_Printf, printf) | ||||
| WX_DEFINE_VARARG_FUNC(int, wxFprintf, 2, (FILE*, const wxString&), | ||||
|                       wxCRT_Fprintf, fprintf) | ||||
|  | ||||
| // va_list versions of printf functions simply forward to the respective | ||||
| // CRT function; note that they assume that va_list was created using | ||||
| @@ -299,34 +299,56 @@ wxVfprintf(FILE *f, const wxString& format, va_list ap) | ||||
| // wxSprintf() and friends have to be implemented in two forms, one for | ||||
| // writing to char* buffer and one for writing to wchar_t*: | ||||
|  | ||||
| int WXDLLIMPEXP_BASE wxDoSprintf(char *str, const wxString& format, ...); | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
| int WXDLLIMPEXP_BASE wxDoSprintfWchar(char *str, const wxChar *format, ...); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
| int WXDLLIMPEXP_BASE wxDoSprintfUtf8(char *str, const char *format, ...); | ||||
| #endif | ||||
| WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (char*, const wxString&), | ||||
|                       wxDoSprintf) | ||||
|                       wxDoSprintfWchar, wxDoSprintfUtf8) | ||||
|  | ||||
| int WXDLLIMPEXP_BASE | ||||
| wxVsprintf(char *str, const wxString& format, va_list argptr); | ||||
|  | ||||
| int WXDLLIMPEXP_BASE wxDoSnprintf(char *str, size_t size, const wxString& format, ...); | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
| int WXDLLIMPEXP_BASE wxDoSnprintfWchar(char *str, size_t size, const wxChar *format, ...); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
| int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(char *str, size_t size, const char *format, ...); | ||||
| #endif | ||||
| WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxString&), | ||||
|                       wxDoSnprintf) | ||||
|                       wxDoSnprintfWchar, wxDoSnprintfUtf8) | ||||
|  | ||||
| int WXDLLIMPEXP_BASE | ||||
| wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr); | ||||
|  | ||||
| #if wxUSE_UNICODE | ||||
| int WXDLLIMPEXP_BASE wxDoSprintf(wchar_t *str, const wxString& format, ...); | ||||
|  | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
| int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
| int WXDLLIMPEXP_BASE wxDoSprintfUtf8(wchar_t *str, const char *format, ...); | ||||
| #endif | ||||
| WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (wchar_t*, const wxString&), | ||||
|                       wxDoSprintf) | ||||
|                       wxDoSprintfWchar, wxDoSprintfUtf8) | ||||
|  | ||||
| int WXDLLIMPEXP_BASE | ||||
| wxVsprintf(wchar_t *str, const wxString& format, va_list argptr); | ||||
|  | ||||
| int WXDLLIMPEXP_BASE wxDoSnprintf(wchar_t *str, size_t size, const wxString& format, ...); | ||||
| #if !wxUSE_UTF8_LOCALE_ONLY | ||||
| int WXDLLIMPEXP_BASE wxDoSnprintfWchar(wchar_t *str, size_t size, const wxChar *format, ...); | ||||
| #endif | ||||
| #if wxUSE_UNICODE_UTF8 | ||||
| int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(wchar_t *str, size_t size, const char *format, ...); | ||||
| #endif | ||||
| WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxString&), | ||||
|                       wxDoSnprintf) | ||||
|                       wxDoSnprintfWchar, wxDoSnprintfUtf8) | ||||
|  | ||||
| int WXDLLIMPEXP_BASE | ||||
| wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr); | ||||
|  | ||||
| #endif // wxUSE_UNICODE | ||||
|  | ||||
| #ifdef __WATCOMC__ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user