Class FileLineCharIndex
Represents a character-level position within a file by file index, line index, and character index. All indices are 0-based.
public class FileLineCharIndex : IFileLineCharIndex, IFileLineIndex, IGetFileLineIndex, IComparable<FileLineCharIndex>, IEquatable<FileLineCharIndex>
- Inheritance
-
FileLineCharIndex
- Implements
- Inherited Members
- Extension Methods
Constructors
FileLineCharIndex()
Initializes a new instance of the FileLineCharIndex class.
public FileLineCharIndex()
FileLineCharIndex(IFileLineCharIndex)
Initializes a new instance of the FileLineCharIndex class by copying another instance.
public FileLineCharIndex(IFileLineCharIndex src)
Parameters
srcIFileLineCharIndexThe source to copy from.
FileLineCharIndex(int, int, int)
Initializes a new instance of the FileLineCharIndex class with specified indices.
public FileLineCharIndex(int fileIndex, int lineIndex, int charIndex)
Parameters
fileIndexintThe zero-based file index.
lineIndexintThe zero-based line index.
charIndexintThe zero-based character index within the line.
Properties
CharIndex
Character index within the line. 0-based.
public int CharIndex { get; set; }
Property Value
FileIndex
File Index. Start on 0.
public int FileIndex { get; set; }
Property Value
LineIndex
Line Index. Start on 0.
public int LineIndex { get; set; }
Property Value
Methods
AtLineBegin(int, int)
Creates a FileLineCharIndex at the beginning of a line (CharIndex = 0).
public static FileLineCharIndex AtLineBegin(int fileIndex, int lineIndex)
Parameters
Returns
CompareTo(FileLineCharIndex)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(FileLineCharIndex other)
Parameters
otherFileLineCharIndexAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Equals(FileLineCharIndex)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(FileLineCharIndex other)
Parameters
otherFileLineCharIndexAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetFileLineIndex()
Get FileLineIndex.
public FileLineIndex GetFileLineIndex()
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToUserString()
Returns a user-friendly string representation.
public string ToUserString()
Returns
Operators
operator ==(FileLineCharIndex, FileLineCharIndex)
public static bool operator ==(FileLineCharIndex left, FileLineCharIndex right)
Parameters
leftFileLineCharIndexrightFileLineCharIndex
Returns
operator >(FileLineCharIndex, FileLineCharIndex)
public static bool operator >(FileLineCharIndex left, FileLineCharIndex right)
Parameters
leftFileLineCharIndexrightFileLineCharIndex
Returns
operator >=(FileLineCharIndex, FileLineCharIndex)
public static bool operator >=(FileLineCharIndex left, FileLineCharIndex right)
Parameters
leftFileLineCharIndexrightFileLineCharIndex
Returns
operator !=(FileLineCharIndex, FileLineCharIndex)
public static bool operator !=(FileLineCharIndex left, FileLineCharIndex right)
Parameters
leftFileLineCharIndexrightFileLineCharIndex
Returns
operator <(FileLineCharIndex, FileLineCharIndex)
public static bool operator <(FileLineCharIndex left, FileLineCharIndex right)
Parameters
leftFileLineCharIndexrightFileLineCharIndex
Returns
operator <=(FileLineCharIndex, FileLineCharIndex)
public static bool operator <=(FileLineCharIndex left, FileLineCharIndex right)
Parameters
leftFileLineCharIndexrightFileLineCharIndex