PluckerParser.h Source File documentation

PluckerParser.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 PLUCKERPARSER_H_INCLUDED
11 #define PLUCKERPARSER_H_INCLUDED
12
13 #include <map>
14 #include <memory>
15 #include <vector>
16
17 #include "PDBParser.h"
18
19 namespace libebook
20 {
21
22 typedef std::map<unsigned, std::vector<unsigned char> > PluckerImageMap_t;
23
24 struct PluckerHeader;
25 struct PluckerParserState;
26 struct PluckerRecordHeader;
27
28 class PluckerParser : public PDBParser
29 {
30 // -Weffc++
31 PluckerParser(const PluckerParser &other);
32 PluckerParser &operator=(const PluckerParser &other);
33
34 public:
35 explicit PluckerParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = nullptr);
36
37 static bool checkType(unsigned type, unsigned creator);
38
39 private:
40 void readAppInfoRecord(librevenge::RVNGInputStream *record) override;
41 void readSortInfoRecord(librevenge::RVNGInputStream *record) override;
42 void readIndexRecord(librevenge::RVNGInputStream *record) override;
43 void readDataRecord(librevenge::RVNGInputStream *record, bool last = false) override;
44
45 void readDataRecords() override;
46
47 void readMetadata(librevenge::RVNGInputStream *input, const PluckerRecordHeader &header);
48 void readImage(librevenge::RVNGInputStream *input, const PluckerRecordHeader &header);
49 void readText(librevenge::RVNGInputStream *input, const PluckerRecordHeader &header, const std::vector<unsigned> &paragraphLengths);
50
51 std::shared_ptr<librevenge::RVNGInputStream> getUncompressedStream(librevenge::RVNGInputStream *input) const;
52
53 private:
54 std::shared_ptr<PluckerHeader> m_header;
55 const std::shared_ptr<PluckerParserState> m_state;
56 };
57
58 } // namespace libebook
59
60 #endif // PLUCKERPARSER_H_INCLUDED
61 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::PluckerRecordHeader::PluckerRecordHeader
PluckerRecordHeader()
Definition: PluckerParser.cpp:1174
PDBLZ77Stream.h
libebook::EBOOKCharsetConverter
Definition: EBOOKCharsetConverter.h:22
m_text
std::string m_text
Definition: PluckerParser.cpp:913
textAlignment
TextAlignment textAlignment
Definition: PluckerParser.cpp:811
m_document
librevenge::RVNGTextInterface * m_document
Definition: PluckerParser.cpp:906
libebook::PluckerParser::readImage
void readImage(librevenge::RVNGInputStream *input, const PluckerRecordHeader &header)
Definition: PluckerParser.cpp:1399
libebook::FictionBook2Token::number
@ number
Definition: FictionBook2Token.h:115
rightMargin
unsigned rightMargin
Definition: PluckerParser.cpp:810
libebook::PluckerRecordHeader::paragraphs
unsigned paragraphs
Definition: PluckerParser.cpp:1148
libebook::PluckerRecordHeader::size
unsigned size
Definition: PluckerParser.cpp:1149
libebook::PluckerParser::readMetadata
void readMetadata(librevenge::RVNGInputStream *input, const PluckerRecordHeader &header)
Definition: PluckerParser.cpp:1360
libebook::PluckerHeader::validAppInfo
bool validAppInfo
Definition: PluckerParser.cpp:1128
libebook::PluckerParserState::charsetConverter
shared_ptr< EBOOKCharsetConverter > charsetConverter
Definition: PluckerParser.cpp:1137
m_lineBreaks
unsigned m_lineBreaks
Definition: PluckerParser.cpp:915
libebook::PluckerParser::readDataRecord
void readDataRecord(librevenge::RVNGInputStream *record, bool last=false) override
Definition: PluckerParser.cpp:1244
libebook::PluckerParser::readDataRecords
void readDataRecords() override
Definition: PluckerParser.cpp:1250
libebook
Definition: BBeBCollector.cpp:19
libebook::PDBLZ77Stream
Definition: PDBLZ77Stream.h:21
libebook::PluckerRecordHeader::type
DataType type
Definition: PluckerParser.cpp:1150
libebook_utils.h
underline
bool underline
Definition: PluckerParser.cpp:813
libebook::getDefaultPageSpanPropList
librevenge::RVNGPropertyList getDefaultPageSpanPropList()
Definition: libebook_utils.cpp:265
libebook::EBOOKMemoryStream
Definition: EBOOKMemoryStream.h:21
m_input
librevenge::RVNGInputStream * m_input
Definition: PluckerParser.cpp:909
libebook::PDBParser::getDataRecord
librevenge::RVNGInputStream * getDataRecord(unsigned n) const
Return a stream for the n-th data record.
Definition: PDBParser.cpp:149
libebook::PluckerParser::m_header
std::shared_ptr< PluckerHeader > m_header
Definition: PluckerParser.h:54
libebook::PluckerParser::readIndexRecord
void readIndexRecord(librevenge::RVNGInputStream *record) override
Definition: PluckerParser.cpp:1222
encoding
const char * encoding
Definition: EBOOKHTMLParser.cpp:166
libebook::PluckerRecordHeader
Definition: PluckerParser.cpp:1143
leftMargin
unsigned leftMargin
Definition: PluckerParser.cpp:809
libebook::readNBytes
const unsigned char * readNBytes(librevenge::RVNGInputStream *const input, const unsigned long numBytes)
Definition: libebook_utils.cpp:105
m_imageMap
const PluckerImageMap_t & m_imageMap
Definition: PluckerParser.cpp:907
libebook::PDBParser
Definition: PDBParser.h:26
libebook::PDBParser::getIndexRecord
librevenge::RVNGInputStream * getIndexRecord() const
Return a stream for the format's index record.
Definition: PDBParser.cpp:139
EBOOKMemoryStream.h
libebook::EBOOKHTMLToken::i
@ i
Definition: EBOOKHTMLToken.h:86
libebook::EBOOKHTMLToken::id
@ id
Definition: EBOOKHTMLToken.h:203
libebook::PluckerHeader::PluckerHeader
PluckerHeader()
Definition: PluckerParser.cpp:1153
m_paragraphOpened
bool m_paragraphOpened
Definition: PluckerParser.cpp:917
libebook::PluckerParserState::exceptionalCharsetMap
ExceptionalCharsetMap_t exceptionalCharsetMap
Definition: PluckerParser.cpp:1139
data
MSPackFileData * data
Definition: HTMLHelpStream.cpp:63
libebook::EBOOKOPFToken::creator
@ creator
Definition: EBOOKOPFToken.h:50
libebook::PluckerParserState::PluckerParserState
PluckerParserState()
Definition: PluckerParser.cpp:1165
libebook::PluckerParserState::m_imageMap
PluckerImageMap_t m_imageMap
Definition: PluckerParser.cpp:1135
document
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:163
libebook::UnsupportedFormat
Definition: libebook_utils.h:132
EBOOK_NUM_ELEMENTS
#define EBOOK_NUM_ELEMENTS(array)
Definition: libebook_utils.h:49
PDBParser.h
libebook::PluckerParser::checkType
static bool checkType(unsigned type, unsigned creator)
Definition: PluckerParser.cpp:1203
libebook::PluckerParser::readSortInfoRecord
void readSortInfoRecord(librevenge::RVNGInputStream *record) override
Definition: PluckerParser.cpp:1217
libebook::PluckerParser::m_state
const std::shared_ptr< PluckerParserState > m_state
Definition: PluckerParser.h:55
libebook::PluckerRecordHeader::number
unsigned number
Definition: PluckerParser.cpp:1146
libebook::EBOOKHTMLToken::input
@ input
Definition: EBOOKHTMLToken.h:89
libebook::readU16
uint16_t readU16(librevenge::RVNGInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:57
m_attributes
PluckerAttributes m_attributes
Definition: PluckerParser.cpp:911
libebook::PluckerImageMap_t
std::map< unsigned, std::vector< unsigned char > > PluckerImageMap_t
Definition: PluckerParser.h:22
libebook::readU8
uint8_t readU8(librevenge::RVNGInputStream *input, bool)
Definition: libebook_utils.cpp:45
italic
bool italic
Definition: PluckerParser.cpp:812
libebook::EBOOKZlibStream
Definition: EBOOKZlibStream.h:21
libebook::PluckerParser::operator=
PluckerParser & operator=(const PluckerParser &other)
libebook::PluckerParser::getUncompressedStream
std::shared_ptr< librevenge::RVNGInputStream > getUncompressedStream(librevenge::RVNGInputStream *input) const
Definition: PluckerParser.cpp:1413
libebook::PluckerHeader::compression
Compression compression
Definition: PluckerParser.cpp:1126
libebook::readU32
uint32_t readU32(librevenge::RVNGInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:73
PluckerParser.h
libebook::EBOOKHTMLToken::header
@ header
Definition: EBOOKHTMLToken.h:82
libebook::PluckerParser
Definition: PluckerParser.h:29
libebook::PDBParser::getDataRecordCount
unsigned getDataRecordCount() const
Return the number of data records in the document.
Definition: PDBParser.cpp:144
libebook::PDBParser::getDocument
librevenge::RVNGTextInterface * getDocument() const
Get the document generator used for this parsing run.
Definition: PDBParser.cpp:123
libebook::PluckerParser::readAppInfoRecord
void readAppInfoRecord(librevenge::RVNGInputStream *record) override
Definition: PluckerParser.cpp:1208
libebook::PluckerHeader
Definition: PluckerParser.cpp:1121
strikethrough
bool strikethrough
Definition: PluckerParser.cpp:814
EBOOKCharsetConverter.h
font
Font font
Definition: PluckerParser.cpp:808
EBOOK_DEBUG_MSG
#define EBOOK_DEBUG_MSG(M)
Definition: libebook_utils.h:44
EBOOKZlibStream.h
libebook::PluckerHeader::valid
bool valid
Definition: PluckerParser.cpp:1127
libebook::PluckerParser::readText
void readText(librevenge::RVNGInputStream *input, const PluckerRecordHeader &header, const std::vector< unsigned > &paragraphLengths)
Definition: PluckerParser.cpp:1408
libebook::PluckerParserState
Definition: PluckerParser.cpp:1132
libebook::EBOOKHTMLToken::size
@ size
Definition: EBOOKHTMLToken.h:249
libebook::PluckerParser::PluckerParser
PluckerParser(const PluckerParser &other)
libebook::PluckerParserState::knownEncoding
bool knownEncoding
Definition: PluckerParser.cpp:1138
libebook::PluckerHeader::isValid
bool isValid() const
Definition: PluckerParser.cpp:1160
type
EBOOKDocument::Type type
Definition: EBOOKDocument.cpp:325
PDB_CODE
#define PDB_CODE(s)
Definition: PDBParser.h:18
libebook::PluckerRecordHeader::uid
unsigned uid
Definition: PluckerParser.cpp:1147
libebook::skip
void skip(librevenge::RVNGInputStream *input, unsigned long numBytes)
Definition: libebook_utils.cpp:145
m_header
int m_header
Definition: EBOOKOutputElements.cpp:476
libebook::EBOOKOPFToken::version
@ version
Definition: EBOOKOPFToken.h:97
m_state
const shared_ptr< XMLCollector::State > m_state
Definition: XMLCollector.cpp:1294
libebook::PluckerParserState::markupParser
shared_ptr< MarkupParser > markupParser
Definition: PluckerParser.cpp:1136
length
unsigned length
Definition: SoftBookParser.cpp:73
libebook::EBOOKHTMLToken::charset
@ charset
Definition: EBOOKHTMLToken.h:174