FictionBook2ExtrasCollector.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 FICTIONBOOK2EXTRASCOLLECTOR_H_INCLUDED
11#define FICTIONBOOK2EXTRASCOLLECTOR_H_INCLUDED
12
13#include "FictionBook2Collector.h"
14
15 namespace libebook
16{
17
18 class FictionBook2Style;
19
20 class FictionBook2ExtrasCollector : public FictionBook2Collector
21{
22 // no copying
23 FictionBook2ExtrasCollector(const FictionBook2ExtrasCollector &other);
24 FictionBook2ExtrasCollector &operator=(const FictionBook2ExtrasCollector &other);
25
26 public:
27 FictionBook2ExtrasCollector(NoteMap_t &notes, BinaryMap_t &bitmaps);
28 ~FictionBook2ExtrasCollector() override;
29
30 private:
31 void defineMetadataEntry(const char *name, const char *value) override;
32 void openMetadataEntry(const char *name) override;
33 void closeMetadataEntry() override;
34
35 void defineID(const char *) override;
36
37 void openPageSpan() override;
38 void closePageSpan() override;
39
40 void openBlock() override;
41 void closeBlock() override;
42
43 void openParagraph(const FictionBook2BlockFormat &format) override;
44 void closeParagraph() override;
45
46 void openSpan(const FictionBook2Style &style) override;
47 void closeSpan() override;
48
49 void insertText(const char *text) override;
50
51 void openTable(const FictionBook2BlockFormat &format) override;
52 void closeTable() override;
53
54 void openTableRow(const FictionBook2BlockFormat &format) override;
55 void closeTableRow() override;
56
57 void openTableCell(int rowspan, int colspan) override;
58 void closeTableCell() override;
59 void insertCoveredTableCell() override;
60
61 void insertFootnote(const char *id) override;
62
63 void insertBitmap(const char *id) override;
64 void insertBitmapData(const char *contentType, const char *base64Data) override;
65
66 void flushCurrentNote();
67
68 private:
69 NoteMap_t &m_notes;
70 BinaryMap_t &m_bitmaps;
71 std::string m_currentID;
72 Note m_currentNote;
73 // TODO: this is a hack, but better way would require refactoring
74 bool m_ignored;
75 bool m_title;
76 std::string m_currentText;
77};
78
79}
80
81#endif // FICTIONBOOK2EXTRASCOLLECTOR_H_INCLUDED
82
83/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
FictionBook2Collector.h
name
string name
Definition HTMLHelpStream.cpp:80
style
optional< Style > style
Definition TealDocParser.cpp:105
value
qi::rule< Iterator, AttrValue_t, qi::space_type > value
Definition TealDocParser.cpp:231
text
qi::rule< Iterator, AttrValue_t, qi::space_type > text
Definition TealDocParser.cpp:232
libebook::FictionBook2Collector
Definition FictionBook2Collector.h:23
libebook::FictionBook2Collector::NoteMap_t
std::unordered_map< std::string, Note > NoteMap_t
Definition FictionBook2Collector.h:58
libebook::FictionBook2Collector::BinaryMap_t
std::unordered_map< std::string, Binary > BinaryMap_t
Definition FictionBook2Collector.h:57
libebook::FictionBook2ExtrasCollector
Definition FictionBook2ExtrasCollector.h:21
libebook::FictionBook2ExtrasCollector::openSpan
void openSpan(const FictionBook2Style &style) override
Definition FictionBook2ExtrasCollector.cpp:95
libebook::FictionBook2ExtrasCollector::defineMetadataEntry
void defineMetadataEntry(const char *name, const char *value) override
Definition FictionBook2ExtrasCollector.cpp:42
libebook::FictionBook2ExtrasCollector::openTableCell
void openTableCell(int rowspan, int colspan) override
Definition FictionBook2ExtrasCollector.cpp:153
libebook::FictionBook2ExtrasCollector::m_notes
NoteMap_t & m_notes
Definition FictionBook2ExtrasCollector.h:69
libebook::FictionBook2ExtrasCollector::closeMetadataEntry
void closeMetadataEntry() override
Definition FictionBook2ExtrasCollector.cpp:50
libebook::FictionBook2ExtrasCollector::openTable
void openTable(const FictionBook2BlockFormat &format) override
Definition FictionBook2ExtrasCollector.cpp:131
libebook::FictionBook2ExtrasCollector::openTableRow
void openTableRow(const FictionBook2BlockFormat &format) override
Definition FictionBook2ExtrasCollector.cpp:142
libebook::FictionBook2ExtrasCollector::~FictionBook2ExtrasCollector
~FictionBook2ExtrasCollector() override
Definition FictionBook2ExtrasCollector.cpp:37
libebook::FictionBook2ExtrasCollector::openMetadataEntry
void openMetadataEntry(const char *name) override
Definition FictionBook2ExtrasCollector.cpp:46
libebook::FictionBook2ExtrasCollector::closeTableCell
void closeTableCell() override
Definition FictionBook2ExtrasCollector.cpp:160
libebook::FictionBook2ExtrasCollector::m_bitmaps
BinaryMap_t & m_bitmaps
Definition FictionBook2ExtrasCollector.h:70
libebook::FictionBook2ExtrasCollector::flushCurrentNote
void flushCurrentNote()
Definition FictionBook2ExtrasCollector.cpp:187
libebook::FictionBook2ExtrasCollector::closeParagraph
void closeParagraph() override
Definition FictionBook2ExtrasCollector.cpp:89
libebook::FictionBook2ExtrasCollector::insertCoveredTableCell
void insertCoveredTableCell() override
Definition FictionBook2ExtrasCollector.cpp:165
libebook::FictionBook2ExtrasCollector::closePageSpan
void closePageSpan() override
Definition FictionBook2ExtrasCollector.cpp:65
libebook::FictionBook2ExtrasCollector::operator=
FictionBook2ExtrasCollector & operator=(const FictionBook2ExtrasCollector &other)
libebook::FictionBook2ExtrasCollector::m_title
bool m_title
Definition FictionBook2ExtrasCollector.h:75
libebook::FictionBook2ExtrasCollector::insertBitmap
void insertBitmap(const char *id) override
Definition FictionBook2ExtrasCollector.cpp:174
libebook::FictionBook2ExtrasCollector::insertFootnote
void insertFootnote(const char *id) override
Definition FictionBook2ExtrasCollector.cpp:170
libebook::FictionBook2ExtrasCollector::closeTable
void closeTable() override
Definition FictionBook2ExtrasCollector.cpp:137
libebook::FictionBook2ExtrasCollector::closeSpan
void closeSpan() override
Definition FictionBook2ExtrasCollector.cpp:103
libebook::FictionBook2ExtrasCollector::insertBitmapData
void insertBitmapData(const char *contentType, const char *base64Data) override
Definition FictionBook2ExtrasCollector.cpp:178
libebook::FictionBook2ExtrasCollector::openBlock
void openBlock() override
Definition FictionBook2ExtrasCollector.cpp:69
libebook::FictionBook2ExtrasCollector::defineID
void defineID(const char *) override
Definition FictionBook2ExtrasCollector.cpp:54
libebook::FictionBook2ExtrasCollector::insertText
void insertText(const char *text) override
Definition FictionBook2ExtrasCollector.cpp:124
libebook::FictionBook2ExtrasCollector::m_currentNote
Note m_currentNote
Definition FictionBook2ExtrasCollector.h:72
libebook::FictionBook2ExtrasCollector::openParagraph
void openParagraph(const FictionBook2BlockFormat &format) override
Definition FictionBook2ExtrasCollector.cpp:79
libebook::FictionBook2ExtrasCollector::m_currentText
std::string m_currentText
Definition FictionBook2ExtrasCollector.h:76
libebook::FictionBook2ExtrasCollector::m_ignored
bool m_ignored
Definition FictionBook2ExtrasCollector.h:74
libebook::FictionBook2ExtrasCollector::closeTableRow
void closeTableRow() override
Definition FictionBook2ExtrasCollector.cpp:148
libebook::FictionBook2ExtrasCollector::FictionBook2ExtrasCollector
FictionBook2ExtrasCollector(const FictionBook2ExtrasCollector &other)
libebook::FictionBook2ExtrasCollector::closeBlock
void closeBlock() override
Definition FictionBook2ExtrasCollector.cpp:74
libebook::FictionBook2ExtrasCollector::m_currentID
std::string m_currentID
Definition FictionBook2ExtrasCollector.h:71
libebook::FictionBook2ExtrasCollector::openPageSpan
void openPageSpan() override
Definition FictionBook2ExtrasCollector.cpp:61
libebook::FictionBook2Style
Definition FictionBook2Style.h:56
libebook
Definition BBeBCollector.cpp:19
libebook::FictionBook2BlockFormat
Definition FictionBook2Style.h:36
libebook::FictionBook2Collector::Note
Definition FictionBook2Collector.h:50