SECEditBlockBuffer Class

class SECEditBlockBuffer: public ISECEditBuffer, public CTypedPtrArray&ltCObArray, SECEditBufferArray*>

The SECEditBlockBuffer class implements the  ISECEditBuffer interface, through which the  SECEdit model interacts with the actual text data. This allows greater flexibility for providing different implementations for managing the actual text data without having to make changes to the model itself.
The current implementation is that the entire text buffer is maintained in a single blcok. Soon this implementation will change such that it will utilize an array of SECEditBufferArray objects, each containing a portion of the text data.

Defined in: SECEditBlockBuffer.h

See Also

ISECEditBuffer  SECEditSECEditBufferArray

Class Members

Creation / initialization

 SECEditBlockBuffer()

Constructor.

Array methods

virtual SECEditBufferArray*&  ElementAt(int nIndex)

Retrieves the specified element.

virtual SECEditBufferArray*&  operator[](int nIndex)

Retrieves the element at the given index.

virtual SECEditBufferArray*  operator[](int nIndex) const

Retrieves the element at the given index.

virtual SECEditBufferArray*  GetAt(int nIndex) const

Retrieves the element at the given index.

ISECEditBuffer implemtation

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

Insert Text into the buffer

virtual BOOL  ClearTextBlock(const SECEditLineColPair& lcpDeleteBlock)

Delete the text within the specified block.

virtual int  GetLineCount()

Gets the count of lines in this text buffer.

virtual int  GetLineLength(int nLine)

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

virtual int  GetLineVisibleLength(int nLine)

Gets the visible length of this line.

virtual void  SetLineEnd(TCHAR chLineEnd)

Sets the line end character.

virtual TCHAR  GetLineEnd()

Gets the line end character.

virtual TCHAR  GetLineBreakChar()

Gets the line break character.

virtual void  SetLineBreakChar(TCHAR chLineBreak)

Sets the line break character.

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

Retrieves 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 from the text buffer.

virtual BOOL  Init()

Initializes the text buffer.

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

Finds the given text in the text buffer.

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

Converts a line and column position into an index.

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

Converts an index position into line and column.

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

Writes the buffer to a file.

Implementation

int  CountLineEndsInBuffer(LPCTSTR lpszText, int nLength, int* pLastLineLength = NULL)

Counts the number of line ends in the current buffer.

virtual int  GetBufferNo(int nOffset, BOOL bKeepBeforeLineEnd = FALSE)

Returns the buffer index for a given offset.

LPTSTR  GetData(int nOffset)

Retrieves the line data for the line at the given virtual offset.

int  GetLastLine()

Retrieves virtual offset of the last line in the buffer.

int  GetLineCol(int nOffset, int* pCol = NULL)

Returns the column index for a given offset.

int  IsLineColValid(int nLine, int nCol)

Checks the validity of the given line and column indices.

virtual void  NotifyBufferArrayChanged(int nBuffer)

Signals the virtual offsets for element(s) in the buffer array have changed.

virtual BOOL  WholeWord(int nOffset, int nLength)

Checks the text at the given offset and length for a whole word.

virtual void  WriteToFile(CFile* pFile, int nOffset, int nBytes, BOOL bSaveAsUnicodeText)

Helper method for writing a segment of the buffer to a file.

CArray<_LineInfo, _LineInfo>  m_LineStartArray

Array of the virtual offsets for the start of each line.

int  m_nTopInvalidLine

Line number of the topmost known buffer line not yet validated.

int  m_nTopInvalidBuffer

Array buffer index of the most topmost known buffer not yet validated.

int  m_nMaxBufferSize

The maximum size in bytes of each element in the buffer array.

int  m_nLineCount

The current line count.

TCHAR  m_chLineEnd

Character used to delineate the line ends in the text buffer.

TCHAR  m_chLineBreak

The line break character for the text buffer.

int  m_nMaxLineLength

The maximum length a line can attain.