From 7789ee4fba568cfbb722afd0437785d47bf65f1b Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Wed, 27 May 2015 02:25:13 +0200 Subject: [PATCH] Add keyword 'explicit' to some constructors --- src/fbutton.h | 2 +- src/fbuttongroup.h | 2 +- src/fcheckbox.h | 2 +- src/fdialog.h | 2 +- src/fevent.h | 12 ++++++------ src/ffiledialog.h | 2 +- src/flabel.h | 2 +- src/flineedit.h | 2 +- src/flistbox.h | 8 ++++---- src/fmessagebox.h | 2 +- src/fobject.h | 2 +- src/foptimove.h | 2 +- src/fprogressbar.h | 2 +- src/fradiobutton.h | 2 +- src/fscrollbar.h | 2 +- src/fstatusbar.h | 4 ++-- src/fstring.cpp | 8 ++++---- src/fstring.h | 6 +++--- src/ftextview.h | 2 +- src/ftogglebutton.h | 2 +- src/fwidget.h | 2 +- src/fwindow.h | 2 +- test/mandelbrot.cpp | 2 +- test/timer.cpp | 2 +- test/ui.cpp | 4 ++-- 25 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/fbutton.h b/src/fbutton.h index d110bfc2..89dd8bed 100644 --- a/src/fbutton.h +++ b/src/fbutton.h @@ -31,7 +31,7 @@ class FButton : public FWidget friend class FDialog; public: - FButton (FWidget* parent=0); // constructor + explicit FButton (FWidget* parent=0); // constructor FButton (const FString&, FWidget* parent=0); // constructor virtual ~FButton(); // destructor diff --git a/src/fbuttongroup.h b/src/fbuttongroup.h index a4d6c572..75bf77c1 100644 --- a/src/fbuttongroup.h +++ b/src/fbuttongroup.h @@ -38,7 +38,7 @@ class FButtonGroup : public FWidget void drawLabel(); public: - FButtonGroup (FWidget* parent=0); // constructor + explicit FButtonGroup (FWidget* parent=0); // constructor FButtonGroup (const FString&, FWidget* parent=0); // constructor virtual ~FButtonGroup(); // destructor const char* getClassName() const; diff --git a/src/fcheckbox.h b/src/fcheckbox.h index 02bc40aa..1f921ff2 100644 --- a/src/fcheckbox.h +++ b/src/fcheckbox.h @@ -23,7 +23,7 @@ class FCheckBox : public FToggleButton void drawCheckButton(); public: - FCheckBox (FWidget* parent=0); // constructor + explicit FCheckBox (FWidget* parent=0); // constructor FCheckBox (const FString&, FWidget* parent=0); // constructor virtual ~FCheckBox(); // destructor const char* getClassName() const; diff --git a/src/fdialog.h b/src/fdialog.h index f7bb73f1..974ea43e 100644 --- a/src/fdialog.h +++ b/src/fdialog.h @@ -46,7 +46,7 @@ class FDialog : public FWindow virtual void onClose (FCloseEvent*); public: - FDialog (FWidget* parent=0); // constructor + explicit FDialog (FWidget* parent=0); // constructor FDialog (const FString&, FWidget* parent=0); // constructor virtual ~FDialog(); // destructor virtual const char* getClassName() const; diff --git a/src/fevent.h b/src/fevent.h index e2742447..1426ee0b 100644 --- a/src/fevent.h +++ b/src/fevent.h @@ -40,7 +40,7 @@ class FEvent // event base class { public: - FEvent(int); + explicit FEvent(int); ~FEvent(); int type() const; @@ -190,7 +190,7 @@ enum FocusTypes class FFocusEvent : public FEvent // focus event { public: - FFocusEvent (int); + explicit FFocusEvent (int); bool gotFocus() const; bool lostFocus() const; FocusTypes getFocusType() const; @@ -239,7 +239,7 @@ class FAccelEvent : public FEvent // focus event class FResizeEvent : public FEvent // resize event { public: - FResizeEvent (int); + explicit FResizeEvent (int); bool isAccepted() const; void accept(); void ignore(); @@ -258,7 +258,7 @@ class FResizeEvent : public FEvent // resize event class FShowEvent : public FEvent // show event { public: - FShowEvent (int); + explicit FShowEvent (int); }; #define F_SHOW_EVENT(x) ((FShowEvent*)x) @@ -271,7 +271,7 @@ class FShowEvent : public FEvent // show event class FHideEvent : public FEvent // hide event { public: - FHideEvent (int); + explicit FHideEvent (int); }; #define F_HIDE_EVENT(x) ((FHideEvent*)x) @@ -284,7 +284,7 @@ class FHideEvent : public FEvent // hide event class FCloseEvent : public FEvent // close event { public: - FCloseEvent(int); + explicit FCloseEvent(int); bool isAccepted() const; void accept(); void ignore(); diff --git a/src/ffiledialog.h b/src/ffiledialog.h index ee4fbd37..6a8b48c0 100644 --- a/src/ffiledialog.h +++ b/src/ffiledialog.h @@ -83,7 +83,7 @@ class FFileDialog : public FDialog void adjustSize(); public: - FFileDialog (FWidget* parent=0); + explicit FFileDialog (FWidget* parent=0); FFileDialog (const FString&, const FString&, DialogType type = FFileDialog::Open, diff --git a/src/flabel.h b/src/flabel.h index 616cb1c7..8004683b 100644 --- a/src/flabel.h +++ b/src/flabel.h @@ -39,7 +39,7 @@ class FLabel : public FWidget void draw(); public: - FLabel (FWidget* parent=0); // constructor + explicit FLabel (FWidget* parent=0); // constructor FLabel (const FString&, FWidget* parent=0); // constructor virtual ~FLabel(); // destructor const char* getClassName() const; diff --git a/src/flineedit.h b/src/flineedit.h index 9f07130d..ef4f7e26 100644 --- a/src/flineedit.h +++ b/src/flineedit.h @@ -56,7 +56,7 @@ class FLineEdit : public FWidget void adjustSize(); public: - FLineEdit (FWidget* parent=0); // constructor + explicit FLineEdit (FWidget* parent=0); // constructor FLineEdit (const FString&, FWidget* parent=0); // constructor virtual ~FLineEdit(); // destructor const char* getClassName() const; diff --git a/src/flistbox.h b/src/flistbox.h index 16e6209d..39b887f0 100644 --- a/src/flistbox.h +++ b/src/flistbox.h @@ -25,9 +25,9 @@ class FListBoxItem bool selected; public: FListBoxItem (); - FListBoxItem (FString&); - FListBoxItem (const std::string&); - FListBoxItem (const char*); + explicit FListBoxItem (FString&); + explicit FListBoxItem (const std::string&); + explicit FListBoxItem (const char*); virtual ~FListBoxItem(); virtual FString getText() const; protected: @@ -111,7 +111,7 @@ class FListBox : public FWidget void adjustSize(); public: - FListBox (FWidget* parent=0); // constructor + explicit FListBox (FWidget* parent=0); // constructor ~FListBox(); // destructor const char* getClassName() const; diff --git a/src/fmessagebox.h b/src/fmessagebox.h index c643827c..7440a949 100644 --- a/src/fmessagebox.h +++ b/src/fmessagebox.h @@ -58,7 +58,7 @@ class FMessageBox : public FDialog void cb_processClick (FWidget*, void*); public: - FMessageBox (FWidget* parent=0); + explicit FMessageBox (FWidget* parent=0); FMessageBox (const FString&, const FString&, int, int, int, FWidget* parent=0); diff --git a/src/fobject.h b/src/fobject.h index a3cde427..4fc262b7 100644 --- a/src/fobject.h +++ b/src/fobject.h @@ -58,7 +58,7 @@ class FObject friend class FApplication; public: - FObject (FObject* parent=0); + explicit FObject (FObject* parent=0); virtual ~FObject(); virtual const char* getClassName() const; diff --git a/src/foptimove.h b/src/foptimove.h index 9cb15dac..f9586507 100644 --- a/src/foptimove.h +++ b/src/foptimove.h @@ -78,7 +78,7 @@ class FOptiMove bool isWideMove (int, int, int, int); public: - FOptiMove(int baud=0); // constructor + explicit FOptiMove(int baud=0); // constructor ~FOptiMove(); // destructor void setBaudRate (int); diff --git a/src/fprogressbar.h b/src/fprogressbar.h index 841d5c45..5d04877e 100644 --- a/src/fprogressbar.h +++ b/src/fprogressbar.h @@ -29,7 +29,7 @@ class FProgressbar : public FWidget virtual void draw(); public: - FProgressbar(FWidget* parent=0); // constructor + explicit FProgressbar(FWidget* parent=0); // constructor virtual ~FProgressbar(); const char* getClassName() const; diff --git a/src/fradiobutton.h b/src/fradiobutton.h index 41fec81b..5ec36a86 100644 --- a/src/fradiobutton.h +++ b/src/fradiobutton.h @@ -22,7 +22,7 @@ class FRadioButton : public FToggleButton void drawRadioButton(); public: - FRadioButton (FWidget* parent=0); // constructor + explicit FRadioButton (FWidget* parent=0); // constructor FRadioButton (const FString&, FWidget* parent=0); // constructor virtual ~FRadioButton(); // destructor const char* getClassName() const; diff --git a/src/fscrollbar.h b/src/fscrollbar.h index 7f22d549..24b12f94 100644 --- a/src/fscrollbar.h +++ b/src/fscrollbar.h @@ -59,7 +59,7 @@ class FScrollbar : public FWidget void processScroll(); public: - FScrollbar(FWidget* parent=0); // constructor + explicit FScrollbar(FWidget* parent=0); // constructor FScrollbar(int o=fc::vertical, FWidget* parent=0); // constructor virtual ~FScrollbar(); const char* getClassName() const; diff --git a/src/fstatusbar.h b/src/fstatusbar.h index 9bb85411..7108f5d1 100644 --- a/src/fstatusbar.h +++ b/src/fstatusbar.h @@ -33,7 +33,7 @@ class FStatusKey : public FWidget void setStatusbar (FStatusBar*); public: - FStatusKey (FWidget* parent=0); + explicit FStatusKey (FWidget* parent=0); FStatusKey (int, FString&, FWidget* parent=0); FStatusKey (int, const std::string&, FWidget* parent=0); FStatusKey (int, const char*, FWidget* parent=0); @@ -133,7 +133,7 @@ class FStatusBar : public FWindow void adjustSize(); public: - FStatusBar (FWidget* parent=0); // constructor + explicit FStatusBar (FWidget* parent=0); // constructor virtual ~FStatusBar(); // destructor virtual const char* getClassName() const; diff --git a/src/fstring.cpp b/src/fstring.cpp index 3bba4640..5487d616 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -753,7 +753,7 @@ const FString operator + (const std::string& s1, const FString& s2) //---------------------------------------------------------------------- const FString operator + (const char* s1, const FString& s2) { - FString tmp = s1; + FString tmp(s1); tmp._insert ( tmp.getLength(), uInt(wcslen(s2.wc_str())), s2.wc_str() ); @@ -763,7 +763,7 @@ const FString operator + (const char* s1, const FString& s2) //---------------------------------------------------------------------- const FString operator + (const wchar_t c, const FString& s) { - FString tmp = c; + FString tmp(c); tmp._insert (1, uInt(wcslen(s.wc_str())), s.wc_str()); return (tmp); } @@ -771,7 +771,7 @@ const FString operator + (const wchar_t c, const FString& s) //---------------------------------------------------------------------- const FString operator + (const char c, const FString& s) { - FString tmp = c; + FString tmp(c); tmp._insert (1, uInt(wcslen(s.wc_str())), s.wc_str()); return (tmp); } @@ -1832,7 +1832,7 @@ FString FString::expandTabs (uInt tabstop) const { uLong end; FString instr(this->string); - FString outstr = ""; + FString outstr(""); std::vector tab_split = instr.split("\t"); end = tab_split.size(); diff --git a/src/fstring.h b/src/fstring.h index babcc026..c0c7db45 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -71,8 +71,8 @@ class FString public: FString (); // constructor - FString (int); // constructor - FString (uInt); // constructor + explicit FString (int); // constructor + explicit FString (uInt); // constructor FString (int, wchar_t); // constructor FString (uInt, wchar_t); // constructor FString (int, char); // constructor @@ -83,7 +83,7 @@ class FString FString (const std::string&); // constructor FString (const char*); // constructor FString (const wchar_t); // constructor - FString (const char); // constructor + explicit FString (const char); // constructor virtual ~FString (); // destructor bool isNull() const; diff --git a/src/ftextview.h b/src/ftextview.h index a2fb50e3..10194071 100644 --- a/src/ftextview.h +++ b/src/ftextview.h @@ -45,7 +45,7 @@ class FTextView : public FWidget void adjustSize(); public: - FTextView (FWidget* parent=0); // constructor + explicit FTextView (FWidget* parent=0); // constructor ~FTextView(); // destructor const char* getClassName() const; diff --git a/src/ftogglebutton.h b/src/ftogglebutton.h index 17d60102..1d94ef44 100644 --- a/src/ftogglebutton.h +++ b/src/ftogglebutton.h @@ -45,7 +45,7 @@ class FToggleButton : public FWidget virtual void onKeyPress (FKeyEvent*); public: - FToggleButton (FWidget* parent=0); // constructor + explicit FToggleButton (FWidget* parent=0); // constructor FToggleButton (const FString&, FWidget* parent=0); // constructor virtual ~FToggleButton(); // destructor virtual const char* getClassName() const; diff --git a/src/fwidget.h b/src/fwidget.h index 9db09f6f..fabe352f 100644 --- a/src/fwidget.h +++ b/src/fwidget.h @@ -220,7 +220,7 @@ class FWidget : public FObject, public FTerm virtual bool focusPrevChild (void); public: - FWidget (FWidget* parent=0); // constructor + explicit FWidget (FWidget* parent=0); // constructor ~FWidget(); // destructor const char* getClassName() const; diff --git a/src/fwindow.h b/src/fwindow.h index 9138b91a..c8c715a1 100644 --- a/src/fwindow.h +++ b/src/fwindow.h @@ -31,7 +31,7 @@ class FWindow : public FWidget virtual void onWindowLowered (FEvent*); public: - FWindow (FWidget* parent=0); // constructor + explicit FWindow (FWidget* parent=0); // constructor ~FWindow (); // destructor const char* getClassName() const; diff --git a/test/mandelbrot.cpp b/test/mandelbrot.cpp index e16a815d..626459f9 100644 --- a/test/mandelbrot.cpp +++ b/test/mandelbrot.cpp @@ -17,7 +17,7 @@ class Mandelbrot : public FDialog virtual void draw(); public: - Mandelbrot (FWidget* parent=0); // constructor + explicit Mandelbrot (FWidget* parent=0); // constructor ~Mandelbrot(); // destructor void onAccel (FAccelEvent*); void onClose (FCloseEvent*); diff --git a/test/timer.cpp b/test/timer.cpp index bf9fb5a3..8d9eb935 100644 --- a/test/timer.cpp +++ b/test/timer.cpp @@ -9,7 +9,7 @@ class timer : public FWidget { public: - timer (FWidget* parent = 0); + explicit timer (FWidget* parent = 0); protected: virtual void draw(); void onTimer (FTimerEvent*); diff --git a/test/ui.cpp b/test/ui.cpp index d39f8a79..f764eb9b 100644 --- a/test/ui.cpp +++ b/test/ui.cpp @@ -21,7 +21,7 @@ class ProgressDialog : public FDialog FProgressbar* progressBar; public: - ProgressDialog (FWidget* parent=0); // constructor + explicit ProgressDialog (FWidget* parent=0); // constructor ~ProgressDialog(); // destructor void onShow (FShowEvent*); @@ -149,7 +149,7 @@ class MyDialog : public FDialog private: FListBox* myList; public: - MyDialog (FWidget* parent=0); // constructor + explicit MyDialog (FWidget* parent=0); // constructor ~MyDialog(); // destructor void onClose (FCloseEvent*); void cb_noFunctionMsg (FWidget*, void*);