Use ctor-initializer rather than assignment for non-POD class members

This commit is contained in:
Paul Cornett
2019-02-25 10:23:35 -08:00
parent 8df0cfba2a
commit 7c3ce912e0
59 changed files with 150 additions and 177 deletions

View File

@@ -231,8 +231,8 @@ public:
{
public:
DataHolder(const T2& value)
: m_value(value)
{
m_value = value;
}
virtual ~DataHolder() { }

View File

@@ -69,10 +69,10 @@ public:
wxAuiToolBarEvent(wxEventType commandType = wxEVT_NULL,
int winId = 0)
: wxNotifyEvent(commandType, winId)
, m_clickPt(-1, -1)
, m_rect(-1, -1, 0, 0)
{
m_isDropdownClicked = false;
m_clickPt = wxPoint(-1, -1);
m_rect = wxRect(-1,-1, 0, 0);
m_toolId = -1;
}
wxEvent *Clone() const wxOVERRIDE { return new wxAuiToolBarEvent(*this); }

View File

@@ -148,6 +148,11 @@ class WXDLLIMPEXP_AUI wxAuiPaneInfo
public:
wxAuiPaneInfo()
: best_size(wxDefaultSize)
, min_size(wxDefaultSize)
, max_size(wxDefaultSize)
, floating_pos(wxDefaultPosition)
, floating_size(wxDefaultSize)
{
window = NULL;
frame = NULL;
@@ -156,11 +161,6 @@ public:
dock_layer = 0;
dock_row = 0;
dock_pos = 0;
floating_pos = wxDefaultPosition;
floating_size = wxDefaultSize;
best_size = wxDefaultSize;
min_size = wxDefaultSize;
max_size = wxDefaultSize;
dock_proportion = 0;
DefaultPane();

View File

@@ -40,7 +40,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerCtrlNameStr[];
class WXDLLIMPEXP_CORE wxColourPickerWidgetBase
{
public:
wxColourPickerWidgetBase() { m_colour = *wxBLACK; }
wxColourPickerWidgetBase() : m_colour(*wxBLACK) { }
virtual ~wxColourPickerWidgetBase() {}
wxColour GetColour() const

View File

@@ -464,7 +464,7 @@ public:
// ------------------------------------------------------------------------
// default ctor does not initialize the object, use Set()!
wxDateTime() { m_time = wxINT64_MIN; }
wxDateTime() : m_time(wxINT64_MIN) { }
// from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
inline wxDateTime(time_t timet);
@@ -1114,7 +1114,7 @@ public:
// ------------------------------------------------------------------------
// construct from internal representation
wxDateTime(const wxLongLong& time) { m_time = time; }
wxDateTime(const wxLongLong& time) : m_time(time) { }
// get the internal representation
inline wxLongLong GetValue() const;
@@ -1343,7 +1343,7 @@ public:
// ------------------------------------------------------------------------
// construct from internal representation
wxTimeSpan(const wxLongLong& diff) { m_diff = diff; }
wxTimeSpan(const wxLongLong& diff) : m_diff(diff) { }
// get the internal representation
wxLongLong GetValue() const { return m_diff; }

View File

@@ -160,7 +160,7 @@ public:
// The class of wxEvent-derived class carried by the events of this type.
typedef T EventClass;
wxEventTypeTag(wxEventType type) { m_type = type; }
wxEventTypeTag(wxEventType type) : m_type(type) { }
// Return a wxEventType reference for the initialization of the static
// event tables. See wxEventTableEntry::m_eventType for a more thorough
@@ -1898,8 +1898,8 @@ public:
}
wxGestureEvent(const wxGestureEvent& event) : wxEvent(event)
, m_pos(event.m_pos)
{
m_pos = event.m_pos;
m_isStart = event.m_isStart;
m_isEnd = event.m_isEnd;
}

View File

@@ -38,14 +38,14 @@ public:
, wxDateTime modif
#endif // wxUSE_DATETIME
)
: m_Location(loc)
, m_MimeType(mimetype.Lower())
, m_Anchor(anchor)
#if wxUSE_DATETIME
, m_Modif(modif)
#endif
{
m_Stream = stream;
m_Location = loc;
m_MimeType = mimetype.Lower();
m_Anchor = anchor;
#if wxUSE_DATETIME
m_Modif = modif;
#endif // wxUSE_DATETIME
}
virtual ~wxFSFile() { delete m_Stream; }

View File

@@ -43,8 +43,8 @@ class wxGtkCollatableString
{
public:
wxGtkCollatableString( const wxString &label, gchar *key )
: m_label(label)
{
m_label = label;
m_key = key;
}

View File

@@ -32,11 +32,11 @@ class WXDLLIMPEXP_HTML wxHtmlBookRecord
public:
wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
const wxString& title, const wxString& start)
: m_BookFile(bookfile)
, m_BasePath(basepath)
, m_Title(title)
, m_Start(start)
{
m_BookFile = bookfile;
m_BasePath = basepath;
m_Title = title;
m_Start = start;
// for debugging, give the contents index obvious default values
m_ContentsStart = m_ContentsEnd = -1;
}

View File

@@ -571,7 +571,7 @@ protected:
class WXDLLIMPEXP_HTML wxHtmlColourCell : public wxHtmlCell
{
public:
wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell(), m_Colour(clr) { m_Flags = flags;}
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
wxHtmlRenderingInfo& info) wxOVERRIDE;
virtual void DrawInvisible(wxDC& dc, int x, int y,
@@ -596,7 +596,7 @@ protected:
class WXDLLIMPEXP_HTML wxHtmlFontCell : public wxHtmlCell
{
public:
wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); }
wxHtmlFontCell(wxFont *font) : wxHtmlCell(), m_Font(*font) { }
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
wxHtmlRenderingInfo& info) wxOVERRIDE;
virtual void DrawInvisible(wxDC& dc, int x, int y,

View File

@@ -578,10 +578,10 @@ public:
wxHtmlCell *cell, const wxPoint &pt,
const wxMouseEvent &ev)
: wxCommandEvent(commandType, id)
, m_mouseEvent(ev)
, m_pt(pt)
{
m_cell = cell;
m_pt = pt;
m_mouseEvent = ev;
m_bLinkWasClicked = false;
}

