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

Generated for libe-book by doxygen 1.8.14