OSDN Git Service

Initial commit
[wordring-tm/wordring-tm.git] / html / htmlprivate.h
1 #ifndef HTMLPRIVATE_H
2 #define HTMLPRIVATE_H
3
4 #include "html.h"
5
6 class HtmlHandler;
7 class HtmlElement;
8
9 class HtmlPrivate : public HtmlNode
10 {
11         friend class HtmlDocument;
12         typedef HtmlPrivate self_type;
13
14 public:
15         int type() const;
16         int place() const;
17
18         int tclass() const;
19         string_type tname() const;
20         int tcategory() const;
21         int tinfo() const;
22
23         string_type name() const;
24         string_type value() const;
25         void set_value(string_type const &value_);
26
27         // 属性
28         attribute_iterator abegin();
29         attribute_iterator aend();
30         const_attribute_iterator abegin() const;
31         const_attribute_iterator aend() const;
32
33         bool has_attribute(string_type const &name_) const;
34         string_type attribute(string_type const &name_) const;
35         HtmlNode& set_attribute(string_type const &name_, string_type const &value_);
36         HtmlNode& set_attribute(string_type const &name_, int value_);
37
38         // 文字列化
39         string_type to_string() const;
40         string_type debug_dump() const;
41
42 public:
43         // リスト操作系
44         pointer lself();
45         pointer lparent();
46         pointer lbegin();
47         pointer ltail();
48         pointer lend();
49
50         weak_pointer set_lparent(weak_pointer const &parent_);
51         virtual weak_pointer set_lbegin(weak_pointer const &begin_);
52         virtual weak_pointer set_ltail(weak_pointer const &tail_);
53
54         virtual const_pointer lself() const;
55         const_pointer lparent() const;
56         virtual const_pointer lbegin() const;
57         virtual const_pointer ltail() const;
58         const_pointer lend() const;
59
60         pointer lprevious();
61         pointer lnext();
62         weak_pointer set_lprevious(weak_pointer const &previous_);
63         pointer set_lnext(pointer const &next_);
64         const_pointer lprevious() const;
65         const_pointer lnext() const;
66
67         pointer lappend(pointer node);
68         pointer linsert_after(pointer begin_, pointer tail_);
69         pointer linsert(pointer begin_, pointer tail_);
70         pointer lremove(pointer begin_, pointer tail_);
71
72         // 子ノード
73         pointer lcbegin();
74         pointer lcend();
75         const_pointer lcbegin() const;
76         const_pointer lcend() const;
77
78         virtual pointer lclone(weak_pointer const &parent_);
79
80 protected:
81         HtmlPrivate(weak_pointer const &parent_);
82         HtmlPrivate();
83
84 protected:
85         weak_pointer m_parent; /*!< 親のデータ開始位置参照 */
86         weak_pointer m_previous; /*!< 前のデータ参照 */
87 };
88
89 class HtmlElementOpenPrivate : public HtmlPrivate
90 {
91         friend class HtmlHandler;
92         typedef HtmlElementOpenPrivate self_type;
93
94 public:
95         int type() const;
96         int place() const;
97
98         string_type debug_dump() const;
99
100         pointer lbegin();
101         pointer ltail();
102         weak_pointer set_ltail(weak_pointer const &tail_);
103
104 protected:
105         HtmlElementOpenPrivate(weak_pointer const &parent_);
106
107 private:
108         weak_pointer m_tail; /*!< 閉じタグへの参照 */
109 };
110
111 /*!
112  * \brief 終了タグを表すクラスです。
113  */
114 class HtmlElementClosePrivate : public HtmlPrivate
115 {
116         friend class HtmlHandler;
117         friend class HtmlElement;
118         friend class HtmlElementClose;
119         typedef HtmlElementClosePrivate self_type;
120
121 public:
122         int type() const;
123         int place() const;
124
125         string_type name() const;
126
127         int tcategory() const;
128
129         string_type to_string() const;
130         string_type debug_dump() const;
131
132         pointer lbegin();
133         pointer ltail();
134         weak_pointer set_lbegin(weak_pointer const &begin_);
135
136 protected:
137         HtmlElementClosePrivate(weak_pointer const &parent_);
138
139 private:
140         weak_pointer m_begin; /*!< 開きタグへの参照 */
141 };
142
143 /*!
144  * \brief テキストを表現するクラスです。
145  */
146 class HtmlTextPrivate : public HtmlPrivate
147 {
148         friend class HtmlText;
149         typedef HtmlTextPrivate self_type;
150
151 public:
152         int type() const;
153         string_type name() const;
154         string_type value() const;
155         void set_value(string_type const &value_);
156
157         int tinfo() const;
158
159         string_type to_string() const;
160         string_type debug_dump() const;
161
162
163 protected:
164         HtmlTextPrivate(weak_pointer const &parent_);
165
166 protected:
167         string_type m_value;
168         int m_tinfo;
169 };
170
171 class HtmlCDATASectionPrivate : public HtmlPrivate
172 {
173         friend class HtmlHandler;
174         typedef HtmlCDATASectionPrivate self_type;
175
176 public:
177         int type() const;
178         string_type name() const;
179
180         void set_value(string_type const &value_);
181
182 protected:
183         HtmlCDATASectionPrivate(weak_pointer const &parent_);
184
185 private:
186         string_type m_value;
187 };
188
189 class HtmlEntityReferencePrivate : public HtmlPrivate
190 {
191         friend class HtmlHandler;
192         typedef HtmlEntityReferencePrivate self_type;
193
194 public:
195         int type() const;
196         string_type name() const;
197
198         void set_value(string_type const &value_);
199
200 protected:
201         HtmlEntityReferencePrivate(weak_pointer const &parent_);
202
203 private:
204         string_type m_value;
205 };
206
207 class HtmlEntityPrivate : public HtmlPrivate
208 {
209         friend class HtmlHandler;
210         typedef HtmlEntityPrivate self_type;
211
212 public:
213         int type() const;
214         string_type name() const;
215
216 protected:
217         HtmlEntityPrivate(weak_pointer const &parent_);
218
219 private:
220         string_type m_value;
221 };
222
223 class HtmlProcessingInstructionPrivate : public HtmlPrivate
224 {
225         friend class HtmlHandler;
226         typedef HtmlProcessingInstructionPrivate self_type;
227
228 public:
229         int type() const;
230         string_type name() const;
231
232 protected:
233         HtmlProcessingInstructionPrivate(weak_pointer const &parent_);
234
235 private:
236         string_type m_value;
237 };
238
239 class HtmlCommentPrivate : public HtmlPrivate
240 {
241         friend class HtmlComment;
242         typedef HtmlCommentPrivate self_type;
243
244 public:
245         int type() const;
246         string_type name() const;
247
248         void set_value(string_type const &value_);
249
250         string_type to_string() const;
251         string_type debug_dump() const;
252
253 protected:
254         HtmlCommentPrivate(weak_pointer const &parent_);
255
256 protected:
257         string_type m_value;
258 };
259
260 class HtmlDocumentOpenPrivate : public HtmlPrivate
261 {
262         friend class HtmlHandler;
263         typedef HtmlDocumentOpenPrivate self_type;
264
265 public:
266         document_type* document();
267         document_type const* document() const;
268
269         int type() const;
270         int place() const;
271
272         string_type name() const;
273
274         pointer lself();
275         pointer lbegin();
276         pointer ltail();
277         weak_pointer set_ltail(weak_pointer const &tail_);
278
279 protected:
280         HtmlDocumentOpenPrivate(document_type *document_);
281
282 private:
283         document_type *m_document;
284         weak_pointer m_tail; /*!< 閉じタグへの参照 */
285 };
286
287 class HtmlDocumentClosePrivate : public HtmlPrivate
288 {
289         friend class HtmlHandler;
290         typedef HtmlDocumentClosePrivate self_type;
291
292 public:
293         int type() const;
294         int place() const;
295
296         string_type name() const;
297
298         pointer lbegin();
299         pointer ltail();
300         weak_pointer set_lbegin(weak_pointer const &begin_);
301
302 protected:
303         HtmlDocumentClosePrivate();
304
305 private:
306         weak_pointer m_begin; /*!< 開きタグへの参照 */
307 };
308
309 class HtmlDocumentTypePrivate : public HtmlPrivate
310 {
311         friend class HtmlHandler;
312         typedef HtmlDocumentTypePrivate self_type;
313
314 public:
315         int type() const;
316         string_type name() const;
317
318 protected:
319         HtmlDocumentTypePrivate(weak_pointer const &parent_);
320
321 private:
322         string_type m_value;
323 };
324
325 class HtmlDocumentFragmentPrivate : public HtmlPrivate
326 {
327         friend class HtmlHandler;
328         typedef HtmlDocumentFragmentPrivate self_type;
329
330 public:
331         int type() const;
332         string_type name() const;
333
334 protected:
335         HtmlDocumentFragmentPrivate(weak_pointer const &parent_);
336
337 private:
338         string_type m_value;
339 };
340
341 class HtmlNotationPrivate : public HtmlPrivate
342 {
343         friend class HtmlHandler;
344         typedef HtmlNotationPrivate self_type;
345
346 public:
347         int type() const;
348         string_type name() const;
349
350 protected:
351         HtmlNotationPrivate(weak_pointer const &parent_);
352
353 private:
354         string_type m_value;
355 };
356
357
358 #endif // HTMLPRIVATE_H