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: */
libebook::RocketEBookHeader
Definition RocketEBookHeader.h:22
libebook::RocketEBookHeader::RocketEBookHeader
RocketEBookHeader(const RVNGInputStreamPtr_t &input)
Definition RocketEBookHeader.cpp:46
libebook::RocketEBookHeader::m_length
unsigned m_length
Definition RocketEBookHeader.h:57
libebook::RocketEBookHeader::m_tocOffset
unsigned m_tocOffset
Definition RocketEBookHeader.h:56
libebook::RocketEBookHeader::readDirectory
void readDirectory(const RVNGInputStreamPtr_t &input)
Definition RocketEBookHeader.cpp:94
libebook::RocketEBookHeader::m_info
unsigned m_info
Definition RocketEBookHeader.h:59
libebook::RocketEBookHeader::Directory_t
std::deque< Entry > Directory_t
Definition RocketEBookHeader.h:42
libebook::RocketEBookHeader::m_version
unsigned m_version
Definition RocketEBookHeader.h:55
libebook::RocketEBookHeader::readHeader
void readHeader(const RVNGInputStreamPtr_t &input)
Definition RocketEBookHeader.cpp:70
libebook::RocketEBookHeader::m_dir
Directory_t m_dir
Definition RocketEBookHeader.h:58
libebook::RocketEBookHeader::getDirectory
const Directory_t & getDirectory() const
Definition RocketEBookHeader.cpp:65
libebook::RocketEBookHeader::Flag
Flag
Definition RocketEBookHeader.h:25
libebook::RocketEBookHeader::FLAG_INFO_PAGE
@ FLAG_INFO_PAGE
Definition RocketEBookHeader.h:27
libebook::RocketEBookHeader::FLAG_RESERVED
@ FLAG_RESERVED
Definition RocketEBookHeader.h:28
libebook::RocketEBookHeader::FLAG_DEFLATED
@ FLAG_DEFLATED
Definition RocketEBookHeader.h:29
libebook::RocketEBookHeader::FLAG_ENCRYPTED
@ FLAG_ENCRYPTED
Definition RocketEBookHeader.h:26
libebook::RocketEBookHeader::getInfoID
unsigned getInfoID() const
Definition RocketEBookHeader.cpp:60
libebook_utils.h
libebook
Definition BBeBCollector.cpp:19
libebook::RVNGInputStreamPtr_t
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition libebook_utils.h:54
libebook::RocketEBookHeader::Entry
Definition RocketEBookHeader.h:33
libebook::RocketEBookHeader::Entry::length
unsigned length
Definition RocketEBookHeader.h:35
libebook::RocketEBookHeader::Entry::name
std::string name
Definition RocketEBookHeader.h:34
libebook::RocketEBookHeader::Entry::offset
unsigned offset
Definition RocketEBookHeader.h:36
libebook::RocketEBookHeader::Entry::flags
unsigned flags
Definition RocketEBookHeader.h:37
libebook::RocketEBookHeader::Entry::Entry
Entry()
Definition RocketEBookHeader.cpp:38