great copy ctor/assignment operators cleanup by Paul Cornett (patch 1307665)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -22,17 +22,8 @@ public:
|
||||
wxAcceleratorTable();
|
||||
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array
|
||||
|
||||
// Copy constructors
|
||||
wxAcceleratorTable(const wxAcceleratorTable& accel)
|
||||
: wxObject()
|
||||
{ Ref(accel); }
|
||||
wxAcceleratorTable(const wxAcceleratorTable* accel)
|
||||
{ if (accel) Ref(*accel); }
|
||||
|
||||
~wxAcceleratorTable();
|
||||
|
||||
wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
|
||||
{ if (*this == accel) return (*this); Ref(accel); return *this; }
|
||||
bool operator == (const wxAcceleratorTable& accel) const
|
||||
{ return m_refData == accel.m_refData; }
|
||||
bool operator != (const wxAcceleratorTable& accel) const
|
||||
|
@@ -104,13 +104,6 @@ class WXDLLEXPORT wxBitmap: public wxBitmapBase
|
||||
public:
|
||||
wxBitmap(); // Platform-specific
|
||||
|
||||
// Copy constructors
|
||||
wxBitmap(const wxBitmap& bitmap)
|
||||
: wxBitmapBase()
|
||||
{
|
||||
Ref(bitmap);
|
||||
}
|
||||
|
||||
// Initialize with raw data.
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
|
||||
@@ -177,7 +170,6 @@ public:
|
||||
wxMask *GetMask() const;
|
||||
void SetMask(wxMask *mask) ;
|
||||
|
||||
inline wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; }
|
||||
inline bool operator == (const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; }
|
||||
inline bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; }
|
||||
|
||||
|
@@ -35,9 +35,6 @@ public:
|
||||
wxBrush(short macThemeBrush ) ;
|
||||
wxBrush(const wxColour& col, int style = wxSOLID);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
wxBrush(const wxBrush& brush)
|
||||
: wxBrushBase()
|
||||
{ Ref(brush); }
|
||||
~wxBrush();
|
||||
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
@@ -47,8 +44,6 @@ public:
|
||||
virtual void MacSetTheme(short macThemeBrush) ;
|
||||
virtual void MacSetThemeBackground(unsigned long macThemeBackground , WXRECTPTR extent) ;
|
||||
|
||||
wxBrush& operator = (const wxBrush& brush)
|
||||
{ if (*this == brush) return (*this); Ref(brush); return *this; }
|
||||
bool operator == (const wxBrush& brush) const
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush) const
|
||||
|
@@ -39,10 +39,6 @@ public:
|
||||
wxColour( const wxChar *colourName )
|
||||
{ InitFromName(colourName); }
|
||||
|
||||
// copy ctors and assignment operators
|
||||
wxColour( const wxColour& col );
|
||||
wxColour& operator = ( const wxColour& col );
|
||||
|
||||
// dtor
|
||||
~wxColour();
|
||||
|
||||
|
@@ -22,11 +22,6 @@ class WXDLLEXPORT wxCursor: public wxBitmap
|
||||
public:
|
||||
wxCursor();
|
||||
|
||||
// Copy constructors
|
||||
wxCursor(const wxCursor& cursor)
|
||||
: wxBitmap()
|
||||
{ Ref(cursor); }
|
||||
|
||||
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
|
||||
const char maskBits[] = NULL);
|
||||
|
||||
@@ -42,7 +37,6 @@ public:
|
||||
bool CreateFromXpm(const char **bits) ;
|
||||
virtual bool Ok() const ;
|
||||
|
||||
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
|
||||
inline bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
|
||||
inline bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
|
||||
|
||||
|
@@ -20,13 +20,7 @@ class WXDLLEXPORT wxFont : public wxFontBase
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxFont() { Init(); }
|
||||
wxFont(const wxFont& font)
|
||||
: wxFontBase()
|
||||
{
|
||||
Init();
|
||||
Ref(font);
|
||||
}
|
||||
wxFont() { }
|
||||
|
||||
wxFont(int size,
|
||||
int family,
|
||||
@@ -36,15 +30,11 @@ public:
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(size, family, style, weight, underlined, face, encoding);
|
||||
}
|
||||
|
||||
wxFont(const wxNativeFontInfo& info)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(info);
|
||||
}
|
||||
|
||||
@@ -64,9 +54,6 @@ public:
|
||||
|
||||
virtual ~wxFont();
|
||||
|
||||
// assignment
|
||||
wxFont& operator=(const wxFont& font);
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual int GetPointSize() const;
|
||||
virtual int GetFamily() const;
|
||||
@@ -111,9 +98,6 @@ public:
|
||||
void* MacGetATSUStyle() const ;
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
void Unshare();
|
||||
|
||||
private:
|
||||
|
@@ -20,13 +20,6 @@ class WXDLLEXPORT wxIcon: public wxGDIObject
|
||||
public:
|
||||
wxIcon();
|
||||
|
||||
// Copy constructors
|
||||
wxIcon(const wxIcon& icon)
|
||||
: wxGDIObject()
|
||||
{
|
||||
Ref(icon);
|
||||
}
|
||||
|
||||
wxIcon(const char **data);
|
||||
wxIcon(char **data);
|
||||
wxIcon(const char bits[], int width , int height );
|
||||
@@ -43,8 +36,6 @@ public:
|
||||
bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
|
||||
{ return LoadFile( name , flags , -1 , -1 ) ; }
|
||||
|
||||
wxIcon& operator=(const wxIcon& icon)
|
||||
{ if (this != &icon) Ref(icon); return *this; }
|
||||
bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; }
|
||||
bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
|
||||
|
||||
|
@@ -39,11 +39,6 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMetafile)
|
||||
public:
|
||||
// Copy constructor
|
||||
wxMetafile(const wxMetafile& metafile)
|
||||
: wxGDIObject()
|
||||
{ Ref(metafile); }
|
||||
|
||||
wxMetafile(const wxString& file = wxEmptyString);
|
||||
~wxMetafile(void);
|
||||
|
||||
@@ -63,7 +58,6 @@ public:
|
||||
void SetHMETAFILE(WXHMETAFILE mf) ;
|
||||
|
||||
// Operators
|
||||
inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; }
|
||||
inline bool operator == (const wxMetafile& metafile) const { return m_refData == metafile.m_refData; }
|
||||
inline bool operator != (const wxMetafile& metafile) const { return m_refData != metafile.m_refData; }
|
||||
|
||||
|
@@ -38,9 +38,6 @@ class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
|
||||
public:
|
||||
wxPalette();
|
||||
wxPalette(const wxPalette& palette)
|
||||
: wxPaletteBase()
|
||||
{ Ref(palette); }
|
||||
|
||||
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||
~wxPalette();
|
||||
@@ -50,7 +47,6 @@ public:
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
inline wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; }
|
||||
inline bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; }
|
||||
inline bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; }
|
||||
|
||||
|
@@ -52,12 +52,8 @@ public:
|
||||
wxPen();
|
||||
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
|
||||
wxPen(const wxBitmap& stipple, int width);
|
||||
wxPen(const wxPen& pen)
|
||||
: wxGDIObject()
|
||||
{ Ref(pen); }
|
||||
~wxPen();
|
||||
|
||||
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
|
||||
inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; }
|
||||
inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; }
|
||||
|
||||
|
@@ -54,13 +54,6 @@ public:
|
||||
|
||||
~wxRegion();
|
||||
|
||||
//# Copying
|
||||
wxRegion(const wxRegion& r)
|
||||
: wxGDIObject()
|
||||
{ Ref(r); }
|
||||
wxRegion& operator = (const wxRegion& r)
|
||||
{ Ref(r); return (*this); }
|
||||
|
||||
//# Modify region
|
||||
// Clear current region
|
||||
void Clear();
|
||||
|
@@ -22,17 +22,8 @@ public:
|
||||
wxAcceleratorTable();
|
||||
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array
|
||||
|
||||
// Copy constructors
|
||||
wxAcceleratorTable(const wxAcceleratorTable& accel)
|
||||
: wxObject()
|
||||
{ Ref(accel); }
|
||||
wxAcceleratorTable(const wxAcceleratorTable* accel)
|
||||
{ if (accel) Ref(*accel); }
|
||||
|
||||
~wxAcceleratorTable();
|
||||
|
||||
wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
|
||||
{ if (*this == accel) return (*this); Ref(accel); return *this; }
|
||||
bool operator == (const wxAcceleratorTable& accel) const
|
||||
{ return m_refData == accel.m_refData; }
|
||||
bool operator != (const wxAcceleratorTable& accel) const
|
||||
|
@@ -133,11 +133,6 @@ class WXDLLEXPORT wxBitmap: public wxBitmapBase
|
||||
public:
|
||||
wxBitmap(); // Platform-specific
|
||||
|
||||
// Copy constructors
|
||||
wxBitmap(const wxBitmap& bitmap)
|
||||
: wxBitmapBase()
|
||||
{ Ref(bitmap); }
|
||||
|
||||
// Initialize with raw data.
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
|
||||
@@ -194,7 +189,6 @@ public:
|
||||
|
||||
int GetBitmapType() const;
|
||||
|
||||
inline wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; }
|
||||
inline bool operator == (const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; }
|
||||
inline bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; }
|
||||
|
||||
|
@@ -35,9 +35,6 @@ public:
|
||||
wxBrush(short macThemeBrush ) ;
|
||||
wxBrush(const wxColour& col, int style = wxSOLID);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
wxBrush(const wxBrush& brush)
|
||||
: wxBrushBase()
|
||||
{ Ref(brush); }
|
||||
~wxBrush();
|
||||
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
@@ -47,8 +44,6 @@ public:
|
||||
virtual void SetMacTheme(short macThemeBrush) ;
|
||||
virtual void SetMacThemeBackground(unsigned long macThemeBackground , WXRECTPTR extent) ;
|
||||
|
||||
wxBrush& operator = (const wxBrush& brush)
|
||||
{ if (*this == brush) return (*this); Ref(brush); return *this; }
|
||||
bool operator == (const wxBrush& brush) const
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush) const
|
||||
|
@@ -43,11 +43,6 @@ class WXDLLEXPORT wxCursor: public wxBitmap
|
||||
public:
|
||||
wxCursor();
|
||||
|
||||
// Copy constructors
|
||||
wxCursor(const wxCursor& cursor)
|
||||
: wxBitmap()
|
||||
{ Ref(cursor); }
|
||||
|
||||
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
|
||||
const char maskBits[] = NULL);
|
||||
|
||||
@@ -63,7 +58,6 @@ public:
|
||||
bool CreateFromXpm(const char **bits) ;
|
||||
virtual bool Ok() const { return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ; }
|
||||
|
||||
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
|
||||
inline bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
|
||||
inline bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
|
||||
|
||||
|
@@ -20,13 +20,7 @@ class WXDLLEXPORT wxFont : public wxFontBase
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxFont() { Init(); }
|
||||
wxFont(const wxFont& font)
|
||||
: wxFontBase()
|
||||
{
|
||||
Init();
|
||||
Ref(font);
|
||||
}
|
||||
wxFont() { }
|
||||
|
||||
wxFont(int size,
|
||||
int family,
|
||||
@@ -36,15 +30,11 @@ public:
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(size, family, style, weight, underlined, face, encoding);
|
||||
}
|
||||
|
||||
wxFont(const wxNativeFontInfo& info)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(info);
|
||||
}
|
||||
|
||||
@@ -62,9 +52,6 @@ public:
|
||||
|
||||
virtual ~wxFont();
|
||||
|
||||
// assignment
|
||||
wxFont& operator=(const wxFont& font);
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual int GetPointSize() const;
|
||||
virtual int GetFamily() const;
|
||||
@@ -99,9 +86,6 @@ public:
|
||||
wxUint32 GetMacATSUFontID() const;
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
void Unshare();
|
||||
|
||||
private:
|
||||
|
@@ -20,11 +20,6 @@ class WXDLLEXPORT wxIcon: public wxBitmap
|
||||
public:
|
||||
wxIcon();
|
||||
|
||||
// Copy constructors
|
||||
wxIcon(const wxIcon& icon)
|
||||
: wxBitmap()
|
||||
{ Ref(icon); }
|
||||
|
||||
wxIcon(const char **data);
|
||||
wxIcon(char **data);
|
||||
wxIcon(const char bits[], int width , int height );
|
||||
@@ -41,8 +36,6 @@ public:
|
||||
bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
|
||||
{ return LoadFile( name , flags , -1 , -1 ) ; }
|
||||
|
||||
wxIcon& operator=(const wxIcon& icon)
|
||||
{ if (this != &icon) Ref(icon); return *this; }
|
||||
bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; }
|
||||
bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
|
||||
|
||||
|
@@ -50,11 +50,6 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMetafile)
|
||||
public:
|
||||
// Copy constructor
|
||||
wxMetafile(const wxMetafile& metafile)
|
||||
: wxGDIObject()
|
||||
{ Ref(metafile); }
|
||||
|
||||
wxMetafile(const wxString& file = wxEmptyString);
|
||||
~wxMetafile(void);
|
||||
|
||||
@@ -74,7 +69,6 @@ public:
|
||||
void SetHMETAFILE(WXHMETAFILE mf) ;
|
||||
|
||||
// Operators
|
||||
inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; }
|
||||
inline bool operator == (const wxMetafile& metafile) const { return m_refData == metafile.m_refData; }
|
||||
inline bool operator != (const wxMetafile& metafile) const { return m_refData != metafile.m_refData; }
|
||||
|
||||
|
@@ -38,9 +38,6 @@ class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
|
||||
public:
|
||||
wxPalette();
|
||||
wxPalette(const wxPalette& palette)
|
||||
: wxPaletteBase()
|
||||
{ Ref(palette); }
|
||||
|
||||
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||
~wxPalette();
|
||||
@@ -50,7 +47,6 @@ public:
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
inline wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; }
|
||||
inline bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; }
|
||||
inline bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; }
|
||||
|
||||
|
@@ -52,12 +52,8 @@ public:
|
||||
wxPen();
|
||||
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
|
||||
wxPen(const wxBitmap& stipple, int width);
|
||||
wxPen(const wxPen& pen)
|
||||
: wxGDIObject()
|
||||
{ Ref(pen); }
|
||||
~wxPen();
|
||||
|
||||
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
|
||||
inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; }
|
||||
inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; }
|
||||
|
||||
|
@@ -53,13 +53,6 @@ public:
|
||||
|
||||
~wxRegion();
|
||||
|
||||
//# Copying
|
||||
wxRegion(const wxRegion& r)
|
||||
: wxGDIObject()
|
||||
{ Ref(r); }
|
||||
wxRegion& operator = (const wxRegion& r)
|
||||
{ Ref(r); return (*this); }
|
||||
|
||||
//# Modify region
|
||||
// Clear current region
|
||||
void Clear();
|
||||
|
Reference in New Issue
Block a user