NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Render.HtmlRenderer Class Reference

Renders IHtmlObjects into plain text for display in browsers. More...

Inheritance diagram for Ntp.Analyzer.Render.HtmlRenderer:
Collaboration diagram for Ntp.Analyzer.Render.HtmlRenderer:

Public Member Functions

 HtmlRenderer (IHtmlObject htmlObject)
 Initializes a new instance of the HtmlRenderer class. More...
 
override string Render ()
 Render this instance plus all child instances. More...
 
string RenderFooter ()
 Renders the footer of the object. More...
 
string RenderHead ()
 Renders the head of the object. More...
 

Public Attributes

IEnumerable< IHtmlObjectChildren => children.ToArray()
 Gets the children of the IHtmlObject. More...
 
Uri WebPath => htmlObject.WebPath
 

Private Attributes

readonly List< IHtmlObjectchildren
 
readonly IHtmlObject htmlObject
 

Additional Inherited Members

- Properties inherited from Ntp.Analyzer.Render.IHtmlObject
IEnumerable< IHtmlObjectChildren [get]
 
Uri WebPath [get]
 

Detailed Description

Renders IHtmlObjects into plain text for display in browsers.

Definition at line 31 of file HtmlRenderer.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Render.HtmlRenderer.HtmlRenderer ( IHtmlObject  htmlObject)
inline

Initializes a new instance of the HtmlRenderer class.

Parameters
htmlObjectThe HTML object.

Definition at line 37 of file HtmlRenderer.cs.

References Ntp.Analyzer.Render.IHtmlObject.Children.

38  {
39  this.htmlObject = htmlObject;
40  children = new List<IHtmlObject>(htmlObject.Children);
41  }
IEnumerable< IHtmlObject > Children
Definition: IHtmlObject.cs:31
readonly IHtmlObject htmlObject
Definition: HtmlRenderer.cs:44
readonly List< IHtmlObject > children
Definition: HtmlRenderer.cs:43

Member Function Documentation

override string Ntp.Analyzer.Render.HtmlRenderer.Render ( )
inline

Render this instance plus all child instances.

Implements Ntp.Analyzer.Render.IHtmlObject.

Definition at line 66 of file HtmlRenderer.cs.

67  {
68  var builder = new StringBuilder();
69 
70  builder.Append(RenderHead());
71  builder.Append(htmlObject.Render());
72 
73  foreach (IHtmlObject renderer in children)
74  {
75  var childRenderer = new HtmlRenderer(renderer);
76  builder.Append(childRenderer.Render());
77  }
78 
79  builder.Append(RenderFooter());
80 
81  return builder.ToString();
82  }
string RenderFooter()
Renders the footer of the object.
Definition: HtmlRenderer.cs:88
readonly IHtmlObject htmlObject
Definition: HtmlRenderer.cs:44
string RenderHead()
Renders the head of the object.
Definition: HtmlRenderer.cs:58
readonly List< IHtmlObject > children
Definition: HtmlRenderer.cs:43
HtmlRenderer(IHtmlObject htmlObject)
Initializes a new instance of the HtmlRenderer class.
Definition: HtmlRenderer.cs:37
string Ntp.Analyzer.Render.HtmlRenderer.RenderFooter ( )
inline

Renders the footer of the object.

Returns
The footer.

Implements Ntp.Analyzer.Render.IHtmlObject.

Definition at line 88 of file HtmlRenderer.cs.

89  {
90  return htmlObject.RenderFooter();
91  }
readonly IHtmlObject htmlObject
Definition: HtmlRenderer.cs:44
string Ntp.Analyzer.Render.HtmlRenderer.RenderHead ( )
inline

Renders the head of the object.

Returns
The head.

Implements Ntp.Analyzer.Render.IHtmlObject.

Definition at line 58 of file HtmlRenderer.cs.

59  {
60  return htmlObject.RenderHead();
61  }
readonly IHtmlObject htmlObject
Definition: HtmlRenderer.cs:44

Member Data Documentation

readonly List<IHtmlObject> Ntp.Analyzer.Render.HtmlRenderer.children
private

Definition at line 43 of file HtmlRenderer.cs.

IEnumerable<IHtmlObject> Ntp.Analyzer.Render.HtmlRenderer.Children => children.ToArray()

Gets the children of the IHtmlObject.

The children.

Definition at line 52 of file HtmlRenderer.cs.

readonly IHtmlObject Ntp.Analyzer.Render.HtmlRenderer.htmlObject
private

Definition at line 44 of file HtmlRenderer.cs.

Uri Ntp.Analyzer.Render.HtmlRenderer.WebPath => htmlObject.WebPath

Definition at line 46 of file HtmlRenderer.cs.


The documentation for this class was generated from the following file: