From 93a9962fdea155552fc9f08d09b729ecf7d9073a Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 19 Aug 2019 02:05:21 +0200 Subject: [PATCH] Code enhancement: Use C++11 =default & =delete for the constructor & destructor --- .../Notepad++.exe.lastcodeanalysissucceeded | 0 .../src/MISC/PluginsManager/PluginsManager.h | 20 ++++---- PowerEditor/src/MISC/RegExt/regExtDlg.h | 6 +-- PowerEditor/src/MISC/md5/md5Dlgs.h | 4 +- .../src/ScitillaComponent/AutoCompletion.h | 1 + PowerEditor/src/ScitillaComponent/Buffer.h | 8 ++-- .../src/ScitillaComponent/FindReplaceDlg.h | 43 +++++++++-------- .../src/ScitillaComponent/GoToLineDlg.h | 2 +- PowerEditor/src/ScitillaComponent/Printer.h | 3 +- .../src/ScitillaComponent/UserDefineDialog.h | 12 ++--- .../src/ScitillaComponent/columnEditor.h | 8 +--- .../src/WinControls/AboutDlg/AboutDlg.h | 9 ++-- .../src/WinControls/AnsiCharPanel/ListView.h | 4 +- .../WinControls/ColourPicker/ColourPicker.h | 12 ++--- .../WinControls/ColourPicker/WordStyleDlg.h | 25 +++++----- .../WinControls/DockingWnd/DockingSplitter.h | 16 +++---- .../DocumentMap/documentSnapshot.h | 4 +- .../src/WinControls/FileBrowser/fileBrowser.h | 7 ++- .../FindCharsInRange/FindCharsInRange.h | 2 +- .../WinControls/FunctionList/functionParser.h | 4 +- .../src/WinControls/Grid/BabyGridWrapper.h | 5 +- .../src/WinControls/Grid/ShortcutMapper.h | 2 +- .../WinControls/ImageListSet/ImageListSet.h | 8 ++-- .../WinControls/PluginsAdmin/pluginsAdmin.h | 8 ++-- .../WinControls/Preference/preferenceDlg.h | 34 +++++++------- .../WinControls/ProjectPanel/ProjectPanel.h | 4 +- .../src/WinControls/ProjectPanel/TreeView.h | 6 +-- .../WinControls/StaticDialog/RunDlg/RunDlg.h | 4 +- PowerEditor/src/WinControls/TabBar/TabBar.h | 6 +-- .../src/WinControls/TaskList/TaskList.h | 2 +- PowerEditor/src/WinControls/ToolBar/ToolBar.h | 4 +- PowerEditor/src/WinControls/ToolTip/ToolTip.h | 2 +- .../VerticalFileSwitcherListView.h | 6 ++- .../src/WinControls/shortcut/RunMacroDlg.h | 5 +- .../src/WinControls/shortcut/shortcut.h | 4 +- PowerEditor/src/dpiManager.h | 6 +-- PowerEditor/src/lastRecentFileList.h | 5 +- PowerEditor/src/lesDlgs.h | 46 +++++++++---------- 38 files changed, 170 insertions(+), 177 deletions(-) create mode 100644 PowerEditor/bin/Notepad++.exe.lastcodeanalysissucceeded diff --git a/PowerEditor/bin/Notepad++.exe.lastcodeanalysissucceeded b/PowerEditor/bin/Notepad++.exe.lastcodeanalysissucceeded new file mode 100644 index 00000000..e69de29b diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h index b29aae14..7260e9a8 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h @@ -45,7 +45,7 @@ struct PluginCommand struct PluginInfo { - PluginInfo() {} + PluginInfo() = default; ~PluginInfo() { if (_pluginMenu) @@ -55,17 +55,17 @@ struct PluginInfo ::FreeLibrary(_hLib); } - HINSTANCE _hLib = NULL; - HMENU _pluginMenu = NULL; + HINSTANCE _hLib = nullptr; + HMENU _pluginMenu = nullptr; - PFUNCSETINFO _pFuncSetInfo = NULL; - PFUNCGETNAME _pFuncGetName = NULL; - PBENOTIFIED _pBeNotified = NULL; - PFUNCGETFUNCSARRAY _pFuncGetFuncsArray = NULL; - PMESSAGEPROC _pMessageProc = NULL; - PFUNCISUNICODE _pFuncIsUnicode = NULL; + PFUNCSETINFO _pFuncSetInfo = nullptr; + PFUNCGETNAME _pFuncGetName = nullptr; + PBENOTIFIED _pBeNotified = nullptr; + PFUNCGETFUNCSARRAY _pFuncGetFuncsArray = nullptr; + PMESSAGEPROC _pMessageProc = nullptr; + PFUNCISUNICODE _pFuncIsUnicode = nullptr; - FuncItem *_funcItems = NULL; + FuncItem *_funcItems = nullptr; int _nbFuncItem = 0; generic_string _moduleName; generic_string _funcName; diff --git a/PowerEditor/src/MISC/RegExt/regExtDlg.h b/PowerEditor/src/MISC/RegExt/regExtDlg.h index 244e7b62..9fa71af5 100644 --- a/PowerEditor/src/MISC/RegExt/regExtDlg.h +++ b/PowerEditor/src/MISC/RegExt/regExtDlg.h @@ -37,13 +37,13 @@ const int extNameLen = 32; class RegExtDlg : public StaticDialog { public : - RegExtDlg() : _isCustomize(false){}; - ~RegExtDlg(){}; + RegExtDlg() = default; + ~RegExtDlg() = default; void doDialog(bool isRTL = false); private : - bool _isCustomize; + bool _isCustomize = false; INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/MISC/md5/md5Dlgs.h b/PowerEditor/src/MISC/md5/md5Dlgs.h index d28160a5..42ece604 100644 --- a/PowerEditor/src/MISC/md5/md5Dlgs.h +++ b/PowerEditor/src/MISC/md5/md5Dlgs.h @@ -24,7 +24,7 @@ enum hashType {hash_md5, hash_sha256}; class HashFromFilesDlg : public StaticDialog { public : - HashFromFilesDlg() : StaticDialog() {}; + HashFromFilesDlg() = default; void doDialog(bool isRTL = false); virtual void destroy() {}; @@ -38,7 +38,7 @@ protected : class HashFromTextDlg : public StaticDialog { public : - HashFromTextDlg() : StaticDialog() {}; + HashFromTextDlg() = default; void doDialog(bool isRTL = false); virtual void destroy() {}; diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.h b/PowerEditor/src/ScitillaComponent/AutoCompletion.h index 0a4731e4..a49418c5 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.h +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.h @@ -36,6 +36,7 @@ const size_t tagMaxLen = 256; class ScintillaEditView; struct MatchedCharInserted { + MatchedCharInserted() = delete; char _c; int _pos; MatchedCharInserted(char c, int pos) : _c(c), _pos(pos) {}; diff --git a/PowerEditor/src/ScitillaComponent/Buffer.h b/PowerEditor/src/ScitillaComponent/Buffer.h index 76448452..9803b4c7 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.h +++ b/PowerEditor/src/ScitillaComponent/Buffer.h @@ -117,10 +117,10 @@ public: private: struct LoadedFileFormat { - LoadedFileFormat() {}; - LangType _language; - int _encoding; - EolType _eolFormat; + LoadedFileFormat() = default; + LangType _language = L_TEXT; + int _encoding = 0; + EolType _eolFormat = EolType::osdefault; }; FileManager() = default; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 8668e5bd..2bb7a4f1 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -227,12 +227,12 @@ friend class FindIncrementDlg; public : static FindOption _options; static FindOption* _env; - FindReplaceDlg() : StaticDialog(), _pFinder(NULL), _isRTL(false),\ - _fileNameLenMax(1024) { + FindReplaceDlg() { _uniFileName = new char[(_fileNameLenMax + 3) * 2]; _winVer = (NppParameters::getInstance()).getWinVersion(); _env = &_options; }; + ~FindReplaceDlg(); void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { @@ -354,8 +354,8 @@ private : RECT _countInSelFramePos, _replaceInSelFramePos; RECT _countInSelCheckPos, _replaceInSelCheckPos; - ScintillaEditView **_ppEditView; - Finder *_pFinder; + ScintillaEditView **_ppEditView = nullptr; + Finder *_pFinder = nullptr; std::vector _findersOfFinder; @@ -363,21 +363,20 @@ private : HWND _2ButtonsTip = nullptr; - bool _isRTL; + bool _isRTL = false; int _findAllResult; TCHAR _findAllResultStr[1024]; - int _fileNameLenMax; + int _fileNameLenMax = 1024; char *_uniFileName; TabBar _tab; - winVer _winVer; + winVer _winVer = winVer::WV_UNKNOWN; StatusBar _statusBar; FindStatus _statusbarFindStatus; HFONT _hMonospaceFont = nullptr; - void enableReplaceFunc(bool isEnable); void enableFindInFilesControls(bool isEnable = true); @@ -417,7 +416,7 @@ private : class FindIncrementDlg : public StaticDialog { public : - FindIncrementDlg() {}; + FindIncrementDlg() = default; void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false); virtual void destroy(); virtual void display(bool toShow = true) const; @@ -452,6 +451,10 @@ public: explicit Progress(HINSTANCE hInst); ~Progress(); + // Disable copy construction and operator= + Progress(const Progress&) = delete; + const Progress& operator=(const Progress&) = delete; + HWND open(HWND hCallerWnd = NULL, const TCHAR* header = NULL); void close(); @@ -484,22 +487,18 @@ private: static DWORD WINAPI threadFunc(LPVOID data); static LRESULT APIENTRY wndProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam); - // Disable copy construction and operator= - Progress(const Progress&); - const Progress& operator=(const Progress&); - int thread(); int createProgressWindow(); RECT adjustSizeAndPos(int width, int height); - HINSTANCE _hInst; - volatile HWND _hwnd; - HWND _hCallerWnd; - TCHAR _header[128]; - HANDLE _hThread; - HANDLE _hActiveState; - HWND _hPText; - HWND _hPBar; - HWND _hBtn; + HINSTANCE _hInst = nullptr; + volatile HWND _hwnd = nullptr; + HWND _hCallerWnd = nullptr; + TCHAR _header[128] = {'\0'}; + HANDLE _hThread = nullptr; + HANDLE _hActiveState = nullptr; + HWND _hPText = nullptr; + HWND _hPBar = nullptr; + HWND _hBtn = nullptr; }; diff --git a/PowerEditor/src/ScitillaComponent/GoToLineDlg.h b/PowerEditor/src/ScitillaComponent/GoToLineDlg.h index 12408311..705e33ba 100644 --- a/PowerEditor/src/ScitillaComponent/GoToLineDlg.h +++ b/PowerEditor/src/ScitillaComponent/GoToLineDlg.h @@ -33,7 +33,7 @@ class GoToLineDlg : public StaticDialog { public : - GoToLineDlg() : StaticDialog() {}; + GoToLineDlg() = default; void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { Window::init(hInst, hPere); diff --git a/PowerEditor/src/ScitillaComponent/Printer.h b/PowerEditor/src/ScitillaComponent/Printer.h index d2ee40ec..e1b3130e 100644 --- a/PowerEditor/src/ScitillaComponent/Printer.h +++ b/PowerEditor/src/ScitillaComponent/Printer.h @@ -45,7 +45,8 @@ struct NPP_RangeToFormat { class Printer { public : - Printer(){}; + Printer() = default; + void init(HINSTANCE hInst, HWND hwnd, ScintillaEditView *pSEView, bool showDialog, int startPos, int endPos, bool isRTL = false); size_t doPrint() { if (!::PrintDlg(&_pdlg)) diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h index 226e5d07..f4619f93 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h @@ -252,7 +252,7 @@ class SharedParametersDialog : public StaticDialog { friend class StylerDlg; public: - SharedParametersDialog() {}; + SharedParametersDialog() = default; virtual void updateDlg() = 0; protected : //Shared data @@ -266,7 +266,7 @@ protected : class FolderStyleDialog : public SharedParametersDialog { public: - FolderStyleDialog(): SharedParametersDialog() {}; + FolderStyleDialog() = default; void updateDlg(); protected : INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); @@ -279,7 +279,7 @@ private : class KeyWordsStyleDialog : public SharedParametersDialog { public: - KeyWordsStyleDialog(): SharedParametersDialog() {}; + KeyWordsStyleDialog() = default; void updateDlg(); protected : INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); @@ -289,7 +289,7 @@ protected : class CommentStyleDialog : public SharedParametersDialog { public : - CommentStyleDialog(): SharedParametersDialog() {}; + CommentStyleDialog() = default; void updateDlg(); protected : INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); @@ -301,7 +301,7 @@ private : class SymbolsStyleDialog : public SharedParametersDialog { public : - SymbolsStyleDialog(): SharedParametersDialog() {}; + SymbolsStyleDialog() = default; void updateDlg(); protected : INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); @@ -398,7 +398,7 @@ protected : class StringDlg : public StaticDialog { public : - StringDlg() : StaticDialog() {}; + StringDlg() = default; void init(HINSTANCE hInst, HWND parent, const TCHAR *title, const TCHAR *staticName, const TCHAR *text2Set, int txtLen = 0, const TCHAR* restrictedChars = nullptr, bool bGotoCenter = false) { Window::init(hInst, parent); _title = title; diff --git a/PowerEditor/src/ScitillaComponent/columnEditor.h b/PowerEditor/src/ScitillaComponent/columnEditor.h index 468523af..dc5ef7e0 100644 --- a/PowerEditor/src/ScitillaComponent/columnEditor.h +++ b/PowerEditor/src/ScitillaComponent/columnEditor.h @@ -38,8 +38,7 @@ const bool activeNumeric = false; class ColumnEditorDlg : public StaticDialog { public : - ColumnEditorDlg() : StaticDialog() {}; - + ColumnEditorDlg() = default; void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView); virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true) { @@ -55,18 +54,13 @@ public : }; virtual void display(bool toShow = true) const; - void switchTo(bool toText); - UCHAR getFormat(); protected : virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); private : - ScintillaEditView **_ppEditView = nullptr; - - }; diff --git a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h index 92790c24..2dd6705c 100644 --- a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h +++ b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.h @@ -51,7 +51,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.") class AboutDlg : public StaticDialog { public : - AboutDlg() : StaticDialog() {}; + AboutDlg() = default; void doDialog(); @@ -72,7 +72,7 @@ private : class DebugInfoDlg : public StaticDialog { public: - DebugInfoDlg() : StaticDialog() {}; + DebugInfoDlg() = default; void init(HINSTANCE hInst, HWND parent, bool isAdmin, const generic_string& loadedPlugins) { _isAdmin = isAdmin; @@ -100,7 +100,7 @@ private: class DoSaveOrNotBox : public StaticDialog { public: - DoSaveOrNotBox() : StaticDialog() {}; + DoSaveOrNotBox() = default; void init(HINSTANCE hInst, HWND parent, const TCHAR* fn, bool isMulti) { Window::init(hInst, parent); @@ -112,8 +112,7 @@ public: void doDialog(bool isRTL = false); - virtual void destroy() { - }; + virtual void destroy() {}; int getClickedButtonId() const { return clickedButtonId; diff --git a/PowerEditor/src/WinControls/AnsiCharPanel/ListView.h b/PowerEditor/src/WinControls/AnsiCharPanel/ListView.h index 3ef91292..6f05d785 100644 --- a/PowerEditor/src/WinControls/AnsiCharPanel/ListView.h +++ b/PowerEditor/src/WinControls/AnsiCharPanel/ListView.h @@ -43,8 +43,8 @@ struct columnInfo { class ListView : public Window { public: - ListView() : Window() {}; - virtual ~ListView() {}; + ListView() = default; + virtual ~ListView() = default; enum SortDirection { sortEncrease = 0, diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h index f47e5710..4144c838 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPicker.h @@ -37,8 +37,8 @@ class ColourPopup; class ColourPicker : public Window { public : - ColourPicker() : Window(), _currentColour(RGB(0xFF, 0x00, 0x00)), _pColourPopup(NULL), _isEnabled(true) {}; - ~ColourPicker(){}; + ColourPicker() = default; + ~ColourPicker() = default; virtual void init(HINSTANCE hInst, HWND parent); virtual void destroy(); void setColour(COLORREF c) { @@ -50,10 +50,10 @@ public : void setEnabled(bool enabled) {_isEnabled = enabled;}; private : - COLORREF _currentColour; - WNDPROC _buttonDefaultProc; - ColourPopup *_pColourPopup; - bool _isEnabled; + COLORREF _currentColour = RGB(0xFF, 0x00, 0x00); + WNDPROC _buttonDefaultProc = nullptr; + ColourPopup *_pColourPopup = nullptr; + bool _isEnabled = true; static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { return (((ColourPicker *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(Message, wParam, lParam)); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 72892d85..691ccbdb 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -68,7 +68,7 @@ private : class WordStyleDlg : public StaticDialog { public : - WordStyleDlg() {}; + WordStyleDlg() = default; void init(HINSTANCE hInst, HWND parent) { Window::init(hInst, parent); @@ -125,19 +125,18 @@ private : int _currentLexerIndex = 0; int _currentThemeIndex = 0; - HWND _hCheckBold; - HWND _hCheckItalic; - HWND _hCheckUnderline; - HWND _hFontNameCombo; - HWND _hFontSizeCombo; - HWND _hSwitch2ThemeCombo; + HWND _hCheckBold = nullptr; + HWND _hCheckItalic = nullptr; + HWND _hCheckUnderline = nullptr; + HWND _hFontNameCombo = nullptr; + HWND _hFontSizeCombo = nullptr; + HWND _hSwitch2ThemeCombo = nullptr; - HWND _hFgColourStaticText; - HWND _hBgColourStaticText; - HWND _hFontNameStaticText; - HWND _hFontSizeStaticText; - HWND _hStyleInfoStaticText; - //TCHAR _originalWarning[256]; + HWND _hFgColourStaticText = nullptr; + HWND _hBgColourStaticText = nullptr; + HWND _hFontNameStaticText = nullptr; + HWND _hFontSizeStaticText = nullptr; + HWND _hStyleInfoStaticText = nullptr; LexerStylerArray _lsArray; StyleArray _globalStyles; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h index 521c117c..00ac5a8c 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.h @@ -45,8 +45,8 @@ class DockingSplitter : public Window { public : - DockingSplitter() : _isLeftButtonDown(FALSE), _hMessage(NULL) {}; - ~DockingSplitter(){}; + DockingSplitter() = default; + ~DockingSplitter() = default; virtual void destroy() {}; @@ -59,14 +59,14 @@ protected: LRESULT runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); private: - HWND _hMessage; + HWND _hMessage = nullptr; - BOOL _isLeftButtonDown; - POINT _ptOldPos; - UINT _flags; + BOOL _isLeftButtonDown = FALSE; + POINT _ptOldPos = {0, 0}; + UINT _flags = 0; - static BOOL _isVertReg; - static BOOL _isHoriReg; + static BOOL _isVertReg; + static BOOL _isHoriReg; }; #endif // DOCKINGSPLITTER_H diff --git a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h index 0851d50e..5fd4f2a3 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h @@ -38,17 +38,15 @@ struct MapPosition; class DocumentPeeker : public StaticDialog { public: - DocumentPeeker(): StaticDialog() {}; + DocumentPeeker() = default; void init(HINSTANCE hInst, HWND hPere) { Window::init(hInst, hPere); }; void doDialog(POINT p, Buffer *buf, ScintillaEditView & scintSource); - void syncDisplay(Buffer *buf, ScintillaEditView & scintSource); - void setParent(HWND parent2set){ _hParent = parent2set; }; diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h index 3ca9d127..5daeeceb 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h @@ -58,12 +58,12 @@ friend class FileBrowser; friend class FolderInfo; public: + FileInfo() = delete; // constructor by default is forbidden FileInfo(const generic_string & name, FolderInfo *parent) : _name(name), _parent(parent) {}; generic_string getName() const { return _name; }; void setName(generic_string name) { _name = name; }; private: - FileInfo(){}; // constructor by default is forbidden FolderInfo *_parent = nullptr; generic_string _name; }; @@ -75,6 +75,7 @@ friend class FileBrowser; friend class FolderUpdater; public: + FolderInfo() = delete; // constructor by default is forbidden FolderInfo(const generic_string & name, FolderInfo *parent) : _name(name), _parent(parent) {}; void setRootPath(const generic_string& rootPath) { _rootPath = rootPath; }; generic_string getRootPath() const { return _rootPath; }; @@ -88,7 +89,6 @@ public: bool renameInStructure(std::vector linarPathArrayFrom, std::vector linarPathArrayTo); private: - FolderInfo(){}; // constructor by default is forbidden std::vector _subFolders; std::vector _files; FolderInfo *_parent = nullptr; @@ -104,8 +104,7 @@ class FolderUpdater { friend class FileBrowser; public: FolderUpdater(const FolderInfo& fi, FileBrowser *pFileBrowser) : _rootFolder(fi), _pFileBrowser(pFileBrowser) {}; - ~FolderUpdater() {}; - //bool updateTree(DWORD action, const std::vector & file2Change); // postMessage to FileBrowser to upgrade GUI + ~FolderUpdater() = default; void startWatcher(); void stopWatcher(); diff --git a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.h b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.h index 39a80351..dd5cf2cc 100644 --- a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.h +++ b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.h @@ -40,7 +40,7 @@ class FindCharsInRangeDlg : public StaticDialog { public : - FindCharsInRangeDlg() : StaticDialog() {}; + FindCharsInRangeDlg() = default; void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { Window::init(hInst, hPere); diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.h b/PowerEditor/src/WinControls/FunctionList/functionParser.h index e65f6b45..ccf5d09f 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.h +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.h @@ -49,7 +49,8 @@ public: virtual void parse(std::vector & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) = 0; void funcParse(std::vector & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT(""), const std::vector< std::pair > * commentZones = NULL); bool isInZones(int pos2Test, const std::vector< std::pair > & zones); - virtual ~FunctionParser() {}; + virtual ~FunctionParser() = default; + protected: generic_string _id; generic_string _displayName; @@ -66,6 +67,7 @@ protected: class FunctionZoneParser : public FunctionParser { public: + FunctionZoneParser() = delete; FunctionZoneParser(const TCHAR *id, const TCHAR *displayName, const TCHAR *commentExpr, const generic_string& rangeExpr, const generic_string& openSymbole, const generic_string& closeSymbole, const std::vector& classNameExprArray, const generic_string& functionExpr, const std::vector& functionNameExprArray): FunctionParser(id, displayName, commentExpr, functionExpr, functionNameExprArray, classNameExprArray), _rangeExpr(rangeExpr), _openSymbole(openSymbole), _closeSymbole(closeSymbole) {}; diff --git a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h index 2be95739..06b66d4e 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h +++ b/PowerEditor/src/WinControls/Grid/BabyGridWrapper.h @@ -35,8 +35,9 @@ class BabyGridWrapper : public Window { public : - BabyGridWrapper() : Window(){}; - ~BabyGridWrapper(){}; + BabyGridWrapper() = default; + ~BabyGridWrapper() = default; + virtual void init(HINSTANCE hInst, HWND parent, int16_t id); virtual void destroy() { ::DestroyWindow(_hSelf); diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h index 751e149b..8498766e 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h @@ -41,7 +41,7 @@ public: _shortcutFilter = TEXT(""); _dialogInitDone = false; }; - ~ShortcutMapper() {}; + ~ShortcutMapper() = default; void init(HINSTANCE hInst, HWND parent, GridState initState = STATE_MENU) { Window::init(hInst, parent); diff --git a/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h b/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h index 02faf6fb..820a58b7 100644 --- a/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h +++ b/PowerEditor/src/WinControls/ImageListSet/ImageListSet.h @@ -38,7 +38,7 @@ const int nbMax = 45; class IconList { public : - IconList() {}; + IconList() = default; void create(HINSTANCE hInst, int iconSize); void create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize); @@ -76,7 +76,7 @@ typedef std::vector IconListVector; class IconLists { public : - IconLists() {}; + IconLists() = default; HIMAGELIST getImageListHandle(int index) const { return _iconListVector[index].getHandle(); }; @@ -92,7 +92,7 @@ const int HLIST_DISABLE = 2; class ToolBarIcons : public IconLists { public : - ToolBarIcons() : _nbCmd(0) {}; + ToolBarIcons() = default; void init(ToolBarButtonUnit *buttonUnitArray, int arraySize); void create(HINSTANCE hInst, int iconSize); @@ -133,6 +133,6 @@ public : private : ToolBarIconIDs _tbiis; - unsigned int _nbCmd; + unsigned int _nbCmd = 0; }; diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h index 80f55625..975f2e2d 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h @@ -44,7 +44,7 @@ struct Version unsigned long _patch = 0; unsigned long _build = 0; - Version() {}; + Version() = default; Version(const generic_string& versionStr); void setVersionFrom(const generic_string& filePath); @@ -89,7 +89,7 @@ struct PluginUpdateInfo bool _isVisible = true; // if false then it should not be displayed generic_string describe(); - PluginUpdateInfo() {}; + PluginUpdateInfo() = default; PluginUpdateInfo(const generic_string& fullFilePath, const generic_string& fileName); }; @@ -126,7 +126,7 @@ struct SortDisplayNameDecrease final class PluginViewList { public: - PluginViewList() {}; + PluginViewList() = default; ~PluginViewList() { _ui.destroy(); for (auto i : _list) @@ -172,7 +172,7 @@ class PluginsAdminDlg final : public StaticDialog { public : PluginsAdminDlg(); - ~PluginsAdminDlg() {}; + ~PluginsAdminDlg() = default; void init(HINSTANCE hInst, HWND parent) { Window::init(hInst, parent); diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index d01f62a1..66a5168f 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -38,7 +38,7 @@ class SettingsDlg : public StaticDialog { public : - SettingsDlg() {}; + SettingsDlg() = default; private : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -47,7 +47,7 @@ private : class BarsDlg : public StaticDialog { public : - BarsDlg() {}; + BarsDlg() = default; private : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); }; @@ -55,7 +55,7 @@ private : class MarginsDlg : public StaticDialog { public : - MarginsDlg() {}; + MarginsDlg() = default; virtual void destroy() { _verticalEdgeLineNbColVal.destroy(); }; @@ -76,7 +76,7 @@ struct LangID_Name class DefaultNewDocDlg : public StaticDialog { public : - DefaultNewDocDlg() {}; + DefaultNewDocDlg() = default; private : std::vector _langList; @@ -91,7 +91,7 @@ private : class DefaultDirectoryDlg : public StaticDialog { public : - DefaultDirectoryDlg() {}; + DefaultDirectoryDlg() = default; private : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -100,7 +100,7 @@ private : class RecentFilesHistoryDlg : public StaticDialog { public : - RecentFilesHistoryDlg() {}; + RecentFilesHistoryDlg() = default; virtual void destroy() { _nbHistoryVal.destroy(); _customLenVal.destroy(); @@ -116,7 +116,7 @@ private : class LangMenuDlg : public StaticDialog { public : - LangMenuDlg() {}; + LangMenuDlg() = default; virtual void destroy() { _tabSizeVal.destroy(); }; @@ -131,7 +131,7 @@ private : class Highlighting : public StaticDialog { public : - Highlighting() {}; + Highlighting() = default; private : @@ -148,7 +148,8 @@ struct strCouple { class PrintSettingsDlg : public StaticDialog { public : - PrintSettingsDlg(){}; + PrintSettingsDlg() = default; + private : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); std::vector varList; @@ -158,7 +159,8 @@ private : class BackupDlg : public StaticDialog { public : - BackupDlg() {}; + BackupDlg() = default; + private : void updateBackupGUI(); INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -168,7 +170,7 @@ private : class AutoCompletionDlg : public StaticDialog { public : - AutoCompletionDlg() {}; + AutoCompletionDlg() = default; private : URLCtrl _nbCharVal; INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -177,7 +179,7 @@ private : class MultiInstDlg : public StaticDialog { public : - MultiInstDlg() {}; + MultiInstDlg() = default; private : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -186,7 +188,7 @@ private : class DelimiterSettingsDlg : public StaticDialog { public : - DelimiterSettingsDlg() {}; + DelimiterSettingsDlg() = default; ~DelimiterSettingsDlg() { if (_tip) ::DestroyWindow(_tip); @@ -206,7 +208,7 @@ private : class SettingsOnCloudDlg : public StaticDialog { public : - SettingsOnCloudDlg() {}; + SettingsOnCloudDlg() = default; private : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -215,7 +217,7 @@ private : class SearchEngineChoiceDlg : public StaticDialog { public : - SearchEngineChoiceDlg() {}; + SearchEngineChoiceDlg() = default; private : INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); @@ -226,7 +228,7 @@ class PreferenceDlg : public StaticDialog friend class NativeLangSpeaker; public : - PreferenceDlg(){}; + PreferenceDlg() = default; void init(HINSTANCE hInst, HWND parent) { Window::init(hInst, parent); diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h index b13a2107..930759f9 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.h @@ -145,8 +145,8 @@ protected: class FileRelocalizerDlg : public StaticDialog { public : - FileRelocalizerDlg() : StaticDialog() {}; - void init(HINSTANCE hInst, HWND parent){ + FileRelocalizerDlg() = default; + void init(HINSTANCE hInst, HWND parent) { Window::init(hInst, parent); }; diff --git a/PowerEditor/src/WinControls/ProjectPanel/TreeView.h b/PowerEditor/src/WinControls/ProjectPanel/TreeView.h index 2098df37..a08ae212 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/TreeView.h +++ b/PowerEditor/src/WinControls/ProjectPanel/TreeView.h @@ -44,9 +44,9 @@ struct TreeStateNode { class TreeView : public Window { public: - TreeView() : Window(), _isItemDragged(false) {}; + TreeView() = default; + virtual ~TreeView() = default; - virtual ~TreeView() {}; virtual void init(HINSTANCE hInst, HWND parent, int treeViewID); virtual void destroy(); HTREEITEM addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage, const TCHAR *filePath = NULL); @@ -131,7 +131,7 @@ protected: // Drag and Drop operations HTREEITEM _draggedItem; HIMAGELIST _draggedImageList; - bool _isItemDragged; + bool _isItemDragged = false; std::vector _canNotDragOutList; std::vector _canNotDropInList; bool canBeDropped(HTREEITEM draggedItem, HTREEITEM targetItem); diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h index e7ef0e1f..6185a9f3 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h @@ -39,7 +39,7 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str class Command { public : - Command(){}; + Command() = default; explicit Command(TCHAR *cmd) : _cmdLine(cmd){}; explicit Command(const generic_string& cmd) : _cmdLine(cmd){}; HINSTANCE run(HWND hWnd); @@ -54,7 +54,7 @@ private : class RunDlg : public Command, public StaticDialog { public : - RunDlg() : StaticDialog() {}; + RunDlg() = default; void doDialog(bool isRTL = false); virtual void destroy() {}; diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 8810f09f..5c00ba39 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -68,8 +68,8 @@ struct TBHDR class TabBar : public Window { public: - TabBar() : Window() {}; - virtual ~TabBar() {}; + TabBar() = default; + virtual ~TabBar() = default; virtual void destroy(); virtual void init(HINSTANCE hInst, HWND hwnd, bool isVertical = false, bool isMultiLine = false); virtual void reSizeTo(RECT & rc2Ajust); @@ -143,7 +143,7 @@ struct CloseButtonZone class TabBarPlus : public TabBar { public : - TabBarPlus() : TabBar() {}; + TabBarPlus() = default; enum tabColourIndex { activeText, activeFocusedTop, activeUnfocusedTop, inactiveText, inactiveBg }; diff --git a/PowerEditor/src/WinControls/TaskList/TaskList.h b/PowerEditor/src/WinControls/TaskList/TaskList.h index cd1d1ea3..89c4e9c5 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskList.h +++ b/PowerEditor/src/WinControls/TaskList/TaskList.h @@ -46,7 +46,7 @@ public: _rc.bottom = 0; }; - virtual ~TaskList() {}; + virtual ~TaskList() = default; void init(HINSTANCE hInst, HWND hwnd, HIMAGELIST hImaLst, int nbItem, int index2set); virtual void destroy(); void setFont(const TCHAR *fontName, int fontSize); diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.h b/PowerEditor/src/WinControls/ToolBar/ToolBar.h index cb639e02..20a33491 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.h +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.h @@ -67,8 +67,8 @@ class TiXmlNode; class ToolBar : public Window { public : - ToolBar():Window() {}; - virtual ~ToolBar(){}; + ToolBar() = default; + virtual ~ToolBar() = default; void initTheme(TiXmlDocument *toolIconsDocRoot); virtual bool init(HINSTANCE hInst, HWND hPere, toolBarStatusType type, diff --git a/PowerEditor/src/WinControls/ToolTip/ToolTip.h b/PowerEditor/src/WinControls/ToolTip/ToolTip.h index 75244306..e39b761d 100644 --- a/PowerEditor/src/WinControls/ToolTip/ToolTip.h +++ b/PowerEditor/src/WinControls/ToolTip/ToolTip.h @@ -35,7 +35,7 @@ class ToolTip : public Window { public : - ToolTip() {}; + ToolTip() = default; void destroy(){ ::DestroyWindow(_hSelf); diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h index cf30a1a9..26d5e7b7 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h @@ -42,15 +42,17 @@ typedef Buffer * BufferID; //each buffer has unique ID by which it can be retrie struct SwitcherFileInfo { BufferID _bufID; int _iView; + + SwitcherFileInfo() = delete; SwitcherFileInfo(BufferID buf, int view) : _bufID(buf), _iView(view){}; }; class VerticalFileSwitcherListView : public Window { public: - VerticalFileSwitcherListView() : Window() {}; + VerticalFileSwitcherListView() = default; + virtual ~VerticalFileSwitcherListView() = default; - virtual ~VerticalFileSwitcherListView() {}; virtual void init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst); virtual void destroy(); void initList(); diff --git a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h index 6cd94aec..83db082c 100644 --- a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h +++ b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.h @@ -39,9 +39,8 @@ class RunMacroDlg : public StaticDialog { public : - RunMacroDlg() : StaticDialog() {}; - ~RunMacroDlg() { - }; + RunMacroDlg() = default; + ~RunMacroDlg() = default; void init(HINSTANCE hInst, HWND hPere/*, ScintillaEditView **ppEditView*/) { Window::init(hInst, hPere); diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.h b/PowerEditor/src/WinControls/shortcut/shortcut.h index 95b4814e..08323569 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.h +++ b/PowerEditor/src/WinControls/shortcut/shortcut.h @@ -352,7 +352,7 @@ private : class Accelerator { //Handles accelerator keys for Notepad++ menu, including custom commands friend class ShortcutMapper; public: - Accelerator() {}; + Accelerator() = default; ~Accelerator() { if (_hAccTable) ::DestroyAcceleratorTable(_hAccTable); @@ -388,7 +388,7 @@ private: class ScintillaAccelerator { //Handles accelerator keys for scintilla public: - ScintillaAccelerator() {}; + ScintillaAccelerator() = default; void init(std::vector * vScintillas, HMENU hMenu, HWND menuParent); void updateKeys(); size_t nbScintillas() { return _vScintillas.size(); }; diff --git a/PowerEditor/src/dpiManager.h b/PowerEditor/src/dpiManager.h index ea31614c..07c9fb7b 100644 --- a/PowerEditor/src/dpiManager.h +++ b/PowerEditor/src/dpiManager.h @@ -86,8 +86,8 @@ public: private: // X and Y DPI values are provided, though to date all // Windows OS releases have equal X and Y scale values - int _dpiX; - int _dpiY; + int _dpiX = 0; + int _dpiY = 0; void init() { @@ -121,4 +121,4 @@ private: } }; -#endif //DPIMANAGER_H \ No newline at end of file +#endif //DPIMANAGER_H diff --git a/PowerEditor/src/lastRecentFileList.h b/PowerEditor/src/lastRecentFileList.h index 49856c10..fd46dc38 100644 --- a/PowerEditor/src/lastRecentFileList.h +++ b/PowerEditor/src/lastRecentFileList.h @@ -44,8 +44,6 @@ class LastRecentFileList public: LastRecentFileList() { _userMax = (NppParameters::getInstance()).getNbMaxRecentFile(); - for (int i = 0; i < NB_MAX_LRF_FILE; i++) - _idFreeArray[i] = false; }; void initMenu(HMENU hMenu, int idBase, int posBase, Accelerator *accelerator, bool doSubMenu = false); @@ -107,12 +105,11 @@ private: HMENU _hMenu = nullptr; int _posBase = -1; int _idBase = -1; - bool _idFreeArray[NB_MAX_LRF_FILE]; + bool _idFreeArray[NB_MAX_LRF_FILE] = {false}; bool _hasSeparators = false; bool _locked = false; int find(const TCHAR *fn); - int popFirstAvailableID(); void setAvailable(int id); }; diff --git a/PowerEditor/src/lesDlgs.h b/PowerEditor/src/lesDlgs.h index 08415207..942172c0 100644 --- a/PowerEditor/src/lesDlgs.h +++ b/PowerEditor/src/lesDlgs.h @@ -36,7 +36,7 @@ const int DEFAULT_NB_NUMBER = 2; class ValueDlg : public StaticDialog { public : - ValueDlg() : StaticDialog() {}; + ValueDlg() = default; void init(HINSTANCE hInst, HWND parent, int valueToSet, const TCHAR *text); int doDialog(POINT p, bool isRTL = false); void setNBNumber(int nbNumber) { @@ -53,7 +53,7 @@ private : int _nbNumber = DEFAULT_NB_NUMBER; int _defaultValue = 0; generic_string _name; - POINT _p; + POINT _p = {0, 0}; }; // 0 : sans fullscreen @@ -66,32 +66,32 @@ const int buttonStatus_postit = 2; class ButtonDlg : public StaticDialog { public : - ButtonDlg() : StaticDialog(), _buttonStatus(buttonStatus_nada) {}; - void init(HINSTANCE hInst, HWND parent){ - Window::init(hInst, parent); - }; + ButtonDlg() = default; + void init(HINSTANCE hInst, HWND parent){ + Window::init(hInst, parent); + }; - void doDialog(bool isRTL = false); - void destroy() {}; - int getButtonStatus() const { - return _buttonStatus; - }; - void setButtonStatus(int buttonStatus) { - _buttonStatus = buttonStatus; - }; + void doDialog(bool isRTL = false); + void destroy() {}; + int getButtonStatus() const { + return _buttonStatus; + }; + void setButtonStatus(int buttonStatus) { + _buttonStatus = buttonStatus; + }; - void display(bool toShow = true) const { - int cmdToShow = toShow?SW_SHOW:SW_HIDE; - if (!toShow) - { - cmdToShow = (_buttonStatus != buttonStatus_nada)?SW_SHOW:SW_HIDE; - } - ::ShowWindow(_hSelf, cmdToShow); - }; + void display(bool toShow = true) const { + int cmdToShow = toShow?SW_SHOW:SW_HIDE; + if (!toShow) + { + cmdToShow = (_buttonStatus != buttonStatus_nada)?SW_SHOW:SW_HIDE; + } + ::ShowWindow(_hSelf, cmdToShow); + }; protected : INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM); - int _buttonStatus; + int _buttonStatus = buttonStatus_nada; }; #endif //TABSIZE_DLG_H