ISECEditBuffer Class

class ISECEditBuffer

ISECEditBuffer is an abstract base class that defines the interface for text storage and retrieval in Objective Edit

Defined in: ISECEditBuffer.h

Comments

The SECEdit object instantiates a an object derived from ISECEditBuffer, and all actions that translate into operations on the text buffer are through this interface. This interface isolates text storage and retrieval operations, making the SECEdit model class less tightly coupled to the implementation for these operations, allowing for greater flexibility. Attributes such as breakpoints, keywords, etc., are handled by the SECEdit model object.
For example, if you needed to provide a special mechanism for handling extremely large text files, you could derive from ISECEditBuffer and manage the loading and paging of the file without interfering with the operations handled by the SECEdit model. To incorporate your derived class into the model, override SECEdit::GetNewEditBuffer and create an instance of your derived class. SECEdit will then interact with text buffer as usual through the ISECEditBuffer interface, which would now be implemented by the new ISECEditBuffer-derived class.
Many of the methods in this interface require line and column values. These values are zero based indices. The very first character entered into the buffer would be line index 0, column index 0.

Class Members

Interface methods

virtual BOOL Insert(SECEditLineColPair& lcpInsertBlock, LPCTSTR lpszText, int nLength = -1)

Inserts text into the buffer.

virtual BOOL ClearTextBlock(const SECEditLineColPair& lcpDeleteBlock)

Deletes the text between the line/col pair as specified

virtual int GetLineCount()

Gets the count of lines in this text buffer.

virtual int GetLineLength(int nLine)

Gets the length of this line, including line end characters.

virtual int GetLineVisibleLength(int nLine)

Gets the number of displayable characters on this line.

virtual void SetLineEnd(TCHAR chLineEnd)

Sets the line end character for this text buffer.

virtual TCHAR GetLineEnd()

Gets the line end character for this text buffer.

virtual void SetLineBreakChar(TCHAR chLineBreak)

Sets the line break character for this text buffer.

virtual TCHAR GetLineBreakChar()

Gets the line break character for this text buffer.

virtual int GetTextBlock(LPCTSTR& lpszBlock, int nStartLine, int nStartCol = 0, int nEndLine = -1, int nEndCol = -1)

Retrieves a pointer to a block of text from the text buffer.

virtual BOOL GetTextBlock(CString& strBlock, int nStartLine, int nStartCol = 0, int nEndLine = -1, int nEndCol = -1)

Retrieves a block of text between the specified positions.

virtual BOOL Init()

Initializes the text buffer.

virtual int LineIndex(int nLine, int nCol = 0)

Returns a virtual index into the buffer for the given line and column indices.

virtual BOOL LineColFromChar(int nIndex, int& nLine, int& nCol)

Returns the line and column indices into the buffer for a given virtual index.

virtual int FindText(int nLine, int nCol, int& nResultLine, int& nResultCol, LPCTSTR lpszText, BOOL bDown, BOOL bWrapAround, BOOL bMatchCase, BOOL bBatchWholeWord, BOOL bRegularExpression, int nStopLine = -1, int nStopCol = -1)

Finds a search string in the text buffer.

virtual void Write(CFile* pFile, BOOL bSaveAsUnicodeText = FALSE)

Saves the text buffer to a file.