RocketEBookHeader.h Source File documentation

RocketEBookHeader.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 * For further information visit http://libebook.sourceforge.net
8 */
9
10 #ifndef ROCKETEBOOKHEADER_H_INCLUDED
11 #define ROCKETEBOOKHEADER_H_INCLUDED
12
13 #include <deque>
14 #include <string>
15
16 #include "libebook_utils.h"
17
18 namespace libebook
19 {
20
21 class RocketEBookHeader
22 {
23 public:
24 enum Flag
25 {
26 FLAG_ENCRYPTED = 1,
27 FLAG_INFO_PAGE = 1 << 1,
28 FLAG_RESERVED = 1 << 2,
29 FLAG_DEFLATED = 1 << 3
30 };
31
32 struct Entry
33 {
34 std::string name;
35 unsigned length;
36 unsigned offset;
37 unsigned flags;
38
39 Entry();
40 };
41
42 typedef std::deque<Entry> Directory_t;
43
44 public:
45 explicit RocketEBookHeader(const RVNGInputStreamPtr_t &input);
46
47 unsigned getInfoID() const;
48 const Directory_t &getDirectory() const;
49
50 private:
51 void readHeader(const RVNGInputStreamPtr_t &input);
52 void readDirectory(const RVNGInputStreamPtr_t &input);
53
54 private:
55 unsigned m_version;
56 unsigned m_tocOffset;
57 unsigned m_length;
58 Directory_t m_dir;
59 unsigned m_info;
60 };
61
62 }
63
64 #endif // ROCKETEBOOKHEADER_H_INCLUDED
65
66 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
len
size_t len
Definition: EBOOKHTMLParser.cpp:47
libebook::RocketEBookHeader::Entry::flags
unsigned flags
Definition: RocketEBookHeader.h:37
libebook::RocketEBookHeader::readHeader
void readHeader(const RVNGInputStreamPtr_t &input)
Definition: RocketEBookHeader.cpp:70
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::RocketEBookHeader::getInfoID
unsigned getInfoID() const
Definition: RocketEBookHeader.cpp:60
libebook
Definition: BBeBCollector.cpp:19
libebook::RocketEBookHeader::FLAG_DEFLATED
@ FLAG_DEFLATED
Definition: RocketEBookHeader.h:29
libebook::char_cast
const char * char_cast(const char *const c)
Definition: libebook_xml.cpp:53
libebook_utils.h
libebook::RocketEBookHeader::FLAG_ENCRYPTED
@ FLAG_ENCRYPTED
Definition: RocketEBookHeader.h:26
libebook::RocketEBookHeader::Entry::Entry
Entry()
Definition: RocketEBookHeader.cpp:38
libebook::RocketEBookHeader::FLAG_INFO_PAGE
@ FLAG_INFO_PAGE
Definition: RocketEBookHeader.h:27
libebook::RocketEBookHeader::m_dir
Directory_t m_dir
Definition: RocketEBookHeader.h:58
offset
unsigned offset
Definition: SoftBookParser.cpp:74
libebook::EBOOKHTMLToken::i
@ i
Definition: EBOOKHTMLToken.h:86
libebook::PackageError
Definition: libebook_utils.h:116
libebook::seek
void seek(librevenge::RVNGInputStream *const input, const unsigned long pos)
Definition: libebook_utils.cpp:152
libebook::RocketEBookHeader::getDirectory
const Directory_t & getDirectory() const
Definition: RocketEBookHeader.cpp:65
libebook::UnsupportedFormat
Definition: libebook_utils.h:132
libebook::RocketEBookHeader
Definition: RocketEBookHeader.h:22
libebook::RocketEBookHeader::Flag
Flag
Definition: RocketEBookHeader.h:25
libebook::RocketEBookHeader::RocketEBookHeader
RocketEBookHeader(const RVNGInputStreamPtr_t &input)
Definition: RocketEBookHeader.cpp:46
libebook::EBOOKHTMLToken::input
@ input
Definition: EBOOKHTMLToken.h:89
libebook::readU16
uint16_t readU16(librevenge::RVNGInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:57
libebook::RocketEBookHeader::Entry
Definition: RocketEBookHeader.h:33
libebook::readU32
uint32_t readU32(librevenge::RVNGInputStream *input, bool bigEndian)
Definition: libebook_utils.cpp:73
libebook::RocketEBookHeader::Entry::offset
unsigned offset
Definition: RocketEBookHeader.h:36
name
string name
Definition: HTMLHelpStream.cpp:80
libebook::RocketEBookHeader::Entry::length
unsigned length
Definition: RocketEBookHeader.h:35
libebook::ParseError
Definition: libebook_utils.h:120
libebook::RocketEBookHeader::m_info
unsigned m_info
Definition: RocketEBookHeader.h:59
libebook_xml.h
libebook::RocketEBookHeader::Entry::name
std::string name
Definition: RocketEBookHeader.h:34
libebook::RocketEBookHeader::m_length
unsigned m_length
Definition: RocketEBookHeader.h:57
RocketEBookHeader.h
libebook::readNBytes
const unsigned char * readNBytes(librevenge::RVNGInputStream *const input, const unsigned long numBytes)
Definition: libebook_utils.cpp:105
libebook::UnsupportedEncryption
Definition: libebook_utils.h:128
libebook::RocketEBookHeader::m_tocOffset
unsigned m_tocOffset
Definition: RocketEBookHeader.h:56
libebook::EBOOKHTMLToken::s
@ s
Definition: EBOOKHTMLToken.h:125
libebook::RocketEBookHeader::readDirectory
void readDirectory(const RVNGInputStreamPtr_t &input)
Definition: RocketEBookHeader.cpp:94
libebook::RocketEBookHeader::m_version
unsigned m_version
Definition: RocketEBookHeader.h:55
libebook::skip
void skip(librevenge::RVNGInputStream *input, unsigned long numBytes)
Definition: libebook_utils.cpp:145
libebook::RocketEBookHeader::FLAG_RESERVED
@ FLAG_RESERVED
Definition: RocketEBookHeader.h:28
ROCKETEBOOK_CODE
#define ROCKETEBOOK_CODE(s)
Definition: RocketEBookHeader.cpp:15
length
unsigned length
Definition: SoftBookParser.cpp:73
libebook::RocketEBookHeader::Directory_t
std::deque< Entry > Directory_t
Definition: RocketEBookHeader.h:42