PMLParser.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 PMLPARSER_H_INCLUDED
11 #define PMLPARSER_H_INCLUDED
12
13 #include <string>
14 #include <vector>
15
16 #include <boost/scoped_ptr.hpp>
17 #include <boost/unordered_map.hpp>
18
19 #include "PDXParser.h"
20
21
22 namespace libebook
23 {
24
25 struct PMLHeader;
26
27 class PMLParser : public PDXParser
28 {
29 public:
30 typedef boost::unordered_map<std::string, std::vector<unsigned char> > ImageMap_t;
31
32 public:
33 explicit PMLParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = 0);
34 virtual ~PMLParser();
35
36 static bool checkType(unsigned type, unsigned creator);
37
38 virtual void readAppInfoRecord(librevenge::RVNGInputStream *record);
39 virtual void readSortInfoRecord(librevenge::RVNGInputStream *record);
40 virtual void readIndexRecord(librevenge::RVNGInputStream *record);
41 virtual void readDataRecord(librevenge::RVNGInputStream *record, bool last = false);
42
43 virtual void readDataRecords();
44
45 private:
46 void readText();
47 void readImages();
48 void readImage(librevenge::RVNGInputStream *record, bool verified = false);
49
50 void openDocument();
51 void closeDocument();
52
53 private:
54 boost::scoped_ptr<PMLHeader> m_header;
55 ImageMap_t m_imageMap;
56 };
57
58 } // namespace libebook
59
60 #endif // PMLPARSER_H_INCLUDED
61 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::PMLParser::checkType
static bool checkType(unsigned type, unsigned creator)
Definition: PMLParser.cpp:719
libebook::PMLParser::ImageMap_t
boost::unordered_map< std::string, std::vector< unsigned char > > ImageMap_t
Definition: PMLParser.h:30
libebook::PMLParser
Definition: PMLParser.h:27
libebook::PDXParser
Definition: PDXParser.h:25
libebook::EBOOKOPFToken::creator
Definition: EBOOKOPFToken.h:52
type
EBOOKDocument::Type type
Definition: EBOOKDocument.cpp:328
libebook::PMLParser::~PMLParser
virtual ~PMLParser()
Definition: PMLParser.cpp:715
PDXParser.h
libebook::PMLParser::m_imageMap
ImageMap_t m_imageMap
Definition: PMLParser.h:55
libebook::PMLParser::readDataRecord
virtual void readDataRecord(librevenge::RVNGInputStream *record, bool last=false)
Definition: PMLParser.cpp:768
libebook::PMLParser::readIndexRecord
virtual void readIndexRecord(librevenge::RVNGInputStream *record)
Definition: PMLParser.cpp:732
libebook::PMLParser::readImages
void readImages()
Definition: PMLParser.cpp:844
libebook::PMLParser::readImage
void readImage(librevenge::RVNGInputStream *record, bool verified=false)
Definition: PMLParser.cpp:871
libebook::PMLParser::m_header
boost::scoped_ptr< PMLHeader > m_header
Definition: PMLParser.h:54
libebook::PMLParser::openDocument
void openDocument()
Definition: PMLParser.cpp:887
libebook::PMLParser::readAppInfoRecord
virtual void readAppInfoRecord(librevenge::RVNGInputStream *record)
Definition: PMLParser.cpp:724
document
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:169
libebook::PMLParser::readDataRecords
virtual void readDataRecords()
Definition: PMLParser.cpp:775
libebook::PMLParser::closeDocument
void closeDocument()
Definition: PMLParser.cpp:893
libebook::PMLParser::PMLParser
PMLParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document=0)
Definition: PMLParser.cpp:701
libebook::EBOOKHTMLToken::input
Definition: EBOOKHTMLToken.h:91
libebook
Definition: CHMParser.cpp:20
libebook::PMLParser::readSortInfoRecord
virtual void readSortInfoRecord(librevenge::RVNGInputStream *record)
Definition: PMLParser.cpp:728
libebook::PMLParser::readText
void readText()
Definition: PMLParser.cpp:781