fix DLL build with MSVC: it wasn't happy that some functions of a template class were not implemented, so get rid of FromCStrData() and implement its logic in one of the 2 derived classes ctors instead

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-23 00:04:15 +00:00
parent d18c8d3d94
commit ccd4deab6b
2 changed files with 21 additions and 20 deletions

View File

@@ -27,7 +27,7 @@ inline char *wxStrDup(const char *s) { return wxStrdupA(s); }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
template <typename T> template <typename T>
class WXDLLIMPEXP_BASE wxCharTypeBuffer class wxCharTypeBuffer
{ {
public: public:
typedef T CharType; typedef T CharType;
@@ -37,11 +37,6 @@ public:
{ {
} }
wxCharTypeBuffer(const wxCStrData& cstr)
{
FromCStrData(cstr);
}
wxCharTypeBuffer(size_t len) wxCharTypeBuffer(size_t len)
: m_str((CharType *)malloc((len + 1)*sizeof(CharType))) : m_str((CharType *)malloc((len + 1)*sizeof(CharType)))
{ {
@@ -119,9 +114,6 @@ public:
operator const CharType *() const { return m_str; } operator const CharType *() const { return m_str; }
CharType operator[](size_t n) const { return m_str[n]; } CharType operator[](size_t n) const { return m_str[n]; }
private:
void FromCStrData(const wxCStrData& cstr);
private: private:
CharType *m_str; CharType *m_str;
}; };
@@ -129,30 +121,40 @@ private:
class WXDLLIMPEXP_BASE wxCharBuffer : public wxCharTypeBuffer<char> class WXDLLIMPEXP_BASE wxCharBuffer : public wxCharTypeBuffer<char>
{ {
public: public:
wxCharBuffer(const CharType *str = NULL) : wxCharTypeBuffer<char>(str) {} typedef wxCharTypeBuffer<char> wxCharTypeBufferBase;
wxCharBuffer(const wxCStrData& cstr) : wxCharTypeBuffer<char>(cstr) {}
wxCharBuffer(size_t len) : wxCharTypeBuffer<char>(len) {} wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
#if !wxUSE_UNICODE
wxCharBuffer(const wxCStrData& cstr);
#endif
}; };
#if wxUSE_WCHAR_T #if wxUSE_WCHAR_T
class WXDLLIMPEXP_BASE wxWCharBuffer : public wxCharTypeBuffer<wchar_t> class WXDLLIMPEXP_BASE wxWCharBuffer : public wxCharTypeBuffer<wchar_t>
{ {
public: public:
wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBuffer<wchar_t>(str) {} typedef wxCharTypeBuffer<wchar_t> wxCharTypeBufferBase;
wxWCharBuffer(const wxCStrData& cstr) : wxCharTypeBuffer<wchar_t>(cstr) {}
wxWCharBuffer(size_t len) : wxCharTypeBuffer<wchar_t>(len) {} wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {}
wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
#if wxUSE_UNICODE
wxWCharBuffer(const wxCStrData& cstr);
#endif
}; };
#endif // wxUSE_WCHAR_T #endif // wxUSE_WCHAR_T
#if wxUSE_UNICODE #if wxUSE_UNICODE
typedef wxWCharBuffer wxWxCharBuffer; #define wxWxCharBuffer wxWCharBuffer
#define wxMB2WXbuf wxWCharBuffer #define wxMB2WXbuf wxWCharBuffer
#define wxWX2MBbuf wxCharBuffer #define wxWX2MBbuf wxCharBuffer
#define wxWC2WXbuf wxChar* #define wxWC2WXbuf wxChar*
#define wxWX2WCbuf wxChar* #define wxWX2WCbuf wxChar*
#else // ANSI #else // ANSI
typedef wxCharBuffer wxWxCharBuffer; #define wxWxCharBuffer wxCharBuffer
#define wxMB2WXbuf wxChar* #define wxMB2WXbuf wxChar*
#define wxWX2MBbuf wxChar* #define wxWX2MBbuf wxChar*

View File

@@ -2045,10 +2045,9 @@ inline wxString& wxString::operator=(const wxCStrData& cstr)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// FIXME-UTF8: move this to buffer.h; provide versions for both variants // FIXME-UTF8: move this to buffer.h; provide versions for both variants
template<> inline wxWxCharBuffer::wxWxCharBuffer(const wxCStrData& cstr)
inline void wxCharTypeBuffer<wxChar>::FromCStrData(const wxCStrData& cstr) : wxCharTypeBufferBase((const wxChar *)cstr)
{ {
m_str = wxStrDup(cstr.AsString());
} }
#endif // _WX_WXSTRINGH__ #endif // _WX_WXSTRINGH__