1 // HtmlAgilityPack V1.0 - Simon Mourier <simon underscore mourier at hotmail dot com>
2 namespace HtmlAgilityPack
5 /// Represents a base class for fragments in a mixed code document.
7 public abstract class MixedCodeDocumentFragment
11 internal MixedCodeDocument Doc
;
12 private string _fragmentText
;
16 internal int _lineposition
;
17 internal MixedCodeDocumentFragmentType _type
;
23 internal MixedCodeDocumentFragment(MixedCodeDocument doc
, MixedCodeDocumentFragmentType type
)
29 case MixedCodeDocumentFragmentType
.Text
:
30 Doc
._textfragments
.Append(this);
33 case MixedCodeDocumentFragmentType
.Code
:
34 Doc
._codefragments
.Append(this);
37 Doc
._fragments
.Append(this);
45 /// Gets the fragement text.
47 public string FragmentText
51 if (_fragmentText
== null)
53 _fragmentText
= Doc
._text
.Substring(Index
, Length
);
57 internal set { _fragmentText = value; }
61 /// Gets the type of fragment.
63 public MixedCodeDocumentFragmentType FragmentType
69 /// Gets the line number of the fragment.
74 internal set { _line = value; }
78 /// Gets the line position (column) of the fragment.
80 public int LinePosition
82 get { return _lineposition; }
86 /// Gets the fragment position in the document's stream.
88 public int StreamPosition