From 4c47631bf4aa907aad4f7088bc7edc7e5cde11b9 Mon Sep 17 00:00:00 2001 From: subhasan Date: Fri, 24 May 2019 15:29:12 -0700 Subject: [PATCH] Cleanup - termDispatch.hpp & adaptDispatch.hpp overrides (#1004) * Fix for https://github.com/microsoft/terminal/issues/896 * Fixing spaces * Base Class destructor is virtual, derived class destructor shouldn't be declared vitual or override * Update src/terminal/adapter/termDispatch.hpp nit: remove space Co-Authored-By: Mike Griese --- src/terminal/adapter/InteractDispatch.hpp | 18 +-- src/terminal/adapter/adaptDispatch.hpp | 129 +++++++++++----------- src/terminal/adapter/termDispatch.hpp | 126 ++++++++++----------- 3 files changed, 137 insertions(+), 136 deletions(-) diff --git a/src/terminal/adapter/InteractDispatch.hpp b/src/terminal/adapter/InteractDispatch.hpp index a49b07eec..413bb4753 100644 --- a/src/terminal/adapter/InteractDispatch.hpp +++ b/src/terminal/adapter/InteractDispatch.hpp @@ -26,16 +26,16 @@ namespace Microsoft::Console::VirtualTerminal InteractDispatch(ConGetSet* const pConApi); - virtual ~InteractDispatch() override = default; + ~InteractDispatch() = default; - virtual bool WriteInput(_In_ std::deque>& inputEvents) override; - virtual bool WriteCtrlC() override; - virtual bool WriteString(_In_reads_(cch) const wchar_t* const pws, const size_t cch) override; - virtual bool WindowManipulation(const DispatchTypes::WindowManipulationType uiFunction, - _In_reads_(cParams) const unsigned short* const rgusParams, - const size_t cParams) override; // DTTERM_WindowManipulation - virtual bool MoveCursor(const unsigned int row, - const unsigned int col) override; + bool WriteInput(_In_ std::deque>& inputEvents) override; + bool WriteCtrlC() override; + bool WriteString(_In_reads_(cch) const wchar_t* const pws, const size_t cch) override; + bool WindowManipulation(const DispatchTypes::WindowManipulationType uiFunction, + _In_reads_(cParams) const unsigned short* const rgusParams, + const size_t cParams) override; // DTTERM_WindowManipulation + bool MoveCursor(const unsigned int row, + const unsigned int col) override; private: std::unique_ptr _pConApi; diff --git a/src/terminal/adapter/adaptDispatch.hpp b/src/terminal/adapter/adaptDispatch.hpp index 53ce1de4e..39d05d986 100644 --- a/src/terminal/adapter/adaptDispatch.hpp +++ b/src/terminal/adapter/adaptDispatch.hpp @@ -33,76 +33,77 @@ namespace Microsoft::Console::VirtualTerminal AdaptDispatch(ConGetSet* const pConApi, AdaptDefaults* const pDefaults); - virtual void Execute(const wchar_t wchControl) + void Execute(const wchar_t wchControl) override { _pDefaults->Execute(wchControl); } - virtual void PrintString(const wchar_t* const rgwch, const size_t cch); - virtual void Print(const wchar_t wchPrintable); + void PrintString(const wchar_t* const rgwch, const size_t cch) override; + void Print(const wchar_t wchPrintable) override; - virtual bool CursorUp(_In_ unsigned int const uiDistance); // CUU - virtual bool CursorDown(_In_ unsigned int const uiDistance); // CUD - virtual bool CursorForward(_In_ unsigned int const uiDistance); // CUF - virtual bool CursorBackward(_In_ unsigned int const uiDistance); // CUB - virtual bool CursorNextLine(_In_ unsigned int const uiDistance); // CNL - virtual bool CursorPrevLine(_In_ unsigned int const uiDistance); // CPL - virtual bool CursorHorizontalPositionAbsolute(_In_ unsigned int const uiColumn); // CHA - virtual bool VerticalLinePositionAbsolute(_In_ unsigned int const uiLine); // VPA - virtual bool CursorPosition(_In_ unsigned int const uiLine, _In_ unsigned int const uiColumn); // CUP - virtual bool CursorSavePosition(); // DECSC - virtual bool CursorRestorePosition(); // DECRC - virtual bool CursorVisibility(const bool fIsVisible); // DECTCEM - virtual bool EraseInDisplay(const DispatchTypes::EraseType eraseType); // ED - virtual bool EraseInLine(const DispatchTypes::EraseType eraseType); // EL - virtual bool EraseCharacters(_In_ unsigned int const uiNumChars); // ECH - virtual bool InsertCharacter(_In_ unsigned int const uiCount); // ICH - virtual bool DeleteCharacter(_In_ unsigned int const uiCount); // DCH - virtual bool SetGraphicsRendition(_In_reads_(cOptions) const DispatchTypes::GraphicsOptions* const rgOptions, - const size_t cOptions); // SGR - virtual bool DeviceStatusReport(const DispatchTypes::AnsiStatusType statusType); // DSR - virtual bool DeviceAttributes(); // DA - virtual bool ScrollUp(_In_ unsigned int const uiDistance); // SU - virtual bool ScrollDown(_In_ unsigned int const uiDistance); // SD - virtual bool InsertLine(_In_ unsigned int const uiDistance); // IL - virtual bool DeleteLine(_In_ unsigned int const uiDistance); // DL - virtual bool SetColumns(_In_ unsigned int const uiColumns); // DECSCPP, DECCOLM - virtual bool SetPrivateModes(_In_reads_(cParams) const DispatchTypes::PrivateModeParams* const rParams, - const size_t cParams); // DECSET - virtual bool ResetPrivateModes(_In_reads_(cParams) const DispatchTypes::PrivateModeParams* const rParams, - const size_t cParams); // DECRST - virtual bool SetCursorKeysMode(const bool fApplicationMode); // DECCKM - virtual bool SetKeypadMode(const bool fApplicationMode); // DECKPAM, DECKPNM - virtual bool EnableCursorBlinking(const bool bEnable); // ATT610 - virtual bool SetTopBottomScrollingMargins(const SHORT sTopMargin, - const SHORT sBottomMargin); // DECSTBM - virtual bool ReverseLineFeed(); // RI - virtual bool SetWindowTitle(const std::wstring_view title) override; // OscWindowTitle - virtual bool UseAlternateScreenBuffer(); // ASBSET - virtual bool UseMainScreenBuffer(); // ASBRST - virtual bool HorizontalTabSet(); // HTS - virtual bool ForwardTab(const SHORT sNumTabs); // CHT - virtual bool BackwardsTab(const SHORT sNumTabs); // CBT - virtual bool TabClear(const SHORT sClearType); // TBC - virtual bool DesignateCharset(const wchar_t wchCharset); // DesignateCharset - virtual bool SoftReset(); // DECSTR - virtual bool HardReset(); // RIS - virtual bool EnableVT200MouseMode(const bool fEnabled); // ?1000 - virtual bool EnableUTF8ExtendedMouseMode(const bool fEnabled); // ?1005 - virtual bool EnableSGRExtendedMouseMode(const bool fEnabled); // ?1006 - virtual bool EnableButtonEventMouseMode(const bool fEnabled); // ?1002 - virtual bool EnableAnyEventMouseMode(const bool fEnabled); // ?1003 - virtual bool EnableAlternateScroll(const bool fEnabled); // ?1007 - virtual bool SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle); // DECSCUSR - virtual bool SetCursorColor(const COLORREF cursorColor); + bool CursorUp(_In_ unsigned int const uiDistance) override; // CUU + bool CursorDown(_In_ unsigned int const uiDistance) override; // CUD + bool CursorForward(_In_ unsigned int const uiDistance) override; // CUF + bool CursorBackward(_In_ unsigned int const uiDistance) override; // CUB + bool CursorNextLine(_In_ unsigned int const uiDistance) override; // CNL + bool CursorPrevLine(_In_ unsigned int const uiDistance) override; // CPL + bool CursorHorizontalPositionAbsolute(_In_ unsigned int const uiColumn) override; // CHA + bool VerticalLinePositionAbsolute(_In_ unsigned int const uiLine) override; // VPA + bool CursorPosition(_In_ unsigned int const uiLine, _In_ unsigned int const uiColumn) override; // CUP + bool CursorSavePosition() override; // DECSC + bool CursorRestorePosition() override; // DECRC + bool CursorVisibility(const bool fIsVisible) override; // DECTCEM + bool EraseInDisplay(const DispatchTypes::EraseType eraseType) override; // ED + bool EraseInLine(const DispatchTypes::EraseType eraseType) override; // EL + bool EraseCharacters(_In_ unsigned int const uiNumChars) override; // ECH + bool InsertCharacter(_In_ unsigned int const uiCount) override; // ICH + bool DeleteCharacter(_In_ unsigned int const uiCount) override; // DCH + bool SetGraphicsRendition(_In_reads_(cOptions) const DispatchTypes::GraphicsOptions* const rgOptions, + const size_t cOptions) override; // SGR + bool DeviceStatusReport(const DispatchTypes::AnsiStatusType statusType) override; // DSR + bool DeviceAttributes() override; // DA + bool ScrollUp(_In_ unsigned int const uiDistance) override; // SU + bool ScrollDown(_In_ unsigned int const uiDistance) override; // SD + bool InsertLine(_In_ unsigned int const uiDistance) override; // IL + bool DeleteLine(_In_ unsigned int const uiDistance) override; // DL + bool SetColumns(_In_ unsigned int const uiColumns) override; // DECSCPP, DECCOLM + bool SetPrivateModes(_In_reads_(cParams) const DispatchTypes::PrivateModeParams* const rParams, + const size_t cParams) override; // DECSET + bool ResetPrivateModes(_In_reads_(cParams) const DispatchTypes::PrivateModeParams* const rParams, + const size_t cParams) override; // DECRST + bool SetCursorKeysMode(const bool fApplicationMode) override; // DECCKM + bool SetKeypadMode(const bool fApplicationMode) override; // DECKPAM, DECKPNM + bool EnableCursorBlinking(const bool bEnable) override; // ATT610 + bool SetTopBottomScrollingMargins(const SHORT sTopMargin, + const SHORT sBottomMargin) override; // DECSTBM + bool ReverseLineFeed() override; // RI + bool SetWindowTitle(const std::wstring_view title) override; // OscWindowTitle + bool UseAlternateScreenBuffer() override; // ASBSET + bool UseMainScreenBuffer() override; // ASBRST + bool HorizontalTabSet() override; // HTS + bool ForwardTab(const SHORT sNumTabs) override; // CHT + bool BackwardsTab(const SHORT sNumTabs) override; // CBT + bool TabClear(const SHORT sClearType) override; // TBC + bool DesignateCharset(const wchar_t wchCharset) override; // DesignateCharset + bool SoftReset() override; // DECSTR + bool HardReset() override; // RIS + bool EnableVT200MouseMode(const bool fEnabled) override; // ?1000 + bool EnableUTF8ExtendedMouseMode(const bool fEnabled) override; // ?1005 + bool EnableSGRExtendedMouseMode(const bool fEnabled) override; // ?1006 + bool EnableButtonEventMouseMode(const bool fEnabled) override; // ?1002 + bool EnableAnyEventMouseMode(const bool fEnabled) override; // ?1003 + bool EnableAlternateScroll(const bool fEnabled) override; // ?1007 + bool SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle) override; // DECSCUSR + bool SetCursorColor(const COLORREF cursorColor) override; - virtual bool SetColorTableEntry(const size_t tableIndex, const DWORD dwColor); // OscColorTable - virtual bool SetDefaultForeground(const DWORD dwColor); // OSCDefaultForeground - virtual bool SetDefaultBackground(const DWORD dwColor); // OSCDefaultBackground - - virtual bool WindowManipulation(const DispatchTypes::WindowManipulationType uiFunction, - _In_reads_(cParams) const unsigned short* const rgusParams, - const size_t cParams); // DTTERM_WindowManipulation + bool SetColorTableEntry(const size_t tableIndex, + const DWORD dwColor) override; // OscColorTable + bool SetDefaultForeground(const DWORD dwColor) override; // OSCDefaultForeground + bool SetDefaultBackground(const DWORD dwColor) override; // OSCDefaultBackground + + bool WindowManipulation(const DispatchTypes::WindowManipulationType uiFunction, + _In_reads_(cParams) const unsigned short* const rgusParams, + const size_t cParams) override; // DTTERM_WindowManipulation private: diff --git a/src/terminal/adapter/termDispatch.hpp b/src/terminal/adapter/termDispatch.hpp index a56352367..acc3e3147 100644 --- a/src/terminal/adapter/termDispatch.hpp +++ b/src/terminal/adapter/termDispatch.hpp @@ -20,79 +20,79 @@ namespace Microsoft::Console::VirtualTerminal class Microsoft::Console::VirtualTerminal::TermDispatch : public Microsoft::Console::VirtualTerminal::ITermDispatch { public: - virtual void Execute(const wchar_t wchControl) = 0; - virtual void Print(const wchar_t wchPrintable) = 0; - virtual void PrintString(const wchar_t* const rgwch, const size_t cch) = 0; + void Execute(const wchar_t wchControl) override = 0; + void Print(const wchar_t wchPrintable) override = 0; + void PrintString(const wchar_t* const rgwch, const size_t cch) override = 0; - virtual bool CursorUp(const unsigned int /*uiDistance*/) { return false; }; // CUU - virtual bool CursorDown(const unsigned int /*uiDistance*/) { return false; } // CUD - virtual bool CursorForward(const unsigned int /*uiDistance*/) { return false; } // CUF - virtual bool CursorBackward(const unsigned int /*uiDistance*/) { return false; } // CUB - virtual bool CursorNextLine(const unsigned int /*uiDistance*/) { return false; } // CNL - virtual bool CursorPrevLine(const unsigned int /*uiDistance*/) { return false; } // CPL - virtual bool CursorHorizontalPositionAbsolute(const unsigned int /*uiColumn*/) { return false; } // CHA - virtual bool VerticalLinePositionAbsolute(const unsigned int /*uiLine*/) { return false; } // VPA - virtual bool CursorPosition(const unsigned int /*uiLine*/, const unsigned int /*uiColumn*/) { return false; } // CUP - virtual bool CursorSavePosition() { return false; } // DECSC - virtual bool CursorRestorePosition() { return false; } // DECRC - virtual bool CursorVisibility(const bool /*fIsVisible*/) { return false; } // DECTCEM - virtual bool InsertCharacter(const unsigned int /*uiCount*/) { return false; } // ICH - virtual bool DeleteCharacter(const unsigned int /*uiCount*/) { return false; } // DCH - virtual bool ScrollUp(const unsigned int /*uiDistance*/) { return false; } // SU - virtual bool ScrollDown(const unsigned int /*uiDistance*/) { return false; } // SD - virtual bool InsertLine(const unsigned int /*uiDistance*/) { return false; } // IL - virtual bool DeleteLine(const unsigned int /*uiDistance*/) { return false; } // DL - virtual bool SetColumns(const unsigned int /*uiColumns*/) { return false; } // DECSCPP, DECCOLM - virtual bool SetCursorKeysMode(const bool /*fApplicationMode*/) { return false; } // DECCKM - virtual bool SetKeypadMode(const bool /*fApplicationMode*/) { return false; } // DECKPAM, DECKPNM - virtual bool EnableCursorBlinking(const bool /*fEnable*/) { return false; } // ATT610 - virtual bool SetTopBottomScrollingMargins(const SHORT /*sTopMargin*/, const SHORT /*sBottomMargin*/) { return false; } // DECSTBM - virtual bool ReverseLineFeed() { return false; } // RI - virtual bool SetWindowTitle(std::wstring_view /*title*/) { return false; } // OscWindowTitle - virtual bool UseAlternateScreenBuffer() { return false; } // ASBSET - virtual bool UseMainScreenBuffer() { return false; } // ASBRST - virtual bool HorizontalTabSet() { return false; } // HTS - virtual bool ForwardTab(const SHORT /*sNumTabs*/) { return false; } // CHT - virtual bool BackwardsTab(const SHORT /*sNumTabs*/) { return false; } // CBT - virtual bool TabClear(const SHORT /*sClearType*/) { return false; } // TBC - virtual bool EnableVT200MouseMode(const bool /*fEnabled*/) { return false; } // ?1000 - virtual bool EnableUTF8ExtendedMouseMode(const bool /*fEnabled*/) { return false; } // ?1005 - virtual bool EnableSGRExtendedMouseMode(const bool /*fEnabled*/) { return false; } // ?1006 - virtual bool EnableButtonEventMouseMode(const bool /*fEnabled*/) { return false; } // ?1002 - virtual bool EnableAnyEventMouseMode(const bool /*fEnabled*/) { return false; } // ?1003 - virtual bool EnableAlternateScroll(const bool /*fEnabled*/) { return false; } // ?1007 - virtual bool SetColorTableEntry(const size_t /*tableIndex*/, const DWORD /*dwColor*/) { return false; } // OSCColorTable - virtual bool SetDefaultForeground(const DWORD /*dwColor*/) { return false; } // OSCDefaultForeground - virtual bool SetDefaultBackground(const DWORD /*dwColor*/) { return false; } // OSCDefaultBackground + bool CursorUp(const unsigned int /*uiDistance*/) override { return false; } // CUU + bool CursorDown(const unsigned int /*uiDistance*/) override { return false; } // CUD + bool CursorForward(const unsigned int /*uiDistance*/) override { return false; } // CUF + bool CursorBackward(const unsigned int /*uiDistance*/) override { return false; } // CUB + bool CursorNextLine(const unsigned int /*uiDistance*/) override { return false; } // CNL + bool CursorPrevLine(const unsigned int /*uiDistance*/) override { return false; } // CPL + bool CursorHorizontalPositionAbsolute(const unsigned int /*uiColumn*/) override { return false; } // CHA + bool VerticalLinePositionAbsolute(const unsigned int /*uiLine*/) override { return false; } // VPA + bool CursorPosition(const unsigned int /*uiLine*/, const unsigned int /*uiColumn*/) override { return false; } // CUP + bool CursorSavePosition() override { return false; } // DECSC + bool CursorRestorePosition() override { return false; } // DECRC + bool CursorVisibility(const bool /*fIsVisible*/) override { return false; } // DECTCEM + bool InsertCharacter(const unsigned int /*uiCount*/) override { return false; } // ICH + bool DeleteCharacter(const unsigned int /*uiCount*/) override { return false; } // DCH + bool ScrollUp(const unsigned int /*uiDistance*/) override { return false; } // SU + bool ScrollDown(const unsigned int /*uiDistance*/) override { return false; } // SD + bool InsertLine(const unsigned int /*uiDistance*/) override { return false; } // IL + bool DeleteLine(const unsigned int /*uiDistance*/) override { return false; } // DL + bool SetColumns(const unsigned int /*uiColumns*/) override { return false; } // DECSCPP, DECCOLM + bool SetCursorKeysMode(const bool /*fApplicationMode*/) override { return false; } // DECCKM + bool SetKeypadMode(const bool /*fApplicationMode*/) override { return false; } // DECKPAM, DECKPNM + bool EnableCursorBlinking(const bool /*fEnable*/) override { return false; } // ATT610 + bool SetTopBottomScrollingMargins(const SHORT /*sTopMargin*/, const SHORT /*sBottomMargin*/) override { return false; } // DECSTBM + bool ReverseLineFeed() override { return false; } // RI + bool SetWindowTitle(std::wstring_view /*title*/) override { return false; } // OscWindowTitle + bool UseAlternateScreenBuffer() override { return false; } // ASBSET + bool UseMainScreenBuffer() override { return false; } // ASBRST + bool HorizontalTabSet() override { return false; } // HTS + bool ForwardTab(const SHORT /*sNumTabs*/) override { return false; } // CHT + bool BackwardsTab(const SHORT /*sNumTabs*/) override { return false; } // CBT + bool TabClear(const SHORT /*sClearType*/) override { return false; } // TBC + bool EnableVT200MouseMode(const bool /*fEnabled*/) override { return false; } // ?1000 + bool EnableUTF8ExtendedMouseMode(const bool /*fEnabled*/) override { return false; } // ?1005 + bool EnableSGRExtendedMouseMode(const bool /*fEnabled*/) override { return false; } // ?1006 + bool EnableButtonEventMouseMode(const bool /*fEnabled*/)override { return false; } // ?1002 + bool EnableAnyEventMouseMode(const bool /*fEnabled*/) override { return false; } // ?1003 + bool EnableAlternateScroll(const bool /*fEnabled*/) override { return false; } // ?1007 + bool SetColorTableEntry(const size_t /*tableIndex*/, const DWORD /*dwColor*/) override { return false; } // OSCColorTable + bool SetDefaultForeground(const DWORD /*dwColor*/) override { return false; } // OSCDefaultForeground + bool SetDefaultBackground(const DWORD /*dwColor*/) override { return false; } // OSCDefaultBackground - virtual bool EraseInDisplay(const DispatchTypes::EraseType /* eraseType*/) { return false; } // ED - virtual bool EraseInLine(const DispatchTypes::EraseType /* eraseType*/) { return false; } // EL - virtual bool EraseCharacters(const unsigned int /*uiNumChars*/){ return false; } // ECH + bool EraseInDisplay(const DispatchTypes::EraseType /* eraseType*/) override { return false; } // ED + bool EraseInLine(const DispatchTypes::EraseType /* eraseType*/) override { return false; } // EL + bool EraseCharacters(const unsigned int /*uiNumChars*/) override { return false; } // ECH - virtual bool SetGraphicsRendition(_In_reads_(_Param_(2)) const DispatchTypes::GraphicsOptions* const /*rgOptions*/, - const size_t /*cOptions*/) { return false; } // SGR + bool SetGraphicsRendition(_In_reads_(_Param_(2)) const DispatchTypes::GraphicsOptions* const /*rgOptions*/, + const size_t /*cOptions*/) override { return false; } // SGR - virtual bool SetPrivateModes(_In_reads_(_Param_(2)) const DispatchTypes::PrivateModeParams* const /*rgParams*/, - const size_t /*cParams*/) { return false; } // DECSET + bool SetPrivateModes(_In_reads_(_Param_(2)) const DispatchTypes::PrivateModeParams* const /*rgParams*/, + const size_t /*cParams*/) override { return false; } // DECSET - virtual bool ResetPrivateModes(_In_reads_(_Param_(2)) const DispatchTypes::PrivateModeParams* const /*rgParams*/, - const size_t /*cParams*/) { return false; } // DECRST + bool ResetPrivateModes(_In_reads_(_Param_(2)) const DispatchTypes::PrivateModeParams* const /*rgParams*/, + const size_t /*cParams*/) override { return false; } // DECRST - virtual bool DeviceStatusReport(const DispatchTypes::AnsiStatusType /*statusType*/) { return false; } // DSR - virtual bool DeviceAttributes() { return false; } // DA + bool DeviceStatusReport(const DispatchTypes::AnsiStatusType /*statusType*/) override { return false; } // DSR + bool DeviceAttributes() override { return false; } // DA - virtual bool DesignateCharset(const wchar_t /*wchCharset*/){ return false; } // DesignateCharset + bool DesignateCharset(const wchar_t /*wchCharset*/) override { return false; } // DesignateCharset - virtual bool SoftReset(){ return false; } // DECSTR - virtual bool HardReset(){ return false; } // RIS - - virtual bool SetCursorStyle(const DispatchTypes::CursorStyle /*cursorStyle*/){ return false; } // DECSCUSR - virtual bool SetCursorColor(const COLORREF /*Color*/) { return false; } // OSCSetCursorColor, OSCResetCursorColor + bool SoftReset() override { return false; } // DECSTR + bool HardReset() override { return false; } // RIS + bool SetCursorStyle(const DispatchTypes::CursorStyle /*cursorStyle*/) override { return false; } // DECSCUSR + bool SetCursorColor(const COLORREF /*Color*/) override { return false; } // OSCSetCursorColor, OSCResetCursorColor + // DTTERM_WindowManipulation - virtual bool WindowManipulation(const DispatchTypes::WindowManipulationType /*uiFunction*/, - _In_reads_(_Param_(3)) const unsigned short* const /*rgusParams*/, - const size_t /*cParams*/) { return false; } + bool WindowManipulation(const DispatchTypes::WindowManipulationType /*uiFunction*/, + _In_reads_(_Param_(3)) const unsigned short* const /*rgusParams*/, + const size_t /*cParams*/) override { return false; } };