+ virtual wxMBConv *Clone() const { return new wxCSConv(*this); }
+
+ void Clear();
+
+ // return true if the conversion could be initialized successfully
+ bool IsOk() const;
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // creates m_convReal if necessary
+ void CreateConvIfNeeded() const;
+
+ // do create m_convReal (unconditionally)
+ wxMBConv *DoCreate() const;
+
+ // set the name (may be only called when m_name == NULL), makes copy of
+ // the charset string
+ void SetName(const char *charset);
+
+
+ // m_name may be NULL in which case m_encoding should be used
+ //
+ // note that we can't use wxString here because of compilation
+ // dependencies: we're included from wx/string.h
+ char *m_name;
+
+ // may be wxFONTENCODING_SYSTEM in which case m_name is used
+ //
+ // if m_name is NULL, then we should use the default system encoding
+ wxFontEncoding m_encoding;
+
+ // use CreateConvIfNeeded() before accessing m_convReal!
+ wxMBConv *m_convReal;
+ bool m_deferred;
+};
+
+
+// ----------------------------------------------------------------------------
+// declare predefined conversion objects
+// ----------------------------------------------------------------------------
+
+// Note: this macro is an implementation detail (see the comment in
+// strconv.cpp). The wxGet_XXX() and wxGet_XXXPtr() functions shouldn't be
+// used by user code and neither should XXXPtr, use the wxConvXXX macro
+// instead.
+#define WX_DECLARE_GLOBAL_CONV(klass, name) \
+ extern WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr; \
+ extern WXDLLIMPEXP_BASE klass* wxGet_##name##Ptr(); \
+ inline klass& wxGet_##name() \
+ { \
+ if ( !name##Ptr ) \
+ name##Ptr = wxGet_##name##Ptr(); \
+ return *name##Ptr; \
+ }
+
+
+// conversion to be used with all standard functions affected by locale, e.g.
+// strtol(), strftime(), ...
+WX_DECLARE_GLOBAL_CONV(wxMBConv, wxConvLibc)
+#define wxConvLibc wxGet_wxConvLibc()
+
+// conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t
+WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvISO8859_1)
+#define wxConvISO8859_1 wxGet_wxConvISO8859_1()
+
+WX_DECLARE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8)
+#define wxConvUTF8 wxGet_wxConvUTF8()
+
+WX_DECLARE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7)
+#define wxConvUTF7 wxGet_wxConvUTF7()
+
+// conversion used for the file names on the systems where they're not Unicode
+// (basically anything except Windows)
+//
+// this is used by all file functions, can be changed by the application
+//
+// by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used
+// under Windows normally)
+extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName;
+
+// backwards compatible define
+#define wxConvFile (*wxConvFileName)
+
+// the current conversion object, may be set to any conversion, is used by
+// default in a couple of places inside wx (initially same as wxConvLibc)
+extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent;
+
+// the conversion corresponding to the current locale
+WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvLocal)
+#define wxConvLocal wxGet_wxConvLocal()
+
+// the conversion corresponding to the encoding of the standard UI elements
+//
+// by default this is the same as wxConvLocal but may be changed if the program
+// needs to use a fixed encoding
+extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
+
+#undef WX_DECLARE_GLOBAL_CONV
+
+// ----------------------------------------------------------------------------
+// endianness-dependent conversions
+// ----------------------------------------------------------------------------
+
+#ifdef WORDS_BIGENDIAN
+ typedef wxMBConvUTF16BE wxMBConvUTF16;
+ typedef wxMBConvUTF32BE wxMBConvUTF32;
+#else
+ typedef wxMBConvUTF16LE wxMBConvUTF16;
+ typedef wxMBConvUTF32LE wxMBConvUTF32;
+#endif
+
+// ----------------------------------------------------------------------------
+// filename conversion macros
+// ----------------------------------------------------------------------------
+
+// filenames are multibyte on Unix and widechar on Windows
+#if wxMBFILES && wxUSE_UNICODE
+ #define wxFNCONV(name) wxConvFileName->cWX2MB(name)
+ #define wxFNSTRINGCAST wxMBSTRINGCAST
+#else
+#if defined( __WXOSX_OR_COCOA__ ) && wxMBFILES
+ #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) )
+#else
+ #define wxFNCONV(name) name
+#endif
+ #define wxFNSTRINGCAST WXSTRINGCAST
+#endif
+
+// ----------------------------------------------------------------------------
+// macros for the most common conversions
+// ----------------------------------------------------------------------------
+
+#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_