[Mono.Security]: Add the new certificate store.
[mono-project.git] / docs / HtmlAgilityPack / MixedCodeDocumentFragment.cs
blobcfd268e0795d55c6953ba964afc2b33563defa6f
1 // HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
2 namespace HtmlAgilityPack
4 /// <summary>
5 /// Represents a base class for fragments in a mixed code document.
6 /// </summary>
7 public abstract class MixedCodeDocumentFragment
9 #region Fields
11 internal MixedCodeDocument Doc;
12 private string _fragmentText;
13 internal int Index;
14 internal int Length;
15 private int _line;
16 internal int _lineposition;
17 internal MixedCodeDocumentFragmentType _type;
19 #endregion
21 #region Constructors
23 internal MixedCodeDocumentFragment(MixedCodeDocument doc, MixedCodeDocumentFragmentType type)
25 Doc = doc;
26 _type = type;
27 switch (type)
29 case MixedCodeDocumentFragmentType.Text:
30 Doc._textfragments.Append(this);
31 break;
33 case MixedCodeDocumentFragmentType.Code:
34 Doc._codefragments.Append(this);
35 break;
37 Doc._fragments.Append(this);
40 #endregion
42 #region Properties
44 /// <summary>
45 /// Gets the fragement text.
46 /// </summary>
47 public string FragmentText
49 get
51 if (_fragmentText == null)
53 _fragmentText = Doc._text.Substring(Index, Length);
55 return FragmentText;
57 internal set { _fragmentText = value; }
60 /// <summary>
61 /// Gets the type of fragment.
62 /// </summary>
63 public MixedCodeDocumentFragmentType FragmentType
65 get { return _type; }
68 /// <summary>
69 /// Gets the line number of the fragment.
70 /// </summary>
71 public int Line
73 get { return _line; }
74 internal set { _line = value; }
77 /// <summary>
78 /// Gets the line position (column) of the fragment.
79 /// </summary>
80 public int LinePosition
82 get { return _lineposition; }
85 /// <summary>
86 /// Gets the fragment position in the document's stream.
87 /// </summary>
88 public int StreamPosition
90 get { return Index; }
93 #endregion