diff options
Diffstat (limited to 'src/CellBuffer.h')
| -rw-r--r-- | src/CellBuffer.h | 70 | 
1 files changed, 44 insertions, 26 deletions
| diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 7cd79336d..d078c22c0 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -1,28 +1,35 @@  // Scintilla source code edit control -// CellBuffer.h - manages the text of the document +/** @file CellBuffer.h + ** Manages the text of the document. + **/  // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>  // The License.txt file describes the conditions under which this software may be distributed.  #ifndef CELLBUFFER_H  #define CELLBUFFER_H -// This holds the marker identifier and the marker type to display. -// MarkerHandleNumbers are members of lists. +/** + * This holds the marker identifier and the marker type to display. + * MarkerHandleNumbers are members of lists. + */  struct MarkerHandleNumber {  	int handle;  	int number;  	MarkerHandleNumber *next;  }; -// A marker handle set contains any number of MarkerHandleNumbers +/** + * A marker handle set contains any number of MarkerHandleNumbers. + */  class MarkerHandleSet {  	MarkerHandleNumber *root; +  public:  	MarkerHandleSet();  	~MarkerHandleSet();  	int Length();  	int NumberFromHandle(int handle); -	int MarkValue();	// Bit set of marker numbers +	int MarkValue();	///< Bit set of marker numbers.  	bool Contains(int handle);  	bool InsertHandle(int handle, int markerNum);  	void RemoveHandle(int handle); @@ -30,8 +37,10 @@ public:  	void CombineWith(MarkerHandleSet *other);  }; -// Each line stores the starting position of the first character of the line in the cell buffer -// and potentially a marker handle set. Often a line will not have any attached markers. +/** + * Each line stores the starting position of the first character of the line in the cell buffer + * and potentially a marker handle set. Often a line will not have any attached markers. + */  struct LineData {  	int startPosition;  	MarkerHandleSet *handleSet; @@ -39,7 +48,9 @@ struct LineData {  	}  }; -// The line vector contains information about each of the lines in a cell buffer. +/** + * The line vector contains information about each of the lines in a cell buffer. + */  class LineVector {  public:  	enum { growSize = 4000 }; @@ -49,7 +60,7 @@ public:  	int *levels;  	int sizeLevels; -	// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big. +	/// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.  	int handleCurrent;  	LineVector(); @@ -71,9 +82,11 @@ public:  	int LineFromHandle(int markerHandle);  }; -// Actions are used to store all the information required to perform one undo/redo step.  enum actionType { insertAction, removeAction, startAction }; +/** + * Actions are used to store all the information required to perform one undo/redo step. + */  class Action {  public:  	actionType at; @@ -89,6 +102,9 @@ public:  	void Grab(Action *source);  }; +/** + * + */  class UndoHistory {  	Action *actions;  	int lenActions; @@ -110,13 +126,13 @@ public:  	void DropUndoSequence();  	void DeleteUndoHistory(); -	// The save point is a marker in the undo stack where the container has stated that  -	// the buffer was saved. Undo and redo can move over the save point. +	/// The save point is a marker in the undo stack where the container has stated that +	/// the buffer was saved. Undo and redo can move over the save point.  	void SetSavePoint();  	bool IsSavePoint() const; -	// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is  -	// called that many times. Similarly for redo. +	/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is +	/// called that many times. Similarly for redo.  	bool CanUndo() const;  	int StartUndo();  	const Action &GetUndoStep() const; @@ -127,9 +143,11 @@ public:  	void CompletedRedoStep();  }; -// Holder for an expandable array of characters that supports undo and line markers -// Based on article "Data Structures in a Bit-Mapped Text Editor" -// by Wilfred J. Hansen, Byte January 1987, page 183 +/** + * Holder for an expandable array of characters that supports undo and line markers. + * Based on article "Data Structures in a Bit-Mapped Text Editor" + * by Wilfred J. Hansen, Byte January 1987, page 183. + */  class CellBuffer {  private:  	char *body; @@ -158,7 +176,7 @@ public:  	CellBuffer(int initialLength = 4000);  	~CellBuffer(); -	// Retrieving positions outside the range of the buffer works and returns 0 +	/// Retrieving positions outside the range of the buffer works and returns 0  	char CharAt(int position);  	void GetCharRange(char *buffer, int position, int lengthRetrieve);  	char StyleAt(int position); @@ -171,8 +189,8 @@ public:  	const char *InsertString(int position, char *s, int insertLength);  	void InsertCharStyle(int position, char ch, char style); -	// Setting styles for positions outside the range of the buffer is safe and has no effect. -	// True is returned if the style of a character changed. +	/// Setting styles for positions outside the range of the buffer is safe and has no effect. +	/// @return true if the style of a character is changed.  	bool SetStyleAt(int position, char style, char mask='\377');  	bool SetStyleFor(int position, int length, char style, char mask); @@ -181,12 +199,12 @@ public:  	bool IsReadOnly();  	void SetReadOnly(bool set); -	// The save point is a marker in the undo stack where the container has stated that  -	// the buffer was saved. Undo and redo can move over the save point. +	/// The save point is a marker in the undo stack where the container has stated that +	/// the buffer was saved. Undo and redo can move over the save point.  	void SetSavePoint();  	bool IsSavePoint(); -	// Line marker functions +	/// Line marker functions  	int AddMark(int line, int markerNum);  	void DeleteMark(int line, int markerNum);  	void DeleteMarkFromHandle(int markerHandle); @@ -194,7 +212,7 @@ public:  	void DeleteAllMarks(int markerNum);  	int LineFromHandle(int markerHandle); -	// Without undo +	/// Actions without undo  	void BasicInsertString(int position, char *s, int insertLength);  	void BasicDeleteChars(int position, int deleteLength); @@ -204,8 +222,8 @@ public:  	void EndUndoAction();  	void DeleteUndoHistory(); -	// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is  -	// called that many times. Similarly for redo. +	/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is +	/// called that many times. Similarly for redo.  	bool CanUndo();  	int StartUndo();  	const Action &GetUndoStep() const; | 
