SoftBookLZSSStream.h Source File documentation

SoftBookLZSSStream.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 SOFTBOOKLZSSSTREAM_H_INCLUDED
11 #define SOFTBOOKLZSSSTREAM_H_INCLUDED
12
13 #include <memory>
14
15 #include <librevenge-stream/librevenge-stream.h>
16
17 namespace libebook
18 {
19
20 class SoftBookLZSSStream : public librevenge::RVNGInputStream
21 {
22 // disable copying
23 SoftBookLZSSStream(const SoftBookLZSSStream &other);
24 SoftBookLZSSStream &operator=(const SoftBookLZSSStream &other);
25
26 public:
27 struct Configuration
28 {
29 unsigned offsetBits;
30 unsigned lengthBits;
31 unsigned uncompressedLength;
32 unsigned fillPos;
33 char fillChar;
34 bool allowOverflow;
35 bool bigEndian;
36
37 Configuration();
38 };
39
40 public:
41 explicit SoftBookLZSSStream(librevenge::RVNGInputStream *stream, const Configuration &configuration = Configuration());
42 ~SoftBookLZSSStream() override;
43
44 bool isStructured() override;
45 unsigned subStreamCount() override;
46 const char *subStreamName(unsigned id) override;
47 bool existsSubStream(const char *name) override;
48 librevenge::RVNGInputStream *getSubStreamByName(const char *name) override;
49 RVNGInputStream *getSubStreamById(unsigned id) override;
50
51 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override;
52 int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override;
53 long tell() override;
54 bool isEnd() override;
55
56 private:
57 std::unique_ptr<librevenge::RVNGInputStream> m_stream;
58 };
59
60 }
61
62 #endif // SOFTBOOKLZSSSTREAM_H_INCLUDED
63
64 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::SoftBookLZSSStream::isEnd
bool isEnd() override
Definition: SoftBookLZSSStream.cpp:243
libebook::SoftBookLZSSStream::operator=
SoftBookLZSSStream & operator=(const SoftBookLZSSStream &other)
libebook::SoftBookLZSSStream::Configuration::bigEndian
bool bigEndian
Definition: SoftBookLZSSStream.h:35
m_end
size_t m_end
Definition: SoftBookLZSSStream.cpp:53
libebook::SoftBookLZSSStream::Configuration::allowOverflow
bool allowOverflow
Definition: SoftBookLZSSStream.h:34
libebook::SoftBookLZSSStream::existsSubStream
bool existsSubStream(const char *name) override
Definition: SoftBookLZSSStream.cpp:213
libebook::SoftBookLZSSStream::getSubStreamByName
librevenge::RVNGInputStream * getSubStreamByName(const char *name) override
Definition: SoftBookLZSSStream.cpp:218
libebook::SoftBookLZSSStream::isStructured
bool isStructured() override
Definition: SoftBookLZSSStream.cpp:198
libebook::SoftBookLZSSStream::Configuration
Definition: SoftBookLZSSStream.h:28
libebook::SoftBookLZSSStream::SoftBookLZSSStream
SoftBookLZSSStream(const SoftBookLZSSStream &other)
libebook::SoftBookLZSSStream
Definition: SoftBookLZSSStream.h:21
m_data
const std::unique_ptr< unsigned char[]> m_data
Definition: SoftBookLZSSStream.cpp:50
libebook
Definition: BBeBCollector.cpp:19
libebook_utils.h
libebook::SoftBookLZSSStream::subStreamName
const char * subStreamName(unsigned id) override
Definition: SoftBookLZSSStream.cpp:208
SoftBookLZSSStream.h
libebook::EBOOKMemoryStream
Definition: EBOOKMemoryStream.h:21
EBOOKMemoryStream.h
offset
unsigned offset
Definition: SoftBookParser.cpp:74
libebook::EBOOKHTMLToken::i
@ i
Definition: EBOOKHTMLToken.h:86
stream
RVNGInputStreamPtr_t stream
Definition: HTMLHelpStream.cpp:79
m_allowOverflow
bool m_allowOverflow
Definition: SoftBookLZSSStream.cpp:55
m_begin
size_t m_begin
Definition: SoftBookLZSSStream.cpp:52
libebook::SoftBookLZSSStream::~SoftBookLZSSStream
~SoftBookLZSSStream() override
Definition: SoftBookLZSSStream.cpp:194
libebook::SoftBookLZSSStream::Configuration::lengthBits
unsigned lengthBits
Definition: SoftBookLZSSStream.h:30
libebook::SoftBookLZSSStream::Configuration::offsetBits
unsigned offsetBits
Definition: SoftBookLZSSStream.h:29
libebook::SoftBookLZSSStream::subStreamCount
unsigned subStreamCount() override
Definition: SoftBookLZSSStream.cpp:203
libebook::SoftBookLZSSStream::getSubStreamById
RVNGInputStream * getSubStreamById(unsigned id) override
Definition: SoftBookLZSSStream.cpp:223
EBOOKBitStream.h
name
string name
Definition: HTMLHelpStream.cpp:80
libebook::SoftBookLZSSStream::Configuration::fillChar
char fillChar
Definition: SoftBookLZSSStream.h:33
libebook::SoftBookLZSSStream::Configuration::uncompressedLength
unsigned uncompressedLength
Definition: SoftBookLZSSStream.h:31
m_size
const size_t m_size
Definition: SoftBookLZSSStream.cpp:51
m_growing
bool m_growing
Definition: SoftBookLZSSStream.cpp:54
libebook::EBOOKHTMLToken::size
@ size
Definition: EBOOKHTMLToken.h:249
libebook::SoftBookLZSSStream::seek
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override
Definition: SoftBookLZSSStream.cpp:233
libebook::SoftBookLZSSStream::tell
long tell() override
Definition: SoftBookLZSSStream.cpp:238
libebook::SoftBookLZSSStream::Configuration::fillPos
unsigned fillPos
Definition: SoftBookLZSSStream.h:32
libebook::SoftBookLZSSStream::m_stream
std::unique_ptr< librevenge::RVNGInputStream > m_stream
Definition: SoftBookLZSSStream.h:57
libebook::SoftBookLZSSStream::read
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) override
Definition: SoftBookLZSSStream.cpp:228
libebook::SoftBookLZSSStream::Configuration::Configuration
Configuration()
Definition: SoftBookLZSSStream.cpp:169
length
unsigned length
Definition: SoftBookParser.cpp:73