From 54ad3bff9d2d95db808d5f0cd0720d072b95d401 Mon Sep 17 00:00:00 2001 From: berryzplus Date: Mon, 28 Sep 2020 12:15:21 +0900 Subject: [PATCH] =?UTF-8?q?CFigure=E3=81=ABfinal=E3=81=A8override=E4=BF=AE?= =?UTF-8?q?=E9=A3=BE=E5=AD=90=E3=82=92=E4=BB=98=E3=81=91=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/view/figures/CFigureStrategy.h | 18 ++++++++++------ sakura_core/view/figures/CFigure_Comma.h | 10 ++++----- sakura_core/view/figures/CFigure_CtrlCode.h | 24 ++++++++++----------- sakura_core/view/figures/CFigure_Eol.h | 13 +++++------ sakura_core/view/figures/CFigure_HanSpace.h | 8 +++---- sakura_core/view/figures/CFigure_Tab.h | 10 ++++----- sakura_core/view/figures/CFigure_ZenSpace.h | 8 +++---- 7 files changed, 48 insertions(+), 43 deletions(-) diff --git a/sakura_core/view/figures/CFigureStrategy.h b/sakura_core/view/figures/CFigureStrategy.h index 1e36cae45e..95389715e3 100644 --- a/sakura_core/view/figures/CFigureStrategy.h +++ b/sakura_core/view/figures/CFigureStrategy.h @@ -45,6 +45,7 @@ class CFigure{ CEditDoc* pCEditDoc = CEditDoc::GetInstance(0); m_pTypeData = &pCEditDoc->m_cDocType.GetDocumentAttribute(); } + protected: const STypeConfig* m_pTypeData; }; @@ -52,7 +53,7 @@ class CFigure{ typedef int FigureRenderType; //! 通常テキスト描画 -class CFigure_Text : public CFigure{ +class CFigure_Text final : public CFigure{ public: // 文字列を進める static FigureRenderType GetRenderType(SColorStrategyInfo* pInfo); @@ -64,14 +65,14 @@ class CFigure_Text : public CFigure{ static bool DrawImpBlock(SColorStrategyInfo* pInfo, int nPos, int nLength); static int FowardChars(SColorStrategyInfo* pInfo); - bool DrawImp(SColorStrategyInfo* pInfo); - bool Match(const wchar_t* pText, int nTextLen) const + bool DrawImp(SColorStrategyInfo* pInfo) override; + bool Match(const wchar_t* pText, int nTextLen) const override { return true; } //! 色分け表示対象判定 - virtual bool Disp(void) const + bool Disp(void) const override { return true; } @@ -80,19 +81,21 @@ class CFigure_Text : public CFigure{ //! 各種空白(半角空白/全角空白/タブ/改行)描画用の基本クラス class CFigureSpace : public CFigure{ public: - virtual bool DrawImp(SColorStrategyInfo* pInfo); + bool DrawImp(SColorStrategyInfo* pInfo) override; + protected: virtual void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const = 0; virtual EColorIndexType GetColorIdx(void) const = 0; +public: //! 色分け表示対象判定 - virtual bool Disp(void) const + bool Disp(void) const override { EColorIndexType nColorIndex = GetColorIdx(); return m_pTypeData->m_ColorInfoArr[nColorIndex].m_bDisp; } - virtual void Update(void) + void Update(void) override { CFigure::Update(); @@ -104,6 +107,7 @@ class CFigureSpace : public CFigure{ } } +protected: EColorIndexType GetDispColorIdx(void) const{ return m_nDispColorIndex; } // 実装補助 diff --git a/sakura_core/view/figures/CFigure_Comma.h b/sakura_core/view/figures/CFigure_Comma.h index 9bf6cb46c4..4b079e8812 100644 --- a/sakura_core/view/figures/CFigure_Comma.h +++ b/sakura_core/view/figures/CFigure_Comma.h @@ -29,17 +29,17 @@ #include "view/figures/CFigureStrategy.h" //! カンマ描画(CSVモード) -class CFigure_Comma : public CFigureSpace{ +class CFigure_Comma final : public CFigureSpace{ public: //traits - bool Match(const wchar_t* pText, int nTextLen) const; - bool Disp(void) const + bool Match(const wchar_t* pText, int nTextLen) const override; + bool Disp(void) const override { return true; } //action - void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const; - EColorIndexType GetColorIdx(void) const{ return COLORIDX_TAB; } + void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const override; + EColorIndexType GetColorIdx(void) const override { return COLORIDX_TAB; } }; #endif /* SAKURA_CFIGURE_COMMA_DE8237CD_24C0_4A21_8599_5BE8B04BF7E6_H_ */ diff --git a/sakura_core/view/figures/CFigure_CtrlCode.h b/sakura_core/view/figures/CFigure_CtrlCode.h index 49f41e8d93..2ea1b1f04d 100644 --- a/sakura_core/view/figures/CFigure_CtrlCode.h +++ b/sakura_core/view/figures/CFigure_CtrlCode.h @@ -32,38 +32,38 @@ class CFigure_CtrlCode : public CFigureSpace{ public: //traits - bool Match(const wchar_t* pText, int nTextLen) const; + bool Match(const wchar_t* pText, int nTextLen) const override; //action - bool DrawImp(SColorStrategyInfo* pInfo); + bool DrawImp(SColorStrategyInfo* pInfo) override; virtual void DispSpaceEx(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans, int width) const; virtual wchar_t GetAlternateChar() const{ return L'・'; } - void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const + void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const override { assert(0); } - EColorIndexType GetColorIdx(void) const{ return COLORIDX_CTRLCODE; } + EColorIndexType GetColorIdx(void) const override { return COLORIDX_CTRLCODE; } }; //! バイナリ半角描画 -class CFigure_HanBinary : public CFigure_CtrlCode{ +class CFigure_HanBinary final: public CFigure_CtrlCode{ public: //traits - bool Match(const wchar_t* pText, int nTextLen) const; + bool Match(const wchar_t* pText, int nTextLen) const override; //action - virtual wchar_t GetAlternateChar() const{ return L'〓'; } - EColorIndexType GetColorIdx(void) const{ return COLORIDX_CTRLCODE; } + wchar_t GetAlternateChar() const override { return L'〓'; } + EColorIndexType GetColorIdx(void) const override { return COLORIDX_CTRLCODE; } }; //! バイナリ全角描画 -class CFigure_ZenBinary : public CFigure_CtrlCode{ +class CFigure_ZenBinary final : public CFigure_CtrlCode{ public: //traits - bool Match(const wchar_t* pText, int nTextLen) const; + bool Match(const wchar_t* pText, int nTextLen) const override; //action - virtual wchar_t GetAlternateChar() const{ return L'〓'; } - EColorIndexType GetColorIdx(void) const{ return COLORIDX_CTRLCODE; } + wchar_t GetAlternateChar() const override { return L'〓'; } + EColorIndexType GetColorIdx(void) const override { return COLORIDX_CTRLCODE; } }; #endif /* SAKURA_CFIGURE_CTRLCODE_53EB409B_17F7_4B7F_9AD2_A00C29CDC792_H_ */ diff --git a/sakura_core/view/figures/CFigure_Eol.h b/sakura_core/view/figures/CFigure_Eol.h index 3d4a0c886d..116408d827 100644 --- a/sakura_core/view/figures/CFigure_Eol.h +++ b/sakura_core/view/figures/CFigure_Eol.h @@ -29,7 +29,7 @@ #include "view/figures/CFigureStrategy.h" //! 改行描画 -class CFigure_Eol : public CFigureSpace{ +class CFigure_Eol final : public CFigureSpace{ public: ~CFigure_Eol() { @@ -38,16 +38,17 @@ class CFigure_Eol : public CFigureSpace{ } } //traits - bool Match(const wchar_t* pText, int nTextLen) const; - bool Disp(void) const + bool Match(const wchar_t* pText, int nTextLen) const override; + bool Disp(void) const override { return true; } //action - bool DrawImp(SColorStrategyInfo* pInfo); - void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const {}; - EColorIndexType GetColorIdx(void) const{ return COLORIDX_EOL; } + bool DrawImp(SColorStrategyInfo* pInfo) override; + void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const override {}; + EColorIndexType GetColorIdx(void) const override { return COLORIDX_EOL; } + private: HPEN m_hPen = NULL; COLORREF m_clrPen; diff --git a/sakura_core/view/figures/CFigure_HanSpace.h b/sakura_core/view/figures/CFigure_HanSpace.h index 396639a9c9..23459790e0 100644 --- a/sakura_core/view/figures/CFigure_HanSpace.h +++ b/sakura_core/view/figures/CFigure_HanSpace.h @@ -29,13 +29,13 @@ #include "view/figures/CFigureStrategy.h" //! 半角スペース描画 -class CFigure_HanSpace : public CFigureSpace{ +class CFigure_HanSpace final : public CFigureSpace{ public: //traits - bool Match(const wchar_t* pText, int nTextLen) const; + bool Match(const wchar_t* pText, int nTextLen) const override; //action - void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool trans) const; - EColorIndexType GetColorIdx(void) const{ return COLORIDX_SPACE; } + void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool trans) const override; + EColorIndexType GetColorIdx(void) const override { return COLORIDX_SPACE; } }; #endif /* SAKURA_CFIGURE_HANSPACE_38751BA0_6F58_4929_A24D_1937F2FB3E6A_H_ */ diff --git a/sakura_core/view/figures/CFigure_Tab.h b/sakura_core/view/figures/CFigure_Tab.h index 24520036f4..d4f6c64b1c 100644 --- a/sakura_core/view/figures/CFigure_Tab.h +++ b/sakura_core/view/figures/CFigure_Tab.h @@ -29,17 +29,17 @@ #include "view/figures/CFigureStrategy.h" //! タブ描画 -class CFigure_Tab : public CFigureSpace{ +class CFigure_Tab final : public CFigureSpace{ public: //traits - bool Match(const wchar_t* pText, int nTextLen) const; - bool Disp(void) const + bool Match(const wchar_t* pText, int nTextLen) const override; + bool Disp(void) const override { return true; } //action - void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const; - EColorIndexType GetColorIdx(void) const{ return COLORIDX_TAB; } + void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const override; + EColorIndexType GetColorIdx(void) const override { return COLORIDX_TAB; } }; #endif /* SAKURA_CFIGURE_TAB_4401678E_D165_4130_A973_CC40038CDE8E_H_ */ diff --git a/sakura_core/view/figures/CFigure_ZenSpace.h b/sakura_core/view/figures/CFigure_ZenSpace.h index 89c45d0388..f15ee10ca2 100644 --- a/sakura_core/view/figures/CFigure_ZenSpace.h +++ b/sakura_core/view/figures/CFigure_ZenSpace.h @@ -29,13 +29,13 @@ #include "view/figures/CFigureStrategy.h" //! 全角スペース描画 -class CFigure_ZenSpace : public CFigureSpace{ +class CFigure_ZenSpace final : public CFigureSpace{ public: //traits - bool Match(const wchar_t* pText, int nTextLen) const; + bool Match(const wchar_t* pText, int nTextLen) const override; //action - void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const; - EColorIndexType GetColorIdx(void) const{ return COLORIDX_ZENSPACE; } + void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const override; + EColorIndexType GetColorIdx(void) const override { return COLORIDX_ZENSPACE; } }; #endif /* SAKURA_CFIGURE_ZENSPACE_6176BBA4_68C9_41A1_B944_7F6EE0E5E4A4_H_ */