X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1801e0eb80854c1b96950de5c7082ec02346798..42d9bd5dc99349749eaa1e8924aaf3ef1549e4e9:/include/wx/string.h?ds=inline diff --git a/include/wx/string.h b/include/wx/string.h index af6c1ab17f..988937c581 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -165,15 +165,6 @@ inline int Stricmp(const char *psz1, const char *psz2) #endif // OS/compiler } -// wxSnprintf() is like snprintf() if it's available and sprintf() (always -// available, but dangerous!) if not -extern int WXDLLEXPORT wxSnprintf(wxChar *buf, size_t len, - const wxChar *format, ...); - -// and wxVsnprintf() is like vsnprintf() or vsprintf() -extern int WXDLLEXPORT wxVsnprintf(wxChar *buf, size_t len, - const wxChar *format, va_list argptr); - // return an empty wxString class WXDLLEXPORT wxString; // not yet defined inline const wxString& wxGetEmptyString() { return *(wxString *)&wxEmptyString; } @@ -462,6 +453,18 @@ public: // identical to c_str() const wxChar* GetData() const { return m_pchData; } + // conversion to plain ascii: this is usefull for + // converting numbers or strings which are certain + // not to contain special chars (typically system + // functions, X atoms, environment variables etc.) +#if wxUSE_UNICODE + static wxString FromAscii( char *ascii ); + const wxCharBuffer ToAscii() const; +#else + static wxString FromAscii( char *ascii ) { return wxString( ascii ); } + const char *ToAscii() const { return m_pchData; } +#endif + // conversions with (possible) format convertions: have to return a // buffer with temporary data // @@ -718,12 +721,13 @@ public: // formated input/output // as sprintf(), returns the number of characters written or < 0 on error - int Printf(const wxChar *pszFormat, ...); + // (take 'this' into account in attribute parameter count) + int Printf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; // as vprintf(), returns the number of characters written or < 0 on error int PrintfV(const wxChar* pszFormat, va_list argptr); // returns the string containing the result of Printf() to it - static wxString Format(const wxChar *pszFormat, ...); + static wxString Format(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_1; // the same as above, but takes a va_list static wxString FormatV(const wxChar *pszFormat, va_list argptr); @@ -751,8 +755,9 @@ public: // values for first parameter of Strip function enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; - // use Printf() - int sprintf(const wxChar *pszFormat, ...); + // use Printf() + // (take 'this' into account in attribute parameter count) + int sprintf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2; // use Cmp() inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const