|
|
|
|
@ -17,9 +17,27 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
@@ -17,9 +17,27 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IDocument |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the total text length.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>The length of the text, in characters.</returns>
|
|
|
|
|
/// <remarks>This is the same as Text.Length, but is more efficient because
|
|
|
|
|
/// it doesn't require creating a String object.</remarks>
|
|
|
|
|
int TextLength { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the total number of lines in the document.
|
|
|
|
|
/// </summary>
|
|
|
|
|
int TotalNumberOfLines { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets/Sets the whole text as string.
|
|
|
|
|
/// </summary>
|
|
|
|
|
string Text { get; set; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Is raised when the Text property changes.
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler TextChanged; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -40,7 +58,22 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
@@ -40,7 +58,22 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
|
|
|
|
|
void Remove(int offset, int length); |
|
|
|
|
void Replace(int offset, int length, string newText); |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a character at the specified position in the document.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <paramref name="offset">The index of the character to get.</paramref>
|
|
|
|
|
/// <exception cref="ArgumentOutOfRangeException">Offset is outside the valid range (0 to TextLength-1).</exception>
|
|
|
|
|
/// <returns>The character at the specified position.</returns>
|
|
|
|
|
/// <remarks>This is the same as Text[offset], but is more efficient because
|
|
|
|
|
/// it doesn't require creating a String object.</remarks>
|
|
|
|
|
char GetCharAt(int offset); |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves the text for a portion of the document.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <exception cref="ArgumentOutOfRangeException">offset or length is outside the valid range.</exception>
|
|
|
|
|
/// <remarks>This is the same as Text.Substring, but is more efficient because
|
|
|
|
|
/// it doesn't require creating a String object for the whole document.</remarks>
|
|
|
|
|
string GetText(int offset, int length); |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -66,10 +99,30 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
@@ -66,10 +99,30 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IDocumentLine |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the starting offset of the line in the document's text.
|
|
|
|
|
/// </summary>
|
|
|
|
|
int Offset { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the length of this line (=the number of characters on the line).
|
|
|
|
|
/// </summary>
|
|
|
|
|
int Length { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the length of this line, including the line delimiter.
|
|
|
|
|
/// </summary>
|
|
|
|
|
int TotalLength { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the number of this line.
|
|
|
|
|
/// The first line has the number 1.
|
|
|
|
|
/// </summary>
|
|
|
|
|
int LineNumber { get; } |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the text on this line.
|
|
|
|
|
/// </summary>
|
|
|
|
|
string Text { get; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|