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

assert を独立した 1 行で記載する #1217

Merged
merged 3 commits into from
Mar 21, 2020
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
6 changes: 5 additions & 1 deletion sakura_core/CAutoReloadAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class CAutoReloadAgent : public CDocListenerEx{

//監視の一時停止
void PauseWatching(){ m_nPauseCount++; }
void ResumeWatching(){ m_nPauseCount--; assert(m_nPauseCount>=0); }
void ResumeWatching()
{
m_nPauseCount--;
assert(m_nPauseCount>=0);
}
bool IsPausing() const{ return m_nPauseCount>=1; }

public://#####仮
Expand Down
6 changes: 5 additions & 1 deletion sakura_core/mem/CNativeW.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ class CStringRef final : public IStringRef{

//########補助
bool IsValid() const{ return m_pData!=NULL; }
wchar_t At(int nIndex) const{ assert(nIndex>=0 && nIndex<m_nDataLen); return m_pData[nIndex]; }
wchar_t At(int nIndex) const
{
assert(nIndex>=0 && nIndex<m_nDataLen);
return m_pData[nIndex];
}
private:
const wchar_t* m_pData;
int m_nDataLen;
Expand Down
6 changes: 5 additions & 1 deletion sakura_core/types/CType.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ class CTypeConfig{
m_nType = n;
}
bool IsValidType() const{ return m_nType>=0 && m_nType<MAX_TYPES; }
int GetIndex() const{ /*assert(IsValid());*/ return m_nType; }
int GetIndex() const
{
/*assert(IsValid());*/
return m_nType;
}

//共有データへの簡易アクセサ
// STypeConfig* operator->(){ return GetTypeConfig(); }
Expand Down
14 changes: 12 additions & 2 deletions sakura_core/util/StaticType.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,18 @@ class StaticVector{
int max_size() const{ return MAX_SIZE; }

//要素アクセス
ElementType& operator[](int nIndex) { assert(nIndex<MAX_SIZE); assert_warning(nIndex<m_nCount); return m_aElements[nIndex]; }
const ElementType& operator[](int nIndex) const{ assert(nIndex<MAX_SIZE); assert_warning(nIndex<m_nCount); return m_aElements[nIndex]; }
ElementType& operator[](int nIndex)
{
assert(nIndex<MAX_SIZE);
assert_warning(nIndex<m_nCount);
return m_aElements[nIndex];
}
const ElementType& operator[](int nIndex) const
{
assert(nIndex<MAX_SIZE);
assert_warning(nIndex<m_nCount);
return m_aElements[nIndex];
}

//操作
void clear(){ m_nCount=0; }
Expand Down
12 changes: 10 additions & 2 deletions sakura_core/util/design_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,16 @@ class TSingleInstance{

protected:
//※2個以上のインスタンスは想定していません。assertが破綻を検出します。
TSingleInstance(){ assert(gm_instance==NULL); gm_instance=static_cast<T*>(this); }
~TSingleInstance(){ assert(gm_instance); gm_instance=NULL; }
TSingleInstance()
{
assert(gm_instance==NULL);
gm_instance=static_cast<T*>(this);
}
~TSingleInstance()
{
assert(gm_instance);
gm_instance=NULL;
}
private:
static T* gm_instance;
};
Expand Down
48 changes: 40 additions & 8 deletions sakura_core/view/CEditView.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,36 @@ class CEditView
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
public:
//主要構成部品アクセス
CTextArea& GetTextArea(){ assert(m_pcTextArea); return *m_pcTextArea; }
const CTextArea& GetTextArea() const{ assert(m_pcTextArea); return *m_pcTextArea; }
CCaret& GetCaret(){ assert(m_pcCaret); return *m_pcCaret; }
const CCaret& GetCaret() const{ assert(m_pcCaret); return *m_pcCaret; }
CRuler& GetRuler(){ assert(m_pcRuler); return *m_pcRuler; }
const CRuler& GetRuler() const{ assert(m_pcRuler); return *m_pcRuler; }
CTextArea& GetTextArea()
{
assert(m_pcTextArea);
return *m_pcTextArea;
}
const CTextArea& GetTextArea() const
{
assert(m_pcTextArea);
return *m_pcTextArea;
}
CCaret& GetCaret()
{
assert(m_pcCaret);
return *m_pcCaret;
}
const CCaret& GetCaret() const
{
assert(m_pcCaret);
return *m_pcCaret;
}
CRuler& GetRuler()
{
assert(m_pcRuler);
return *m_pcRuler;
}
const CRuler& GetRuler() const
{
assert(m_pcRuler);
return *m_pcRuler;
}

//主要属性アクセス
CTextMetrics& GetTextMetrics(){ return m_cTextMetrics; }
Expand All @@ -581,8 +605,16 @@ class CEditView
const CViewSelect& GetSelectionInfo() const{ return m_cViewSelect; }

//主要オブジェクトアクセス
CViewFont& GetFontset(){ assert(m_pcViewFont); return *m_pcViewFont; }
const CViewFont& GetFontset() const{ assert(m_pcViewFont); return *m_pcViewFont; }
CViewFont& GetFontset()
{
assert(m_pcViewFont);
return *m_pcViewFont;
}
const CViewFont& GetFontset() const
{
assert(m_pcViewFont);
return *m_pcViewFont;
}

//主要ヘルパアクセス
const CViewParser& GetParser() const{ return m_cParser; }
Expand Down
5 changes: 4 additions & 1 deletion sakura_core/view/figures/CFigure_CtrlCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ class CFigure_CtrlCode : public CFigureSpace{
bool DrawImp(SColorStrategyInfo* pInfo);
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{assert(0);};
void DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pcView, bool bTrans) const
{
assert(0);
}
EColorIndexType GetColorIdx(void) const{ return COLORIDX_CTRLCODE; }
};

Expand Down