EBOOKMemoryStream.h Source File documentation

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
20 class EBOOKMemoryStream : public librevenge::RVNGInputStream
21{
22// disable copying
23 EBOOKMemoryStream(const EBOOKMemoryStream &other);
24 EBOOKMemoryStream &operator=(const EBOOKMemoryStream &other);
25
26public:
27 EBOOKMemoryStream();
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: */
name
string name
Definition: HTMLHelpStream.cpp:80
data
MSPackFileData * data
Definition: HTMLHelpStream.cpp:63
offset
unsigned offset
Definition: SoftBookParser.cpp:74
length
unsigned length
Definition: SoftBookParser.cpp:73
libebook::EBOOKMemoryStream
Definition: EBOOKMemoryStream.h:21
libebook::EBOOKMemoryStream::m_pos
long m_pos
Definition: EBOOKMemoryStream.h:46
libebook::EBOOKMemoryStream::m_length
const long m_length
Definition: EBOOKMemoryStream.h:45
libebook::EBOOKMemoryStream::getSubStreamById
RVNGInputStream * getSubStreamById(unsigned id) override
Definition: EBOOKMemoryStream.cpp:65
libebook::EBOOKMemoryStream::EBOOKMemoryStream
EBOOKMemoryStream()
Definition: EBOOKMemoryStream.cpp:17
libebook::EBOOKMemoryStream::subStreamCount
unsigned subStreamCount() override
Definition: EBOOKMemoryStream.cpp:45
libebook::EBOOKMemoryStream::isEnd
bool isEnd() override
Definition: EBOOKMemoryStream.cpp:125
libebook::EBOOKMemoryStream::getSubStreamByName
librevenge::RVNGInputStream * getSubStreamByName(const char *name) override
Definition: EBOOKMemoryStream.cpp:60
libebook::EBOOKMemoryStream::subStreamName
const char * subStreamName(unsigned id) override
Definition: EBOOKMemoryStream.cpp:50
libebook::EBOOKMemoryStream::EBOOKMemoryStream
EBOOKMemoryStream(const EBOOKMemoryStream &other)
libebook::EBOOKMemoryStream::m_data
std::unique_ptr< unsigned char[]> m_data
Definition: EBOOKMemoryStream.h:44
libebook::EBOOKMemoryStream::existsSubStream
bool existsSubStream(const char *name) override
Definition: EBOOKMemoryStream.cpp:55
libebook::EBOOKMemoryStream::seek
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override
Definition: EBOOKMemoryStream.cpp:91
libebook::EBOOKMemoryStream::operator=
EBOOKMemoryStream & operator=(const EBOOKMemoryStream &other)
libebook::EBOOKMemoryStream::tell
long tell() override
Definition: EBOOKMemoryStream.cpp:120
libebook::EBOOKMemoryStream::read
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) override
Definition: EBOOKMemoryStream.cpp:70
libebook::EBOOKMemoryStream::isStructured
bool isStructured() override
Definition: EBOOKMemoryStream.cpp:40
libebook::EBOOKMemoryStream::~EBOOKMemoryStream
~EBOOKMemoryStream() override
Definition: EBOOKMemoryStream.cpp:36
libebook
Definition: BBeBCollector.cpp:19