PDBParser.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 PDBPARSER_H_INCLUDED
11 #define PDBPARSER_H_INCLUDED
12
13 #include <vector>
14
15 #include <librevenge/librevenge.h>
16
17 #include "PDXParser.h"
18
19
20 namespace libebook
21 {
22
23 class EBOOKCharsetConverter;
24
25 class PDBParser : public PDXParser
26 {
27 // disable copying
28 PDBParser(const PDBParser &);
29 PDBParser &operator=(const PDBParser &);
30
31 public:
32 explicit PDBParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = 0);
33 virtual ~PDBParser();
34
35 static bool checkType(unsigned type, unsigned creator);
36
37 private:
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);
42
43 void createConverter(const std::vector<char> &text);
44
45 void openDocument();
46 void closeDocument();
47 void handleText(const std::vector<char> &text);
48 void openParagraph();
49 void closeParagraph(bool continuing = false);
50 void handleCharacters(const char *text);
51
52 private:
53 bool m_compressed;
54 unsigned m_textLength;
55 unsigned m_recordCount;
56 unsigned m_recordSize;
57 unsigned m_read;
58
68 bool m_openedParagraph;
69 bool m_openedDocument;
70
71 EBOOKCharsetConverter *m_converter;
72 };
73
74 }
75
76 #endif // PDBPARSER_H_INCLUDED
77
78 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::PDBParser::openDocument
void openDocument()
Definition: PDBParser.cpp:132
libebook::PDBParser::m_compressed
bool m_compressed
Definition: PDBParser.h:53
libebook::PDBParser::handleText
void handleText(const std::vector< char > &text)
Definition: PDBParser.cpp:168
libebook::PDBParser::m_read
unsigned m_read
Definition: PDBParser.h:57
libebook::EBOOKCharsetConverter
Definition: EBOOKCharsetConverter.h:20
libebook::EBOOKHTMLToken::text
Definition: EBOOKHTMLToken.h:259
libebook::PDBParser::m_recordSize
unsigned m_recordSize
Definition: PDBParser.h:56
libebook::PDXParser
Definition: PDXParser.h:25
libebook::PDBParser::closeParagraph
void closeParagraph(bool continuing=false)
Definition: PDBParser.cpp:203
libebook::PDBParser::closeDocument
void closeDocument()
Definition: PDBParser.cpp:156
libebook::EBOOKOPFToken::creator
Definition: EBOOKOPFToken.h:52
type
EBOOKDocument::Type type
Definition: EBOOKDocument.cpp:328
PDXParser.h
libebook::PDBParser::checkType
static bool checkType(unsigned type, unsigned creator)
Definition: PDBParser.cpp:50
libebook::PDBParser::~PDBParser
virtual ~PDBParser()
Definition: PDBParser.cpp:45
libebook::PDBParser::createConverter
void createConverter(const std::vector< char > &text)
Definition: PDBParser.cpp:117
libebook::PDBParser::operator=
PDBParser & operator=(const PDBParser &)
libebook::PDBParser::readDataRecord
virtual void readDataRecord(librevenge::RVNGInputStream *record, bool last)
Definition: PDBParser.cpp:83
libebook::PDBParser
Definition: PDBParser.h:25
libebook::PDBParser::readSortInfoRecord
virtual void readSortInfoRecord(librevenge::RVNGInputStream *record)
Definition: PDBParser.cpp:60
document
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:169
libebook::PDBParser::handleCharacters
void handleCharacters(const char *text)
Definition: PDBParser.cpp:211
libebook::EBOOKHTMLToken::input
Definition: EBOOKHTMLToken.h:91
libebook::PDBParser::m_openedParagraph
bool m_openedParagraph
Signalize that a paragraph is split at record break.
Definition: PDBParser.h:68
libebook
Definition: CHMParser.cpp:20
libebook::PDBParser::m_recordCount
unsigned m_recordCount
Definition: PDBParser.h:55
libebook::PDBParser::openParagraph
void openParagraph()
Definition: PDBParser.cpp:196
libebook::PDBParser::m_openedDocument
bool m_openedDocument
Definition: PDBParser.h:69
libebook::PDBParser::PDBParser
PDBParser(const PDBParser &)
libebook::PDBParser::readIndexRecord
virtual void readIndexRecord(librevenge::RVNGInputStream *record)
Definition: PDBParser.cpp:65
libebook::PDBParser::m_converter
EBOOKCharsetConverter * m_converter
Definition: PDBParser.h:71
libebook::PDBParser::m_textLength
unsigned m_textLength
Definition: PDBParser.h:54
libebook::PDBParser::readAppInfoRecord
virtual void readAppInfoRecord(librevenge::RVNGInputStream *record)
Definition: PDBParser.cpp:55