C# Class AvalonStudio.TextEditor.Utils.CharRope

Poor man's template specialization: extension methods for Rope<char>.
Show file Open project: VitalElement/AvalonStudio Class Usage Examples

Public Methods

Method Description
AddText ( this rope, string text ) : void

Appends text to this rope. Runs in O(lg N + M).

Create ( string text ) : Rope

Creates a new rope from the specified text.

IndexOf ( this rope, string searchText, int startIndex, int length, System.StringComparison comparisonType ) : int

Gets the index of the first occurrence of the search text.

IndexOfAny ( this rope, char anyOf, int startIndex, int length ) : int

Gets the index of the first occurrence of any element in the specified array.

InsertText ( this rope, int index, string text ) : void

Inserts text into this rope. Runs in O(lg N + M).

LastIndexOf ( this rope, string searchText, int startIndex, int length, System.StringComparison comparisonType ) : int

Gets the index of the last occurrence of the search text.

ToString ( this rope, int startIndex, int length ) : string

Retrieves the text for a portion of the rope. Runs in O(lg N + M), where M=length.

This method counts as a read access and may be called concurrently to other read accesses.

WriteTo ( this rope, TextWriter output, int startIndex, int length ) : void

Retrieves the text for a portion of the rope and writes it to the specified text writer. Runs in O(lg N + M), where M=length.

This method counts as a read access and may be called concurrently to other read accesses.

Private Methods

Method Description
FillNode ( RopeNode node, string text, int start ) : void
InitFromString ( string text ) : RopeNode
WriteTo ( this node, int index, TextWriter output, int count ) : void

Method Details

AddText() public static method

Appends text to this rope. Runs in O(lg N + M).
newElements is null.
public static AddText ( this rope, string text ) : void
rope this
text string
return void

Create() public static method

Creates a new rope from the specified text.
public static Create ( string text ) : Rope
text string
return Rope

IndexOf() public static method

Gets the index of the first occurrence of the search text.
public static IndexOf ( this rope, string searchText, int startIndex, int length, System.StringComparison comparisonType ) : int
rope this
searchText string
startIndex int
length int
comparisonType System.StringComparison
return int

IndexOfAny() public static method

Gets the index of the first occurrence of any element in the specified array.
public static IndexOfAny ( this rope, char anyOf, int startIndex, int length ) : int
rope this The target rope.
anyOf char Array of characters being searched.
startIndex int Start index of the search.
length int Length of the area to search.
return int

InsertText() public static method

Inserts text into this rope. Runs in O(lg N + M).
newElements is null. index or length is outside the valid range.
public static InsertText ( this rope, int index, string text ) : void
rope this
index int
text string
return void

LastIndexOf() public static method

Gets the index of the last occurrence of the search text.
public static LastIndexOf ( this rope, string searchText, int startIndex, int length, System.StringComparison comparisonType ) : int
rope this
searchText string
startIndex int
length int
comparisonType System.StringComparison
return int

ToString() public static method

Retrieves the text for a portion of the rope. Runs in O(lg N + M), where M=length.
This method counts as a read access and may be called concurrently to other read accesses.
offset or length is outside the valid range.
public static ToString ( this rope, int startIndex, int length ) : string
rope this
startIndex int
length int
return string

WriteTo() public static method

Retrieves the text for a portion of the rope and writes it to the specified text writer. Runs in O(lg N + M), where M=length.
This method counts as a read access and may be called concurrently to other read accesses.
offset or length is outside the valid range.
public static WriteTo ( this rope, TextWriter output, int startIndex, int length ) : void
rope this
output System.IO.TextWriter
startIndex int
length int
return void