View File

@@ -81,9 +81,9 @@ public:
wxColourPropertyValue( const wxColourPropertyValue& v )
: wxObject()
, m_colour(v.m_colour)
{
m_type = v.m_type;
m_colour = v.m_colour;
}
void Init( wxUint32 type, const wxColour& colour )
@@ -94,9 +94,9 @@ public:
wxColourPropertyValue( const wxColour& colour )
: wxObject()
, m_colour(colour)
{
m_type = wxPG_COLOUR_CUSTOM;
m_colour = colour;
}
wxColourPropertyValue( wxUint32 type )

View File

@@ -338,8 +338,8 @@ class WXDLLIMPEXP_PROPGRID wxPGCommonValue
public:
wxPGCommonValue( const wxString& label, wxPGCellRenderer* renderer )
: m_label(label)
{
m_label = label;
m_renderer = renderer;
renderer->IncRef();
}

View File

@@ -485,7 +485,7 @@ class classname##VariantData: public wxVariantData \
{ \
public:\
classname##VariantData() {} \
classname##VariantData( const classname &value ) { m_value = value; } \
classname##VariantData( const classname &value ) : m_value(value) { } \
\
classname &GetValue() { return m_value; } \
\

View File

@@ -25,13 +25,13 @@ public:
int micro = 0,
const wxString& description = wxString(),
const wxString& copyright = wxString())
: m_name(name)
, m_description(description)
, m_copyright(copyright)
{
m_name = name;
m_major = major;
m_minor = minor;
m_micro = micro;
m_description = description;
m_copyright = copyright;
}
// Default copy ctor, assignment operator and dtor are ok.