From a1eb65c24668845888c1be5d701e32e216c79af3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 30 May 2007 22:02:19 +0000 Subject: [PATCH] use wxString, not wxChar*, in wxDataFormat ctor and SetId() method git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cocoa/dataform.h | 4 ++-- include/wx/dataobj.h | 4 ++-- include/wx/gtk/dataform.h | 3 +-- include/wx/gtk1/dataform.h | 3 +-- include/wx/mac/carbon/dataform.h | 3 +-- include/wx/motif/dataform.h | 3 +-- include/wx/msw/ole/dataform.h | 4 ++-- include/wx/os2/dataform.h | 4 ++-- include/wx/x11/dataform.h | 3 +-- src/gtk/dataobj.cpp | 11 ++--------- src/gtk1/dataobj.cpp | 11 ++--------- src/mac/carbon/dataobj.cpp | 7 +------ src/motif/dataobj.cpp | 11 ++--------- src/msw/ole/dataobj.cpp | 2 +- src/os2/dataobj.cpp | 4 ++-- src/x11/dataobj.cpp | 11 ++--------- 16 files changed, 25 insertions(+), 63 deletions(-) diff --git a/include/wx/cocoa/dataform.h b/include/wx/cocoa/dataform.h index 17b95ee4a8..285a13913e 100644 --- a/include/wx/cocoa/dataform.h +++ b/include/wx/cocoa/dataform.h @@ -16,7 +16,7 @@ class wxDataFormat { public: wxDataFormat(unsigned int uFormat = wxDF_INVALID) { m_uFormat = uFormat; } - wxDataFormat(const wxChar* zFormat) { SetId(zFormat); } + wxDataFormat(const wxString& zFormat) { SetId(zFormat); } wxDataFormat& operator=(unsigned int uFormat) { m_uFormat = uFormat; return(*this); } wxDataFormat& operator=(const wxDataFormat& rFormat) {m_uFormat = rFormat.m_uFormat; return(*this); } @@ -42,7 +42,7 @@ public: // application-specific formats // wxString GetId(void) const; - void SetId(const wxChar* WXUNUSED(pId)) { /* TODO */ } + void SetId(const wxString& WXUNUSED(pId)) { /* TODO */ } private: unsigned int m_uFormat; diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h index 2201cd195a..b860e208ec 100644 --- a/include/wx/dataobj.h +++ b/include/wx/dataobj.h @@ -55,7 +55,7 @@ public: typedef NativeFormat; wxDataFormat(NativeFormat format = wxDF_INVALID); - wxDataFormat(const wxChar *format); + wxDataFormat(const wxString& format); wxDataFormat& operator=(NativeFormat format); wxDataFormat& operator=(const wxDataFormat& format); @@ -67,7 +67,7 @@ public: NativeFormat GetType() const; wxString GetId() const; - void SetId(const wxChar *format); + void SetId(const wxString& format); }; */ diff --git a/include/wx/gtk/dataform.h b/include/wx/gtk/dataform.h index 3b66e3117a..78803ff7da 100644 --- a/include/wx/gtk/dataform.h +++ b/include/wx/gtk/dataform.h @@ -21,7 +21,6 @@ public: wxDataFormat(); wxDataFormat( wxDataFormatId type ); wxDataFormat( const wxString &id ); - wxDataFormat( const wxChar *id ); wxDataFormat( NativeFormat format ); wxDataFormat& operator=(const wxDataFormat& format) @@ -50,7 +49,7 @@ public: // string ids are used for custom types - this SetId() must be used for // application-specific formats wxString GetId() const; - void SetId( const wxChar *id ); + void SetId( const wxString& id ); // implementation wxDataFormatId GetType() const; diff --git a/include/wx/gtk1/dataform.h b/include/wx/gtk1/dataform.h index 5cb61dce26..5d143ed9aa 100644 --- a/include/wx/gtk1/dataform.h +++ b/include/wx/gtk1/dataform.h @@ -21,7 +21,6 @@ public: wxDataFormat(); wxDataFormat( wxDataFormatId type ); wxDataFormat( const wxString &id ); - wxDataFormat( const wxChar *id ); wxDataFormat( NativeFormat format ); wxDataFormat& operator=(const wxDataFormat& format) @@ -50,7 +49,7 @@ public: // string ids are used for custom types - this SetId() must be used for // application-specific formats wxString GetId() const; - void SetId( const wxChar *id ); + void SetId( const wxString& id ); // implementation wxDataFormatId GetType() const; diff --git a/include/wx/mac/carbon/dataform.h b/include/wx/mac/carbon/dataform.h index ffc4f87a42..7fa7cb6e0c 100644 --- a/include/wx/mac/carbon/dataform.h +++ b/include/wx/mac/carbon/dataform.h @@ -20,7 +20,6 @@ public: wxDataFormat(); wxDataFormat(wxDataFormatId vType); wxDataFormat(const wxString& rId); - wxDataFormat(const wxChar* pId); wxDataFormat(NativeFormat vFormat); wxDataFormat& operator=(NativeFormat vFormat) @@ -46,7 +45,7 @@ public: // string ids are used for custom types - this SetId() must be used for // application-specific formats wxString GetId() const; - void SetId(const wxChar* pId); + void SetId(const wxString& pId); // implementation wxDataFormatId GetType() const { return m_type; } diff --git a/include/wx/motif/dataform.h b/include/wx/motif/dataform.h index 2487376ab3..314eaf5b68 100644 --- a/include/wx/motif/dataform.h +++ b/include/wx/motif/dataform.h @@ -21,7 +21,6 @@ public: wxDataFormat(); wxDataFormat( wxDataFormatId type ); wxDataFormat( const wxString &id ); - wxDataFormat( const wxChar *id ); wxDataFormat( NativeFormat format ); wxDataFormat& operator=(NativeFormat format) @@ -48,7 +47,7 @@ public: // string ids are used for custom types - this SetId() must be used for // application-specific formats wxString GetId() const; - void SetId( const wxChar *id ); + void SetId( const wxString& id ); // implementation wxDataFormatId GetType() const; diff --git a/include/wx/msw/ole/dataform.h b/include/wx/msw/ole/dataform.h index 10c6bb2c3d..3b81aef322 100644 --- a/include/wx/msw/ole/dataform.h +++ b/include/wx/msw/ole/dataform.h @@ -23,7 +23,7 @@ public: typedef unsigned short NativeFormat; wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; } - wxDataFormat(const wxChar *format) { SetId(format); } + wxDataFormat(const wxString& format) { SetId(format); } wxDataFormat& operator=(NativeFormat format) { m_format = format; return *this; } @@ -55,7 +55,7 @@ public: // string ids are used for custom types - this SetId() must be used for // application-specific formats wxString GetId() const; - void SetId(const wxChar *format); + void SetId(const wxString& format); // returns true if the format is one of those defined in wxDataFormatId bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; } diff --git a/include/wx/os2/dataform.h b/include/wx/os2/dataform.h index 18336bb540..b28d059403 100644 --- a/include/wx/os2/dataform.h +++ b/include/wx/os2/dataform.h @@ -16,7 +16,7 @@ class wxDataFormat { public: wxDataFormat(unsigned int uFormat = wxDF_INVALID) { m_uFormat = uFormat; } - wxDataFormat(const wxChar* zFormat) { SetId(zFormat); } + wxDataFormat(const wxString& zFormat) { SetId(zFormat); } wxDataFormat& operator=(unsigned int uFormat) { m_uFormat = uFormat; return(*this); } wxDataFormat& operator=(const wxDataFormat& rFormat) {m_uFormat = rFormat.m_uFormat; return(*this); } @@ -42,7 +42,7 @@ public: // application-specific formats // wxString GetId(void) const; - void SetId(const wxChar* pId); + void SetId(const wxString& pId); private: unsigned int m_uFormat; diff --git a/include/wx/x11/dataform.h b/include/wx/x11/dataform.h index 0e6fed774f..56a956093f 100644 --- a/include/wx/x11/dataform.h +++ b/include/wx/x11/dataform.h @@ -21,7 +21,6 @@ public: wxDataFormat(); wxDataFormat( wxDataFormatId type ); wxDataFormat( const wxString &id ); - wxDataFormat( const wxChar *id ); wxDataFormat( NativeFormat format ); wxDataFormat& operator=(NativeFormat format) @@ -48,7 +47,7 @@ public: // string ids are used for custom types - this SetId() must be used for // application-specific formats wxString GetId() const; - void SetId( const wxChar *id ); + void SetId( const wxString& id ); // implementation wxDataFormatId GetType() const; diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp index ce2ec4730b..4c3e4225eb 100644 --- a/src/gtk/dataobj.cpp +++ b/src/gtk/dataobj.cpp @@ -58,12 +58,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type ) SetType( type ); } -wxDataFormat::wxDataFormat( const wxChar *id ) -{ - PrepareFormats(); - SetId( id ); -} - wxDataFormat::wxDataFormat( const wxString &id ) { PrepareFormats(); @@ -138,12 +132,11 @@ void wxDataFormat::SetId( NativeFormat format ) m_type = wxDF_PRIVATE; } -void wxDataFormat::SetId( const wxChar *id ) +void wxDataFormat::SetId( const wxString& id ) { PrepareFormats(); m_type = wxDF_PRIVATE; - wxString tmp( id ); - m_format = gdk_atom_intern( (const char*) tmp.ToAscii(), FALSE ); + m_format = gdk_atom_intern( id.ToAscii(), FALSE ); } void wxDataFormat::PrepareFormats() diff --git a/src/gtk1/dataobj.cpp b/src/gtk1/dataobj.cpp index e93e1d7047..97b7bc8510 100644 --- a/src/gtk1/dataobj.cpp +++ b/src/gtk1/dataobj.cpp @@ -58,12 +58,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type ) SetType( type ); } -wxDataFormat::wxDataFormat( const wxChar *id ) -{ - PrepareFormats(); - SetId( id ); -} - wxDataFormat::wxDataFormat( const wxString &id ) { PrepareFormats(); @@ -140,12 +134,11 @@ void wxDataFormat::SetId( NativeFormat format ) m_type = wxDF_PRIVATE; } -void wxDataFormat::SetId( const wxChar *id ) +void wxDataFormat::SetId( const wxString& id ) { PrepareFormats(); m_type = wxDF_PRIVATE; - wxString tmp( id ); - m_format = gdk_atom_intern( (const char*) tmp.ToAscii(), FALSE ); + m_format = gdk_atom_intern( id.ToAscii(), FALSE ); } void wxDataFormat::PrepareFormats() diff --git a/src/mac/carbon/dataobj.cpp b/src/mac/carbon/dataobj.cpp index fb73241ed9..748c387ad6 100644 --- a/src/mac/carbon/dataobj.cpp +++ b/src/mac/carbon/dataobj.cpp @@ -49,11 +49,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId vType ) SetType( vType ); } -wxDataFormat::wxDataFormat( const wxChar *zId ) -{ - SetId( zId ); -} - wxDataFormat::wxDataFormat( const wxString& rId ) { SetId( rId ); @@ -137,7 +132,7 @@ void wxDataFormat::SetId( NativeFormat format ) } } -void wxDataFormat::SetId( const wxChar* zId ) +void wxDataFormat::SetId( const wxString& zId ) { m_type = wxDF_PRIVATE; m_id = zId; diff --git a/src/motif/dataobj.cpp b/src/motif/dataobj.cpp index 7b4f82f041..c96ec26e15 100644 --- a/src/motif/dataobj.cpp +++ b/src/motif/dataobj.cpp @@ -61,12 +61,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type ) SetType( type ); } -wxDataFormat::wxDataFormat( const wxChar *id ) -{ - PrepareFormats(); - SetId( id ); -} - wxDataFormat::wxDataFormat( const wxString &id ) { PrepareFormats(); @@ -129,13 +123,12 @@ void wxDataFormat::SetId( NativeFormat format ) m_type = wxDF_PRIVATE; } -void wxDataFormat::SetId( const wxChar *id ) +void wxDataFormat::SetId( const wxString& id ) { PrepareFormats(); m_type = wxDF_PRIVATE; - wxString tmp( id ); m_format = XInternAtom( wxGlobalDisplay(), - tmp.mbc_str(), False ); + id.mbc_str(), False ); } void wxDataFormat::PrepareFormats() diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 48e999239a..6452e4b2fd 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -137,7 +137,7 @@ private: // wxDataFormat // ---------------------------------------------------------------------------- -void wxDataFormat::SetId(const wxChar *format) +void wxDataFormat::SetId(const wxString& format) { m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format); if ( !m_format ) diff --git a/src/os2/dataobj.cpp b/src/os2/dataobj.cpp index 8ec854054c..81939cf429 100644 --- a/src/os2/dataobj.cpp +++ b/src/os2/dataobj.cpp @@ -57,11 +57,11 @@ wxString wxDataFormat::GetId() const } // end of wxDataFormat::GetId() void wxDataFormat::SetId ( - const wxChar* zId + const wxString& zId ) { m_uFormat = ::WinAddAtom( ::WinQuerySystemAtomTable() - ,(PSZ)zId + ,zId.char_str() ); } // end of wxDataFormat::SetId diff --git a/src/x11/dataobj.cpp b/src/x11/dataobj.cpp index b0c6bbc7d4..b9b8f7a37d 100644 --- a/src/x11/dataobj.cpp +++ b/src/x11/dataobj.cpp @@ -57,12 +57,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type ) SetType( type ); } -wxDataFormat::wxDataFormat( const wxChar *id ) -{ - PrepareFormats(); - SetId( id ); -} - wxDataFormat::wxDataFormat( const wxString &id ) { PrepareFormats(); @@ -129,13 +123,12 @@ void wxDataFormat::SetId( NativeFormat format ) m_type = wxDF_PRIVATE; } -void wxDataFormat::SetId( const wxChar *id ) +void wxDataFormat::SetId( const wxString& id ) { #if !wxUSE_NANOX PrepareFormats(); m_type = wxDF_PRIVATE; - wxString tmp( id ); - m_format = XInternAtom( (Display*) wxGetDisplay(), tmp.ToAscii(), FALSE ); + m_format = XInternAtom( (Display*) wxGetDisplay(), id.ToAscii(), FALSE ); #endif } -- 2.45.2