RBHeader.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 RBHEADER_H_INCLUDED
11 #define RBHEADER_H_INCLUDED
12
13 #include <deque>
14 #include <string>
15
16 #include "libebook_utils.h"
17
18 namespace libebook
19 {
20
21 class RBHeader
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 RBHeader(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 // RBHEADER_H_INCLUDED
65
66 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::RBHeader::FLAG_ENCRYPTED
Definition: RBHeader.h:26
libebook::RBHeader::m_dir
Directory_t m_dir
Definition: RBHeader.h:58
libebook::RVNGInputStreamPtr_t
boost::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libebook_utils.h:82
libebook::RBHeader::Directory_t
std::deque< Entry > Directory_t
Definition: RBHeader.h:42
libebook::RBHeader::m_tocOffset
unsigned m_tocOffset
Definition: RBHeader.h:56
libebook::RBHeader::FLAG_RESERVED
Definition: RBHeader.h:28
libebook::RBHeader::FLAG_DEFLATED
Definition: RBHeader.h:29
libebook_utils.h
libebook::RBHeader::RBHeader
RBHeader(const RVNGInputStreamPtr_t &input)
Definition: RBHeader.cpp:44
libebook::RBHeader::getDirectory
const Directory_t & getDirectory() const
Definition: RBHeader.cpp:63
libebook::RBHeader::Flag
Flag
Definition: RBHeader.h:24
libebook::RBHeader::m_info
unsigned m_info
Definition: RBHeader.h:59
libebook::RBHeader::Entry::name
std::string name
Definition: RBHeader.h:34
libebook::RBHeader::m_length
unsigned m_length
Definition: RBHeader.h:57
libebook::RBHeader
Definition: RBHeader.h:21
libebook::RBHeader::readDirectory
void readDirectory(const RVNGInputStreamPtr_t &input)
Definition: RBHeader.cpp:92
libebook::RBHeader::FLAG_INFO_PAGE
Definition: RBHeader.h:27
libebook::RBHeader::Entry::Entry
Entry()
Definition: RBHeader.cpp:36
libebook::EBOOKHTMLToken::input
Definition: EBOOKHTMLToken.h:91
libebook::RBHeader::Entry::length
unsigned length
Definition: RBHeader.h:35
libebook::RBHeader::readHeader
void readHeader(const RVNGInputStreamPtr_t &input)
Definition: RBHeader.cpp:68
libebook
Definition: CHMParser.cpp:20
libebook::RBHeader::Entry
Definition: RBHeader.h:32
libebook::RBHeader::Entry::flags
unsigned flags
Definition: RBHeader.h:37
libebook::RBHeader::m_version
unsigned m_version
Definition: RBHeader.h:55
libebook::RBHeader::Entry::offset
unsigned offset
Definition: RBHeader.h:36
libebook::RBHeader::getInfoID
unsigned getInfoID() const
Definition: RBHeader.cpp:58