C# Class Microsoft.CodeAnalysis.Sarif.NewLineIndex

An index of newline start locations in a string in order to relatively cheaply turn a given offset into a line / column number.
Show file Open project: Microsoft/sarif-sdk Class Usage Examples

Public Methods

Method Description
GetLineInfoForLine ( int lineNumber ) : LineInfo

Gets a LineInfo for the line at the specified index.

GetLineInfoForOffset ( int offset ) : LineInfo

Gets line information for the line containing the character at the specified offset.

GetOffsetInfoForOffset ( int offset ) : OffsetInfo

Gets information for a given offset, such as the line and column numbers.

Private Methods

Method Description
NewLineIndex ( string textToIndex ) : System

Method Details

GetLineInfoForLine() public method

Gets a LineInfo for the line at the specified index.
Thrown when is not /// a valid line number; e.g. if it is zero, negative, or greater than the maximum line count in /// the file.
public GetLineInfoForLine ( int lineNumber ) : LineInfo
lineNumber int The line number.
return LineInfo

GetLineInfoForOffset() public method

Gets line information for the line containing the character at the specified offset.
Thrown when is negative.
public GetLineInfoForOffset ( int offset ) : LineInfo
offset int The offset.
return LineInfo

GetOffsetInfoForOffset() public method

Gets information for a given offset, such as the line and column numbers.
Thrown when is negative.
public GetOffsetInfoForOffset ( int offset ) : OffsetInfo
offset int The offset for which information shall be obtained.
return OffsetInfo