PMLParser.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 PMLPARSER_H_INCLUDED
18 #define PMLPARSER_H_INCLUDED
19 
20 #include <string>
21 #include <vector>
22 
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/unordered_map.hpp>
25 
26 #include "PDXParser.h"
27 
28 class WPXDocumentInterface;
29 class WPXInputStream;
30 
31 namespace libebook
32 {
33 
34 struct PMLHeader;
35 
36 class PMLParser : public PDXParser
37 {
38 public:
39  typedef boost::unordered_map<std::string, std::vector<unsigned char> > ImageMap_t;
40 
41 public:
42  explicit PMLParser(WPXInputStream *input, WPXDocumentInterface *document = 0);
43  virtual ~PMLParser();
44 
45  virtual bool isFormatSupported(unsigned type, unsigned creator);
46 
47  virtual void readAppInfoRecord(WPXInputStream *record);
48  virtual void readSortInfoRecord(WPXInputStream *record);
49  virtual void readIndexRecord(WPXInputStream *record);
50  virtual void readDataRecord(WPXInputStream *record, bool last = false);
51 
52  virtual void readDataRecords();
53 
54 private:
55  void readText();
56  void readImages();
57  void readImage(WPXInputStream *record, bool verified = false);
58 
59  void openDocument();
60  void closeDocument();
61 
62 private:
63  boost::scoped_ptr<PMLHeader> m_header;
65 };
66 
67 } // namespace libebook
68 
69 #endif // PMLPARSER_H_INCLUDED
70 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
boost::unordered_map< std::string, std::vector< unsigned char > > ImageMap_t
Definition: PMLParser.h:39
virtual void readAppInfoRecord(WPXInputStream *record)
Definition: PMLParser.cpp:677
Definition: PMLParser.h:36
Definition: PDXParser.h:32
virtual ~PMLParser()
Definition: PMLParser.cpp:663
ImageMap_t m_imageMap
Definition: PMLParser.h:64
virtual bool isFormatSupported(unsigned type, unsigned creator)
Check whether a specific subformat is supported.
Definition: PMLParser.cpp:667
virtual void readSortInfoRecord(WPXInputStream *record)
Definition: PMLParser.cpp:681
Definition: FB2Token.h:124
void readImages()
Definition: PMLParser.cpp:772
boost::scoped_ptr< PMLHeader > m_header
Definition: PMLParser.h:63
void openDocument()
Definition: PMLParser.cpp:815
virtual void readDataRecords()
Definition: PMLParser.cpp:728
void closeDocument()
Definition: PMLParser.cpp:823
PMLParser(WPXInputStream *input, WPXDocumentInterface *document=0)
Definition: PMLParser.cpp:656
void readImage(WPXInputStream *record, bool verified=false)
Definition: PMLParser.cpp:799
virtual void readDataRecord(WPXInputStream *record, bool last=false)
Definition: PMLParser.cpp:721
virtual void readIndexRecord(WPXInputStream *record)
Definition: PMLParser.cpp:685
void readText()
Definition: PMLParser.cpp:734

Generated for libe-book by doxygen 1.8.5