ScummVM API documentation
te_text_layout_xml_parser.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef TETRAEDGE_TE_TE_TEXT_LAYOUT_XML_PARSER_H
23#define TETRAEDGE_TE_TE_TEXT_LAYOUT_XML_PARSER_H
24
25#include "common/array.h"
26#include "common/str.h"
27
28#include "tetraedge/te/te_xml_parser.h"
29#include "tetraedge/te/te_color.h"
30
31namespace Tetraedge {
32
34public:
35 TeTextLayoutXmlParser() : TeXmlParser(), _fontSize(0) {}
36
37 CUSTOM_XML_PARSER(TeTextLayoutXmlParser) {
38 XML_KEY(document)
39 XML_KEY(section)
40 XML_PROP(style, true)
41 KEY_END()
42 XML_KEY(color)
43 XML_PROP(r, true)
44 XML_PROP(g, true)
45 XML_PROP(b, true)
46 KEY_END()
47 XML_KEY(font)
48 XML_PROP(file, true)
49 XML_PROP(size, false)
50 KEY_END()
51 XML_KEY(br)
52 KEY_END()
53 XML_KEY(b)
54 KEY_END()
55 KEY_END()
56 } PARSER_END()
57
58private:
59 // Parser callback methods
60 bool parserCallback_document(ParserNode *node) { return true; };
61 bool parserCallback_section(ParserNode *node);
62 bool parserCallback_color(ParserNode *node);
63 bool parserCallback_font(ParserNode *node);
64 bool parserCallback_br(ParserNode *node);
65 bool parserCallback_b(ParserNode *node);
66
67 virtual bool textCallback(const Common::String &str) override;
68
69public:
70 const TeColor &color() const { return _color; }
71 const Common::String &fontFile() const { return _fontFile; }
72 int fontSize() const { return _fontSize; }
73 const Common::String &style() const { return _style; }
74 const Common::String &textContent() const { return _textContent; }
75 const Common::Array<uint> &lineBreaks() const { return _lineBreaks; }
76
77private:
78 TeColor _color;
79 Common::String _fontFile;
80 int _fontSize;
81 Common::String _style;
82 Common::String _textContent;
83 Common::Array<uint> _lineBreaks;
84};
85
86} // end namespace Tetraedge
87
88#endif // TETRAEDGE_TE_TE_TEXT_LAYOUT_XML_PARSER_H
Definition: str.h:59
Definition: te_color.h:30
Definition: te_text_layout_xml_parser.h:33
virtual bool textCallback(const Common::String &str) override
Definition: te_xml_parser.h:38
Definition: xmlparser.h:145