]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/strconv.cpp
unicode fixes
[wxWidgets.git] / src / common / strconv.cpp
index b15169ac547b7aa32b4aa37ce31c0a318211b524..a5e08ae3330413bf9731ca01dd52f12132f9abcc 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     29/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) 1999 Ove Kaaven, Robert Roebling, Vadim Zeitlin, Vaclav Slavik
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
   #pragma implementation "strconv.h"
 #endif
 
     #include "wx/msw/private.h"
 #endif
 
+#ifndef __WXWINCE__
 #include <errno.h>
+#endif
+
 #include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
 // ----------------------------------------------------------------------------
 
 #if wxUSE_WCHAR_T
-    WXDLLEXPORT_DATA(wxMBConv) wxConvLibc;
-    WXDLLEXPORT_DATA(wxCSConv) wxConvLocal((const wxChar *)NULL);
-    WXDLLEXPORT_DATA(wxCSConv) wxConvISO8859_1(_T("iso-8859-1"));
+    WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc;
+    WXDLLIMPEXP_DATA_BASE(wxCSConv) wxConvLocal((const wxChar *)NULL);
+    WXDLLIMPEXP_DATA_BASE(wxCSConv) wxConvISO8859_1(_T("iso-8859-1"));
 #else
     // stand-ins in absence of wchar_t
-    WXDLLEXPORT_DATA(wxMBConv) wxConvLibc,
-                               wxConvFile,
-                               wxConvISO8859_1,
-                               wxConvLocal;
+    WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc,
+                                    wxConvFile,
+                                    wxConvISO8859_1,
+                                    wxConvLocal,
+                                    wxConvUTF8;
 #endif // wxUSE_WCHAR_T
 
-WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc;
+WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent = &wxConvLibc;
 
 class wxStrConvModule: public wxModule
 {
@@ -274,53 +278,11 @@ const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *pwz) const
     return buf;
 }
 
-// ----------------------------------------------------------------------------
-// standard gdk conversion
-// ----------------------------------------------------------------------------
-
-#ifdef __WXGTK12__
-
-WXDLLEXPORT_DATA(wxMBConvGdk) wxConvGdk;
-
-#include <gdk/gdk.h>
-
-size_t wxMBConvGdk::MB2WC(wchar_t *buf, const char *psz, size_t n) const
-{
-    if (buf)
-    {
-        return gdk_mbstowcs((GdkWChar *)buf, psz, n);
-    }
-    else
-    {
-        GdkWChar *nbuf = new GdkWChar[n=strlen(psz)];
-        size_t len = gdk_mbstowcs(nbuf, psz, n);
-        delete[] nbuf;
-        return len;
-    }
-}
-
-size_t wxMBConvGdk::WC2MB(char *buf, const wchar_t *psz, size_t n) const
-{
-    char *mbstr = gdk_wcstombs((GdkWChar *)psz);
-    size_t len = mbstr ? strlen(mbstr) : 0;
-    if (buf)
-    {
-        if (len > n)
-            len = n;
-        memcpy(buf, psz, len);
-        if (len < n)
-            buf[len] = 0;
-    }
-    return len;
-}
-
-#endif // GTK > 1.0
-
 // ----------------------------------------------------------------------------
 // UTF-7
 // ----------------------------------------------------------------------------
 
-WXDLLEXPORT_DATA(wxMBConvUTF7) wxConvUTF7;
+WXDLLIMPEXP_DATA_BASE(wxMBConvUTF7) wxConvUTF7;
 
 #if 0
 static char utf7_setD[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -351,7 +313,7 @@ size_t wxMBConvUTF7::WC2MB(char * WXUNUSED(buf),
 // UTF-8
 // ----------------------------------------------------------------------------
 
-WXDLLEXPORT_DATA(wxMBConvUTF8) wxConvUTF8;
+WXDLLIMPEXP_DATA_BASE(wxMBConvUTF8) wxConvUTF8;
 
 static wxUint32 utf8_max[]=
     { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff, 0xffffffff };
@@ -884,6 +846,8 @@ public:
 
     // were we initialized successfully?
     bool m_ok;
+
+    DECLARE_NO_COPY_CLASS(EC_CharSet)
 };
 
 #endif // wxUSE_FONTMAP