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
17namespace libcdr
18{
19
20class CDRInternalStream : public librevenge::RVNGInputStream
21{
22public:
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
60private:
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 & operator=(const CDRInternalStream &)
bool existsSubStream(const char *) override
Definition CDRInternalStream.h:39
unsigned long getSize() const
Definition CDRInternalStream.h:55
CDRInternalStream(librevenge::RVNGInputStream *input, unsigned long size, bool compressed=false)
Definition CDRInternalStream.cpp:25
long tell() override
Definition CDRInternalStream.cpp:148
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) override
Definition CDRInternalStream.cpp:100
unsigned subStreamCount() override
Definition CDRInternalStream.h:31
~CDRInternalStream() override
Definition CDRInternalStream.h:25
librevenge::RVNGInputStream * getSubStreamById(unsigned) override
Definition CDRInternalStream.h:47
bool isStructured() override
Definition CDRInternalStream.h:27
bool isEnd() override
Definition CDRInternalStream.cpp:153
const char * subStreamName(unsigned) override
Definition CDRInternalStream.h:35
CDRInternalStream(const CDRInternalStream &)
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override
Definition CDRInternalStream.cpp:125
std::vector< unsigned char > m_buffer
Definition CDRInternalStream.h:62
volatile long m_offset
Definition CDRInternalStream.h:61
librevenge::RVNGInputStream * getSubStreamByName(const char *) override
Definition CDRInternalStream.h:43
Definition CDRCollector.h:25

Generated for libcdr by doxygen 1.13.2