Skip to content

Commit

Permalink
Merge pull request #1625 from berryzplus/feature/apply_rule_of_five
Browse files Browse the repository at this point in the history
SonarCloudにBugsだと言われているc++クラス定義の警告に対処する
  • Loading branch information
berryzplus authored Apr 15, 2021
2 parents e6137a7 + c5f7cbf commit 713d6db
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 47 deletions.
11 changes: 8 additions & 3 deletions sakura_core/CGrepEnumFileBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ class CGrepEnumFileBase {
private:
VPGrepEnumItem m_vpItems;

public:
CGrepEnumFileBase(){
}
using Me = CGrepEnumFileBase;

public:
CGrepEnumFileBase() noexcept = default;
CGrepEnumFileBase(const Me&) = delete;
Me& operator = (const Me&) = delete;
CGrepEnumFileBase(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
virtual ~CGrepEnumFileBase(){
ClearItems();
}
Expand Down Expand Up @@ -180,4 +184,5 @@ class CGrepEnumFileBase {
return found;
}
};

#endif /* SAKURA_CGREPENUMFILEBASE_6B85547E_13E4_4183_AE06_B4D6395ABC88_H_ */
11 changes: 8 additions & 3 deletions sakura_core/CGrepEnumKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
typedef std::vector< LPCWSTR > VGrepEnumKeys;

class CGrepEnumKeys {

using Me = CGrepEnumKeys;

public:
VGrepEnumKeys m_vecSearchFileKeys;
VGrepEnumKeys m_vecSearchFolderKeys;
Expand All @@ -56,9 +59,11 @@ class CGrepEnumKeys {
VGrepEnumKeys m_vecExceptAbsFolderKeys;

public:
CGrepEnumKeys(){
}

CGrepEnumKeys() noexcept = default;
CGrepEnumKeys(const Me&) = delete;
Me& operator = (const Me&) = delete;
CGrepEnumKeys(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
~CGrepEnumKeys(){
ClearItems();
}
Expand Down
27 changes: 0 additions & 27 deletions sakura_core/CKeyWordSetMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ CKeyWordSetMgr::CKeyWordSetMgr( void )
return;
}

CKeyWordSetMgr::~CKeyWordSetMgr( void)
{
m_nKeyWordSetNum = 0;
return;
}

/*!
@brief 全キーワードセットの削除と初期化
Expand All @@ -87,27 +81,6 @@ void CKeyWordSetMgr::ResetAllKeyWordSet( void )
}
}

const CKeyWordSetMgr& CKeyWordSetMgr::operator=( CKeyWordSetMgr& cKeyWordSetMgr )
{
// int nDataLen;
// char* pData;
// int i;
if( this == &cKeyWordSetMgr ){
return *this;
}
m_nCurrentKeyWordSetIdx = cKeyWordSetMgr.m_nCurrentKeyWordSetIdx;
m_nKeyWordSetNum = cKeyWordSetMgr.m_nKeyWordSetNum;
//配列まるごとコピー
memcpy_raw( m_szSetNameArr , cKeyWordSetMgr.m_szSetNameArr , sizeof( m_szSetNameArr ) );
memcpy_raw( m_bKEYWORDCASEArr, cKeyWordSetMgr.m_bKEYWORDCASEArr, sizeof( m_bKEYWORDCASEArr ) );
memcpy_raw( m_nStartIdx , cKeyWordSetMgr.m_nStartIdx , sizeof( m_nStartIdx ) );// 2004.07.29 Moca
memcpy_raw( m_nKeyWordNumArr , cKeyWordSetMgr.m_nKeyWordNumArr , sizeof( m_nKeyWordNumArr ) );
memcpy_raw( m_szKeyWordArr , cKeyWordSetMgr.m_szKeyWordArr , sizeof( m_szKeyWordArr ) );
memcpy_raw( m_IsSorted , cKeyWordSetMgr.m_IsSorted , sizeof( m_IsSorted ) ); //MIK 2000.12.01 binary search
memcpy_raw( m_nKeyWordMaxLenArr, cKeyWordSetMgr.m_nKeyWordMaxLenArr, sizeof( m_nKeyWordMaxLenArr ) ); //2014.05.04 Moca
return *this;
}

/*! @brief キーワードセットの追加
@date 2005.01.26 Moca 新規作成
Expand Down
7 changes: 1 addition & 6 deletions sakura_core/CKeyWordSetMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class CKeyWordSetMgr
|| Constructors
*/
CKeyWordSetMgr();
~CKeyWordSetMgr();


/// @name キーワードセット操作
bool AddKeyWordSet( //!< セットの追加
const wchar_t* pszSetName, //!< [in] セット名
Expand Down Expand Up @@ -124,10 +123,6 @@ class CKeyWordSetMgr
void ResetAllKeyWordSet( void ); // 全キーワードセットの削除と初期化
// To Here 2004.07.29 Moca

/*
|| 演算子
*/
const CKeyWordSetMgr& operator=( CKeyWordSetMgr& );
/*
|| Attributes & Operations
*/
Expand Down
7 changes: 7 additions & 0 deletions sakura_core/COpeBlk.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ class COpeBlk;
COpe を複数束ねるためのもの。Undo, Redoはこのブロック単位で行われる。
*/
class COpeBlk {

using Me = COpeBlk;

public:
//コンストラクタ・デストラクタ
COpeBlk();
COpeBlk(const Me&) = delete;
Me& operator = (const Me&) = delete;
COpeBlk(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
~COpeBlk();

//インターフェース
Expand Down
7 changes: 7 additions & 0 deletions sakura_core/COpeBuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ class COpeBlk;/// 2002/2/10 aroka
@brief アンドゥ・リドゥバッファ
*/
class COpeBuf {

using Me = COpeBuf;

public:
//コンストラクタ・デストラクタ
COpeBuf();
COpeBuf(const Me&) = delete;
Me& operator = (const Me&) = delete;
COpeBuf(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
~COpeBuf();

//状態
Expand Down
9 changes: 8 additions & 1 deletion sakura_core/CSelectLang.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

class CSelectLang
{

using Me = CSelectLang;

public:
// メッセージリソース用構造体
struct SSelLangInfo {
Expand All @@ -44,7 +47,11 @@ class CSelectLang
/*
|| Constructors
*/
CSelectLang(){}
CSelectLang() noexcept = default;
CSelectLang(const Me&) = delete;
Me& operator = (const Me&) = delete;
CSelectLang(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
~CSelectLang();

/*
Expand Down
7 changes: 7 additions & 0 deletions sakura_core/charset/CESI.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,15 @@ enum EBOMType {
//*/

class CESI {

using Me = CESI;

public:

CESI(const Me&) = delete;
Me& operator = (const Me&) = delete;
CESI(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
virtual ~CESI() { ; }
explicit CESI( const SEncodingConfig& ref ) : m_pEncodingConfig(&ref) {
m_dwStatus = ESI_NOINFORMATION;
Expand Down
10 changes: 8 additions & 2 deletions sakura_core/dlg/CDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ struct SAnchorList
@date 2002.2.17 YAZAKI CShareDataのインスタンスは、CProcessにひとつあるのみ。
*/
class CDialog
{
class CDialog{

using Me = CDialog;

public:
/*
|| Constructors
*/
CDialog( bool bSizable = false, bool bCheckShareData = true );
CDialog(const Me&) = delete;
Me& operator = (const Me&) = delete;
CDialog(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
virtual ~CDialog();
/*
|| Attributes & Operations
Expand Down
7 changes: 7 additions & 0 deletions sakura_core/extmodule/CDllHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ enum EDllResult{
@date 2008.05.10 kobake 整理。派生クラスは、~Impをオーバーロードすれば良いという方式です。
*/
class CDllImp{

using Me = CDllImp;

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// 型 //
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
Expand All @@ -107,6 +110,10 @@ class CDllImp{
public:
//コンストラクタ・デストラクタ
CDllImp();
CDllImp(const Me&) = delete;
Me& operator = (const Me&) = delete;
CDllImp(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
virtual ~CDllImp();

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
Expand Down
4 changes: 0 additions & 4 deletions sakura_core/extmodule/CIcu4cI18n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ CIcu4cI18n::CIcu4cI18n() noexcept
{
}

CIcu4cI18n::~CIcu4cI18n() noexcept
{
}

/*!
* @brief DLLの名前を返す
*/
Expand Down
1 change: 0 additions & 1 deletion sakura_core/extmodule/CIcu4cI18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class CIcu4cI18n final : public CDllImp

public:
CIcu4cI18n() noexcept;
virtual ~CIcu4cI18n() noexcept;

protected:
// CDllImpインタフェース
Expand Down
8 changes: 8 additions & 0 deletions sakura_core/window/CWnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@
*/
class CWnd
{

using Me = CWnd;

protected:
friend LRESULT CALLBACK CWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
public:
/* Constructors */
CWnd(const WCHAR* pszInheritanceAppend = L"");
CWnd(const Me&) = delete;
Me& operator = (const Me&) = delete;
CWnd(Me&&) noexcept = delete;
Me& operator = (Me&&) noexcept = delete;
virtual ~CWnd();

/*
|| Attributes & Operations
*/
Expand Down

0 comments on commit 713d6db

Please sign in to comment.