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

This commit is contained in:
Paul Cornett
2019-04-05 10:21:04 -07:00
parent 691521e411
commit af1cf0a5f3
10 changed files with 40 additions and 41 deletions

View File

@@ -20,27 +20,26 @@ class LifePattern
{ {
public: public:
// This ctor is used by the LifeReader class // This ctor is used by the LifeReader class
LifePattern(wxString name, LifePattern(const wxString& name,
wxString description, const wxString& description,
wxString rules, const wxString& rules,
wxArrayString shape) const wxArrayString& shape)
: m_name(name)
, m_description(description)
, m_rules(rules)
, m_shape(shape)
{ {
m_name = name;
m_description = description;
m_rules = rules;
m_shape = shape;
} }
// A more convenient ctor for the built-in samples // A more convenient ctor for the built-in samples
LifePattern(wxString name, LifePattern(const wxString& name,
wxString description, const wxString& description,
int width, int width,
int height, int height,
const char *shape) const char *shape)
: m_name(name)
, m_description(description)
{ {
m_name = name;
m_description = description;
m_rules = wxEmptyString;
// TODO: add the positions later, since the formatting command // TODO: add the positions later, since the formatting command
// causes a crash due to conversion objects not being available // causes a crash due to conversion objects not being available
// during initialisation. // during initialisation.

View File

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

View File

@@ -154,11 +154,11 @@ wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
wxTreeEvent::wxTreeEvent(const wxTreeEvent & event) wxTreeEvent::wxTreeEvent(const wxTreeEvent & event)
: wxNotifyEvent(event) : wxNotifyEvent(event)
, m_evtKey(event.m_evtKey) , m_evtKey(event.m_evtKey)
, m_item(event.m_item)
, m_itemOld(event.m_itemOld)
, m_pointDrag(event.m_pointDrag) , m_pointDrag(event.m_pointDrag)
, m_label(event.m_label) , m_label(event.m_label)
{ {
m_item = event.m_item;
m_itemOld = event.m_itemOld;
m_editCancelled = event.m_editCancelled; m_editCancelled = event.m_editCancelled;
} }

View File

@@ -292,8 +292,8 @@ bool wxHtmlCell::IsBefore(wxHtmlCell *cell) const
wxIMPLEMENT_ABSTRACT_CLASS(wxHtmlWordCell, wxHtmlCell); wxIMPLEMENT_ABSTRACT_CLASS(wxHtmlWordCell, wxHtmlCell);
wxHtmlWordCell::wxHtmlWordCell(const wxString& word, const wxDC& dc) : wxHtmlCell() wxHtmlWordCell::wxHtmlWordCell(const wxString& word, const wxDC& dc) : wxHtmlCell()
, m_Word(word)
{ {
m_Word = word;
wxCoord w, h, d; wxCoord w, h, d;
dc.GetTextExtent(m_Word, &w, &h, &d); dc.GetTextExtent(m_Word, &w, &h, &d);
m_Width = w; m_Width = w;

View File

@@ -158,6 +158,7 @@ wxPenRefData::wxPenRefData()
wxPenRefData::wxPenRefData(const wxPenRefData& data) wxPenRefData::wxPenRefData(const wxPenRefData& data)
:wxGDIRefData() :wxGDIRefData()
, m_colour(data.m_colour)
{ {
m_style = data.m_style; m_style = data.m_style;
m_width = data.m_width; m_width = data.m_width;
@@ -165,11 +166,12 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
m_cap = data.m_cap; m_cap = data.m_cap;
m_nbDash = data.m_nbDash; m_nbDash = data.m_nbDash;
m_dash = data.m_dash; m_dash = data.m_dash;
m_colour = data.m_colour;
m_hPen = 0; m_hPen = 0;
} }
wxPenRefData::wxPenRefData(const wxPenInfo& info) wxPenRefData::wxPenRefData(const wxPenInfo& info)
: m_stipple(info.GetStipple())
, m_colour(info.GetColour())
{ {
Init(); Init();
@@ -177,9 +179,7 @@ wxPenRefData::wxPenRefData(const wxPenInfo& info)
m_width = info.GetWidth(); m_width = info.GetWidth();
m_join = info.GetJoin(); m_join = info.GetJoin();
m_cap = info.GetCap(); m_cap = info.GetCap();
m_stipple = info.GetStipple();
m_nbDash = info.GetDashes(&m_dash); m_nbDash = info.GetDashes(&m_dash);
m_colour = info.GetColour();
} }
wxPenRefData::~wxPenRefData() wxPenRefData::~wxPenRefData()

View File

@@ -266,13 +266,13 @@ static const char * const ribbon_help_button_xpm[] = {
}; };
wxRibbonMSWArtProvider::wxRibbonMSWArtProvider(bool set_colour_scheme) wxRibbonMSWArtProvider::wxRibbonMSWArtProvider(bool set_colour_scheme)
#if defined( __WXMAC__ )
: m_tab_label_font(*wxSMALL_FONT)
#else
: m_tab_label_font(*wxNORMAL_FONT)
#endif
{ {
m_flags = 0; m_flags = 0;
#if defined( __WXMAC__ )
m_tab_label_font = *wxSMALL_FONT;
#else
m_tab_label_font = *wxNORMAL_FONT;
#endif
m_button_bar_label_font = m_tab_label_font; m_button_bar_label_font = m_tab_label_font;
m_panel_label_font = m_tab_label_font; m_panel_label_font = m_tab_label_font;

View File

@@ -258,8 +258,8 @@ int wxRichTextFloatCollector::GetWidthFromFloatRect(const wxRichTextFloatRectMap
} }
wxRichTextFloatCollector::wxRichTextFloatCollector(const wxRect& rect) : m_left(wxRichTextFloatRectMapCmp), m_right(wxRichTextFloatRectMapCmp) wxRichTextFloatCollector::wxRichTextFloatCollector(const wxRect& rect) : m_left(wxRichTextFloatRectMapCmp), m_right(wxRichTextFloatRectMapCmp)
, m_availableRect(rect)
{ {
m_availableRect = rect;
m_para = NULL; m_para = NULL;
} }
@@ -14317,13 +14317,15 @@ void wxTextAttrDimension::CollectCommonAttributes(const wxTextAttrDimension& att
} }
wxTextAttrDimensionConverter::wxTextAttrDimensionConverter(wxDC& dc, double scale, const wxSize& parentSize) wxTextAttrDimensionConverter::wxTextAttrDimensionConverter(wxDC& dc, double scale, const wxSize& parentSize)
: m_parentSize(parentSize)
{ {
m_ppi = dc.GetPPI().x; m_scale = scale; m_parentSize = parentSize; m_ppi = dc.GetPPI().x; m_scale = scale;
} }
wxTextAttrDimensionConverter::wxTextAttrDimensionConverter(int ppi, double scale, const wxSize& parentSize) wxTextAttrDimensionConverter::wxTextAttrDimensionConverter(int ppi, double scale, const wxSize& parentSize)
: m_parentSize(parentSize)
{ {
m_ppi = ppi; m_scale = scale; m_parentSize = parentSize; m_ppi = ppi; m_scale = scale;
} }
int wxTextAttrDimensionConverter::ConvertTenthsMMToPixels(int units) const int wxTextAttrDimensionConverter::ConvertTenthsMMToPixels(int units) const

View File

@@ -447,16 +447,15 @@ bool wxRichTextPrintout::SubstituteKeywords(wxString& str, const wxString& title
*/ */
wxRichTextPrinting::wxRichTextPrinting(const wxString& name, wxWindow *parentWindow) wxRichTextPrinting::wxRichTextPrinting(const wxString& name, wxWindow *parentWindow)
: m_title(name)
, m_previewRect(100, 100, 800, 800)
{ {
m_richTextBufferPrinting = NULL; m_richTextBufferPrinting = NULL;
m_richTextBufferPreview = NULL; m_richTextBufferPreview = NULL;
m_parentWindow = parentWindow; m_parentWindow = parentWindow;
m_title = name;
m_printData = NULL; m_printData = NULL;
m_previewRect = wxRect(wxPoint(100, 100), wxSize(800, 800));
m_pageSetupData = new wxPageSetupDialogData; m_pageSetupData = new wxPageSetupDialogData;
m_pageSetupData->EnableMargins(true); m_pageSetupData->EnableMargins(true);
m_pageSetupData->SetMarginTopLeft(wxPoint(25, 25)); m_pageSetupData->SetMarginTopLeft(wxPoint(25, 25));

View File

@@ -279,6 +279,14 @@ private:
wxDialUpManagerImpl::wxDialUpManagerImpl() wxDialUpManagerImpl::wxDialUpManagerImpl()
: m_BeaconHost(WXDIALUP_MANAGER_DEFAULT_BEACONHOST)
#ifdef __SGI__
, m_ConnectCommand("/usr/etc/ppp")
#elif defined(__LINUX__)
// default values for Debian/GNU linux
, m_ConnectCommand("pon")
, m_HangUpCommand("poff")
#endif
{ {
m_IsOnline = m_IsOnline =
m_connCard = Net_Unknown; m_connCard = Net_Unknown;
@@ -286,17 +294,8 @@ wxDialUpManagerImpl::wxDialUpManagerImpl()
m_timer = NULL; m_timer = NULL;
m_CanUseIfconfig = -1; // unknown m_CanUseIfconfig = -1; // unknown
m_CanUsePing = -1; // unknown m_CanUsePing = -1; // unknown
m_BeaconHost = WXDIALUP_MANAGER_DEFAULT_BEACONHOST;
m_BeaconPort = 80; m_BeaconPort = 80;
#ifdef __SGI__
m_ConnectCommand = wxT("/usr/etc/ppp");
#elif defined(__LINUX__)
// default values for Debian/GNU linux
m_ConnectCommand = wxT("pon");
m_HangUpCommand = wxT("poff");
#endif
wxChar * dial = wxGetenv(wxT("WXDIALUP_DIALCMD")); wxChar * dial = wxGetenv(wxT("WXDIALUP_DIALCMD"));
wxChar * hup = wxGetenv(wxT("WXDIALUP_HUPCMD")); wxChar * hup = wxGetenv(wxT("WXDIALUP_HUPCMD"));
SetConnectCommand(dial ? wxString(dial) : m_ConnectCommand, SetConnectCommand(dial ? wxString(dial) : m_ConnectCommand,

View File

@@ -64,11 +64,11 @@ class WXDLLEXPORT wxDialUpManagerImpl : public wxDialUpManager
{ {
public: public:
wxDialUpManagerImpl() wxDialUpManagerImpl()
: m_BeaconHost(WXDIALUP_MANAGER_DEFAULT_BEACONHOST)
{ {
m_IsOnline = -1; // unknown m_IsOnline = -1; // unknown
m_timer = NULL; m_timer = NULL;
m_CanUseIfconfig = -1; // unknown m_CanUseIfconfig = -1; // unknown
m_BeaconHost = WXDIALUP_MANAGER_DEFAULT_BEACONHOST;
m_BeaconPort = 80; m_BeaconPort = 80;
} }