EBOOKOPFParser.h Source File documentation

EBOOKOPFParser.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 EBOOKOPFPARSER_H_INCLUDED
11 #define EBOOKOPFPARSER_H_INCLUDED
12
13 #include <librevenge/librevenge.h>
14
15 #include "libebook_utils.h"
16
17 namespace libebook
18 {
19
20 class EBOOKOPFParser
21 {
22 // disable copying
23 EBOOKOPFParser(const EBOOKOPFParser &other);
24 EBOOKOPFParser &operator=(const EBOOKOPFParser &other);
25
26 public:
27 enum Type
28 {
29 TYPE_OEB,
30 TYPE_EPub,
31 TYPE_EPub3
32 };
33
34 public:
35 EBOOKOPFParser(const RVNGInputStreamPtr_t &input, const RVNGInputStreamPtr_t &package, Type type, librevenge::RVNGTextInterface *document);
36
37 void parse();
38
39 static bool findOPFStream(const RVNGInputStreamPtr_t &package, unsigned &stream);
40
41 private:
42 const RVNGInputStreamPtr_t getStream(const char *name) const;
43
44 private:
45 const RVNGInputStreamPtr_t m_input;
46 const RVNGInputStreamPtr_t m_package;
47 const Type m_type;
48 librevenge::RVNGTextInterface *const m_document;
49 };
50
51 }
52
53 #endif // EBOOKOPFPARSER_H_INCLUDED
54
55 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::EBOOKHTMLToken::yes
@ yes
Definition: EBOOKHTMLToken.h:323
m_elementStack
stack< int > m_elementStack
Definition: EBOOKOPFParser.cpp:207
EBOOKHTMLParser.h
libebook::EBOOKHTMLToken::html
@ html
Definition: EBOOKHTMLToken.h:85
len
size_t len
Definition: EBOOKHTMLParser.cpp:47
libebook::EBOOKOPFToken::toc
@ toc
Definition: EBOOKOPFToken.h:95
mimetype
string mimetype
Definition: EBOOKOPFParser.cpp:50
type
SpineItemType type
Definition: EBOOKOPFParser.cpp:51
href
optional< string > href
Definition: EBOOKOPFParser.cpp:150
libebook::EBOOKOPFToken::MIME_oeb
@ MIME_oeb
Definition: EBOOKOPFToken.h:101
libebook::EBOOKOPFToken::dc_metadata
@ dc_metadata
Definition: EBOOKOPFToken.h:52
libebook::getOPFTokenId
int getOPFTokenId(const char *const name, const char *const ns)
Definition: EBOOKOPFToken.cpp:27
id
optional< string > id
Definition: EBOOKOPFParser.cpp:151
libebook::EBOOKOPFParser::m_document
librevenge::RVNGTextInterface *const m_document
Definition: EBOOKOPFParser.h:48
EBOOKSubDocument.h
libebook::EBOOKHTMLToken::NS_xml
@ NS_xml
Definition: EBOOKHTMLToken.h:334
libebook::EBOOKOPFToken::Contributor
@ Contributor
Definition: EBOOKOPFToken.h:33
libebook::EBOOKOPFParser::m_input
const RVNGInputStreamPtr_t m_input
Definition: EBOOKOPFParser.h:45
libebook::EBOOKHTMLToken::title
@ title
Definition: EBOOKHTMLToken.h:146
libebook::getRemainingLength
unsigned long getRemainingLength(librevenge::RVNGInputStream *const input)
Definition: libebook_utils.cpp:170
libebook::RVNGInputStreamPtr_t
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libebook_utils.h:54
libebook::EBOOKOPFParser::TYPE_EPub
@ TYPE_EPub
Definition: EBOOKOPFParser.h:30
EBOOKSAXParser.h
libebook::EBOOKOPFToken::Rights
@ Rights
Definition: EBOOKOPFToken.h:43
path
string path
Definition: EBOOKOPFParser.cpp:49
libebook::EBOOKOPFToken::modification
@ modification
Definition: EBOOKOPFToken.h:108
libebook::EBOOKOPFToken::fallback_style
@ fallback_style
Definition: EBOOKOPFToken.h:82
libebook::EBOOKOPFToken::unique_identifier
@ unique_identifier
Definition: EBOOKOPFToken.h:96
libebook::EBOOKHTMLToken::no
@ no
Definition: EBOOKHTMLToken.h:296
libebook::EBOOKOPFToken::publication
@ publication
Definition: EBOOKOPFToken.h:110
libebook::EBOOKHTMLToken::get
@ get
Definition: EBOOKHTMLToken.h:283
libebook
Definition: BBeBCollector.cpp:19
libebook::EBOOKOPFToken::file_as
@ file_as
Definition: EBOOKOPFToken.h:83
libebook::EBOOKHTMLToken::language
@ language
Definition: EBOOKHTMLToken.h:206
value
qi::rule< Iterator, AttrValue_t, qi::space_type > value
Definition: TealDocParser.cpp:231
libebook::EBOOKOPFToken::Source
@ Source
Definition: EBOOKOPFToken.h:44
libebook::EBOOKOPFParser
Definition: EBOOKOPFParser.h:21
libebook::EBOOKOPFToken::subject
@ subject
Definition: EBOOKOPFToken.h:71
libebook::EBOOKOPFToken::Description
@ Description
Definition: EBOOKOPFToken.h:37
libebook_utils.h
libebook::EBOOKOPFToken::Publisher
@ Publisher
Definition: EBOOKOPFToken.h:41
role
optional< int > role
Definition: EBOOKOPFParser.cpp:155
linear
optional< bool > linear
Definition: EBOOKOPFParser.cpp:153
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::EBOOKOPFToken::description
@ description
Definition: EBOOKOPFToken.h:53
idref
optional< string > idref
Definition: EBOOKOPFParser.cpp:152
spine
Spine_t spine
Definition: EBOOKOPFParser.cpp:65
m_input
librevenge::RVNGInputStream * m_input
Definition: PeanutPressParser.cpp:262
libebook::EBOOKOPFToken::edt
@ edt
Definition: EBOOKOPFToken.h:107
libebook::readNBytes
const unsigned char * readNBytes(librevenge::RVNGInputStream *const input, const unsigned long numBytes)
Definition: libebook_utils.cpp:105
libebook::EBOOKOPFToken::rights
@ rights
Definition: EBOOKOPFToken.h:67
libebook::EBOOKOPFToken::identifier
@ identifier
Definition: EBOOKOPFToken.h:56
libebook::EBOOKOPFToken::coverage
@ coverage
Definition: EBOOKOPFToken.h:49
libebook::EBOOKOPFToken::media_type
@ media_type
Definition: EBOOKOPFToken.h:89
libebook::EBOOKOPFToken::Relation
@ Relation
Definition: EBOOKOPFToken.h:42
libebook::EBOOKOPFParser::m_type
const Type m_type
Definition: EBOOKOPFParser.h:47
libebook::EBOOKOPFToken::NS_opf
@ NS_opf
Definition: EBOOKOPFToken.h:121
libebook::EBOOKOPFToken::creation
@ creation
Definition: EBOOKOPFToken.h:106
libebook::PackageError
Definition: libebook_utils.h:116
stream
RVNGInputStreamPtr_t stream
Definition: HTMLHelpStream.cpp:79
data
MSPackFileData * data
Definition: HTMLHelpStream.cpp:63
libebook::EBOOKHTMLToken::scheme
@ scheme
Definition: EBOOKHTMLToken.h:244
libebook::EBOOKOPFToken::creator
@ creator
Definition: EBOOKOPFToken.h:50
libebook::EBOOKOPFParser::TYPE_OEB
@ TYPE_OEB
Definition: EBOOKOPFParser.h:29
document
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:163
EBOOKOPFParser.h
libebook::EBOOKOPFToken::MIME_xhtml
@ MIME_xhtml
Definition: EBOOKOPFToken.h:102
libebook::FictionBook2Token::image
@ image
Definition: FictionBook2Token.h:60
libebook::EBOOKOPFParser::EBOOKOPFParser
EBOOKOPFParser(const EBOOKOPFParser &other)
metadata
RVNGPropertyList metadata
Definition: EBOOKOPFParser.cpp:63
m_package
const RVNGInputStreamPtr_t m_package
Definition: EBOOKOPFParser.cpp:107
libebook::EBOOKOPFParser::operator=
EBOOKOPFParser & operator=(const EBOOKOPFParser &other)
libebook::EBOOKHTMLToken::content
@ content
Definition: EBOOKHTMLToken.h:185
libebook::EBOOKHTMLToken::input
@ input
Definition: EBOOKHTMLToken.h:89
event
optional< int > event
Definition: EBOOKOPFParser.cpp:149
parser
HUBBUBParserPtr_t parser
Definition: EBOOKHTMLParser.cpp:170
libebook::EBOOKOPFToken::x_metadata
@ x_metadata
Definition: EBOOKOPFToken.h:76
mediaType
optional< string > mediaType
Definition: EBOOKOPFParser.cpp:154
libebook::EBOOKOPFToken::NS_dc
@ NS_dc
Definition: EBOOKOPFToken.h:120
EBOOKOPFToken.h
libebook::EBOOKOPFToken::date
@ date
Definition: EBOOKOPFToken.h:51
m_contextStack
stack< Context > m_contextStack
Definition: EBOOKOPFParser.cpp:206
libebook::EBOOKOPFParser::Type
Type
Definition: EBOOKOPFParser.h:28
libebook::EBOOKOPFToken::relation
@ relation
Definition: EBOOKOPFToken.h:66
libebook::EBOOKOPFParser::findOPFStream
static bool findOPFStream(const RVNGInputStreamPtr_t &package, unsigned &stream)
Definition: EBOOKOPFParser.cpp:689
libebook::EBOOKOPFToken::aut
@ aut
Definition: EBOOKOPFToken.h:105
libebook::EBOOKOPFToken::required_modules
@ required_modules
Definition: EBOOKOPFToken.h:91
name
string name
Definition: HTMLHelpStream.cpp:80
libebook::EBOOKOPFToken::Coverage
@ Coverage
Definition: EBOOKOPFToken.h:34
libebook::EBOOKHTMLToken::lang
@ lang
Definition: EBOOKHTMLToken.h:205
libebook::EBOOKOPFToken::Language
@ Language
Definition: EBOOKOPFToken.h:40
libebook::EBOOKOPFToken::required_namespace
@ required_namespace
Definition: EBOOKOPFToken.h:92
libebook::EBOOKHTMLToken::source
@ source
Definition: EBOOKHTMLToken.h:131
m_currentAttrs
SavedAttributes m_currentAttrs
Definition: EBOOKOPFParser.cpp:208
libebook::EBOOKOPFToken::format
@ format
Definition: EBOOKOPFToken.h:54
libebook::EBOOKOPFToken::Subject
@ Subject
Definition: EBOOKOPFToken.h:45
libebook::EBOOKOPFParser::m_package
const RVNGInputStreamPtr_t m_package
Definition: EBOOKOPFParser.h:46
libebook::EBOOKOPFToken::publisher
@ publisher
Definition: EBOOKOPFToken.h:64
EBOOK_DEBUG_MSG
#define EBOOK_DEBUG_MSG(M)
Definition: libebook_utils.h:44
manifest
Manifest_t manifest
Definition: EBOOKOPFParser.cpp:64
libebook::EBOOKOPFToken::MIME_image
@ MIME_image
Definition: EBOOKOPFToken.h:100
libebook::EBOOKOPFToken::Format
@ Format
Definition: EBOOKOPFToken.h:38
m_document
librevenge::RVNGTextInterface *const m_document
Definition: FictionBook2Parser.cpp:55
type
EBOOKDocument::Type type
Definition: EBOOKDocument.cpp:325
libebook::EBOOKOPFToken::package
@ package
Definition: EBOOKOPFToken.h:63
libebook::EBOOKOPFToken::itemref
@ itemref
Definition: EBOOKOPFToken.h:58
libebook::EBOOKOPFToken::Creator
@ Creator
Definition: EBOOKOPFToken.h:35
libebook::EBOOKSubDocument
Definition: EBOOKSubDocument.h:19
libebook::EBOOKOPFToken::item
@ item
Definition: EBOOKOPFToken.h:57
libebook::EBOOKHTMLToken::meta
@ meta
Definition: EBOOKHTMLToken.h:104
libebook::EBOOKOPFParser::getStream
const RVNGInputStreamPtr_t getStream(const char *name) const
Definition: EBOOKOPFParser.cpp:694
libebook::EBOOKOPFToken::fallback
@ fallback
Definition: EBOOKOPFToken.h:81
libebook::findSubStreamByExt
bool findSubStreamByExt(const RVNGInputStreamPtr_t &input, const std::string &ext, unsigned &id)
Definition: libebook_utils.cpp:245
libebook::EBOOKOPFToken::Title
@ Title
Definition: EBOOKOPFToken.h:46
libebook::EBOOKOPFParser::TYPE_EPub3
@ TYPE_EPub3
Definition: EBOOKOPFParser.h:31
libebook::EBOOKOPFParser::parse
void parse()
Definition: EBOOKOPFParser.cpp:635
libebook::EBOOKOPFToken::Date
@ Date
Definition: EBOOKOPFToken.h:36
libebook::EBOOKOPFToken::version
@ version
Definition: EBOOKOPFToken.h:97
libebook::EBOOKOPFToken::Identifier
@ Identifier
Definition: EBOOKOPFToken.h:39
libebook::EBOOKOPFToken::contributor
@ contributor
Definition: EBOOKOPFToken.h:48
m_type
unsigned m_type
Definition: PDBParser.cpp:36
libebook::EBOOKOPFToken::Type
@ Type
Definition: EBOOKOPFToken.h:47