Revision: 7489
http://winmerge.svn.sourceforge.net/winmerge/?rev=7489&view=rev
Author: gerundt
Date: 2010-12-31 11:55:48 +0000 (Fri, 31 Dec 2010)
Log Message:
-----------
Make bunch of editor functions const functions.
Modified Paths:
--------------
branches/R2_14/Src/DiffTextBuffer.cpp
branches/R2_14/Src/DiffTextBuffer.h
branches/R2_14/Src/editlib/ccrystaltextbuffer.cpp
branches/R2_14/Src/editlib/ccrystaltextbuffer.h
Modified: branches/R2_14/Src/DiffTextBuffer.cpp
===================================================================
--- branches/R2_14/Src/DiffTextBuffer.cpp 2010-12-30 17:02:52 UTC (rev 7488)
+++ branches/R2_14/Src/DiffTextBuffer.cpp 2010-12-31 11:55:48 UTC (rev 7489)
@@ -173,7 +173,7 @@
* @param [in] nLineIndex Index of the line to get.
* @param [out] strLine Returns line text in the index.
*/
-BOOL CDiffTextBuffer::GetLine(int nLineIndex, CString &strLine)
+BOOL CDiffTextBuffer::GetLine(int nLineIndex, CString &strLine) const
{
int nLineLength = CCrystalTextBuffer::GetLineLength(nLineIndex);
if (nLineLength < 0)
@@ -208,7 +208,7 @@
* @param [out] strLine Returns line text in the index. Existing content
* of this string is overwritten.
*/
-BOOL CDiffTextBuffer::GetFullLine(int nLineIndex, CString &strLine)
+BOOL CDiffTextBuffer::GetFullLine(int nLineIndex, CString &strLine) const
{
int cchText = GetFullLineLength(nLineIndex);
if (cchText == 0)
@@ -241,7 +241,7 @@
* @param [in] flag Flag to check.
* @return TRUE if flag is set, FALSE otherwise.
*/
-BOOL CDiffTextBuffer::FlagIsSet(UINT line, DWORD flag)
+BOOL CDiffTextBuffer::FlagIsSet(UINT line, DWORD flag) const
{
return ((m_aLines[line].m_dwFlags & flag) == flag);
}
Modified: branches/R2_14/Src/DiffTextBuffer.h
===================================================================
--- branches/R2_14/Src/DiffTextBuffer.h 2010-12-30 17:02:52 UTC (rev 7488)
+++ branches/R2_14/Src/DiffTextBuffer.h 2010-12-31 11:55:48 UTC (rev 7489)
@@ -40,7 +40,7 @@
*/
FileTextEncoding m_encoding;
- BOOL FlagIsSet(UINT line, DWORD flag);
+ BOOL FlagIsSet(UINT line, DWORD flag) const;
public :
CDiffTextBuffer(CMergeDoc * pDoc, int pane);
@@ -71,10 +71,10 @@
void SetMixedEOL(bool bMixed) { m_bMixedEOL = bMixed; }
// If line has text (excluding eol), set strLine to text (excluding eol)
- BOOL GetLine(int nLineIndex, CString &strLine);
+ BOOL GetLine(int nLineIndex, CString &strLine) const;
// if line has any text (including eol), set strLine to text (including eol)
- BOOL GetFullLine(int nLineIndex, CString &strLine);
+ BOOL GetFullLine(int nLineIndex, CString &strLine) const;
virtual void SetModified (BOOL bModified = TRUE);
void prepareForRescan();
Modified: branches/R2_14/Src/editlib/ccrystaltextbuffer.cpp
===================================================================
--- branches/R2_14/Src/editlib/ccrystaltextbuffer.cpp 2010-12-30 17:02:52 UTC (rev 7488)
+++ branches/R2_14/Src/editlib/ccrystaltextbuffer.cpp 2010-12-31 11:55:48 UTC (rev 7489)
@@ -627,7 +627,7 @@
#endif // #if 0 savetofile
CRLFSTYLE CCrystalTextBuffer::
-GetCRLFMode ()
+GetCRLFMode () const
{
return m_nCRLFMode;
}
@@ -762,7 +762,7 @@
}
int CCrystalTextBuffer::
-FindLineWithFlag (DWORD dwFlag)
+FindLineWithFlag (DWORD dwFlag) const
{
int nSize = (int) m_aLines.GetSize ();
for (int L = 0; L < nSize; L++)
@@ -774,7 +774,7 @@
}
int CCrystalTextBuffer::
-GetLineWithFlag (DWORD dwFlag)
+GetLineWithFlag (DWORD dwFlag) const
{
int nFlagIndex =::FlagToIndex (dwFlag);
if (nFlagIndex < 0)
@@ -853,7 +853,7 @@
*/
void CCrystalTextBuffer::GetTextWithoutEmptys(int nStartLine, int nStartChar,
int nEndLine, int nEndChar,
- CString &text, CRLFSTYLE nCrlfStyle /* CRLF_STYLE_AUTOMATIC */)
+ CString &text, CRLFSTYLE nCrlfStyle /* CRLF_STYLE_AUTOMATIC */) const
{
LPCTSTR sEol = GetStringEol (nCrlfStyle);
GetText(nStartLine, nStartChar, nEndLine, nEndChar, text, sEol);
@@ -861,7 +861,8 @@
void CCrystalTextBuffer::
-GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString & text, LPCTSTR pszCRLF /*= NULL*/ )
+GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar,
+ CString & text, LPCTSTR pszCRLF /*= NULL*/ ) const
{
ASSERT (m_bInit); // Text buffer not yet initialized.
// You must call InitNew() or LoadFromFile() first!
@@ -1219,21 +1220,21 @@
}
BOOL CCrystalTextBuffer::
-CanUndo ()
+CanUndo () const
{
ASSERT (m_nUndoPosition >= 0 && m_nUndoPosition <= m_aUndoBuf.size ());
return m_nUndoPosition > 0;
}
BOOL CCrystalTextBuffer::
-CanRedo ()
+CanRedo () const
{
ASSERT (m_nUndoPosition >= 0 && m_nUndoPosition <= m_aUndoBuf.size ());
return m_nUndoPosition < m_aUndoBuf.size ();
}
POSITION CCrystalTextBuffer::
-GetUndoActionCode (int & nAction, POSITION pos /*= NULL*/ )
+GetUndoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
{
ASSERT (CanUndo ()); // Please call CanUndo() first
@@ -1270,7 +1271,7 @@
}
POSITION CCrystalTextBuffer::
-GetRedoActionCode (int & nAction, POSITION pos /*= NULL*/ )
+GetRedoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
{
ASSERT (CanRedo ()); // Please call CanRedo() before!
@@ -1311,7 +1312,7 @@
}
POSITION CCrystalTextBuffer::
-GetUndoDescription (CString & desc, POSITION pos /*= NULL*/ )
+GetUndoDescription (CString & desc, POSITION pos /*= NULL*/ ) const
{
int nAction;
POSITION retValue = GetUndoActionCode(nAction, pos);
@@ -1324,7 +1325,7 @@
}
POSITION CCrystalTextBuffer::
-GetRedoDescription (CString & desc, POSITION pos /*= NULL*/ )
+GetRedoDescription (CString & desc, POSITION pos /*= NULL*/ ) const
{
int nAction;
POSITION retValue = GetRedoActionCode(nAction, pos);
@@ -1657,7 +1658,7 @@
BOOL CCrystalTextBuffer::
-GetActionDescription (int nAction, CString & desc)
+GetActionDescription (int nAction, CString & desc) const
{
HINSTANCE hOldResHandle = AfxGetResourceHandle ();
#ifdef CRYSEDIT_RES_HANDLE
@@ -1763,7 +1764,7 @@
}
int CCrystalTextBuffer::
-FindNextBookmarkLine (int nCurrentLine)
+FindNextBookmarkLine (int nCurrentLine) const
{
BOOL bWrapIt = TRUE;
DWORD dwFlags = GetLineFlags (nCurrentLine);
@@ -1792,7 +1793,7 @@
}
int CCrystalTextBuffer::
-FindPrevBookmarkLine (int nCurrentLine)
+FindPrevBookmarkLine (int nCurrentLine) const
{
BOOL bWrapIt = TRUE;
DWORD dwFlags = GetLineFlags (nCurrentLine);
@@ -1821,7 +1822,7 @@
}
BOOL CCrystalTextBuffer::
-IsMBSLead (int nLine, int nCol)
+IsMBSLead (int nLine, int nCol) const
{
ASSERT (m_bInit); // Text buffer not yet initialized.
// You must call InitNew() or LoadFromFile() first!
@@ -1830,7 +1831,7 @@
}
BOOL CCrystalTextBuffer::
-IsMBSTrail (int nLine, int nCol)
+IsMBSTrail (int nLine, int nCol) const
{
ASSERT (m_bInit); // Text buffer not yet initialized.
// You must call InitNew() or LoadFromFile() first!
@@ -1860,7 +1861,7 @@
m_aLines.RemoveAt(line, nCount);
}
-int CCrystalTextBuffer::GetTabSize()
+int CCrystalTextBuffer::GetTabSize() const
{
ASSERT( m_nTabSize >= 0 && m_nTabSize <= 64 );
return m_nTabSize;
Modified: branches/R2_14/Src/editlib/ccrystaltextbuffer.h
===================================================================
--- branches/R2_14/Src/editlib/ccrystaltextbuffer.h 2010-12-30 17:02:52 UTC (rev 7488)
+++ branches/R2_14/Src/editlib/ccrystaltextbuffer.h 2010-12-31 11:55:48 UTC (rev 7489)
@@ -127,7 +127,7 @@
BOOL m_bCreateBackupFile;
BOOL m_bInsertTabs;
int m_nTabSize;
- int FindLineWithFlag (DWORD dwFlag);
+ int FindLineWithFlag (DWORD dwFlag) const;
protected :
enum
@@ -183,7 +183,7 @@
LPCTSTR pszText, int cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisonNumbers = NULL);
// Overridable: provide action description
- virtual BOOL GetActionDescription (int nAction, CString & desc);
+ virtual BOOL GetActionDescription (int nAction, CString & desc) const;
// Operations
public :
@@ -224,13 +224,17 @@
LPCTSTR GetLineChars (int nLine) const;
DWORD GetLineFlags (int nLine) const;
DWORD GetLineRevisionNumber (int nLine) const;
- int GetLineWithFlag (DWORD dwFlag);
- void SetLineFlag (int nLine, DWORD dwFlag, BOOL bSet, BOOL bRemoveFromPreviousLine = TRUE, BOOL bUpdate=TRUE);
- void GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString & text, LPCTSTR pszCRLF = NULL);
- virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString &text, CRLFSTYLE nCrlfStyle =CRLF_STYLE_AUTOMATIC );
+ int GetLineWithFlag (DWORD dwFlag) const;
+ void SetLineFlag (int nLine, DWORD dwFlag, BOOL bSet,
+ BOOL bRemoveFromPreviousLine = TRUE, BOOL bUpdate = TRUE);
+ void GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar,
+ CString & text, LPCTSTR pszCRLF = NULL) const;
+ virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar,
+ int nEndLine, int nEndChar, CString &text,
+ CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC) const;
// Attributes
- CRLFSTYLE GetCRLFMode ();
+ CRLFSTYLE GetCRLFMode () const;
void SetCRLFMode (CRLFSTYLE nCRLFMode);
/// Adjust all the lines in the buffer to the buffer default EOL Mode
virtual BOOL applyEOLMode();
@@ -246,8 +250,8 @@
virtual BOOL DeleteText (CCrystalTextView * pSource, int nStartLine, int nStartPos, int nEndLine, int nEndPos, int nAction = CE_ACTION_UNKNOWN, BOOL bHistory =TRUE);
// Undo/Redo
- BOOL CanUndo ();
- BOOL CanRedo ();
+ BOOL CanUndo () const;
+ BOOL CanRedo () const;
virtual BOOL Undo (CCrystalTextView * pSource, CPoint & ptCursorPos);
virtual BOOL Redo (CCrystalTextView * pSource, CPoint & ptCursorPos);
@@ -266,10 +270,10 @@
// Browse undo sequence
- POSITION GetUndoActionCode (int & nAction, POSITION pos = NULL);
- POSITION GetRedoActionCode (int & nAction, POSITION pos = NULL);
- POSITION GetUndoDescription (CString & desc, POSITION pos = NULL);
- POSITION GetRedoDescription (CString & desc, POSITION pos = NULL);
+ POSITION GetUndoActionCode (int & nAction, POSITION pos = NULL) const;
+ POSITION GetRedoActionCode (int & nAction, POSITION pos = NULL) const;
+ POSITION GetUndoDescription (CString & desc, POSITION pos = NULL) const;
+ POSITION GetRedoDescription (CString & desc, POSITION pos = NULL) const;
// Notify all connected views about changes in name of file
CCrystalTextView::TextDefinition *RetypeViews (LPCTSTR lpszFileName);
@@ -282,15 +286,15 @@
void SetInsertTabs(BOOL bInsertTabs);
// Tabbing
- int GetTabSize();
+ int GetTabSize() const;
void SetTabSize(int nTabSize);
// More bookmarks
- int FindNextBookmarkLine (int nCurrentLine = 0);
- int FindPrevBookmarkLine (int nCurrentLine = 0);
+ int FindNextBookmarkLine (int nCurrentLine = 0) const;
+ int FindPrevBookmarkLine (int nCurrentLine = 0) const;
- BOOL IsMBSLead (int nLine, int nCol);
- BOOL IsMBSTrail (int nLine, int nCol);
+ BOOL IsMBSLead (int nLine, int nCol) const;
+ BOOL IsMBSTrail (int nLine, int nCol) const;
// Overrides
// ClassWizard generated virtual function overrides
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|