blob: 7a5a5117e9fb8503e3bfb7d7c21b346e02178b91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#ifndef TEXO_INCLUDED_HTML
#define TEXO_INCLUDED_HTML
#include "texo.hpp"
class TexoHTMLProducer: public TexoProducer {
public:
TexoHTMLProducer(TexoExporter &exporter);
void Put(const Texo &piece);
private:
void BeginLink(const Texo &piece);
void Image(const Texo &piece);
};
class TexoHTMLStack {
public:
TexoHTMLStack();
~TexoHTMLStack();
void Push(Texo::Type tag);
Texo::Type Pop();
private:
TexoHTMLStack *next;
Texo::Type tag;
};
class TexoHTMLImporter: public TexoImporter {
public:
TexoHTMLImporter(TexoProducer &producer, bool is_autoclose = true);
~TexoHTMLImporter();
void Put(const char c);
private:
bool is_autoclose;
enum State {
text = 0,
tag_open,
tag_name,
tag_param_skip,
tag_param_pre,
tag_param,
tag_param_post,
tag_param_value_pre,
tag_param_value,
tag_param_value_quoted
} state;
State Text(const char c);
State TagOpen(const char c);
State TagName(const char c);
State TagParamSkip(const char c);
State TagParamPre(const char c);
State TagParam(const char c);
State TagParamPost(const char c);
State TagParamValuePre(const char c);
State TagParamValue(const char c);
State TagParamValueQuoted(const char c);
TexoHTMLStack opened;
void Close();
bool is_closing;
Texo::Type tag;
void SetTag();
char *readed;
int readed_len;
int readed_size;
void ReadedAdd(const char c);
void ReadedClear();
};
#endif
|