C# Class Microsoft.Cci.SourceDocumentWithInclusion

Inheritance: IPrimarySourceDocument
Show file Open project: visualmutator/visualmutator Class Usage Examples

Public Methods

Method Description
CopyTo ( int position, char destination, int destinationOffset, int length ) : int

Copies no more than the specified number of characters to the destination character array, starting at the specified position in the source document. Returns the actual number of characters that were copied. This number will be greater than zero as long as position is less than this.Length. The number will be precisely the number asked for unless there are not enough characters left in the document.

GetCorrespondingSourceLocation ( ISourceLocation sourceLocationInPreviousVersionOfDocument ) : ISourceLocation

Returns a source location in this document that corresponds to the given source location from a previous version of this document.

GetPrimarySourceLocation ( int position, int length ) : IPrimarySourceLocation

Obtains a source location instance that corresponds to the substring of the document specified by the given start position and length.

GetText ( ) : string

Returns the source text of the document in string form. Each call may do significant work, so be sure to cache this.

IsUpdatedVersionOf ( ISourceDocument sourceDocument ) : bool

Returns true if this source document has been created by editing the given source document (or a updated version of the given source document).

SourceDocumentWithInclusion ( IPrimarySourceDocument wrappedDocument, int originalLineNumber, string originalDocumentName, int startingPositionOfIncludedRegion ) : System

Allocates an object that represents a primary source document that has a region of text that originally came from another source document.

ToLineColumn ( int position, int &line, int &column ) : void

Maps the given (zero based) source position to a (one based) line and column, by scanning the source character by character, counting new lines until the given source position is reached. The source position and corresponding line+column are remembered and scanning carries on where it left off when this routine is called next. If the given position precedes the last given position, scanning restarts from the start. Optimal use of this method requires the client to sort calls in order of position.

Private Methods

Method Description
GetSourceLocation ( int position, int length ) : ISourceLocation
ObjectInvariant ( ) : void

Method Details

CopyTo() public method

Copies no more than the specified number of characters to the destination character array, starting at the specified position in the source document. Returns the actual number of characters that were copied. This number will be greater than zero as long as position is less than this.Length. The number will be precisely the number asked for unless there are not enough characters left in the document.
public CopyTo ( int position, char destination, int destinationOffset, int length ) : int
position int The starting index to copy from. Must be greater than or equal to zero and position+length must be less than or equal to this.Length;
destination char The destination array.
destinationOffset int The starting index where the characters must be copied to in the destination array.
length int The maximum number of characters to copy. Must be greater than 0 and less than or equal to the number elements of the destination array.
return int

GetCorrespondingSourceLocation() public method

Returns a source location in this document that corresponds to the given source location from a previous version of this document.
public GetCorrespondingSourceLocation ( ISourceLocation sourceLocationInPreviousVersionOfDocument ) : ISourceLocation
sourceLocationInPreviousVersionOfDocument ISourceLocation
return ISourceLocation

GetPrimarySourceLocation() public method

Obtains a source location instance that corresponds to the substring of the document specified by the given start position and length.
public GetPrimarySourceLocation ( int position, int length ) : IPrimarySourceLocation
position int
length int
return IPrimarySourceLocation

GetText() public method

Returns the source text of the document in string form. Each call may do significant work, so be sure to cache this.
public GetText ( ) : string
return string

IsUpdatedVersionOf() public method

Returns true if this source document has been created by editing the given source document (or a updated version of the given source document).
public IsUpdatedVersionOf ( ISourceDocument sourceDocument ) : bool
sourceDocument ISourceDocument
return bool

SourceDocumentWithInclusion() public method

Allocates an object that represents a primary source document that has a region of text that originally came from another source document.
public SourceDocumentWithInclusion ( IPrimarySourceDocument wrappedDocument, int originalLineNumber, string originalDocumentName, int startingPositionOfIncludedRegion ) : System
wrappedDocument IPrimarySourceDocument A primary source document that has an inclusion (but does not know about it).
originalLineNumber int The starting line number that the included region of text has in the the document it originated from.
originalDocumentName string The name of the document from which the included region of text has originated.
startingPositionOfIncludedRegion int The position in the wrapped document where the included region starts.
return System

ToLineColumn() public method

Maps the given (zero based) source position to a (one based) line and column, by scanning the source character by character, counting new lines until the given source position is reached. The source position and corresponding line+column are remembered and scanning carries on where it left off when this routine is called next. If the given position precedes the last given position, scanning restarts from the start. Optimal use of this method requires the client to sort calls in order of position.
public ToLineColumn ( int position, int &line, int &column ) : void
position int
line int
column int
return void