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 <librevenge-stream/librevenge-stream.h>
14
15 namespace libebook
16 {
17
18 class EBOOKMemoryStream : public librevenge::RVNGInputStream
19 {
20 // disable copying
21 EBOOKMemoryStream(const EBOOKMemoryStream &other);
22 EBOOKMemoryStream &operator=(const EBOOKMemoryStream &other);
23
24 public:
25 EBOOKMemoryStream();
26 EBOOKMemoryStream(const unsigned char *data, unsigned length);
27 virtual ~EBOOKMemoryStream();
28
29 virtual bool isStructured();
30 virtual unsigned subStreamCount();
31 virtual const char *subStreamName(unsigned id);
32 virtual bool existsSubStream(const char *name);
33 virtual librevenge::RVNGInputStream *getSubStreamByName(const char *name);
34 virtual RVNGInputStream *getSubStreamById(unsigned id);
35
36 virtual const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
37 virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
38 virtual long tell();
39 virtual bool isEnd();
40
41 private:
42 const unsigned char *m_data;
43 const long m_length;
44 long m_pos;
45 };
46
47 }
48
49 #endif // EBOOKMEMORYSTREAM_H_INCLUDED
50
51 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::EBOOKMemoryStream
Definition: EBOOKMemoryStream.h:18
libebook::EBOOKMemoryStream::operator=
EBOOKMemoryStream & operator=(const EBOOKMemoryStream &other)
libebook::EBOOKMemoryStream::m_data
const unsigned char * m_data
Definition: EBOOKMemoryStream.h:42
libebook::EBOOKMemoryStream::subStreamCount
virtual unsigned subStreamCount()
Definition: EBOOKMemoryStream.cpp:47
libebook::EBOOKMemoryStream::isStructured
virtual bool isStructured()
Definition: EBOOKMemoryStream.cpp:42
libebook::EBOOKMemoryStream::existsSubStream
virtual bool existsSubStream(const char *name)
Definition: EBOOKMemoryStream.cpp:57
libebook::EBOOKMemoryStream::getSubStreamByName
virtual librevenge::RVNGInputStream * getSubStreamByName(const char *name)
Definition: EBOOKMemoryStream.cpp:62
libebook::EBOOKMemoryStream::subStreamName
virtual const char * subStreamName(unsigned id)
Definition: EBOOKMemoryStream.cpp:52
libebook::EBOOKMemoryStream::getSubStreamById
virtual RVNGInputStream * getSubStreamById(unsigned id)
Definition: EBOOKMemoryStream.cpp:67
libebook::EBOOKMemoryStream::read
virtual const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead)
Definition: EBOOKMemoryStream.cpp:72
libebook::EBOOKMemoryStream::~EBOOKMemoryStream
virtual ~EBOOKMemoryStream()
Definition: EBOOKMemoryStream.cpp:37
libebook::EBOOKMemoryStream::isEnd
virtual bool isEnd()
Definition: EBOOKMemoryStream.cpp:127
libebook::EBOOKMemoryStream::m_pos
long m_pos
Definition: EBOOKMemoryStream.h:44
libebook::EBOOKMemoryStream::tell
virtual long tell()
Definition: EBOOKMemoryStream.cpp:122
offset
unsigned offset
Definition: IMPParser.cpp:73
libebook::EBOOKMemoryStream::EBOOKMemoryStream
EBOOKMemoryStream()
Definition: EBOOKMemoryStream.cpp:17
name
string name
Definition: CHMStream.cpp:80
libebook::EBOOKMemoryStream::m_length
const long m_length
Definition: EBOOKMemoryStream.h:43
libebook::EBOOKMemoryStream::seek
virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
Definition: EBOOKMemoryStream.cpp:93
libebook
Definition: CHMParser.cpp:20
length
unsigned length
Definition: IMPParser.cpp:72
data
MSPackFileData * data
Definition: CHMStream.cpp:63