EBOOKMemoryStream.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 EBOOKMEMORYSTREAM_H_INCLUDED
11#define EBOOKMEMORYSTREAM_H_INCLUDED
12
13#include <memory>
14
15#include <librevenge-stream/librevenge-stream.h>
16
17namespace libebook
18{
19
20class EBOOKMemoryStream : public librevenge::RVNGInputStream
21{
22// disable copying
25
26public:
28 EBOOKMemoryStream(const unsigned char *data, unsigned length);
29 ~EBOOKMemoryStream() override;
30
31 bool isStructured() override;
32 unsigned subStreamCount() override;
33 const char *subStreamName(unsigned id) override;
34 bool existsSubStream(const char *name) override;
35 librevenge::RVNGInputStream *getSubStreamByName(const char *name) override;
36 RVNGInputStream *getSubStreamById(unsigned id) override;
37
38 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override;
39 int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override;
40 long tell() override;
41 bool isEnd() override;
42
43private:
44 std::unique_ptr<unsigned char[]> m_data;
45 const long m_length;
46 long m_pos;
47};
48
49}
50
51#endif // EBOOKMEMORYSTREAM_H_INCLUDED
52
53/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
string name
Definition: HTMLHelpStream.cpp:80
MSPackFileData * data
Definition: HTMLHelpStream.cpp:63
unsigned offset
Definition: SoftBookParser.cpp:74
unsigned length
Definition: SoftBookParser.cpp:73
Definition: EBOOKMemoryStream.h:21
long m_pos
Definition: EBOOKMemoryStream.h:46
const long m_length
Definition: EBOOKMemoryStream.h:45
RVNGInputStream * getSubStreamById(unsigned id) override
Definition: EBOOKMemoryStream.cpp:65
EBOOKMemoryStream()
Definition: EBOOKMemoryStream.cpp:17
unsigned subStreamCount() override
Definition: EBOOKMemoryStream.cpp:45
bool isEnd() override
Definition: EBOOKMemoryStream.cpp:125
librevenge::RVNGInputStream * getSubStreamByName(const char *name) override
Definition: EBOOKMemoryStream.cpp:60
const char * subStreamName(unsigned id) override
Definition: EBOOKMemoryStream.cpp:50
EBOOKMemoryStream(const EBOOKMemoryStream &other)
std::unique_ptr< unsigned char[]> m_data
Definition: EBOOKMemoryStream.h:44
bool existsSubStream(const char *name) override
Definition: EBOOKMemoryStream.cpp:55
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override
Definition: EBOOKMemoryStream.cpp:91
EBOOKMemoryStream & operator=(const EBOOKMemoryStream &other)
long tell() override
Definition: EBOOKMemoryStream.cpp:120
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) override
Definition: EBOOKMemoryStream.cpp:70
bool isStructured() override
Definition: EBOOKMemoryStream.cpp:40
~EBOOKMemoryStream() override
Definition: EBOOKMemoryStream.cpp:36
Definition: BBeBCollector.cpp:19

Generated for libe-book by doxygen 1.9.3