Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFigureにfinalとoverride修飾子を付ける #1417

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions sakura_core/view/figures/CFigureStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ class CFigure{
CEditDoc* pCEditDoc = CEditDoc::GetInstance(0);
m_pTypeData = &pCEditDoc->m_cDocType.GetDocumentAttribute();
}

protected:
const STypeConfig* m_pTypeData;
};

typedef int FigureRenderType;

//! 通常テキスト描画
class CFigure_Text : public CFigure{
class CFigure_Text final : public CFigure{
public:
// 文字列を進める
static FigureRenderType GetRenderType(SColorStrategyInfo* pInfo);
Expand All @@ -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;
}
Expand All @@ -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();

Expand All @@ -104,6 +107,7 @@ class CFigureSpace : public CFigure{
}
}

protected:
EColorIndexType GetDispColorIdx(void) const{ return m_nDispColorIndex; }

// 実装補助
Expand Down
10 changes: 5 additions & 5 deletions sakura_core/view/figures/CFigure_Comma.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
24 changes: 12 additions & 12 deletions sakura_core/view/figures/CFigure_CtrlCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
13 changes: 7 additions & 6 deletions sakura_core/view/figures/CFigure_Eol.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "view/figures/CFigureStrategy.h"

//! 改行描画
class CFigure_Eol : public CFigureSpace{
class CFigure_Eol final : public CFigureSpace{
public:
~CFigure_Eol()
{
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions sakura_core/view/figures/CFigure_HanSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
10 changes: 5 additions & 5 deletions sakura_core/view/figures/CFigure_Tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
8 changes: 4 additions & 4 deletions sakura_core/view/figures/CFigure_ZenSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */