[runtime] Disable some tests in full-aot mode which cannot be AOTed because of type...
[mono.git] / mcs / tools / mdoc / Mono.Documentation / XhtmlWriter.cs
1 //
2 // XhtmlWriter.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //      Jonathan Pryor  <jpryor@novell.com>
7 //
8 // (C)2004 Atsushi Enomoto 
9 //
10 //
11 using System;
12 using System.Globalization;
13 using System.Collections.Generic;
14 using System.Xml;
15
16 namespace Mono.Documentation {
17
18         class XhtmlWriter : DelegatingXmlWriter {
19                 XmlWriter writer;
20                 Stack<string> localNames;
21                 Stack<string> namespaces;
22
23                 public XhtmlWriter (XmlWriter writer) : base (writer)
24                 {
25                         this.writer = writer;
26                         localNames = new Stack<string> ();
27                         namespaces = new Stack<string> ();
28                 }
29
30                 public override void WriteStartElement (string prefix, string localName, string ns)
31                 {
32                         localNames.Push (localName);
33                         namespaces.Push (ns);
34                         writer.WriteStartElement (prefix, localName, ns);
35                 }
36
37                 public override void WriteEndElement ()
38                 {
39                         WriteWiseEndElement (false);
40                 }
41
42                 public override void WriteFullEndElement ()
43                 {
44                         WriteWiseEndElement (true);
45                 }
46
47                 void WriteWiseEndElement (bool full)
48                 {
49                         string localName = localNames.Pop ();
50                         /* string ns = */ namespaces.Pop ();
51                         if (true /* ns == "http://www.w3.org/1999/xhtml" */) {
52                                 switch (localName.ToLower (CultureInfo.InvariantCulture)) {
53                                 case "area":
54                                 case "base":
55                                 case "basefont":
56                                 case "br":
57                                 case "col":
58                                 case "frame":
59                                 case "hr":
60                                 case "img":
61                                 case "input":
62                                 case "isindex":
63                                 case "link":
64                                 case "meta":
65                                 case "param":
66                                         full = false;
67                                         break;
68                                 default:
69                                         full = true;
70                                         break;
71                                 }
72                         }
73                         if (full)
74                                 writer.WriteFullEndElement ();
75                         else
76                                 writer.WriteEndElement ();
77                 }
78         }
79
80         class DelegatingXmlWriter : XmlWriter {
81                 XmlWriter writer;
82
83                 public DelegatingXmlWriter (XmlWriter writer)
84                 {
85                         this.writer = writer;
86                 }
87
88                 public override void Close ()
89                 {
90                         writer.Close ();
91                 }
92
93                 public override void Flush ()
94                 {
95                         writer.Flush ();
96                 }
97
98                 public override string LookupPrefix (string ns)
99                 {
100                         return writer.LookupPrefix (ns);
101                 }
102
103                 public override void WriteBase64 (byte [] buffer, int index, int count)
104                 {
105                         writer.WriteBase64 (buffer, index, count);
106                 }
107
108                 public override void WriteBinHex (byte [] buffer, int index, int count)
109                 {
110                         writer.WriteBinHex (buffer, index, count);
111                 }
112
113                 public override void WriteCData (string text)
114                 {
115                         writer.WriteCData (text);
116                 }
117
118                 public override void WriteCharEntity (char ch)
119                 {
120                         writer.WriteCharEntity (ch);
121                 }
122
123                 public override void WriteChars (char [] buffer, int index, int count)
124                 {
125                         writer.WriteChars (buffer, index, count);
126                 }
127
128                 public override void WriteComment (string text)
129                 {
130                         writer.WriteComment (text);
131                 }
132
133                 public override void WriteDocType (string name, string pubid, string sysid, string subset)
134                 {
135                         writer.WriteDocType (name, pubid, sysid, subset);
136                 }
137
138                 public override void WriteEndAttribute ()
139                 {
140                         writer.WriteEndAttribute ();
141                 }
142
143                 public override void WriteEndDocument ()
144                 {
145                         writer.WriteEndDocument ();
146                 }
147
148                 public override void WriteEndElement ()
149                 {
150                         writer.WriteEndElement ();
151                 }
152
153                 public override void WriteEntityRef (string name)
154                 {
155                         writer.WriteEntityRef (name);
156                 }
157
158                 public override void WriteFullEndElement ()
159                 {
160                         writer.WriteFullEndElement ();
161                 }
162
163                 public override void WriteName (string name)
164                 {
165                         writer.WriteName (name);
166                 }
167
168                 public override void WriteNmToken (string name)
169                 {
170                         writer.WriteNmToken (name);
171                 }
172
173                 public override void WriteNode (XmlReader reader, bool defattr)
174                 {
175                         writer.WriteNode (reader, defattr);
176                 }
177
178                 public override void WriteProcessingInstruction (string name, string text)
179                 {
180                         writer.WriteProcessingInstruction (name, text);
181                 }
182
183                 public override void WriteQualifiedName (string localName, string ns)
184                 {
185                         writer.WriteQualifiedName (localName, ns);
186                 }
187
188                 public override void WriteRaw (string data)
189                 {
190                         writer.WriteRaw (data);
191                 }
192
193                 public override void WriteRaw (char [] buffer, int index, int count)
194                 {
195                         writer.WriteRaw (buffer, index, count);
196                 }
197
198                 public override void WriteStartAttribute (string prefix, string localName, string ns)
199                 {
200                         writer.WriteStartAttribute (prefix, localName, ns);
201                 }
202
203                 public override void WriteStartDocument (bool standalone)
204                 {
205                         writer.WriteStartDocument (standalone);
206                 }
207
208                 public override void WriteStartDocument ()
209                 {
210                         writer.WriteStartDocument ();
211                 }
212
213                 public override void WriteStartElement (string prefix, string localName, string ns)
214                 {
215                         writer.WriteStartElement (prefix, localName, ns);
216                 }
217
218                 public override void WriteString (string text)
219                 {
220                         writer.WriteString (text);
221                 }
222
223                 public override void WriteSurrogateCharEntity (char lowChar, char highChar)
224                 {
225                         writer.WriteSurrogateCharEntity (lowChar, highChar);
226                 }
227
228                 public override void WriteWhitespace (string ws)
229                 {
230                         writer.WriteWhitespace (ws);
231                 }
232
233                 public override WriteState WriteState {
234                         get {
235                                 return writer.WriteState;
236                         }
237                 }
238
239                 public override string XmlLang {
240                         get {
241                                 return writer.XmlLang;
242                         }
243                 }
244
245                 public override XmlSpace XmlSpace {
246                         get {
247                                 return writer.XmlSpace;
248                         }
249                 }
250         }
251 }
252