Code Coverage Statistics for Source File

c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Document\DocumentEventArgs.cs

Sequence Point Coverage
N/A
0 of 0
Branch Coverage
N/A
0 of 0
Lines
103
Highlight: Uncovered Code Covered Code
L V Source
1
// <file>
2
//     <copyright see="prj:///doc/copyright.txt"/>
3
//     <license see="prj:///doc/license.txt"/>
4
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
5
//     <version>$Revision: 915 $</version>
6
// </file>
7
8
using System;
9
10
namespace ICSharpCode.TextEditor.Document
11
{
12
	/// <summary>
13
	/// This delegate is used for document events.
14
	/// </summary>
15
	public delegate void DocumentEventHandler(object sender, DocumentEventArgs e);
16
	
17
	/// <summary>
18
	/// This class contains more information on a document event
19
	/// </summary>
20
	public class DocumentEventArgs : EventArgs
21
	{
22
		IDocument document;
23
		int       offset;
24
		int       length;
25
		string    text;
26
		
27
		/// <returns>
28
		/// always a valid Document which is related to the Event.
29
		/// </returns>
30
		public IDocument Document {
31
			get {
32
				return document;
33
			}
34
		}
35
		
36
		/// <returns>
37
		/// -1 if no offset was specified for this event
38
		/// </returns>
39
		public int Offset {
40
			get {
41
				return offset;
42
			}
43
		}
44
		
45
		/// <returns>
46
		/// null if no text was specified for this event
47
		/// </returns>
48
		public string Text {
49
			get {
50
				return text;
51
			}
52
		}
53
		
54
		/// <returns>
55
		/// -1 if no length was specified for this event
56
		/// </returns>
57
		public int Length {
58
			get {
59
				return length;
60
			}
61
		}
62
		
63
		/// <summary>
64
		/// Creates a new instance off <see cref="DocumentEventArgs"/>
65
		/// </summary>
66
		public DocumentEventArgs(IDocument document) : this(document, -1, -1, null)
67
		{
68
		}
69
		
70
		/// <summary>
71
		/// Creates a new instance off <see cref="DocumentEventArgs"/>
72
		/// </summary>
73
		public DocumentEventArgs(IDocument document, int offset) : this(document, offset, -1, null)
74
		{
75
		}
76
		
77
		/// <summary>
78
		/// Creates a new instance off <see cref="DocumentEventArgs"/>
79
		/// </summary>
80
		public DocumentEventArgs(IDocument document, int offset, int length) : this(document, offset, length, null)
81
		{
82
		}
83
		
84
		/// <summary>
85
		/// Creates a new instance off <see cref="DocumentEventArgs"/>
86
		/// </summary>
87
		public DocumentEventArgs(IDocument document, int offset, int length, string text)
88
		{
89
			this.document = document;
90
			this.offset   = offset;
91
			this.length   = length;
92
			this.text     = text;
93
		}
94
		public override string ToString()
95
		{
96
			return String.Format("[DocumentEventArgs: Document = {0}, Offset = {1}, Text = {2}, Length = {3}]",
97
			                     Document,
98
			                     Offset,
99
			                     Text,
100
			                     Length);
101
		}
102
	}
103
}