Fixed up and cleaned up Qt variant of wxDataFormat.

Kept "mime type" and "id" conceptually separate in the interface in case they need to diverge later.
Got rid of the odd "wxChar *" variants and the QString one.
Implemented unimplemented "type" functions.
Implemented "!=" in terms of "==", to keep from having two places to keep in sync.
This commit is contained in:
Jay Nabonne
2019-01-28 15:22:01 +00:00
parent 2c7489fffe
commit ea4c7120ff
3 changed files with 72 additions and 74 deletions

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/toolbar.h
// Name: wx/qt/dataform.h
// Author: Sean D'Epagnier
// Copyright: (c) Sean D'Epagnier 2014
// Licence: wxWindows licence
@@ -8,34 +8,34 @@
#ifndef _WX_QT_DATAFORM_H_
#define _WX_QT_DATAFORM_H_
class QString;
class WXDLLIMPEXP_CORE wxDataFormat
{
public:
wxDataFormat();
wxDataFormat( wxDataFormatId formatId );
wxDataFormat(wxDataFormatId formatId = wxDF_INVALID);
wxDataFormat(const wxString &id);
wxDataFormat(const QString &id);
wxDataFormat(const wxChar *id);
void SetId( const wxChar *id );
// Standard methods
const wxString& GetId() const;
void SetId(const wxString& id);
wxDataFormatId GetType() const;
void SetType(wxDataFormatId type);
bool operator==(wxDataFormatId format) const;
bool operator!=(wxDataFormatId format) const;
bool operator==(const wxDataFormat& format) const;
bool operator!=(const wxDataFormat& format) const;
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId( const wxString& id );
// Direct access to the underlying mime type.
// Equivalent to "id", except "id" is supposed to be
// invalid for standard types, whereas this should
// always be valid (if meaningful).
const wxString& GetMimeType() const;
void SetMimeType(const wxString& mimeType);
// implementation
wxDataFormatId GetType() const;
void SetType( wxDataFormatId type );
wxString m_MimeType;
private:
wxString m_mimeType;
wxDataFormatId m_formatId;
};
#endif // _WX_QT_DATAFORM_H_