XMLCollector.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 XMLCOLLECTOR_H_INCLUDED
11 #define XMLCOLLECTOR_H_INCLUDED
12 
13 #include <string>
14 
15 #include <boost/shared_ptr.hpp>
16 
17 #include <librevenge/librevenge.h>
18 
19 #include "XMLTreeWalker.h"
20 
21 namespace libebook
22 {
23 
25 {
26  // disable copying
29 
30 public:
31  struct State;
32 
33 public:
34  explicit XMLCollector(librevenge::RVNGTextInterface *document);
35 
36  void collectMetadata(const librevenge::RVNGPropertyList &metadata);
37 
38  void collectText(const std::string &text);
39  void collectSpace();
40  void collectTab();
41  void collectLineBreak();
42 
43  void collectImage(const librevenge::RVNGPropertyList &props);
44 
45  void collectCoveredTableCell(const librevenge::RVNGPropertyList &props);
46 
47  void openPageSpan(const librevenge::RVNGPropertyList &props);
48  void closePageSpan();
49  void openHeader(const librevenge::RVNGPropertyList &props);
50  void closeHeader();
51  void openFooter(const librevenge::RVNGPropertyList &props);
52  void closeFooter();
53  void openFootnote(const librevenge::RVNGPropertyList &props);
54  void closeFootnote();
55 
56  void openParagraph(const librevenge::RVNGPropertyList &props);
57  void closeParagraph();
58  void openSpan(const librevenge::RVNGPropertyList &props);
59  void closeSpan();
60  void openLink(const librevenge::RVNGPropertyList &props);
61  void closeLink();
62 
63  void openTable(const librevenge::RVNGPropertyList &props);
64  void closeTable();
65  void openTableRow(const librevenge::RVNGPropertyList &props);
66  void closeTableRow();
67  void openTableCell(const librevenge::RVNGPropertyList &props);
68  void closeTableCell();
69 
70  void openOrderedList(const librevenge::RVNGPropertyList &props);
71  void closeOrderedList();
72  void openUnorderedList(const librevenge::RVNGPropertyList &props);
73  void closeUnorderedList();
74 
75  void openListElement(const librevenge::RVNGPropertyList &props);
76  void closeListElement();
77 
78  void openObject(const librevenge::RVNGPropertyList &props);
79  void closeObject();
80 
83  void finish();
84 
85 private:
86  librevenge::RVNGTextInterface *const m_document;
87  boost::shared_ptr<State> m_state;
88 };
89 
90 }
91 
92 #endif // XMLCOLLECTOR_H_INCLUDED
93 
94 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::XMLCollector::finish
void finish()
Signalize an end of parsing from the parser.
Definition: XMLCollector.cpp:1533
m_continued
bool m_continued
Definition: XMLCollector.cpp:147
libebook::XMLCollector::XMLCollector
XMLCollector(const XMLCollector &)
EBOOKOutputElements.h
libebook::XMLCollector::State::metadata
RVNGPropertyList metadata
Definition: XMLCollector.cpp:741
TR
#define TR(c, e, a)
Definition: XMLCollector.cpp:902
action
ActionFun_t action
Definition: XMLCollector.cpp:572
libebook::XMLCollector::openFootnote
void openFootnote(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1422
libebook::XMLCollector::State
Definition: XMLCollector.cpp:739
libebook::XMLCollector::closeTable
void closeTable()
Definition: XMLCollector.cpp:1467
libebook::XMLCollector::openLink
void openLink(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1452
libebook::XMLCollector
Definition: XMLCollector.h:25
libebook::XMLCollector::closePageSpan
void closePageSpan()
Definition: XMLCollector.cpp:1397
m_openFun
OpenFun_t m_openFun
Definition: XMLCollector.cpp:141
libebook::XMLCollector::closeFootnote
void closeFootnote()
Definition: XMLCollector.cpp:1427
libebook::XMLCollector::openFooter
void openFooter(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1412
libebook::XMLCollector::collectMetadata
void collectMetadata(const librevenge::RVNGPropertyList &metadata)
Definition: XMLCollector.cpp:1348
libebook::XMLCollector::State::machine
StackMachine machine
Definition: XMLCollector.cpp:743
libebook::XMLCollector::collectSpace
void collectSpace()
Definition: XMLCollector.cpp:1359
libebook::XMLCollector::collectCoveredTableCell
void collectCoveredTableCell(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1386
newContext
ContextType newContext
Definition: XMLCollector.cpp:571
libebook::XMLCollector::collectImage
void collectImage(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1377
libebook
Definition: CHMParser.cpp:21
libebook::XMLCollector::m_state
boost::shared_ptr< State > m_state
Definition: XMLCollector.h:87
libebook::XMLCollector::collectText
void collectText(const std::string &text)
Definition: XMLCollector.cpp:1353
libebook::XMLCollector::closeSpan
void closeSpan()
Definition: XMLCollector.cpp:1447
libebook::XMLCollector::openTableCell
void openTableCell(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1482
m_queue
EventQueue_t m_queue
Definition: XMLCollector.cpp:731
libebook::XMLCollector::State::contextStack
stack< Context > contextStack
Definition: XMLCollector.cpp:745
libebook_utils.h
m_dummy
bool m_dummy
Definition: XMLCollector.cpp:144
libebook::XMLCollector::closeTableRow
void closeTableRow()
Definition: XMLCollector.cpp:1477
event
EventType event
Definition: XMLCollector.cpp:570
TR_ANY_R
#define TR_ANY_R(c, e, a)
Definition: XMLCollector.cpp:910
context
ContextType context
Definition: XMLCollector.cpp:569
libebook::XMLCollector::openListElement
void openListElement(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1512
libebook::XMLCollector::openParagraph
void openParagraph(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1432
m_closeFun
CloseFun_t m_closeFun
Definition: XMLCollector.cpp:142
libebook::XMLCollector::openOrderedList
void openOrderedList(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1492
libebook::XMLCollector::closeOrderedList
void closeOrderedList()
Definition: XMLCollector.cpp:1497
libebook::EBOOKHTMLToken::i
@ i
Definition: EBOOKHTMLToken.h:88
libebook::XMLCollector::closeTableCell
void closeTableCell()
Definition: XMLCollector.cpp:1487
document
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:169
m_data
shared_ptr< XMLCollector::State > m_data
Definition: XMLCollector.cpp:732
libebook::EBOOKHTMLToken::text
@ text
Definition: EBOOKHTMLToken.h:259
EBOOK_NUM_ELEMENTS
#define EBOOK_NUM_ELEMENTS(array)
Definition: libebook_utils.h:77
libebook::XMLCollector::closeParagraph
void closeParagraph()
Definition: XMLCollector.cpp:1437
libebook::XMLCollector::openObject
void openObject(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1522
m_propList
RVNGPropertyList m_propList
Definition: XMLCollector.cpp:143
metadata
RVNGPropertyList metadata
Definition: EBOOKOPFParser.cpp:63
libebook::XMLCollector::openTableRow
void openTableRow(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1472
libebook::XMLCollector::collectLineBreak
void collectLineBreak()
Definition: XMLCollector.cpp:1371
repeat
bool repeat
Definition: XMLCollector.cpp:573
libebook::XMLCollector::State::State
State(const State &)
data
MSPackFileData * data
Definition: CHMStream.cpp:63
m_transitions
TransitionTable_t m_transitions
Definition: XMLCollector.cpp:730
libebook::XMLCollector::State::currentProps
const RVNGPropertyList * currentProps
Definition: XMLCollector.cpp:748
libebook::XMLCollector::openUnorderedList
void openUnorderedList(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1502
libebook::XMLCollector::closeUnorderedList
void closeUnorderedList()
Definition: XMLCollector.cpp:1507
libebook::XMLCollector::closeListElement
void closeListElement()
Definition: XMLCollector.cpp:1517
libebook::XMLCollector::closeFooter
void closeFooter()
Definition: XMLCollector.cpp:1417
libebook::XMLCollector::State::getCurrentOutput
const OutputHandlerPtr_t getCurrentOutput() const
Definition: XMLCollector.cpp:1333
libebook::XMLCollector::openHeader
void openHeader(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1402
restore
bool restore
Restore one (or more) contexts on close.
Definition: XMLCollector.cpp:603
TR_ANY
#define TR_ANY(c, e, a)
Definition: XMLCollector.cpp:909
libebook::XMLCollector::openSpan
void openSpan(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1442
libebook::XMLCollector::State::operator=
State & operator=(const State &)
libebook::XMLCollector::openPageSpan
void openPageSpan(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1392
continued
bool continued
Indicates that this is a continuation of an interrupted context.
Definition: XMLCollector.cpp:599
XMLTreeWalker.h
m_output
EBOOKOutputElements & m_output
Definition: XMLCollector.cpp:139
libebook::XMLCollector::closeHeader
void closeHeader()
Definition: XMLCollector.cpp:1407
m_parent
const OutputHandlerPtr_t m_parent
Definition: XMLCollector.cpp:140
libebook::XMLCollector::State::savedStack
stack< Context > savedStack
Definition: XMLCollector.cpp:746
libebook::XMLCollector::openTable
void openTable(const librevenge::RVNGPropertyList &props)
Definition: XMLCollector.cpp:1462
libebook::EBOOKHTMLToken::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(EBOOKToken< EBOOKHTMLParser >::LAST_TOKEN >=LAST_TOKEN)
output
OutputHandlerPtr_t output
Definition: XMLCollector.cpp:588
m_closed
bool m_closed
Definition: XMLCollector.cpp:146
artificial
bool artificial
Definition: XMLCollector.cpp:593
restoring
bool restoring
Indicate whether restoring should continue with another context.
Definition: XMLCollector.cpp:610
libebook::XMLCollector::m_document
librevenge::RVNGTextInterface *const m_document
Definition: XMLCollector.h:86
XMLCollector.h
TR_NEW_R
#define TR_NEW_R(c, e, n, a)
Definition: XMLCollector.cpp:907
libebook::XMLCollector::closeObject
void closeObject()
Definition: XMLCollector.cpp:1528
libebook::XMLCollector::collectTab
void collectTab()
Definition: XMLCollector.cpp:1365
TR_NEW
#define TR_NEW(c, e, n, a)
Definition: XMLCollector.cpp:906
m_init
ContextType m_init
Definition: XMLCollector.cpp:733
libebook::EBOOKOutputElements
Definition: EBOOKOutputElements.h:24
libebook::XMLCollector::State::output
EBOOKOutputElements output
Definition: XMLCollector.cpp:740
libebook::XMLCollector::closeLink
void closeLink()
Definition: XMLCollector.cpp:1457
libebook::XMLCollector::operator=
XMLCollector & operator=(const XMLCollector &)
m_state
const shared_ptr< XMLCollector::State > m_state
Definition: XMLCollector.cpp:1295
m_open
bool m_open
Definition: XMLCollector.cpp:145
libebook::EBOOKHTMLToken::reset
@ reset
Definition: EBOOKHTMLToken.h:310
type
ContextType type
Definition: XMLCollector.cpp:589

Generated for libe-book by doxygen 1.8.18