C# Class Microsoft.Cci.CompositeSourceDocument

Inheritance: SourceDocument, IDerivedSourceDocument
Afficher le fichier Open project: visualmutator/visualmutator

Private Properties

Свойство Type Description
ObjectInvariant void
ToLineColumn void

Méthodes publiques

Méthode 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.

GetDerivedSourceLocation ( int position, int length ) : IDerivedSourceLocation

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

GetFragmentLocationsFor ( ISourceLocation sourceLocation ) : IEnumerable

Returns an enumeration of fragments from other documents that together make up the given source location in this document.

GetPrimarySourceLocationsFor ( IDerivedSourceLocation derivedSourceLocation ) : IEnumerable

Returns zero or more primary source locations that correspond to the given derived location.

GetSourceLocation ( int position, int length ) : ISourceLocation

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. This call is expensive in time and space. Rather use CopyTo if at all possible.

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.

Méthodes protégées

Méthode Description
CompositeSourceDocument ( IName name ) : System

Allocates an object that represents a source document that is the composition of an ordered enumeration of fragments from other source document. The document is parsed according to the rules of a particular language, such as C#, to produce an object model that can be obtained via the CompilationPart property.

CompositeSourceDocument ( SourceDocument previousVersion, int position, int oldLength, int newLength ) : System

Allocates an object that represents a composite source document that is derived from another source document by replacing one substring with another.

GetFragments ( ) : IEnumerable

Returns an enumeration of fragments from other documents. The source of the enumeration could be a computation, such as a pre-processor.

Private Methods

Méthode Description
ObjectInvariant ( ) : void
ToLineColumn ( int position, int &line, int &column, string text ) : void

Scans the given text string, incrementing line every time a new line sequence is encountered and incrementing column for every character scanned (resetting column to 1 every time line is incremented).

Method Details

CompositeSourceDocument() protected méthode

Allocates an object that represents a source document that is the composition of an ordered enumeration of fragments from other source document. The document is parsed according to the rules of a particular language, such as C#, to produce an object model that can be obtained via the CompilationPart property.
protected CompositeSourceDocument ( IName name ) : System
name IName The name of the document. Used to identify the document in user interaction.
Résultat System

CompositeSourceDocument() protected méthode

Allocates an object that represents a composite source document that is derived from another source document by replacing one substring with another.
protected CompositeSourceDocument ( SourceDocument previousVersion, int position, int oldLength, int newLength ) : System
previousVersion SourceDocument The source document on which the newly allocated document will be based.
position int The first character in the previous version of the new document that will be changed in the new document.
oldLength int The number of characters in the previous verion of the new document that will be changed in the new document.
newLength int The number of replacement characters in the new document. /// (The length of the string that replaces the substring from position to position+length in the previous version of the new document.)
Résultat System

CopyTo() public méthode

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.
Résultat int

GetDerivedSourceLocation() public méthode

Obtains a source location instance that corresponds to the substring of the document specified by the given start position and length.
public GetDerivedSourceLocation ( int position, int length ) : IDerivedSourceLocation
position int
length int
Résultat IDerivedSourceLocation

GetFragmentLocationsFor() public méthode

Returns an enumeration of fragments from other documents that together make up the given source location in this document.
public GetFragmentLocationsFor ( ISourceLocation sourceLocation ) : IEnumerable
sourceLocation ISourceLocation A location in this document.
Résultat IEnumerable

GetFragments() protected méthode

Returns an enumeration of fragments from other documents. The source of the enumeration could be a computation, such as a pre-processor.
protected GetFragments ( ) : IEnumerable
Résultat IEnumerable

GetPrimarySourceLocationsFor() public méthode

Returns zero or more primary source locations that correspond to the given derived location.
public GetPrimarySourceLocationsFor ( IDerivedSourceLocation derivedSourceLocation ) : IEnumerable
derivedSourceLocation IDerivedSourceLocation A source location in this derived document
Résultat IEnumerable

GetSourceLocation() public méthode

Obtains a source location instance that corresponds to the substring of the document specified by the given start position and length.
public GetSourceLocation ( int position, int length ) : ISourceLocation
position int
length int
Résultat ISourceLocation

GetText() public méthode

Returns the source text of the document in string form. This call is expensive in time and space. Rather use CopyTo if at all possible.
public GetText ( ) : string
Résultat string

ToLineColumn() public méthode

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
Résultat void