-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBalise.h
88 lines (84 loc) · 1.46 KB
/
Balise.h
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
82
83
84
85
86
87
#pragma once
#include <iostream>
#include "KDColor.h"
class Balise {
public:
const char* balises[100]{
"html", "head", "body", "link", "meta", "script", "style", "title",
"abbr", "blockquote", "cite", "q",
"sup", "sub",
"strong", "em", "mark",
"h1", "h2", "h3", "h4", "h5", "h6",
"img", "figure", "figcaption",
"audio", "video", "source",
"a",
"br",
"p",
"hr",
"address",
"del",
"ins",
"dfn",
"kbd",
"pre",
"progress",
"ul",
"ol",
"li",
"dl",
"dt",
"dd",
"span",
"div",
"input",
"unknown",
"Text",
"Line"
};
enum class Balises {
html, head, body, link, meta, script, style, title,
abbr, blockquote, cite, q,
sup, sub,
strong, em, mark,
h1, h2, h3, h4, h5, h6,
img, figure, figcaption,
audio, video, source,
a,
br,
p,
hr,
address,
del,
ins,
dfn,
kbd,
pre,
progress,
ul,
ol,
li,
dl,
dt,
dd,
span,
div,
input,
unknown,
Text
};
Balise(Balises name) :m_name(name) {}
Balise(char * str , size_t len) :m_name(str_to_balises(str, len)) {}
Balise(const char* str) :m_name(str_to_balises(str, strlen(str))) {}
bool isOrpheline();
KDColor defaultColor();
bool isUndisplayable();
bool isDisplayable();
bool isInline();
bool isBlock();
friend bool operator==(const Balise& b1, const Balise& b2);
const char* text ()const;
private:
Balises str_to_balises(const char* str, size_t len);
Balises m_name;
};
std::ostream &operator<<(std::ostream& os, const Balise& b);