TealDocParser.h Source File documentation

TealDocParser.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 TEALDOCPARSER_H_INCLUDED
11 #define TEALDOCPARSER_H_INCLUDED
12
13 #include <memory>
14 #include <vector>
15
16 #include "PDBParser.h"
17
18
19 namespace libebook
20 {
21
22 class EBOOKCharsetConverter;
23
24 class TealDocTextParser;
25
26 class TealDocParser : public PDBParser
27 {
28 // disable copying
29 TealDocParser(const TealDocParser &);
30 TealDocParser &operator=(const TealDocParser &);
31
32 public:
33 explicit TealDocParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = nullptr);
34 ~TealDocParser() 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
49 private:
50 bool m_compressed;
51 unsigned m_textLength;
52 unsigned m_recordCount;
53 unsigned m_recordSize;
54 unsigned m_read;
55
56 bool m_openedDocument;
57
58 std::unique_ptr<EBOOKCharsetConverter> m_converter;
59 std::unique_ptr<TealDocTextParser> m_textParser;
60 };
61
62 }
63
64 #endif // TEALDOCPARSER_H_INCLUDED
65
66 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::TealDocParser::m_read
unsigned m_read
Definition: TealDocParser.h:54
libebook::TealDocParser
Definition: TealDocParser.h:27
libebook::TealDocTextParser
Definition: TealDocParser.cpp:329
PDBLZ77Stream.h
libebook::EBOOKCharsetConverter
Definition: EBOOKCharsetConverter.h:22
libebook::TealDocTextParser::finishParagraph
void finishParagraph()
Definition: TealDocParser.cpp:485
m_attr
const int m_attr
Definition: TealDocParser.cpp:321
libebook::TealDocParser::m_converter
std::unique_ptr< EBOOKCharsetConverter > m_converter
Definition: TealDocParser.h:58
libebook::TealDocParser::closeDocument
void closeDocument()
Definition: TealDocParser.cpp:668
libebook::TealDocTextParser::TealDocTextParser
TealDocTextParser(const TealDocTextParser &other)
m_text
string & m_text
Definition: TealDocParser.cpp:323
libebook::FictionBook2Token::match
@ match
Definition: FictionBook2Token.h:112
libebook::TealDocTextParser::parse
void parse(librevenge::RVNGInputStream *input, bool last=false)
Definition: TealDocParser.cpp:365
libebook::TealDocParser::openDocument
void openDocument()
Definition: TealDocParser.cpp:644
libebook::EBOOKUTF8Stream
Definition: EBOOKUTF8Stream.h:23
libebook::TealDocParser::~TealDocParser
~TealDocParser() override
Definition: TealDocParser.cpp:556
libebook::EBOOKHTMLToken::get
@ get
Definition: EBOOKHTMLToken.h:283
libebook
Definition: BBeBCollector.cpp:19
libebook::EBOOKHTMLToken::space
@ space
Definition: EBOOKHTMLToken.h:250
libebook::PDBLZ77Stream
Definition: PDBLZ77Stream.h:21
value
qi::rule< Iterator, AttrValue_t, qi::space_type > value
Definition: TealDocParser.cpp:231
libebook::TealDocParser::operator=
TealDocParser & operator=(const TealDocParser &)
libebook::TealDocTextParser::operator=
TealDocTextParser operator=(const TealDocTextParser &other)
libebook_utils.h
libebook::TealDocParser::checkType
static bool checkType(unsigned type, unsigned creator)
Definition: TealDocParser.cpp:560
text
qi::rule< Iterator, AttrValue_t, qi::space_type > text
Definition: TealDocParser.cpp:232
libebook::getDefaultPageSpanPropList
librevenge::RVNGPropertyList getDefaultPageSpanPropList()
Definition: libebook_utils.cpp:265
libebook::EBOOKMemoryStream
Definition: EBOOKMemoryStream.h:21
libebook::TealDocParser::m_textLength
unsigned m_textLength
Definition: TealDocParser.h:51
sattrs
libebook::@144::TagGrammar::sattrs_ sattrs
libebook::PDBParser
Definition: PDBParser.h:26
libebook::TealDocParser::readAppInfoRecord
void readAppInfoRecord(librevenge::RVNGInputStream *record) override
Definition: TealDocParser.cpp:565
EBOOKMemoryStream.h
libebook::TealDocParser::m_recordSize
unsigned m_recordSize
Definition: TealDocParser.h:53
libebook::TealDocParser::readSortInfoRecord
void readSortInfoRecord(librevenge::RVNGInputStream *record) override
Definition: TealDocParser.cpp:570
libebook::TealDocTextParser::m_text
string m_text
Definition: TealDocParser.cpp:353
libebook::TealDocTextParser::m_openedParagraph
bool m_openedParagraph
Definition: TealDocParser.cpp:355
libebook::TealDocParser::TealDocParser
TealDocParser(const TealDocParser &)
TealDocParser.h
libebook::EBOOKHTMLToken::char_
@ char_
Definition: EBOOKHTMLToken.h:172
libebook::TealDocParser::m_textParser
std::unique_ptr< TealDocTextParser > m_textParser
Definition: TealDocParser.h:59
libebook::EBOOKOPFToken::creator
@ creator
Definition: EBOOKOPFToken.h:50
libebook::TealDocParser::readDataRecord
void readDataRecord(librevenge::RVNGInputStream *record, bool last) override
Definition: TealDocParser.cpp:590
document
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:163
PDBParser.h
libebook::TealDocParser::m_compressed
bool m_compressed
Definition: TealDocParser.h:50
metadata
RVNGPropertyList metadata
Definition: EBOOKOPFParser.cpp:63
libebook::EBOOKHTMLToken::input
@ input
Definition: EBOOKHTMLToken.h:89
font
optional< Font > font
Definition: TealDocParser.cpp:104
libebook::readU16
uint16_t readU16(librevenge::RVNGInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:57
libebook::readU8
uint8_t readU8(librevenge::RVNGInputStream *input, bool)
Definition: libebook_utils.cpp:45
libebook::TealDocParser::m_openedDocument
bool m_openedDocument
Definition: TealDocParser.h:56
libebook::TealDocTextParser::parseTag
bool parseTag(librevenge::RVNGInputStream *input)
Definition: TealDocParser.cpp:389
libebook::TealDocParser::readIndexRecord
void readIndexRecord(librevenge::RVNGInputStream *record) override
Definition: TealDocParser.cpp:575
libebook::readU32
uint32_t readU32(librevenge::RVNGInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:73
libebook::TealDocTextParser::flushText
void flushText(const TealDocAttributes &attributes=TealDocAttributes())
Definition: TealDocParser.cpp:491
libebook::PDBParser::getDataRecordCount
unsigned getDataRecordCount() const
Return the number of data records in the document.
Definition: PDBParser.cpp:144
libebook::PDBParser::getDocument
librevenge::RVNGTextInterface * getDocument() const
Get the document generator used for this parsing run.
Definition: PDBParser.cpp:123
libebook::PDBParser::getName
const char * getName() const
Definition: PDBParser.cpp:128
libebook::TealDocTextParser::openParagraph
void openParagraph(const TealDocAttributes &attributes=TealDocAttributes())
Definition: TealDocParser.cpp:452
EBOOKUTF8Stream.h
EBOOKCharsetConverter.h
libebook::TealDocTextParser::closeParagraph
void closeParagraph()
Definition: TealDocParser.cpp:478
EBOOK_DEBUG_MSG
#define EBOOK_DEBUG_MSG(M)
Definition: libebook_utils.h:44
libebook::TealDocTextParser::m_document
librevenge::RVNGTextInterface *const m_document
Definition: TealDocParser.cpp:351
tags
libebook::@144::TagGrammar::tags_ tags
attrib
qi::rule< Iterator, std::pair< int, AttrValue_t >, qi::space_type > attrib
Definition: TealDocParser.cpp:230
eattrs
libebook::@144::TagGrammar::eattrs_ eattrs
libebook::TealDocParser::createConverter
void createConverter(const std::vector< char > &text)
Definition: TealDocParser.cpp:628
m_document
librevenge::RVNGTextInterface *const m_document
Definition: FictionBook2Parser.cpp:55
type
EBOOKDocument::Type type
Definition: EBOOKDocument.cpp:325
PDB_CODE
#define PDB_CODE(s)
Definition: PDBParser.h:18
tag
qi::rule< Iterator, std::pair< int, Attributes_t >, qi::space_type > tag
Definition: TealDocParser.cpp:229
values
libebook::@144::TagGrammar::values_ values
unknown
qi::rule< Iterator, int, qi::space_type > unknown
Definition: TealDocParser.cpp:233
libebook::TealDocParser::m_recordCount
unsigned m_recordCount
Definition: TealDocParser.h:52
libebook::skip
void skip(librevenge::RVNGInputStream *input, unsigned long numBytes)
Definition: libebook_utils.cpp:145
libebook::TealDocTextParser::parseHeaderTag
bool parseHeaderTag(const Attributes_t &attributeList)
Definition: TealDocParser.cpp:435
m_attributes
TealDocAttributes & m_attributes
Definition: TealDocParser.cpp:322
style
optional< Style > style
Definition: TealDocParser.cpp:105
align
optional< Align > align
Definition: TealDocParser.cpp:106
libebook::GenericException
Definition: libebook_utils.h:106