EBOOKHTMLParser.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * This file is part of the libe-book project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef EBOOKHTMLPARSER_H_INCLUDED
11#define EBOOKHTMLPARSER_H_INCLUDED
12
13#include <memory>
14
15#include <librevenge/librevenge.h>
16#include <librevenge-stream/librevenge-stream.h>
17
18#include "XMLTreeNode.h"
19
20namespace libebook
21{
22
23class XMLCollector;
24struct EBOOKHTMLMetadata;
25class EBOOKHTMLParagraphAttributes;
26class EBOOKHTMLSpanAttributes;
27class EBOOKHTMLTableCellAttributes;
28class EBOOKOutputElements;
29class XMLTreeWalker;
30
32{
33 struct State;
34
35public:
42
43public:
44 EBOOKHTMLParser(librevenge::RVNGInputStream *input, Dialect dialect, librevenge::RVNGTextInterface *document);
45 virtual ~EBOOKHTMLParser();
46
47 void parse();
49
50 virtual librevenge::RVNGInputStream *getImage(const char *path) = 0;
51 virtual librevenge::RVNGInputStream *getObject(const char *path) = 0;
52 virtual librevenge::RVNGInputStream *getStylesheet(const char *path) = 0;
53
54private:
55 const XMLTreeNodePtr_t readTreeImpl(std::string &encoding, bool &encodingChange);
56 void processNode(const XMLTreeWalker &node);
57
58 void startElement(const XMLTreeWalker &node);
59 void endElement(const XMLTreeWalker &node);
60 void text(const XMLTreeWalker &node);
61
62 void startExternalElement(const XMLTreeWalker &node);
63 void endExternalElement(const XMLTreeWalker &node);
64
65 void sendParagraph(const XMLTreeWalker &node);
66 void sendSpan(const XMLTreeWalker &node);
67 void sendTableCell(const XMLTreeWalker &node);
68 void sendPreformattedText(const char *ch, int len);
69 void sendHeading(const XMLTreeWalker &node, int level);
70
71private:
72 std::shared_ptr<XMLCollector> m_collector;
73 std::shared_ptr<State> m_state;
74 std::shared_ptr<librevenge::RVNGInputStream> m_input;
75 // const Dialect m_dialect;
76 std::shared_ptr<librevenge::RVNGInputStream> m_workingInput;
77};
78
79}
80
81#endif // EBOOKHTMLPARSER_H_INCLUDED
82
83/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
XMLTreeNodePtr_t document
Definition EBOOKHTMLParser.cpp:163
size_t len
Definition EBOOKHTMLParser.cpp:47
const char * encoding
Definition EBOOKHTMLParser.cpp:166
string path
Definition EBOOKOPFParser.cpp:49
Definition EBOOKHTMLParser.h:32
virtual librevenge::RVNGInputStream * getImage(const char *path)=0
std::shared_ptr< XMLCollector > m_collector
Definition EBOOKHTMLParser.h:72
virtual ~EBOOKHTMLParser()
Definition EBOOKHTMLParser.cpp:928
std::shared_ptr< librevenge::RVNGInputStream > m_input
Definition EBOOKHTMLParser.h:74
const XMLTreeNodePtr_t readTreeImpl(std::string &encoding, bool &encodingChange)
Definition EBOOKHTMLParser.cpp:964
void sendSpan(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:1478
void parse()
Definition EBOOKHTMLParser.cpp:932
void endExternalElement(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:1466
void processNode(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:996
virtual librevenge::RVNGInputStream * getObject(const char *path)=0
std::shared_ptr< librevenge::RVNGInputStream > m_workingInput
Definition EBOOKHTMLParser.h:76
void startElement(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:1011
void sendHeading(const XMLTreeWalker &node, int level)
Definition EBOOKHTMLParser.cpp:1534
const XMLTreeNodePtr_t readTree()
Definition EBOOKHTMLParser.cpp:946
Dialect
Definition EBOOKHTMLParser.h:37
@ DIALECT_HTML
Definition EBOOKHTMLParser.h:39
@ DIALECT_UNKNOWN
Definition EBOOKHTMLParser.h:38
@ DIALECT_XHTML
Definition EBOOKHTMLParser.h:40
void startExternalElement(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:1460
std::shared_ptr< State > m_state
Definition EBOOKHTMLParser.h:73
virtual librevenge::RVNGInputStream * getStylesheet(const char *path)=0
EBOOKHTMLParser(librevenge::RVNGInputStream *input, Dialect dialect, librevenge::RVNGTextInterface *document)
Definition EBOOKHTMLParser.cpp:920
void endElement(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:1261
void sendParagraph(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:1472
void sendPreformattedText(const char *ch, int len)
Definition EBOOKHTMLParser.cpp:1490
void sendTableCell(const XMLTreeWalker &node)
Definition EBOOKHTMLParser.cpp:1484
Definition XMLTreeWalker.h:28
@ input
Definition EBOOKHTMLToken.h:89
@ text
Definition EBOOKHTMLToken.h:257
Definition BBeBCollector.cpp:19
boost::intrusive_ptr< XMLTreeNode > XMLTreeNodePtr_t
Definition XMLTreeNode.h:25
Definition EBOOKHTMLParser.cpp:903

Generated for libe-book by doxygen 1.12.0