]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/strconv.h
allocate HFONT on demand instead of doing every time a font property is modified
[wxWidgets.git] / include / wx / strconv.h
index 58ba99ac0cfa65c6e4bc29725cbc6fa085f5c5b6..4e4afff9dca2bfef9a106ecf407d635a0c52d03e 100644 (file)
@@ -385,10 +385,8 @@ public:
 
     void Clear();
 
-#if wxABI_VERSION >= 20802
     // return true if the conversion could be initilized successfully
     bool IsOk() const;
-#endif // wx 2.8.2+
 
 private:
     // common part of all ctors
@@ -523,10 +521,25 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent;
 #if wxUSE_UNICODE
     #define wxConvertWX2MB(s)   wxConvCurrent->cWX2MB(s)
     #define wxConvertMB2WX(s)   wxConvCurrent->cMB2WX(s)
+
+    // these functions should be used when the conversions really, really have
+    // to succeed (usually because we pass their results to a standard C
+    // function which would crash if we passed NULL to it), so these functions
+    // always return a valid pointer if their argument is non-NULL
+
+    // this function safety is achieved by trying wxConvLibc first, wxConvUTF8
+    // next if it fails and, finally, wxConvISO8859_1 which always succeeds
+    extern WXDLLIMPEXP_BASE wxWCharBuffer wxSafeConvertMB2WX(const char *s);
+
+    // this function uses wxConvLibc and wxConvUTF8(MAP_INVALID_UTF8_TO_OCTAL)
+    // if it fails
+    extern WXDLLIMPEXP_BASE wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws);
 #else // ANSI
     // no conversions to do
     #define wxConvertWX2MB(s)   (s)
     #define wxConvertMB2WX(s)   (s)
+    #define wxSafeConvertMB2WX(s) (s)
+    #define wxSafeConvertWX2MB(s) (s)
 #endif // Unicode/ANSI
 
 #endif // _WX_STRCONV_H_