CDRInternalStream.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 libcdr 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 __CDRINTERNALSTREAM_H__
11 #define __CDRINTERNALSTREAM_H__
12 
13 #include <vector>
14 
15 #include <librevenge-stream/librevenge-stream.h>
16 
17 namespace libcdr
18 {
19 
20 class CDRInternalStream : public librevenge::RVNGInputStream
21 {
22 public:
23  CDRInternalStream(librevenge::RVNGInputStream *input, unsigned long size, bool compressed=false);
24  CDRInternalStream(const std::vector<unsigned char> &buffer);
25  ~CDRInternalStream() override {}
26 
27  bool isStructured() override
28  {
29  return false;
30  }
31  unsigned subStreamCount() override
32  {
33  return 0;
34  }
35  const char *subStreamName(unsigned) override
36  {
37  return nullptr;
38  }
39  bool existsSubStream(const char *) override
40  {
41  return false;
42  }
43  librevenge::RVNGInputStream *getSubStreamByName(const char *) override
44  {
45  return nullptr;
46  }
47  librevenge::RVNGInputStream *getSubStreamById(unsigned) override
48  {
49  return nullptr;
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  unsigned long getSize() const
56  {
57  return m_buffer.size();
58  }
59 
60 private:
61  volatile long m_offset;
62  std::vector<unsigned char> m_buffer;
65 };
66 
67 } // namespace libcdr
68 
69 #endif
70 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
~CDRInternalStream() override
Definition: CDRInternalStream.h:25
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) override
Definition: CDRInternalStream.cpp:98
unsigned subStreamCount() override
Definition: CDRInternalStream.h:31
librevenge::RVNGInputStream * getSubStreamByName(const char *) override
Definition: CDRInternalStream.h:43
Definition: CDRInternalStream.h:20
CDRInternalStream(librevenge::RVNGInputStream *input, unsigned long size, bool compressed=false)
Definition: CDRInternalStream.cpp:25
unsigned long getSize() const
Definition: CDRInternalStream.h:55
const char * subStreamName(unsigned) override
Definition: CDRInternalStream.h:35
long tell() override
Definition: CDRInternalStream.cpp:146
bool isEnd() override
Definition: CDRInternalStream.cpp:151
bool existsSubStream(const char *) override
Definition: CDRInternalStream.h:39
Definition: CDRCollector.h:29
CDRInternalStream & operator=(const CDRInternalStream &)
volatile long m_offset
Definition: CDRInternalStream.h:61
bool isStructured() override
Definition: CDRInternalStream.h:27
std::vector< unsigned char > m_buffer
Definition: CDRInternalStream.h:62
librevenge::RVNGInputStream * getSubStreamById(unsigned) override
Definition: CDRInternalStream.h:47
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override
Definition: CDRInternalStream.cpp:123

Generated for libcdr by doxygen 1.8.14