PLKRParser.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 PLKRPARSER_H_INCLUDED
11 #define PLKRPARSER_H_INCLUDED
12
13 #include <map>
14 #include <vector>
15
16 #include <boost/shared_ptr.hpp>
17
18 #include "PDXParser.h"
19
20 namespace libebook
21 {
22
23 typedef std::map<unsigned, std::vector<unsigned char> > PLKRImageMap_t;
24
25 struct PLKRHeader;
26 struct PLKRParserState;
27 struct PLKRRecordHeader;
28
29 class PLKRParser : public PDXParser
30 {
31 // -Weffc++
32 PLKRParser(const PLKRParser &other);
33 PLKRParser &operator=(const PLKRParser &other);
34
35 public:
36 explicit PLKRParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = 0);
37 virtual ~PLKRParser();
38
39 static bool checkType(unsigned type, unsigned creator);
40
41 private:
42 virtual void readAppInfoRecord(librevenge::RVNGInputStream *record);
43 virtual void readSortInfoRecord(librevenge::RVNGInputStream *record);
44 virtual void readIndexRecord(librevenge::RVNGInputStream *record);
45 virtual void readDataRecord(librevenge::RVNGInputStream *record, bool last = false);
46
47 virtual void readDataRecords();
48
49 void readMetadata(librevenge::RVNGInputStream *input, const PLKRRecordHeader &header);
50 void readImage(librevenge::RVNGInputStream *input, const PLKRRecordHeader &header);
51 void readText(librevenge::RVNGInputStream *input, const PLKRRecordHeader &header, const std::vector<unsigned> &paragraphLengths);
52
53 boost::shared_ptr<librevenge::RVNGInputStream> getUncompressedStream(librevenge::RVNGInputStream *input) const;
54
55 private:
56 PLKRHeader *m_header;
57 PLKRParserState *const m_state;
58 };
59
60 } // namespace libebook
61
62 #endif // PLKRPARSER_H_INCLUDED
63 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::PLKRParser::PLKRParser
PLKRParser(const PLKRParser &other)
libebook::PLKRParser::readMetadata
void readMetadata(librevenge::RVNGInputStream *input, const PLKRRecordHeader &header)
Definition: PLKRParser.cpp:1367
libebook::PLKRParser::m_header
PLKRHeader * m_header
Definition: PLKRParser.h:56
libebook::PLKRHeader
Definition: PLKRParser.cpp:1122
libebook::PLKRParser::checkType
static bool checkType(unsigned type, unsigned creator)
Definition: PLKRParser.cpp:1210
libebook::PDXParser
Definition: PDXParser.h:25
libebook::EBOOKOPFToken::creator
Definition: EBOOKOPFToken.h:52
type
EBOOKDocument::Type type
Definition: EBOOKDocument.cpp:328
PDXParser.h
libebook::PLKRParser::operator=
PLKRParser & operator=(const PLKRParser &other)
libebook::PLKRParserState
Definition: PLKRParser.cpp:1133
libebook::PLKRParser::readDataRecords
virtual void readDataRecords()
Definition: PLKRParser.cpp:1257
libebook::PLKRParser::readImage
void readImage(librevenge::RVNGInputStream *input, const PLKRRecordHeader &header)
Definition: PLKRParser.cpp:1406
libebook::PLKRParser::m_state
PLKRParserState *const m_state
Definition: PLKRParser.h:57
libebook::PLKRImageMap_t
std::map< unsigned, std::vector< unsigned char > > PLKRImageMap_t
Definition: PLKRParser.h:23
libebook::PLKRParser::readDataRecord
virtual void readDataRecord(librevenge::RVNGInputStream *record, bool last=false)
Definition: PLKRParser.cpp:1251
document
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:169
libebook::EBOOKHTMLToken::input
Definition: EBOOKHTMLToken.h:91
libebook
Definition: CHMParser.cpp:20
libebook::PLKRParser::readIndexRecord
virtual void readIndexRecord(librevenge::RVNGInputStream *record)
Definition: PLKRParser.cpp:1229
libebook::EBOOKHTMLToken::header
Definition: EBOOKHTMLToken.h:84
libebook::PLKRParser::readAppInfoRecord
virtual void readAppInfoRecord(librevenge::RVNGInputStream *record)
Definition: PLKRParser.cpp:1215
libebook::PLKRParser::getUncompressedStream
boost::shared_ptr< librevenge::RVNGInputStream > getUncompressedStream(librevenge::RVNGInputStream *input) const
Definition: PLKRParser.cpp:1420
libebook::PLKRParser::~PLKRParser
virtual ~PLKRParser()
Definition: PLKRParser.cpp:1204
libebook::PLKRRecordHeader
Definition: PLKRParser.cpp:1144
libebook::PLKRParser::readSortInfoRecord
virtual void readSortInfoRecord(librevenge::RVNGInputStream *record)
Definition: PLKRParser.cpp:1224
libebook::PLKRParser
Definition: PLKRParser.h:29
libebook::PLKRParser::readText
void readText(librevenge::RVNGInputStream *input, const PLKRRecordHeader &header, const std::vector< unsigned > &paragraphLengths)
Definition: PLKRParser.cpp:1415