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:
Vadim Zeitlin
2006-02-09 00:51:23 +00:00
parent 1906f9df59
commit f8855e4725
125 changed files with 44 additions and 892 deletions

View File

@@ -20,10 +20,7 @@ class WXDLLEXPORT wxAcceleratorTable : public wxObject
{
public:
// default ctor
wxAcceleratorTable() : wxObject() { }
// copy ctor
wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject(accel) { Ref(accel); }
wxAcceleratorTable() { }
// load from .rc resource (Windows specific)
wxAcceleratorTable(const wxString& resource);
@@ -31,13 +28,6 @@ public:
// initialize from array
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
wxAcceleratorTable& operator=(const wxAcceleratorTable& accel)
{
if ( *this != accel )
Ref(accel);
return *this;
}
bool operator==(const wxAcceleratorTable& accel) const;
bool operator!=(const wxAcceleratorTable& accel) const
{ return !(*this == accel); }

View File

@@ -39,10 +39,7 @@ class WXDLLEXPORT wxBitmap : public wxGDIImage
{
public:
// default ctor creates an invalid bitmap, you must Create() it later
wxBitmap() { Init(); }
// Copy constructors
wxBitmap(const wxBitmap& bitmap) : wxGDIImage(bitmap) { Init(); Ref(bitmap); }
wxBitmap() { }
// Initialize with raw data
wxBitmap(const char bits[], int width, int height, int depth = 1);
@@ -79,14 +76,7 @@ public:
// we must have this, otherwise icons are silently copied into bitmaps using
// the copy ctor but the resulting bitmap is invalid!
wxBitmap(const wxIcon& icon) { Init(); CopyFromIcon(icon); }
wxBitmap& operator=(const wxBitmap& bitmap)
{
if ( m_refData != bitmap.m_refData )
Ref(bitmap);
return *this;
}
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
wxBitmap& operator=(const wxIcon& icon)
{
@@ -172,9 +162,6 @@ public:
#endif // __WXDEBUG__
protected:
// common part of all ctors
void Init();
virtual wxGDIImageRefData *CreateData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;

View File

@@ -28,7 +28,6 @@ public:
wxBrush();
wxBrush(const wxColour& col, int style = wxSOLID);
wxBrush(const wxBitmap& stipple);
wxBrush(const wxBrush& brush) : wxBrushBase(brush) { Ref(brush); }
virtual ~wxBrush();
virtual void SetColour(const wxColour& col);
@@ -36,7 +35,6 @@ public:
virtual void SetStyle(int style);
virtual void SetStipple(const wxBitmap& stipple);
wxBrush& operator=(const wxBrush& brush);
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }

View File

@@ -38,11 +38,6 @@ public:
wxColour(const wxString &colourName) { InitFromName(colourName); }
wxColour(const wxChar *colourName) { InitFromName(colourName); }
// copy ctors and assignment operators
wxColour(const wxColour& col);
wxColour& operator=( const wxColour& col);
// dtor
~wxColour();

View File

@@ -22,7 +22,6 @@ class WXDLLEXPORT wxCursor : public wxGDIImage
public:
// constructors
wxCursor();
wxCursor(const wxCursor& cursor) : wxGDIImage(cursor) { Ref(cursor); }
wxCursor(const wxImage& image);
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
@@ -33,9 +32,6 @@ public:
wxCursor(int idCursor);
virtual ~wxCursor();
wxCursor& operator=(const wxCursor& cursor)
{ if (*this == cursor) return (*this); Ref(cursor); return *this; }
bool operator==(const wxCursor& cursor) const;
bool operator!=(const wxCursor& cursor) const
{ return !(*this == cursor); }

View File

@@ -22,8 +22,7 @@ class WXDLLEXPORT wxFont : public wxFontBase
{
public:
// ctors and such
wxFont() { Init(); }
wxFont(const wxFont& font) : wxFontBase(font) { Init(); Ref(font); }
wxFont() { }
wxFont(int size,
int family,
@@ -33,8 +32,6 @@ public:
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Init();
(void)Create(size, family, style, weight, underlined, face, encoding);
}
@@ -46,16 +43,12 @@ public:
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Init();
(void)Create(pixelSize, family, style, weight,
underlined, face, encoding);
}
wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
{
Init();
Create(info, hFont);
}
@@ -89,9 +82,6 @@ public:
virtual ~wxFont();
// assignment
wxFont& operator=(const wxFont& font);
// implement base class pure virtuals
virtual int GetPointSize() const;
virtual wxSize GetPixelSize() const;
@@ -145,9 +135,6 @@ protected:
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
// common part of all ctors
void Init();
void Unshare();
private:

View File

@@ -44,9 +44,6 @@ public:
// default
wxIcon() { }
// copy
wxIcon(const wxIcon& icon) : wxGDIImage(icon) { Ref(icon); }
// from raw data
wxIcon(const char bits[], int width, int height);
@@ -68,8 +65,6 @@ public:
long type = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -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

View File

@@ -44,7 +44,6 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject
{
public:
wxMetafile(const wxString& file = wxEmptyString);
wxMetafile(const wxMetafile& metafile) { Ref(metafile); }
virtual ~wxMetafile();
// After this is called, the metafile cannot be used for anything
@@ -69,8 +68,6 @@ public:
void SetWindowsMappingMode(int mm);
// Operators
wxMetafile& operator=(const wxMetafile& metafile)
{ if (*this != metafile) Ref(metafile); return *this; }
bool operator==(const wxMetafile& metafile) const
{ return m_refData == metafile.m_refData; }
bool operator!=(const wxMetafile& metafile) const

View File

@@ -34,7 +34,6 @@ class WXDLLEXPORT wxPalette: public wxPaletteBase
public:
wxPalette(void);
inline wxPalette(const wxPalette& palette) : wxPaletteBase(palette) { Ref(palette); }
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
~wxPalette(void);
@@ -44,7 +43,6 @@ public:
virtual bool Ok(void) 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; }

View File

@@ -77,17 +77,8 @@ public:
wxPen();
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
wxPen(const wxBitmap& stipple, int width);
wxPen(const wxPen& pen) : wxGDIObject(pen) { Ref(pen); }
virtual ~wxPen();
wxPen& operator=(const wxPen& pen)
{
if ( this != &pen )
Ref(pen);
return *this;
}
bool operator==(const wxPen& pen) const
{
const wxPenRefData *penData = (wxPenRefData *)pen.m_refData;

View File

@@ -56,12 +56,6 @@ public:
virtual ~wxRegion();
// Copying
wxRegion(const wxRegion& r) : wxGDIObject(r)
{ Ref(r); }
wxRegion& operator = (const wxRegion& r)
{ Ref(r); return (*this); }
// Modify region
// -------------