Debian Codegraph @

src/lib/CDRInternalStream.h

raw symbols SCIP
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;
63 CDRInternalStream(const CDRInternalStream &);
64 CDRInternalStream &operator=(const CDRInternalStream &);
65 };
66
67 } // namespace libcdr
68
69 #endif
70 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */