PalmDocParser.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 PALMDOCPARSER_H_INCLUDED
11#define PALMDOCPARSER_H_INCLUDED
12
13#include <memory>
14#include <vector>
15
16#include <librevenge/librevenge.h>
17
18#include "PDBParser.h"
19
20
21 namespace libebook
22{
23
24 class EBOOKCharsetConverter;
25
26 class PalmDocParser : public PDBParser
27{
28 // disable copying
29 PalmDocParser(const PalmDocParser &);
30 PalmDocParser &operator=(const PalmDocParser &);
31
32 public:
33 explicit PalmDocParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = nullptr);
34 ~PalmDocParser() override;
35
36 static bool checkType(unsigned type, unsigned creator);
37
38 private:
39 void readAppInfoRecord(librevenge::RVNGInputStream *record) override;
40 void readSortInfoRecord(librevenge::RVNGInputStream *record) override;
41 void readIndexRecord(librevenge::RVNGInputStream *record) override;
42 void readDataRecord(librevenge::RVNGInputStream *record, bool last) override;
43
44 void createConverter(const std::vector<char> &text);
45
46 void openDocument();
47 void closeDocument();
48 void handleText(const std::vector<char> &text);
49 void openParagraph();
50 void closeParagraph(bool continuing = false);
51 void handleCharacters(const char *text);
52
53 private:
54 bool m_compressed;
55 unsigned m_textLength;
56 unsigned m_recordCount;
57 unsigned m_recordSize;
58 unsigned m_read;
59
69 bool m_openedParagraph;
70 bool m_openedDocument;
71
72 std::unique_ptr<EBOOKCharsetConverter> m_converter;
73};
74
75}
76
77#endif // PALMDOCPARSER_H_INCLUDED
78
79/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
type
EBOOKDocument::Type type
Definition EBOOKDocument.cpp:325
document
XMLTreeNodePtr_t document
Definition EBOOKHTMLParser.cpp:163
PDBParser.h
text
qi::rule< Iterator, AttrValue_t, qi::space_type > text
Definition TealDocParser.cpp:232
libebook::PDBParser
Definition PDBParser.h:26
libebook::PalmDocParser
Definition PalmDocParser.h:27
libebook::PalmDocParser::closeDocument
void closeDocument()
Definition PalmDocParser.cpp:158
libebook::PalmDocParser::m_openedDocument
bool m_openedDocument
Definition PalmDocParser.h:70
libebook::PalmDocParser::~PalmDocParser
~PalmDocParser() override
Definition PalmDocParser.cpp:43
libebook::PalmDocParser::m_textLength
unsigned m_textLength
Definition PalmDocParser.h:55
libebook::PalmDocParser::m_compressed
bool m_compressed
Definition PalmDocParser.h:54
libebook::PalmDocParser::readDataRecord
void readDataRecord(librevenge::RVNGInputStream *record, bool last) override
Definition PalmDocParser.cpp:80
libebook::PalmDocParser::m_openedParagraph
bool m_openedParagraph
Signalize that a paragraph is split at record break.
Definition PalmDocParser.h:69
libebook::PalmDocParser::readIndexRecord
void readIndexRecord(librevenge::RVNGInputStream *record) override
Definition PalmDocParser.cpp:62
libebook::PalmDocParser::createConverter
void createConverter(const std::vector< char > &text)
Definition PalmDocParser.cpp:122
libebook::PalmDocParser::handleText
void handleText(const std::vector< char > &text)
Definition PalmDocParser.cpp:170
libebook::PalmDocParser::m_read
unsigned m_read
Definition PalmDocParser.h:58
libebook::PalmDocParser::operator=
PalmDocParser & operator=(const PalmDocParser &)
libebook::PalmDocParser::closeParagraph
void closeParagraph(bool continuing=false)
Definition PalmDocParser.cpp:205
libebook::PalmDocParser::openDocument
void openDocument()
Definition PalmDocParser.cpp:134
libebook::PalmDocParser::readAppInfoRecord
void readAppInfoRecord(librevenge::RVNGInputStream *record) override
Definition PalmDocParser.cpp:52
libebook::PalmDocParser::checkType
static bool checkType(unsigned type, unsigned creator)
Definition PalmDocParser.cpp:47
libebook::PalmDocParser::openParagraph
void openParagraph()
Definition PalmDocParser.cpp:198
libebook::PalmDocParser::m_recordSize
unsigned m_recordSize
Definition PalmDocParser.h:57
libebook::PalmDocParser::PalmDocParser
PalmDocParser(const PalmDocParser &)
libebook::PalmDocParser::readSortInfoRecord
void readSortInfoRecord(librevenge::RVNGInputStream *record) override
Definition PalmDocParser.cpp:57
libebook::PalmDocParser::m_converter
std::unique_ptr< EBOOKCharsetConverter > m_converter
Definition PalmDocParser.h:72
libebook::PalmDocParser::m_recordCount
unsigned m_recordCount
Definition PalmDocParser.h:56
libebook::PalmDocParser::handleCharacters
void handleCharacters(const char *text)
Definition PalmDocParser.cpp:213
libebook
Definition BBeBCollector.cpp:19