PLKRParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libe-book
3  * Version: MPL 2.0 / LGPLv2.1+
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  * Alternatively, the contents of this file may be used under the terms
10  * of the GNU Lesser General Public License Version 2.1 or later
11  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
12  * applicable instead of those above.
13  *
14  * For further information visit http://libebook.sourceforge.net
15  */
16 
17 #ifndef PLKRPARSER_H_INCLUDED
18 #define PLKRPARSER_H_INCLUDED
19 
20 #include <map>
21 #include <vector>
22 
23 #include <boost/shared_ptr.hpp>
24 
25 #include "PDXParser.h"
26 
27 class WPXDocumentInterface;
28 class WPXInputStream;
29 
30 namespace libebook
31 {
32 
33 typedef std::map<unsigned, std::vector<unsigned char> > PLKRImageMap_t;
34 
35 struct PLKRHeader;
36 struct PLKRParserState;
37 struct PLKRRecordHeader;
38 
39 class PLKRParser : public PDXParser
40 {
41  // -Weffc++
42  PLKRParser(const PLKRParser &other);
43  PLKRParser &operator=(const PLKRParser &other);
44 
45 public:
46  explicit PLKRParser(WPXInputStream *input, WPXDocumentInterface *document = 0);
47  virtual ~PLKRParser();
48 
49 private:
50  virtual bool isFormatSupported(unsigned type, unsigned creator);
51 
52  virtual void readAppInfoRecord(WPXInputStream *record);
53  virtual void readSortInfoRecord(WPXInputStream *record);
54  virtual void readIndexRecord(WPXInputStream *record);
55  virtual void readDataRecord(WPXInputStream *record, bool last = false);
56 
57  virtual void readDataRecords();
58 
59  void readMetadata(WPXInputStream *input, const PLKRRecordHeader &header);
60  void readImage(WPXInputStream *input, const PLKRRecordHeader &header);
61  void readText(WPXInputStream *input, const PLKRRecordHeader &header, const std::vector<unsigned> &paragraphLengths);
62 
63  boost::shared_ptr<WPXInputStream> getUncompressedStream(WPXInputStream *input) const;
64 
65 private:
68 };
69 
70 } // namespace libebook
71 
72 #endif // PLKRPARSER_H_INCLUDED
73 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
virtual void readIndexRecord(WPXInputStream *record)
Definition: PLKRParser.cpp:536
PLKRParser(const PLKRParser &other)
PLKRHeader * m_header
Definition: PLKRParser.h:66
boost::shared_ptr< WPXInputStream > getUncompressedStream(WPXInputStream *input) const
Definition: PLKRParser.cpp:691
Definition: PLKRParser.cpp:432
void readImage(WPXInputStream *input, const PLKRRecordHeader &header)
Definition: PLKRParser.cpp:677
Definition: PDXParser.h:32
PLKRParser & operator=(const PLKRParser &other)
Definition: PLKRParser.cpp:443
void readText(WPXInputStream *input, const PLKRRecordHeader &header, const std::vector< unsigned > &paragraphLengths)
Definition: PLKRParser.cpp:686
Definition: FB2Token.h:124
virtual void readDataRecords()
Definition: PLKRParser.cpp:564
void readMetadata(WPXInputStream *input, const PLKRRecordHeader &header)
Definition: PLKRParser.cpp:670
PLKRParserState *const m_state
Definition: PLKRParser.h:67
std::map< unsigned, std::vector< unsigned char > > PLKRImageMap_t
Definition: PLKRParser.h:33
virtual void readSortInfoRecord(WPXInputStream *record)
Definition: PLKRParser.cpp:531
virtual ~PLKRParser()
Definition: PLKRParser.cpp:501
virtual bool isFormatSupported(unsigned type, unsigned creator)
Check whether a specific subformat is supported.
Definition: PLKRParser.cpp:507
Definition: PLKRParser.cpp:451
virtual void readAppInfoRecord(WPXInputStream *record)
Definition: PLKRParser.cpp:522
virtual void readDataRecord(WPXInputStream *record, bool last=false)
Definition: PLKRParser.cpp:558
Definition: PLKRParser.h:39

Generated for libe-book by doxygen 1.8.5