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:
@@ -38,14 +38,8 @@ public:
|
||||
,const wxAcceleratorEntry vaEntries[]
|
||||
); // Load from array
|
||||
|
||||
// Copy constructors
|
||||
inline wxAcceleratorTable(const wxAcceleratorTable& rAccel) { Ref(rAccel); }
|
||||
inline wxAcceleratorTable(const wxAcceleratorTable* pAccel) { if (pAccel) Ref(*pAccel); }
|
||||
|
||||
~wxAcceleratorTable();
|
||||
|
||||
inline wxAcceleratorTable& operator = (const wxAcceleratorTable& rAccel)
|
||||
{ if (*this == rAccel) return (*this); Ref(rAccel); return *this; };
|
||||
inline bool operator== (const wxAcceleratorTable& rAccel) const
|
||||
{ return m_refData == rAccel.m_refData; };
|
||||
inline bool operator!= (const wxAcceleratorTable& rAccel) const
|
||||
|
@@ -70,7 +70,11 @@ public:
|
||||
|
||||
// Copy constructors
|
||||
inline wxBitmap(const wxBitmap& rBitmap)
|
||||
{ Init(); Ref(rBitmap); SetHandle(rBitmap.GetHandle()); }
|
||||
: wxGDIImage(rBitmap)
|
||||
{
|
||||
Init();
|
||||
SetHandle(rBitmap.GetHandle());
|
||||
}
|
||||
|
||||
// Initialize with raw data
|
||||
wxBitmap( const char bits[]
|
||||
@@ -112,13 +116,6 @@ public:
|
||||
inline wxBitmap(const wxIcon& rIcon)
|
||||
{ Init(); CopyFromIcon(rIcon); }
|
||||
|
||||
wxBitmap& operator=(const wxBitmap& rBitmap)
|
||||
{
|
||||
if ( m_refData != rBitmap.m_refData )
|
||||
Ref(rBitmap);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
wxBitmap& operator=(const wxIcon& rIcon)
|
||||
{
|
||||
(void)CopyFromIcon(rIcon);
|
||||
|
@@ -45,10 +45,8 @@ public:
|
||||
wxBrush();
|
||||
wxBrush(const wxColour& rCol, int nStyle = wxSOLID);
|
||||
wxBrush(const wxBitmap& rStipple);
|
||||
inline wxBrush(const wxBrush& rBrush) { Ref(rBrush); }
|
||||
~wxBrush();
|
||||
|
||||
inline wxBrush& operator = (const wxBrush& rBrush) { if (*this == rBrush) return (*this); Ref(rBrush); return *this; }
|
||||
inline bool operator == (const wxBrush& rBrush) const { return m_refData == rBrush.m_refData; }
|
||||
inline bool operator != (const wxBrush& rBrush) const { return m_refData != rBrush.m_refData; }
|
||||
|
||||
|
@@ -32,8 +32,6 @@ class WXDLLEXPORT wxCursor: public wxBitmap
|
||||
public:
|
||||
wxCursor();
|
||||
|
||||
// Copy constructors
|
||||
wxCursor(const wxCursor& rCursor) { Ref(rCursor); }
|
||||
wxCursor(const wxImage& rImage);
|
||||
|
||||
wxCursor( const char acBits[]
|
||||
@@ -50,14 +48,6 @@ public:
|
||||
);
|
||||
wxCursor(int nCursorType);
|
||||
inline ~wxCursor() { }
|
||||
|
||||
inline wxCursor& operator = (const wxCursor& rCursor)
|
||||
{
|
||||
if (*this == rCursor)
|
||||
return (*this);
|
||||
Ref(rCursor);
|
||||
return *this;
|
||||
}
|
||||
inline bool operator == (const wxCursor& rCursor) const { return m_refData == rCursor.m_refData; }
|
||||
inline bool operator != (const wxCursor& rCursor) const { return m_refData != rCursor.m_refData; }
|
||||
|
||||
|
@@ -25,8 +25,7 @@ class WXDLLEXPORT wxFont : public wxFontBase
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxFont() { Init(); }
|
||||
wxFont(const wxFont& rFont) { Init(); Ref(rFont); }
|
||||
wxFont() { }
|
||||
|
||||
wxFont( int nSize
|
||||
,int nFamily
|
||||
@@ -37,8 +36,6 @@ public:
|
||||
,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT
|
||||
)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create( nSize
|
||||
,nFamily
|
||||
,nStyle
|
||||
@@ -54,8 +51,6 @@ public:
|
||||
)
|
||||
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create( rInfo
|
||||
,hFont
|
||||
);
|
||||
@@ -77,11 +72,6 @@ public:
|
||||
|
||||
virtual ~wxFont();
|
||||
|
||||
//
|
||||
// Assignment
|
||||
//
|
||||
wxFont& operator=(const wxFont& rFont);
|
||||
|
||||
//
|
||||
// Implement base class pure virtuals
|
||||
//
|
||||
@@ -123,10 +113,6 @@ public:
|
||||
protected:
|
||||
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& rInfo);
|
||||
|
||||
//
|
||||
// Common part of all ctors
|
||||
//
|
||||
void Init(void);
|
||||
void Unshare(void);
|
||||
|
||||
private:
|
||||
|
@@ -40,9 +40,6 @@ class WXDLLEXPORT wxIcon: public wxIconBase
|
||||
public:
|
||||
wxIcon();
|
||||
|
||||
// Copy constructors
|
||||
inline wxIcon(const wxIcon& icon) { Ref(icon); }
|
||||
|
||||
wxIcon( const char bits[]
|
||||
,int nWidth
|
||||
,int nHeight
|
||||
@@ -67,8 +64,6 @@ public:
|
||||
,int nDesiredHeight = -1
|
||||
);
|
||||
|
||||
inline wxIcon& operator = (const wxIcon& rIcon)
|
||||
{ if (*this != rIcon) Ref(rIcon); return *this; }
|
||||
inline bool operator == (const wxIcon& rIcon) const
|
||||
{ return m_refData == rIcon.m_refData; }
|
||||
inline bool operator != (const wxIcon& rIcon) const
|
||||
|
@@ -50,10 +50,6 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMetafile)
|
||||
public:
|
||||
// Copy constructor
|
||||
inline wxMetafile(const wxMetafile& metafile)
|
||||
{ Ref(metafile); }
|
||||
|
||||
wxMetafile(const wxString& file = wxEmptyString);
|
||||
~wxMetafile(void);
|
||||
|
||||
@@ -71,8 +67,6 @@ public:
|
||||
void SetWindowsMappingMode(int mm);
|
||||
|
||||
// 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
|
||||
|
@@ -36,7 +36,6 @@ class WXDLLEXPORT wxPalette: public wxPaletteBase
|
||||
|
||||
public:
|
||||
wxPalette();
|
||||
inline wxPalette(const wxPalette& rPalette) { Ref(rPalette); }
|
||||
|
||||
wxPalette( int n
|
||||
,const unsigned char* pRed
|
||||
@@ -62,7 +61,6 @@ public:
|
||||
|
||||
virtual bool Ok(void) const { return (m_refData != NULL) ; }
|
||||
|
||||
inline wxPalette& operator = (const wxPalette& rPalette) { if (*this == rPalette) return (*this); Ref(rPalette); return *this; }
|
||||
inline bool operator == (const wxPalette& rPalette) const
|
||||
{ return m_refData == rPalette.m_refData; }
|
||||
inline bool operator != (const wxPalette& rPalette) const
|
||||
|
@@ -52,11 +52,8 @@ public:
|
||||
wxPen( const wxBitmap& rStipple
|
||||
,int nWidth
|
||||
);
|
||||
inline wxPen(const wxPen& rPen) { Ref(rPen); }
|
||||
~wxPen();
|
||||
|
||||
inline wxPen& operator = (const wxPen& rPen)
|
||||
{ if (*this == rPen) return (*this); Ref(rPen); return *this; }
|
||||
inline bool operator == (const wxPen& rPen) const
|
||||
{ return m_refData == rPen.m_refData; }
|
||||
inline bool operator != (const wxPen& rPen) const
|
||||
|
@@ -59,14 +59,6 @@ public:
|
||||
wxRegion();
|
||||
~wxRegion();
|
||||
|
||||
//
|
||||
// Copying
|
||||
//
|
||||
inline wxRegion(const wxRegion& rSrc)
|
||||
{ Ref(rSrc); }
|
||||
inline wxRegion& operator = (const wxRegion& rSrc)
|
||||
{ Ref(rSrc); return (*this); }
|
||||
|
||||
//
|
||||
// Modify region
|
||||
//
|
||||
|
Reference in New Issue
Block a user