/// <summary> /// Allocates an object that represents a composite source document that is derived from another source document by replacing one substring with another. /// </summary> /// <param name="previousVersion">The source document on which the newly allocated document will be based.</param> /// <param name="position">The first character in the previous version of the new document that will be changed in the new document.</param> /// <param name="oldLength">The number of characters in the previous verion of the new document that will be changed in the new document.</param> /// <param name="newLength">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.)</param> protected CompositeSourceDocument(SourceDocument previousVersion, int position, int oldLength, int newLength) : base(previousVersion, position, oldLength, newLength) { }
/// <summary> /// Allocates an object that represents a primary source document that is derived from another source document by replacing one substring with another. /// </summary> /// <param name="text">The text content of new document.</param> /// <param name="previousVersion">The source document on which the newly allocated document will be based.</param> /// <param name="position">The first character in the previous version of the new document that will be changed in the new document.</param> /// <param name="oldLength">The number of characters in the previous verion of the new document that will be changed in the new document.</param> /// <param name="newLength">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.)</param> protected PrimarySourceDocument(string text, SourceDocument previousVersion, int position, int oldLength, int newLength) : base(previousVersion, position, oldLength, newLength) { this.location = previousVersion.Location; this.text = text; }
/// <summary> /// Allocates an object that represents a source document that is derived from another source document by replacing one substring with another. /// </summary> /// <param name="previousVersion">The source document on which the newly allocated document will be based.</param> /// <param name="position">The first character in the previous version of the new document that will be changed in the new document.</param> /// <param name="oldLength">The number of characters in the previous verion of the new document that will be changed in the new document.</param> /// <param name="newLength">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.)</param> protected SourceDocument(SourceDocument previousVersion, int position, int oldLength, int newLength) { this.name = previousVersion.Name; WeakReference wr = new WeakReference(previousVersion); //^ assume wr.Target is SourceDocument; this.previousVersion = wr; this.editStartIndex = position; this.editOldLength = oldLength; this.editNewLength = newLength; }
protected PrimarySourceDocument(string text, SourceDocument previousVersion, int position, int oldLength, int newLength) : base(previousVersion, position, oldLength, newLength) { Contract.Requires(text != null); Contract.Requires(previousVersion != null); this.location = previousVersion.Location; this.text = text; }